]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/drop_bacula_database.in
Tweak version date
[bacula/bacula] / bacula / src / cats / drop_bacula_database.in
index d927621f2bbc623a8acca86791e9d64bdf3cd951..fa8d1553303b69732c0511b3c6a702fa851874f8 100755 (executable)
@@ -1,15 +1,44 @@
 #!/bin/sh
 #
 #  Drop Bacula database -- works for whatever is configured,
-#    MySQL, SQLite, PostgreSQL
-#
-if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then
-  @scriptdir@/drop_@DB_TYPE@_database $*
-else
-  if test xmysql = x@DB_TYPE@ ; then 
-    echo "Dropping MySQL database"
-    @scriptdir@/drop_mysql_database $*
-  else
-    @scriptdir@/drop_postgresql_database $*
-  fi
+#  MySQL, SQLite, PostgreSQL, Ingres
+#
+
+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 "Dropping ${db_type} database"
+@scriptdir@/drop_${db_type}_database $*