X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fcats%2Fgrant_bacula_privileges.in;h=3115facdb15dae9cb37d0af7be83263943dfa4f8;hb=6f9baa7b51e231518ebd6e16f4b0ade96c44f6b5;hp=d18a8731fb8b72a2880b8e33eeb45ba987b943fb;hpb=fa856c1262a2a3178f0ea237c21d2bb8e51c9f50;p=bacula%2Fbacula diff --git a/bacula/src/cats/grant_bacula_privileges.in b/bacula/src/cats/grant_bacula_privileges.in index d18a8731fb..3115facdb1 100755 --- a/bacula/src/cats/grant_bacula_privileges.in +++ b/bacula/src/cats/grant_bacula_privileges.in @@ -1,23 +1,45 @@ #!/bin/sh # # This routine makes the appropriately configured -# Bacula tables for PostgreSQL or MySQL. +# Bacula tables for PostgreSQL or MySQL. # SQLite does not have permissions. # -if test xmysql = x@DB_TYPE@ ; then - echo "Granting MySQL privileges" - @scriptdir@/grant_mysql_privileges $* -else - if test xpostgresql = x@DB_TYPE@ ; then - echo "Granting PostgreSQL privileges" - @scriptdir@/grant_postgresql_privileges $* - elif test xingres = x@DB_TYPE@ ; then - echo "Granting Ingres privileges" - @scriptdir@/grant_ingres_privileges $* - else - if test xsqlite3 = x@DB_TYPE@ ; then - echo "Granting SQLite privileges" - @scriptdir@/grant_@DB_TYPE@_privileges $* - fi - fi + +default_db_type=@DEFAULT_DB_TYPE@ + +# +# See if the first argument is a valid backend name. +# If so the user overrides the default database backend. +# +if [ $# -gt 0 ]; then + case $1 in + sqlite3) + db_type=$1 + shift + ;; + mysql) + db_type=$1 + shift + ;; + postgresql) + db_type=$1 + shift + ;; + ingres) + db_type=$1 + shift + ;; + *) + ;; + esac +fi + +# +# If no new db_type is gives use the default db_type. +# +if [ -z "${db_type}" ]; then + db_type="${default_db_type}" fi + +echo "Granting ${db_type} privileges" +@scriptdir@/grant_${db_type}_privileges $*