]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/create_bacula_database.in
Split messages line by line before sending it to syslog() fix #3325
[bacula/bacula] / bacula / src / cats / create_bacula_database.in
index 9609be8ad6d9aea69bf0834fd9d50e8cc06a3b94..d6b9ddecdddbeb3a056641e9299a2c6071881bd3 100644 (file)
@@ -1,17 +1,44 @@
 #!/bin/sh
 #
 # This routine creates the Bacula database
-#  using PostgreSQL, MySQL, or SQLite.
+# using PostgreSQL, Ingres, MySQL, or SQLite.
 #
-if test xsqlite = x@DB_NAME@ ; then
-  echo "Creating SQLite database"
-  @scriptdir@/create_sqlite_database
-else
-  if test xmysql = x@DB_NAME@ ; then
-    echo "Creating MySQL database"
-    @scriptdir@/create_mysql_database $*
-  else
-    echo "Creating PostgreSQL database"
-    @scriptdir@/create_postgresql_database template1
-  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 "Creating ${db_type} database"
+@scriptdir@/create_${db_type}_database $*