]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/grant_bacula_privileges.in
Remove Ingres and DBI backends
[bacula/bacula] / bacula / src / cats / grant_bacula_privileges.in
index f8f7b3d0ca87be7598cc0eaa41e1383de75cabce..3115facdb15dae9cb37d0af7be83263943dfa4f8 100755 (executable)
@@ -1,22 +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_NAME@ ; then 
-  echo "Granting MySQL privileges"
-  @scriptdir@/grant_mysql_privileges
-else
-  if test xpostgresql = x@DB_NAME@ ; then 
-    echo "Granting PostgreSQL privileges"
-    # hard coded database name
-    @scriptdir@/grant_postgresql_privileges bacula
-  else
-    if test xsqlite = x@DB_NAME@ ; then 
-      echo "Granting SQLite privileges"
-      # hard coded database name
-      @scriptdir@/grant_sqlite_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 $*