(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:
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)
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)
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)
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)
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
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
AC_MSG_RESULT(yes)
have_db=yes
support_mysql=yes
- db_name=BerkelyDB
+ DB_TYPE=BerkelyDB
else
AC_MSG_RESULT(no)
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
[ --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"
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
BA_CHECK_SQLITE_DB
AC_SUBST(cats)
-AC_SUBST(DB_NAME)
+AC_SUBST(DB_TYPE)
AC_DEFINE(PROTOTYPES)
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"
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}
mon_dir_password
mon_fd_password
mon_sd_password
+db_name
+db_user
dir_user
dir_group
sd_user
SQL_INCLUDE
SQL_BINDIR
cats
-DB_NAME
+DB_TYPE
GETCONF
XMKMF
X_CFLAGS
--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
build_dird=yes
build_stored=yes
cats=
-db_name=Internal
-DB_NAME=bdb
+db_type=Internal
+DB_TYPE=bdb
# -------------------------------------------
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
+#
+# 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
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; }
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
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
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
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
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
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
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
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"
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}
depend() {
need net
- use @DB_NAME@
+ use @DB_TYPE@
}
opts="test"
OPTIONS=''
if [ "${SD_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${SD_USER}"
- fi
+ fi
if [ "${SD_GROUP}" != '' ]; then
OPTIONS="${OPTIONS} -g ${SD_GROUP}"
OPTIONS=''
if [ "${FD_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${FD_USER}"
- fi
+ fi
if [ "${FD_GROUP}" != '' ]; then
OPTIONS="${OPTIONS} -g ${FD_GROUP}"
OPTIONS=''
if [ "${DIR_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${DIR_USER}"
- fi
+ fi
if [ "${DIR_GROUP}" != '' ]; then
OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
---- 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
#! /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.
# 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
$(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
(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
${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)
# 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
#
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
#
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
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
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
#!/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
#
# This script deletes a catalog dump
#
-rm -f @working_dir@/bacula.sql
+db_name=@db_name@
+
+rm -f @working_dir@/${db_name}.sql
# 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
# 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"
#
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."
# 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;
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
#
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
# 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;
#!/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."
# 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
#!/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."
# 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
# 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
#
# 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."
#
# 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};
END-OF-DATA
then
- echo "Privileges for ${USER} granted."
+ echo "Privileges for ${USER} granted on ${db_name}."
exit 0
else
echo "Error creating privileges."
# 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
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
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
---- 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
# 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
# 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
(
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 "",
END-OF-DATA
-chmod 640 bacula.db
+chmod 640 ${db_name}.db
exit 0
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 "",
END-OF-DATA
-chmod 640 bacula.db
+chmod 640 ${db_name}.db
exit 0
# shell script to create Bacula MySQL tables
#
bindir=@SQL_BINDIR@
+db_name=@db_name@
-$bindir/mysql $* bacula
+$bindir/mysql $* ${db_name}
# shell script to create Bacula PostgreSQL tables
#
bindir=@SQL_BINDIR@
+db_name=@db_name@
-$bindir/psql $* bacula
+$bindir/psql $* ${db_name}
# 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
# 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
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;
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;
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 (
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 (
---- 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 " "
-bindir=@SQL_BINDIR@
+bindir=/usr/lib/bacula/sqlite
cd @working_dir@
- sqlite=@DB_NAME@
+ sqlite=@DB_TYPE@
# 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
}
db_close_database(NULL, db);
}
+ /* Set type in global for debugging */
+ set_db_type(db_get_type());
return OK;
}
-/*
- * Bacula message handling routines
- *
- * Kern Sibbald, April 2000
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
void
set_db_type(const char *name)
{
- if (catalog_db != NULL)
- {
+ if (catalog_db != NULL) {
free(catalog_db);
}
-
catalog_db = bstrdup(name);
}
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);
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,
#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 */
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++