diff -up bacula-5.0.3/src/cats/Makefile.in.orig bacula-5.0.3/src/cats/Makefile.in --- bacula-5.0.3/src/cats/Makefile.in.orig 2010-10-06 14:37:54.000000000 +0200 +++ bacula-5.0.3/src/cats/Makefile.in 2010-10-06 14:41:35.000000000 +0200 @@ -134,12 +134,12 @@ libtool-uninstall: $(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbacsql.la install: @LIBTOOL_INSTALL_TARGET@ @INCLUDE_INSTALL_TARGET@ - $(INSTALL_SCRIPT) create_@DB_TYPE@_database $(DESTDIR)$(scriptdir)/create_@DB_TYPE@_database - $(INSTALL_SCRIPT) update_@DB_TYPE@_tables $(DESTDIR)$(scriptdir)/update_@DB_TYPE@_tables - $(INSTALL_SCRIPT) make_@DB_TYPE@_tables $(DESTDIR)$(scriptdir)/make_@DB_TYPE@_tables - $(INSTALL_SCRIPT) grant_@DB_TYPE@_privileges $(DESTDIR)$(scriptdir)/grant_@DB_TYPE@_privileges - $(INSTALL_SCRIPT) drop_@DB_TYPE@_tables $(DESTDIR)$(scriptdir)/drop_@DB_TYPE@_tables - $(INSTALL_SCRIPT) drop_@DB_TYPE@_database $(DESTDIR)$(scriptdir)/drop_@DB_TYPE@_database + $(INSTALL_SCRIPT) create_{sqlite3,mysql,postgresql}_database $(DESTDIR)$(scriptdir) + $(INSTALL_SCRIPT) update_{sqlite3,mysql,postgresql}_tables $(DESTDIR)$(scriptdir) + $(INSTALL_SCRIPT) make_{sqlite3,mysql,postgresql}_tables $(DESTDIR)$(scriptdir) + $(INSTALL_SCRIPT) grant_{sqlite3,mysql,postgresql}_privileges $(DESTDIR)$(scriptdir) + $(INSTALL_SCRIPT) drop_{sqlite3,mysql,postgresql}_tables $(DESTDIR)$(scriptdir) + $(INSTALL_SCRIPT) drop_{sqlite3,mysql,postgresql}_database $(DESTDIR)$(scriptdir) $(INSTALL_SCRIPT) create_bacula_database $(DESTDIR)$(scriptdir)/create_bacula_database $(INSTALL_SCRIPT) update_bacula_tables $(DESTDIR)$(scriptdir)/update_bacula_tables @@ -177,12 +177,12 @@ install: @LIBTOOL_INSTALL_TARGET@ @INCLU $(INSTALL_SCRIPT) $$filename $(DESTDIR)$(scriptdir)/$$destname uninstall: @LIBTOOL_UNINSTALL_TARGET@ @INCLUDE_UNINSTALL_TARGET@ - (cd $(DESTDIR)$(scriptdir); $(RMF) create_@DB_TYPE@_database) - (cd $(DESTDIR)$(scriptdir); $(RMF) update_@DB_TYPE@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) make_@DB_TYPE@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) grant_@DB_TYPE@_privileges) - (cd $(DESTDIR)$(scriptdir); $(RMF) drop_@DB_TYPE@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) drop_@DB_TYPE@_database) + (cd $(DESTDIR)$(scriptdir); $(RMF) create_{sqlite3,mysql,postgresql}_database) + (cd $(DESTDIR)$(scriptdir); $(RMF) update_{sqlite3,mysql,postgresql}_tables) + (cd $(DESTDIR)$(scriptdir); $(RMF) make_{sqlite3,mysql,postgresql}_tables) + (cd $(DESTDIR)$(scriptdir); $(RMF) grant_{sqlite3,mysql,postgresql}_privileges) + (cd $(DESTDIR)$(scriptdir); $(RMF) drop_{sqlite3,mysql,postgresql}_tables) + (cd $(DESTDIR)$(scriptdir); $(RMF) drop_{sqlite3,mysql,postgresql}_database) (cd $(DESTDIR)$(scriptdir); $(RMF) create_bacula_database) (cd $(DESTDIR)$(scriptdir); $(RMF) update_bacula_tables) diff -up bacula-5.0.3/src/cats/create_bacula_database.in.orig bacula-5.0.3/src/cats/create_bacula_database.in --- bacula-5.0.3/src/cats/create_bacula_database.in.orig 2010-08-05 16:29:51.000000000 +0200 +++ bacula-5.0.3/src/cats/create_bacula_database.in 2010-10-06 14:42:34.000000000 +0200 @@ -3,18 +3,7 @@ # This routine creates the Bacula database # using PostgreSQL, Ingres, MySQL, or SQLite. # -if test xsqlite3 = x@DB_TYPE@ ; then - echo "Creating SQLite database" - @scriptdir@/create_@DB_TYPE@_database -else - if test xmysql = x@DB_TYPE@ ; then - echo "Creating MySQL database" - @scriptdir@/create_mysql_database $* - elif test xingres = x@DB_TYPE@ ; then - echo "Creating Ingres database with $*" - @scriptdir@/create_ingres_database $* - else - echo "Creating PostgreSQL database" - @scriptdir@/create_postgresql_database $* - fi -fi +DB_TYPE=`ls @scriptdir@/create_[mpsi]*_database | cut -d'_' -f2` + +echo "Creating ${DB_TYPE} database" +@scriptdir@/create_${DB_TYPE}_database $* diff -up bacula-5.0.3/src/cats/create_ingres_database.in.orig bacula-5.0.3/src/cats/create_ingres_database.in --- bacula-5.0.3/src/cats/create_ingres_database.in.orig 2010-08-05 16:29:51.000000000 +0200 +++ bacula-5.0.3/src/cats/create_ingres_database.in 2010-10-06 14:43:21.000000000 +0200 @@ -5,8 +5,8 @@ bindir=@SQL_BINDIR@ PATH="$bindir:$PATH" -db_name=${db_name:-@db_name@} -db_user=${db_user:-@db_user@} +db_name=${DB_NAME:-@db_name@} +db_user=${DB_USER:-@db_user@} # use SQL_ASCII to be able to put any filename into # the database even those created with unusual character sets diff -up bacula-5.0.3/src/cats/create_mysql_database.in.orig bacula-5.0.3/src/cats/create_mysql_database.in --- bacula-5.0.3/src/cats/create_mysql_database.in.orig 2010-08-05 16:29:51.000000000 +0200 +++ bacula-5.0.3/src/cats/create_mysql_database.in 2010-10-06 14:44:01.000000000 +0200 @@ -4,7 +4,7 @@ # bindir=@SQL_BINDIR@ -db_name=@db_name@ +db_name=${DB_NAME:-@db_name@} if $bindir/mysql $* -f <$1.sql -else - if test xmysql = x@DB_TYPE@ ; then + if test xmysql = x${DB_TYPE}; then if test $# -gt 2; then MYSQLPASSWORD=" --password=$3" else @@ -37,7 +35,7 @@ else fi ${BINDIR}/mysqldump -u ${2}${MYSQLPASSWORD}${MYSQLHOST} -f --opt $1 >$1.sql else - if test xpostgresql = x@DB_TYPE@ ; then + if test xpostgresql = x${DB_TYPE}; then if test $# -gt 2; then PGPASSWORD=$3 export PGPASSWORD @@ -53,7 +51,6 @@ else echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql fi fi -fi # # To read back a MySQL database use: # cd @working_dir@ diff -up bacula-5.0.3/src/cats/make_catalog_backup.pl.in.orig bacula-5.0.3/src/cats/make_catalog_backup.pl.in --- bacula-5.0.3/src/cats/make_catalog_backup.pl.in.orig 2010-08-05 16:29:51.000000000 +0200 +++ bacula-5.0.3/src/cats/make_catalog_backup.pl.in 2010-10-06 15:07:05.000000000 +0200 @@ -44,7 +44,7 @@ use strict; $ENV{PATH}="@SQL_BINDIR@:$ENV{PATH}"; my $cat = shift or die "Usage: $0 catalogname"; -my $dir_conf='@sbindir@/dbcheck -B -c @sysconfdir@/bacula-dir.conf'; +my $dir_conf='@bindir@/dbcheck -B -c @sysconfdir@/bacula-dir.conf'; my $wd = "@working_dir@"; sub dump_sqlite diff -up bacula-5.0.3/src/cats/make_ingres_tables.in.orig bacula-5.0.3/src/cats/make_ingres_tables.in --- bacula-5.0.3/src/cats/make_ingres_tables.in.orig 2010-08-05 16:29:51.000000000 +0200 +++ bacula-5.0.3/src/cats/make_ingres_tables.in 2010-10-06 15:07:36.000000000 +0200 @@ -3,7 +3,7 @@ # shell script to create Bacula PostgreSQL tables # bindir=@SQL_BINDIR@ -db_name=${db_name:-@db_name@} +db_name=${DB_NAME:-@db_name@} sql $* ${db_name} <