From: <ke...@us...> - 2007-03-30 21:46:05
|
Revision: 4463 http://bacula.svn.sourceforge.net/bacula/?rev=4463&view=rev Author: kerns Date: 2007-03-30 14:46:04 -0700 (Fri, 30 Mar 2007) Log Message: ----------- kes Make database name and user configurable --with-db-name=xxx --with-db-user=xxx kes Add back database type to message.c for debugging. Modified Paths: -------------- trunk/bacula/Makefile.in trunk/bacula/autoconf/bacula-macros/db.m4 trunk/bacula/autoconf/configure.in trunk/bacula/configure trunk/bacula/platforms/gentoo/bacula-init.in trunk/bacula/platforms/suse/bacula-dir-suse-sqlite.patch trunk/bacula/platforms/suse/bacula-dir.in trunk/bacula/src/cats/Makefile.in trunk/bacula/src/cats/create_bacula_database.in trunk/bacula/src/cats/create_mysql_database.in trunk/bacula/src/cats/create_postgresql_database.in trunk/bacula/src/cats/create_sqlite3_database.in trunk/bacula/src/cats/create_sqlite_database.in trunk/bacula/src/cats/delete_catalog_backup.in trunk/bacula/src/cats/drop_bacula_database.in trunk/bacula/src/cats/drop_bacula_tables.in trunk/bacula/src/cats/drop_mysql_database.in trunk/bacula/src/cats/drop_mysql_tables.in trunk/bacula/src/cats/drop_postgresql_database.in trunk/bacula/src/cats/drop_postgresql_tables.in trunk/bacula/src/cats/drop_sqlite3_database.in trunk/bacula/src/cats/drop_sqlite3_tables.in trunk/bacula/src/cats/drop_sqlite_database.in trunk/bacula/src/cats/drop_sqlite_tables.in trunk/bacula/src/cats/grant_bacula_privileges.in trunk/bacula/src/cats/grant_mysql_privileges.in trunk/bacula/src/cats/grant_postgresql_privileges.in trunk/bacula/src/cats/make_bacula_tables.in trunk/bacula/src/cats/make_catalog_backup.in trunk/bacula/src/cats/make_catalog_backup.in.patch trunk/bacula/src/cats/make_mysql_tables.in trunk/bacula/src/cats/make_postgresql_tables.in trunk/bacula/src/cats/make_sqlite3_tables.in trunk/bacula/src/cats/make_sqlite_tables.in trunk/bacula/src/cats/mysql.in trunk/bacula/src/cats/postgresql.in trunk/bacula/src/cats/sqlite.in trunk/bacula/src/cats/update_bacula_tables.in trunk/bacula/src/cats/update_mysql_tables.in trunk/bacula/src/cats/update_postgresql_tables.in trunk/bacula/src/cats/update_sqlite3_tables.in trunk/bacula/src/cats/update_sqlite_tables.in trunk/bacula/src/cats/update_sqlite_tables.in.patch trunk/bacula/src/dird/bacula-dir.conf.in trunk/bacula/src/dird/dird.c trunk/bacula/src/lib/message.c trunk/bacula/src/lib/protos.h trunk/bacula/src/version.h trunk/bacula/technotes-2.1 Modified: trunk/bacula/Makefile.in =================================================================== --- trunk/bacula/Makefile.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/Makefile.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -184,8 +184,8 @@ (cd src/cats; \ chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \ chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \ - chmod 755 create_@DB_NAME@_database update_@DB_NAME@_tables make_@DB_NAME@_tables; \ - chmod 755 grant_@DB_NAME@_privileges drop_@DB_NAME@_tables drop_@DB_NAME@_database; \ + chmod 755 create_@DB_TYPE@_database update_@DB_TYPE@_tables make_@DB_TYPE@_tables; \ + chmod 755 grant_@DB_TYPE@_privileges drop_@DB_TYPE@_tables drop_@DB_TYPE@_database; \ chmod 755 make_catalog_backup delete_catalog_backup) clean: Modified: trunk/bacula/autoconf/bacula-macros/db.m4 =================================================================== --- trunk/bacula/autoconf/bacula-macros/db.m4 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/autoconf/bacula-macros/db.m4 2007-03-30 21:46:04 UTC (rev 4463) @@ -93,8 +93,8 @@ AC_MSG_RESULT(yes) db_found=yes support_mysql=yes - db_name=MySQL - DB_NAME=mysql + db_type=MySQL + DB_TYPE=mysql else AC_MSG_RESULT(no) @@ -185,8 +185,8 @@ AC_MSG_RESULT(yes) db_found=yes support_mysql=yes - db_name=MySQL - DB_NAME=mysql + db_type=MySQL + DB_TYPE=mysql else AC_MSG_RESULT(no) @@ -268,8 +268,8 @@ AC_MSG_RESULT(yes) db_found=yes support_sqlite=yes - db_name=SQLite - DB_NAME=sqlite + db_type=SQLite + DB_TYPE=sqlite else AC_MSG_RESULT(no) @@ -349,8 +349,8 @@ AC_MSG_RESULT(yes) db_found=yes support_sqlite3=yes - db_name=SQLite3 - DB_NAME=sqlite3 + db_type=SQLite3 + DB_TYPE=sqlite3 else AC_MSG_RESULT(no) @@ -446,8 +446,8 @@ AC_MSG_RESULT(yes) db_found=yes support_postgresql=yes - db_name=PostgreSQL - DB_NAME=postgresql + db_type=PostgreSQL + DB_TYPE=postgresql else AC_MSG_RESULT(no) fi @@ -470,7 +470,7 @@ dnl Check for some DBMS backend dnl NOTE: we can use only one backend at a time db_found=no -db_name=none +DB_TYPE=none if test x$support_mysql = xyes; then cats=cats @@ -516,7 +516,7 @@ AC_MSG_RESULT(yes) have_db=yes support_mysql=yes - db_name=BerkelyDB + DB_TYPE=BerkelyDB else AC_MSG_RESULT(no) Modified: trunk/bacula/autoconf/configure.in =================================================================== --- trunk/bacula/autoconf/configure.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/autoconf/configure.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -212,8 +212,8 @@ build_dird=yes build_stored=yes cats= -db_name=Internal -DB_NAME=bdb +db_type=Internal +DB_TYPE=bdb dnl# -------------------------------------------------------------------------- dnl# CHECKING COMMAND LINE OPTIONS @@ -432,8 +432,8 @@ [ --enable-client-only build client (File daemon) only [disabled]], [if test x$enableval = xyes; then build_client_only=yes - db_name=None - DB_NAME=none + db_type=None + DB_TYPE=none fi]) if test x$build_client_only = xno; then ALL_DIRS="subdirs" @@ -1121,7 +1121,32 @@ AC_SUBST(mon_fd_password) AC_SUBST(mon_sd_password) +# +# Pickup any database name +# +db_name=bacula +AC_ARG_WITH(db_name, + [ --with-db-name=DBNAME specify database name (default bacula)], + [ + if test "x$withval" != "x" ; then + db_name=$withval + fi + ] +) +AC_SUBST(db_name) +db_user=bacula +AC_ARG_WITH(db_user, + [ --with-db-user=UNAME specify database user (default bacula)], + [ + if test "x$withval" != "x" ; then + db_user=$withval + fi + ] +) +AC_SUBST(db_user) + + # # Handle users and groups for each daemon # @@ -1222,7 +1247,7 @@ BA_CHECK_SQLITE_DB AC_SUBST(cats) -AC_SUBST(DB_NAME) +AC_SUBST(DB_TYPE) AC_DEFINE(PROTOTYPES) @@ -2140,7 +2165,7 @@ exit 1 fi -if test "x${db_name}" = "xInternal" ; then +if test "x${db_type}" = "xInternal" ; then echo " " echo " " echo "You have not specified either --enable-client-only or one of the" @@ -2177,8 +2202,10 @@ Statically Linked SD: ${support_static_sd} Statically Linked DIR: ${support_static_dir} Statically Linked CONS: ${support_static_cons} - Database type: ${db_name} + Database type: ${db_type} Database lib: ${DB_LIBS} + Database name: ${db_name} + Database user: ${db_user} Job Output Email: ${job_email} Traceback Email: ${dump_email} Modified: trunk/bacula/configure =================================================================== --- trunk/bacula/configure 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/configure 2007-03-30 21:46:04 UTC (rev 4463) @@ -799,6 +799,8 @@ mon_dir_password mon_fd_password mon_sd_password +db_name +db_user dir_user dir_group sd_user @@ -810,7 +812,7 @@ SQL_INCLUDE SQL_BINDIR cats -DB_NAME +DB_TYPE GETCONF XMKMF X_CFLAGS @@ -1479,6 +1481,8 @@ --with-mon-dir-password=PASSWORD specify Director's password used by the monitor --with-mon-fd-password=PASSWORD specify Client's password used by the monitor --with-mon-sd-password=PASSWORD specify Storage daemon's password used by the monitor + --with-db-name=DBNAME specify database name (default bacula) + --with-db-user=UNAME specify database user (default bacula) --with-dir-user=USER specify user for Director daemon --with-dir-group=GROUP specify group for Director daemon --with-sd-user=USER specify user for Storage daemon @@ -14634,8 +14638,8 @@ build_dird=yes build_stored=yes cats= -db_name=Internal -DB_NAME=bdb +db_type=Internal +DB_TYPE=bdb # ------------------------------------------- @@ -14885,8 +14889,8 @@ if test "${enable_client_only+set}" = set; then enableval=$enable_client_only; if test x$enableval = xyes; then build_client_only=yes - db_name=None - DB_NAME=none + db_type=None + DB_TYPE=none fi fi @@ -18539,7 +18543,38 @@ +# +# Pickup any database name +# +db_name=bacula +# Check whether --with-db_name was given. +if test "${with_db_name+set}" = set; then + withval=$with_db_name; + if test "x$withval" != "x" ; then + db_name=$withval + fi + + +fi + + + +db_user=bacula + +# Check whether --with-db_user was given. +if test "${with_db_user+set}" = set; then + withval=$with_db_user; + if test "x$withval" != "x" ; then + db_user=$withval + fi + + +fi + + + + # # Handle users and groups for each daemon # @@ -18927,8 +18962,8 @@ echo "${ECHO_T}yes" >&6; } db_found=yes support_postgresql=yes - db_name=PostgreSQL - DB_NAME=postgresql + db_type=PostgreSQL + DB_TYPE=postgresql else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } @@ -19053,8 +19088,8 @@ echo "${ECHO_T}yes" >&6; } db_found=yes support_mysql=yes - db_name=MySQL - DB_NAME=mysql + db_type=MySQL + DB_TYPE=mysql else { echo "$as_me:$LINENO: result: no" >&5 @@ -19159,8 +19194,8 @@ echo "${ECHO_T}yes" >&6; } db_found=yes support_mysql=yes - db_name=MySQL - DB_NAME=mysql + db_type=MySQL + DB_TYPE=mysql else { echo "$as_me:$LINENO: result: no" >&5 @@ -19252,8 +19287,8 @@ echo "${ECHO_T}yes" >&6; } db_found=yes support_sqlite3=yes - db_name=SQLite3 - DB_NAME=sqlite3 + db_type=SQLite3 + DB_TYPE=sqlite3 else { echo "$as_me:$LINENO: result: no" >&5 @@ -19347,8 +19382,8 @@ echo "${ECHO_T}yes" >&6; } db_found=yes support_sqlite=yes - db_name=SQLite - DB_NAME=sqlite + db_type=SQLite + DB_TYPE=sqlite else { echo "$as_me:$LINENO: result: no" >&5 @@ -34830,6 +34865,8 @@ mon_dir_password!$mon_dir_password$ac_delim mon_fd_password!$mon_fd_password$ac_delim mon_sd_password!$mon_sd_password$ac_delim +db_name!$db_name$ac_delim +db_user!$db_user$ac_delim dir_user!$dir_user$ac_delim dir_group!$dir_group$ac_delim sd_user!$sd_user$ac_delim @@ -34841,7 +34878,7 @@ SQL_INCLUDE!$SQL_INCLUDE$ac_delim SQL_BINDIR!$SQL_BINDIR$ac_delim cats!$cats$ac_delim -DB_NAME!$DB_NAME$ac_delim +DB_TYPE!$DB_TYPE$ac_delim GETCONF!$GETCONF$ac_delim XMKMF!$XMKMF$ac_delim X_CFLAGS!$X_CFLAGS$ac_delim @@ -34868,7 +34905,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 46; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 48; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -35480,7 +35517,7 @@ exit 1 fi -if test "x${db_name}" = "xInternal" ; then +if test "x${db_type}" = "xInternal" ; then echo " " echo " " echo "You have not specified either --enable-client-only or one of the" @@ -35517,8 +35554,10 @@ Statically Linked SD: ${support_static_sd} Statically Linked DIR: ${support_static_dir} Statically Linked CONS: ${support_static_cons} - Database type: ${db_name} + Database type: ${db_type} Database lib: ${DB_LIBS} + Database name: ${db_name} + Database user: ${db_user} Job Output Email: ${job_email} Traceback Email: ${dump_email} Modified: trunk/bacula/platforms/gentoo/bacula-init.in =================================================================== --- trunk/bacula/platforms/gentoo/bacula-init.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/platforms/gentoo/bacula-init.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -6,7 +6,7 @@ depend() { need net - use @DB_NAME@ + use @DB_TYPE@ } opts="test" @@ -25,7 +25,7 @@ OPTIONS='' if [ "${SD_USER}" != '' ]; then OPTIONS="${OPTIONS} -u ${SD_USER}" - fi + fi if [ "${SD_GROUP}" != '' ]; then OPTIONS="${OPTIONS} -g ${SD_GROUP}" @@ -38,7 +38,7 @@ OPTIONS='' if [ "${FD_USER}" != '' ]; then OPTIONS="${OPTIONS} -u ${FD_USER}" - fi + fi if [ "${FD_GROUP}" != '' ]; then OPTIONS="${OPTIONS} -g ${FD_GROUP}" @@ -52,7 +52,7 @@ OPTIONS='' if [ "${DIR_USER}" != '' ]; then OPTIONS="${OPTIONS} -u ${DIR_USER}" - fi + fi if [ "${DIR_GROUP}" != '' ]; then OPTIONS="${OPTIONS} -g ${DIR_GROUP}" Modified: trunk/bacula/platforms/suse/bacula-dir-suse-sqlite.patch =================================================================== --- trunk/bacula/platforms/suse/bacula-dir-suse-sqlite.patch 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/platforms/suse/bacula-dir-suse-sqlite.patch 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,16 +1,16 @@ ---- bacula-1.36.0/platforms/suse/bacula-dir.in 2004-10-19 09:35:09.000000000 -0400 -+++ bacula-1.36.0/platforms/suse/bacula-dir.sqlite.in 2004-10-31 09:17:40.000000000 -0500 +--- bacula-1.36.0/platforms/suse/bacula-dir.in 2004-10-19 09:35:09.000000000 -0400 ++++ bacula-1.36.0/platforms/suse/bacula-dir.sqlite.in 2004-10-31 09:17:40.000000000 -0500 @@ -11,10 +11,11 @@ # Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com> # Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com> # -+# Configured for @DB_NAME@ support ++# Configured for @DB_TYPE@ support ### BEGIN INIT INFO - # Provides: bacula-dir --# Required-Start: $local_fs $network @DB_NAME@ --# Required-Stop: $local_fs $network @DB_NAME@ -+# Required-Start: $local_fs $network -+# Required-Stop: $local_fs $network - # Default-Start: 3 5 - # Default-Stop: 0 1 2 6 - # Short-Description: bacula director + # Provides: bacula-dir +-# Required-Start: $local_fs $network @DB_TYPE@ +-# Required-Stop: $local_fs $network @DB_TYPE@ ++# Required-Start: $local_fs $network ++# Required-Stop: $local_fs $network + # Default-Start: 3 5 + # Default-Stop: 0 1 2 6 + # Short-Description: bacula director Modified: trunk/bacula/platforms/suse/bacula-dir.in =================================================================== --- trunk/bacula/platforms/suse/bacula-dir.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/platforms/suse/bacula-dir.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,7 +1,7 @@ #! /bin/sh # # bacula This shell script takes care of starting and stopping -# the bacula Director daemon +# the bacula Director daemon # # chkconfig: 2345 90 9 # description: It comes by night and sucks the vital essence from your computers. @@ -12,13 +12,13 @@ # Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com> # ### BEGIN INIT INFO -# Provides: bacula-dir -# Required-Start: $local_fs $network @DB_NAME@ -# Required-Stop: $local_fs $network @DB_NAME@ -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: bacula director -# Description: Bacula network backup system director daemon +# Provides: bacula-dir +# Required-Start: $local_fs $network @DB_TYPE@ +# Required-Stop: $local_fs $network @DB_TYPE@ +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: bacula director +# Description: Bacula network backup system director daemon ### END INIT INFO # source process status functions Modified: trunk/bacula/src/cats/Makefile.in =================================================================== --- trunk/bacula/src/cats/Makefile.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/Makefile.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -84,7 +84,7 @@ $(RMF) grant_sqlite_privileges drop_sqlite_tables drop_sqlite_database $(RMF) create_sqlite3_database update_sqlite3_tables make_sqlite3_tables - $(RMF) grant_sqlite3_privileges drop_sqlite3_tables drop_sqlite3_database + $(RMF) grant_sqlite3_privileges drop_sqlite3_tables drop_sqlite3_database $(RMF) mysql sqlite postgresql $(RMF) make_catalog_backup delete_catalog_backup @@ -98,12 +98,12 @@ (cd $(srcdir); $(RMF) Makefile) install: - $(INSTALL_SCRIPT) create_@DB_NAME@_database $(DESTDIR)$(scriptdir)/create_@DB_NAME@_database - $(INSTALL_SCRIPT) update_@DB_NAME@_tables $(DESTDIR)$(scriptdir)/update_@DB_NAME@_tables - $(INSTALL_SCRIPT) make_@DB_NAME@_tables $(DESTDIR)$(scriptdir)/make_@DB_NAME@_tables - $(INSTALL_SCRIPT) grant_@DB_NAME@_privileges $(DESTDIR)$(scriptdir)/grant_@DB_NAME@_privileges - $(INSTALL_SCRIPT) drop_@DB_NAME@_tables $(DESTDIR)$(scriptdir)/drop_@DB_NAME@_tables - $(INSTALL_SCRIPT) drop_@DB_NAME@_database $(DESTDIR)$(scriptdir)/drop_@DB_NAME@_database + $(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_bacula_database $(DESTDIR)$(scriptdir)/create_bacula_database $(INSTALL_SCRIPT) update_bacula_tables $(DESTDIR)$(scriptdir)/update_bacula_tables @@ -132,12 +132,12 @@ ${INSTALL_SCRIPT} $$filename ${DESTDIR}${scriptdir}/$$destname uninstall: - (cd $(DESTDIR)$(scriptdir); $(RMF) create_@DB_NAME@_database) - (cd $(DESTDIR)$(scriptdir); $(RMF) update_@DB_NAME@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) make_@DB_NAME@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) grant_@DB_NAME@_privileges) - (cd $(DESTDIR)$(scriptdir); $(RMF) drop_@DB_NAME@_tables) - (cd $(DESTDIR)$(scriptdir); $(RMF) drop_@DB_NAME@_database) + (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_bacula_database) (cd $(DESTDIR)$(scriptdir); $(RMF) update_bacula_tables) Modified: trunk/bacula/src/cats/create_bacula_database.in =================================================================== --- trunk/bacula/src/cats/create_bacula_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/create_bacula_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,11 +3,11 @@ # This routine creates the Bacula database # using PostgreSQL, MySQL, or SQLite. # -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then echo "Creating SQLite database" - @scriptdir@/create_@DB_NAME@_database + @scriptdir@/create_@DB_TYPE@_database else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then echo "Creating MySQL database" @scriptdir@/create_mysql_database $* else Modified: trunk/bacula/src/cats/create_mysql_database.in =================================================================== --- trunk/bacula/src/cats/create_mysql_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/create_mysql_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,13 +4,14 @@ # bindir=@SQL_BINDIR@ +db_name=@db_name@ if $bindir/mysql $* -f <<END-OF-DATA -CREATE DATABASE bacula; +CREATE DATABASE ${db_name}; END-OF-DATA then - echo "Creation of bacula database succeeded." + echo "Creation of ${db_name} database succeeded." else - echo "Creation of bacula database failed." + echo "Creation of ${db_name} database failed." fi exit 0 Modified: trunk/bacula/src/cats/create_postgresql_database.in =================================================================== --- trunk/bacula/src/cats/create_postgresql_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/create_postgresql_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,6 +4,7 @@ # bindir=@SQL_BINDIR@ +db_name=@db_name@ # use SQL_ASCII to be able to put any filename into # the database even those created with unusual character sets @@ -15,12 +16,12 @@ if $bindir/psql -f - -d template1 $* <<END-OF-DATA -CREATE DATABASE bacula $ENCODING; -ALTER DATABASE bacula SET datestyle TO 'ISO, YMD'; +CREATE DATABASE ${db_name} $ENCODING; +ALTER DATABASE ${db_name} SET datestyle TO 'ISO, YMD'; END-OF-DATA then - echo "Creation of bacula database succeeded." + echo "Creation of ${db_name} database succeeded." else - echo "Creation of bacula database failed." + echo "Creation of ${db_name} database failed." fi exit 0 Modified: trunk/bacula/src/cats/create_sqlite3_database.in =================================================================== --- trunk/bacula/src/cats/create_sqlite3_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/create_sqlite3_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,8 +4,9 @@ bindir=@SQL_BINDIR@ cd @working_dir@ -sqlite=@DB_NAME@ +sqlite=@DB_TYPE@ +db_name=@db_name@ -${bindir}/${sqlite} $* bacula.db <<END-OF-DATA +${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA END-OF-DATA exit 0 Modified: trunk/bacula/src/cats/create_sqlite_database.in =================================================================== --- trunk/bacula/src/cats/create_sqlite_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/create_sqlite_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,6 +1,7 @@ #!/bin/sh # # shell script to create Bacula SQLite tables +db_name=@db_name@ -touch @working_dir@/bacula.db +touch @working_dir@/${db_name}.db exit 0 Modified: trunk/bacula/src/cats/delete_catalog_backup.in =================================================================== --- trunk/bacula/src/cats/delete_catalog_backup.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/delete_catalog_backup.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -2,4 +2,6 @@ # # This script deletes a catalog dump # -rm -f @working_dir@/bacula.sql +db_name=@db_name@ + +rm -f @working_dir@/${db_name}.sql Modified: trunk/bacula/src/cats/drop_bacula_database.in =================================================================== --- trunk/bacula/src/cats/drop_bacula_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_bacula_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,10 +3,10 @@ # Drop Bacula database -- works for whatever is configured, # MySQL, SQLite, PostgreSQL # -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then - @scriptdir@/drop_@DB_NAME@_database $* +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then + @scriptdir@/drop_@DB_TYPE@_database $* else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then echo "Making MySQL database" @scriptdir@/drop_mysql_database $* else Modified: trunk/bacula/src/cats/drop_bacula_tables.in =================================================================== --- trunk/bacula/src/cats/drop_bacula_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_bacula_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,11 +3,11 @@ # Drop Bacula tables -- works for whatever is configured, # MySQL, SQLite, or PostgreSQL # -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then - @scriptdir@/drop_@DB_NAME@_tables $* +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then + @scriptdir@/drop_@DB_TYPE@_tables $* echo "Dropped SQLite tables" else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then echo "Making MySQL tables" @scriptdir@/drop_mysql_tables $* echo "Dropped MySQL tables" Modified: trunk/bacula/src/cats/drop_mysql_database.in =================================================================== --- trunk/bacula/src/cats/drop_mysql_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_mysql_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,15 +4,16 @@ # bindir=@SQL_BINDIR@ +db_name=@db_name@ -if test xmysql = x@DB_NAME@ ; then +if test xmysql = x@DB_TYPE@ ; then $bindir/mysql $* -f <<END-OF-DATA - DROP DATABASE bacula; + DROP DATABASE ${db_name}; END-OF-DATA if test $? -eq 0 ; then - echo "Drop of bacula database succeeded." + echo "Drop of ${db_name} database succeeded." else - echo "Drop of bacula database failed." + echo "Drop of ${db_name} database failed." fi else echo "Bacula is not configured for a MySQL database." Modified: trunk/bacula/src/cats/drop_mysql_tables.in =================================================================== --- trunk/bacula/src/cats/drop_mysql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_mysql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,9 +3,10 @@ # shell script to delete Bacula tables for MySQL bindir=@SQL_BINDIR@ +db_name=@db_name@ if $bindir/mysql $* <<END-OF-DATA -USE bacula; +USE ${db_name}; DROP TABLE IF EXISTS Filename; DROP TABLE IF EXISTS Path; DROP TABLE IF EXISTS LongName; @@ -33,8 +34,8 @@ DROP TABLE IF EXISTS LocationLog; END-OF-DATA then - echo "Deletion of Bacula MySQL tables succeeded." + echo "Deletion of ${db_name} MySQL tables succeeded." else - echo "Deletion of Bacula MySQL tables failed." + echo "Deletion of ${db_name} MySQL tables failed." fi exit 0 Modified: trunk/bacula/src/cats/drop_postgresql_database.in =================================================================== --- trunk/bacula/src/cats/drop_postgresql_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_postgresql_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,11 +4,12 @@ # bindir=@SQL_BINDIR@ +db_name=@db_name@ -if $bindir/dropdb bacula +if $bindir/dropdb ${db_name} then - echo "Drop of bacula database succeeded." + echo "Drop of ${db_name} database succeeded." else - echo "Drop of bacula database failed." + echo "Drop of ${db_name} database failed." fi exit 0 Modified: trunk/bacula/src/cats/drop_postgresql_tables.in =================================================================== --- trunk/bacula/src/cats/drop_postgresql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_postgresql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,8 +3,9 @@ # shell script to delete Bacula tables for PostgreSQL bindir=@SQL_BINDIR@ +db_name=@db_name@ -$bindir/psql -f - -d bacula $* <<END-OF-DATA +$bindir/psql -f - -d ${db_name} $* <<END-OF-DATA drop table unsavedfiles; drop table basefiles; drop table jobmedia; Modified: trunk/bacula/src/cats/drop_sqlite3_database.in =================================================================== --- trunk/bacula/src/cats/drop_sqlite3_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_sqlite3_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,10 +1,12 @@ #!/bin/sh # # shell script to drop Bacula SQLite tables +db_name=@db_name@ -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then + +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then cd @working_dir@ - rm -rf bacula.db + rm -rf ${db_name}.db echo "SQLite database dropped." else echo "Bacula is not configured for an SQLite database." Modified: trunk/bacula/src/cats/drop_sqlite3_tables.in =================================================================== --- trunk/bacula/src/cats/drop_sqlite3_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_sqlite3_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,5 +3,6 @@ # shell script to Delete the SQLite Bacula database (same as deleting # the tables) # +db_name=@db_name@ -rm -f @working_dir@/bacula.db +rm -f @working_dir@/${db_name}.db Modified: trunk/bacula/src/cats/drop_sqlite_database.in =================================================================== --- trunk/bacula/src/cats/drop_sqlite_database.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_sqlite_database.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,10 +1,12 @@ #!/bin/sh # # shell script to drop Bacula SQLite tables +db_name=@db_name@ -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then + +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then cd @working_dir@ - rm -rf bacula.db + rm -rf ${db_name}.db echo "SQLite database dropped." else echo "Bacula is not configured for an SQLite database." Modified: trunk/bacula/src/cats/drop_sqlite_tables.in =================================================================== --- trunk/bacula/src/cats/drop_sqlite_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/drop_sqlite_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,6 +3,7 @@ # shell script to Delete the SQLite tables, we simply delete and recreate # the database. # +db_name=@db_name@ -rm -f @working_dir@/bacula.db -touch @working_dir@/bacula.db +rm -f @working_dir@/${db_name}.db +touch @working_dir@/${db_name}.db Modified: trunk/bacula/src/cats/grant_bacula_privileges.in =================================================================== --- trunk/bacula/src/cats/grant_bacula_privileges.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/grant_bacula_privileges.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,17 +4,17 @@ # Bacula tables for PostgreSQL or MySQL. # SQLite does not have permissions. # -if test xmysql = x@DB_NAME@ ; then +if test xmysql = x@DB_TYPE@ ; then echo "Granting MySQL privileges" @scriptdir@/grant_mysql_privileges $* else - if test xpostgresql = x@DB_NAME@ ; then + if test xpostgresql = x@DB_TYPE@ ; then echo "Granting PostgreSQL privileges" @scriptdir@/grant_postgresql_privileges $* else - if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then + if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then echo "Granting SQLite privileges" - @scriptdir@/grant_@DB_NAME@_privileges $* + @scriptdir@/grant_@DB_TYPE@_privileges $* fi fi fi Modified: trunk/bacula/src/cats/grant_mysql_privileges.in =================================================================== --- trunk/bacula/src/cats/grant_mysql_privileges.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/grant_mysql_privileges.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -2,18 +2,19 @@ # # shell script to grant privileges to the bacula database # -USER=bacula +USER=@db_user@ bindir=@SQL_BINDIR@ +db_name=@db_name@ if $bindir/mysql $* -u root -f <<END-OF-DATA use mysql -grant all privileges on bacula.* to ${USER}@localhost; -grant all privileges on bacula.* to ${USER}@"%"; +grant all privileges on ${db_name}.* to ${USER}@localhost; +grant all privileges on ${db_name}.* to ${USER}@"%"; select * from user; flush privileges; END-OF-DATA then - echo "Privileges for ${USER} granted." + echo "Privileges for ${USER} granted on ${db_name}." exit 0 else echo "Error creating privileges." Modified: trunk/bacula/src/cats/grant_postgresql_privileges.in =================================================================== --- trunk/bacula/src/cats/grant_postgresql_privileges.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/grant_postgresql_privileges.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -2,10 +2,11 @@ # # shell script to grant privileges to the bacula database # -USER=bacula +USER=@db_user@ bindir=@SQL_BINDIR@ +db_name=@db_name@ -if $bindir/psql -f - -d bacula $* <<END-OF-DATA +if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA create user ${USER}; @@ -53,7 +54,7 @@ END-OF-DATA then - echo "Privileges for ${USER} granted." + echo "Privileges for ${USER} granted on ${db_name}." exit 0 else echo "Error creating privileges." Modified: trunk/bacula/src/cats/make_bacula_tables.in =================================================================== --- trunk/bacula/src/cats/make_bacula_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_bacula_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,11 +3,11 @@ # This routine makes the appropriately configured # Bacula tables for PostgreSQL, MySQL, or SQLite. # -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then echo "Making SQLite tables" - @scriptdir@/make_@DB_NAME@_tables $* + @scriptdir@/make_@DB_TYPE@_tables $* else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then echo "Making MySQL tables" @scriptdir@/make_mysql_tables $* else Modified: trunk/bacula/src/cats/make_catalog_backup.in =================================================================== --- trunk/bacula/src/cats/make_catalog_backup.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_catalog_backup.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -14,11 +14,11 @@ BINDIR=@SQL_BINDIR@ cd @working_dir@ -rm -f bacula.sql -if test xsqlite = x@DB_NAME@ ; then +rm -f $1.sql +if test xsqlite = x@DB_TYPE@ ; then echo ".dump" | ${BINDIR}/sqlite $1.db >$1.sql else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then if test $# -gt 2; then MYSQLPASSWORD=" --password=$3" else @@ -26,7 +26,7 @@ fi ${BINDIR}/mysqldump -u $2$MYSQLPASSWORD -f --opt $1 >$1.sql else - if test xpostgresql = x@DB_NAME@ ; then + if test xpostgresql = x@DB_TYPE@ ; then if test $# -gt 2; then PGPASSWORD=$3 export PGPASSWORD Modified: trunk/bacula/src/cats/make_catalog_backup.in.patch =================================================================== --- trunk/bacula/src/cats/make_catalog_backup.in.patch 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_catalog_backup.in.patch 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,13 +1,13 @@ ---- make_catalog_backup.in 2006-12-09 10:17:05.000000000 -0500 -+++ make_catalog_backup.in.fixed 2006-12-09 10:24:40.000000000 -0500 +--- make_catalog_backup.in 2006-12-09 10:17:05.000000000 -0500 ++++ make_catalog_backup.in.fixed 2006-12-09 10:24:40.000000000 -0500 @@ -16,7 +16,7 @@ cd @working_dir@ rm -f bacula.sql - if test xsqlite = x@DB_NAME@ ; then + if test xsqlite = x@DB_TYPE@ ; then - echo ".dump" | ${BINDIR}/sqlite $1.db >$1.sql + echo ".dump" | /usr/lib/bacula/sqlite/sqlite $1.db >$1.sql else - if test xmysql = x@DB_NAME@ ; then + if test xmysql = x@DB_TYPE@ ; then if test $# -gt 2; then @@ -33,7 +33,7 @@ fi Modified: trunk/bacula/src/cats/make_mysql_tables.in =================================================================== --- trunk/bacula/src/cats/make_mysql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_mysql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,9 +3,10 @@ # shell script to create Bacula MySQL tables # bindir=@SQL_BINDIR@ +db_name=@db_name@ if $bindir/mysql $* -f <<END-OF-DATA -USE bacula; +USE ${db_name}; -- -- Note, we use BLOB rather than TEXT because in MySQL, -- BLOBs are identical to TEXT except that BLOB is case Modified: trunk/bacula/src/cats/make_postgresql_tables.in =================================================================== --- trunk/bacula/src/cats/make_postgresql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_postgresql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,8 +3,9 @@ # shell script to create Bacula PostgreSQL tables # bindir=@SQL_BINDIR@ +db_name=@db_name@ -$bindir/psql -f - -d bacula $* <<END-OF-DATA +$bindir/psql -f - -d ${db_name} $* <<END-OF-DATA CREATE TABLE filename ( Modified: trunk/bacula/src/cats/make_sqlite3_tables.in =================================================================== --- trunk/bacula/src/cats/make_sqlite3_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_sqlite3_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,9 +4,10 @@ bindir=@SQL_BINDIR@ cd @working_dir@ -sqlite=@DB_NAME@ +sqlite=@DB_TYPE@ +db_name=@db_name@ -${bindir}/${sqlite} $* bacula.db <<END-OF-DATA +${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA CREATE TABLE Filename ( FilenameId INTEGER, Name TEXT DEFAULT "", @@ -357,5 +358,5 @@ END-OF-DATA -chmod 640 bacula.db +chmod 640 ${db_name}.db exit 0 Modified: trunk/bacula/src/cats/make_sqlite_tables.in =================================================================== --- trunk/bacula/src/cats/make_sqlite_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/make_sqlite_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,9 +4,10 @@ bindir=@SQL_BINDIR@ cd @working_dir@ -sqlite=@DB_NAME@ +sqlite=@DB_TYPE@ +db_name=@db_name@ -${bindir}/${sqlite} $* bacula.db <<END-OF-DATA +${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA CREATE TABLE Filename ( FilenameId INTEGER, Name TEXT DEFAULT "", @@ -357,5 +358,5 @@ END-OF-DATA -chmod 640 bacula.db +chmod 640 ${db_name}.db exit 0 Modified: trunk/bacula/src/cats/mysql.in =================================================================== --- trunk/bacula/src/cats/mysql.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/mysql.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,5 +3,6 @@ # shell script to create Bacula MySQL tables # bindir=@SQL_BINDIR@ +db_name=@db_name@ -$bindir/mysql $* bacula +$bindir/mysql $* ${db_name} Modified: trunk/bacula/src/cats/postgresql.in =================================================================== --- trunk/bacula/src/cats/postgresql.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/postgresql.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,5 +3,6 @@ # shell script to create Bacula PostgreSQL tables # bindir=@SQL_BINDIR@ +db_name=@db_name@ -$bindir/psql $* bacula +$bindir/psql $* ${db_name} Modified: trunk/bacula/src/cats/sqlite.in =================================================================== --- trunk/bacula/src/cats/sqlite.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/sqlite.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,4 +3,5 @@ # shell script to invoke SQLite on Bacula database bindir=@SQL_BINDIR@ -$bindir/sqlite @working_dir@/bacula.db +db_name=@db_name@ +$bindir/sqlite @working_dir@/${db_name}.db Modified: trunk/bacula/src/cats/update_bacula_tables.in =================================================================== --- trunk/bacula/src/cats/update_bacula_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_bacula_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -3,15 +3,15 @@ # This routine alters the appropriately configured # Bacula tables for PostgreSQL, MySQL, or SQLite. # -if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then +if test xsqlite = x@DB_TYPE@ -o xsqlite3 = x@DB_TYPE@ ; then echo "Altering SQLite tables" - @scriptdir@/update_@DB_NAME@_tables $* + @scriptdir@/update_@DB_TYPE@_tables $* fi -if test xmysql = x@DB_NAME@ ; then +if test xmysql = x@DB_TYPE@ ; then echo "Altering MySQL tables" @scriptdir@/update_mysql_tables $* fi -if test xpostgresql = x@DB_NAME@ ; then +if test xpostgresql = x@DB_TYPE@ ; then echo "Altering PostgreSQL tables" @scriptdir@/update_postgresql_tables $* fi Modified: trunk/bacula/src/cats/update_mysql_tables.in =================================================================== --- trunk/bacula/src/cats/update_mysql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_mysql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -9,9 +9,10 @@ echo "this script may take several minutes to run." echo " " bindir=@SQL_BINDIR@ +db_name=@db_name@ if $bindir/mysql $* -f <<END-OF-DATA -USE bacula; +USE ${db_name}; DROP TABLE IF EXISTS MAC; DROP TABLE IF EXISTS Log; Modified: trunk/bacula/src/cats/update_postgresql_tables.in =================================================================== --- trunk/bacula/src/cats/update_postgresql_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_postgresql_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -9,8 +9,9 @@ echo "this script may take several minutes to run." echo " " bindir=@SQL_BINDIR@ +db_name=@db_name@ -if $bindir/psql -f - -d bacula $* <<END-OF-DATA +if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA ALTER TABLE media ADD COLUMN DeviceId integer; UPDATE media SET DeviceId=0; Modified: trunk/bacula/src/cats/update_sqlite3_tables.in =================================================================== --- trunk/bacula/src/cats/update_sqlite3_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_sqlite3_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -11,9 +11,10 @@ bindir=@SQL_BINDIR@ cd @working_dir@ -sqlite=@DB_NAME@ +sqlite=@DB_TYPE@ +db_name=@db_name@ -${bindir}/${sqlite} $* bacula.db <<END-OF-DATA +${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA BEGIN TRANSACTION; CREATE TEMPORARY TABLE Media_backup ( Modified: trunk/bacula/src/cats/update_sqlite_tables.in =================================================================== --- trunk/bacula/src/cats/update_sqlite_tables.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_sqlite_tables.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -11,9 +11,10 @@ bindir=@SQL_BINDIR@ cd @working_dir@ -sqlite=@DB_NAME@ +sqlite=@DB_TYPE@ +db_name=@db_name@ -${bindir}/${sqlite} $* bacula.db <<END-OF-DATA +${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA BEGIN TRANSACTION; CREATE TEMPORARY TABLE Media_backup ( Modified: trunk/bacula/src/cats/update_sqlite_tables.in.patch =================================================================== --- trunk/bacula/src/cats/update_sqlite_tables.in.patch 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/cats/update_sqlite_tables.in.patch 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,5 +1,5 @@ ---- update_sqlite_tables.in 2006-08-05 10:20:06.000000000 -0400 -+++ update_sqlite_tables.in.fixed 2006-08-05 10:18:23.000000000 -0400 +--- update_sqlite_tables.in 2006-08-05 10:20:06.000000000 -0400 ++++ update_sqlite_tables.in.fixed 2006-08-05 10:18:23.000000000 -0400 @@ -9,7 +9,7 @@ echo "this script may take several minutes to run." echo " " @@ -7,5 +7,5 @@ -bindir=@SQL_BINDIR@ +bindir=/usr/lib/bacula/sqlite cd @working_dir@ - sqlite=@DB_NAME@ + sqlite=@DB_TYPE@ Modified: trunk/bacula/src/dird/bacula-dir.conf.in =================================================================== --- trunk/bacula/src/dird/bacula-dir.conf.in 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/dird/bacula-dir.conf.in 2007-03-30 21:46:04 UTC (rev 4463) @@ -227,7 +227,7 @@ # Generic catalog service Catalog { Name = MyCatalog - dbname = bacula; user = bacula; password = "" + dbname = @db_name@; user = @db_user@; password = "" } # Reasonable message delivery -- send most everything to email address Modified: trunk/bacula/src/dird/dird.c =================================================================== --- trunk/bacula/src/dird/dird.c 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/dird/dird.c 2007-03-30 21:46:04 UTC (rev 4463) @@ -959,5 +959,7 @@ } db_close_database(NULL, db); } + /* Set type in global for debugging */ + set_db_type(db_get_type()); return OK; } Modified: trunk/bacula/src/lib/message.c =================================================================== --- trunk/bacula/src/lib/message.c 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/lib/message.c 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,12 +1,4 @@ /* - * Bacula message handling routines - * - * Kern Sibbald, April 2000 - * - * Version $Id$ - * - */ -/* Bacula® - The Network Backup Solution Copyright (C) 2000-2007 Free Software Foundation Europe e.V. @@ -163,11 +155,9 @@ void set_db_type(const char *name) { - if (catalog_db != NULL) - { + if (catalog_db != NULL) { free(catalog_db); } - catalog_db = bstrdup(name); } Modified: trunk/bacula/src/lib/protos.h =================================================================== --- trunk/bacula/src/lib/protos.h 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/lib/protos.h 2007-03-30 21:46:04 UTC (rev 4463) @@ -86,7 +86,7 @@ bool bnet_tls_server (TLS_CONTEXT *ctx, BSOCK *bsock, alist *verify_list); bool bnet_tls_client (TLS_CONTEXT *ctx, BSOCK *bsock, - alist *verify_list); + alist *verify_list); BSOCK * bnet_connect (JCR *jcr, int retry_interval, utime_t max_retry_time, const char *name, char *host, char *service, int port, int verbose); @@ -223,6 +223,7 @@ void free_msgs_res (MSGS *msgs); void dequeue_messages (JCR *jcr); void set_trace (int trace_flag); +void set_db_type (const char *name); /* bnet_server.c */ void bnet_thread_server(dlist *addr, int max_clients, workq_t *client_wq, Modified: trunk/bacula/src/version.h =================================================================== --- trunk/bacula/src/version.h 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/src/version.h 2007-03-30 21:46:04 UTC (rev 4463) @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.6" -#define BDATE "28 March 2007" -#define LSMDATE "28Mar07" +#define BDATE "30 March 2007" +#define LSMDATE "30Mar07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ Modified: trunk/bacula/technotes-2.1 =================================================================== --- trunk/bacula/technotes-2.1 2007-03-30 16:59:23 UTC (rev 4462) +++ trunk/bacula/technotes-2.1 2007-03-30 21:46:04 UTC (rev 4463) @@ -1,6 +1,10 @@ Technical notes on version 2.1 General: +30Mar07 +kes Make database name and user configurable + --with-db-name=xxx --with-db-user=xxx +kes Add back database type to message.c for debugging. 29Mar07 kes Implement dir_sql() which issues an SQL query. kes Modify bat medialist to use dir_sql() and do some minor C++ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |