"mysql")
db_prog="mysql"
if test -f /usr/local/mysql/bin/mysql; then
- SQL_BINDIR=/usr/local/mysql/bin
+ MYSQL_BINDIR=/usr/local/mysql/bin
if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \
-o -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.so; then
MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
fi
elif test -f /usr/bin/mysql; then
- SQL_BINDIR=/usr/bin
+ MYSQL_BINDIR=/usr/bin
if test -f /usr/lib64/mysql/libmysqlclient_r.a \
-o -f /usr/lib64/mysql/libmysqlclient_r.so; then
MYSQL_LIBDIR=/usr/lib64/mysql
MYSQL_LIBDIR=/usr/lib
fi
elif test -f /usr/local/bin/mysql; then
- SQL_BINDIR=/usr/local/bin
+ MYSQL_BINDIR=/usr/local/bin
if test -f /usr/local/lib64/mysql/libmysqlclient_r.a \
-o -f /usr/local/lib64/mysql/libmysqlclient_r.so; then
MYSQL_LIBDIR=/usr/local/lib64/mysql
MYSQL_LIBDIR=/usr/local/lib
fi
elif test -f $withval/bin/mysql; then
- SQL_BINDIR=$withval/bin
+ MYSQL_BINDIR=$withval/bin
if test -f $withval/lib64/mysql/libmysqlclient_r.a \
-o -f $withval/lib64/mysql/libmysqlclient_r.so; then
MYSQL_LIBDIR=$withval/lib64/mysql
depend() {
need net
- use @DB_TYPE@
+ use @DEFAULT_DB_TYPE@
}
opts="test"
#
### BEGIN INIT INFO
# Provides: bacula-dir
--# Required-Start: $local_fs $network @DB_TYPE@
--# Required-Stop: $local_fs $network @DB_TYPE@
+-# Required-Start: $local_fs $network @DEFAULT_DB_TYPE@
+-# Required-Stop: $local_fs $network @DEFAULT_DB_TYPE@
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
# Default-Start: 3 5
#
### BEGIN INIT INFO
# Provides: bacula-dir
-# Required-Start: $local_fs $network @DB_TYPE@
-# Required-Stop: $local_fs $network @DB_TYPE@
+# Required-Start: $local_fs $network @DEFAULT_DB_TYPE@
+# Required-Stop: $local_fs $network @DEFAULT_DB_TYPE@
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: bacula director
#
# shell script to create Bacula SQLite tables
--bindir=@SQL_BINDIR@
+-bindir=@SQLITE_BINDIR@
+bindir=/usr/lib/bacula/sqlite
cd @working_dir@
- sqlite=@DB_TYPE@
db_name=@db_name@
+
--- 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_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_TYPE@ ; then
- if test $# -gt 2; then
-@@ -33,7 +33,7 @@
- fi
- exec ${BINDIR}/pg_dump -c -U $2 $1 >$1.sql
- else
-- echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql
-+ echo ".dump" | /usr/lib/bacula/sqlite/sqlite3 $1.db >$1.sql
- fi
- fi
- fi
+++ make_catalog_backup.in.fixed 2006-12-09 10:24:40.000000000 -0500
+@@ -56,8 +56,7 @@ rm -f $1.sql
+
+ case ${db_type} in
+ sqlite3)
+- BINDIR=@SQLITE_BINDIR@
+- echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql
++ echo ".dump" | /opt/bacula/sqlite/sqlite3 $1.db >$1.sql
+ ;;
+ mysql)
+ BINDIR=@MYSQL_BINDIR@
# a base64 encoded tar of the content.
#
-bindir=@SQL_BINDIR@
+bindir=@INGRES_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
db_user=${db_user:-@db_user@}
#
# shell script to create Bacula SQLite tables
--bindir=@SQL_BINDIR@
+-bindir=@SQLITE_BINDIR@
+bindir=/usr/lib/bacula/sqlite
PATH="$bindir:$PATH"
cd @working_dir@
- sqlite=@DB_TYPE@
+ db_name=@db_name@
+
# a base64 encoded tar of the content.
#
-bindir=@SQL_BINDIR@
+bindir=@INGRES_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
db_user=${db_user:-@db_user@}
--- ./update_sqlite3_tables.in 2010-01-25 02:56:28.000000000 -0500
+++ ../../../bacula-5.0.0-fixed/src/cats/update_sqlite3_tables.in 2010-01-31 10:22:52.000000000 -0500
-@@ -11,7 +11,7 @@
- echo "this script may take several minutes to run."
+@@ -7,7 +7,7 @@ echo "This script will update a Bacula MySQL database from version 12 to 14"
+ echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
echo " "
--bindir=@SQL_BINDIR@
+-bindir=@SQLITE_BINDIR@
+bindir=/usr/lib/bacula/sqlite
PATH="$bindir:$PATH"
cd @working_dir@
- sqlite=@DB_TYPE@
+ db_name=@db_name@
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
-@uncomment_dbi@ dbdriver = "dbi:@DB_TYPE@"; dbaddress = 127.0.0.1; dbport = @db_port@
+@uncomment_dbi@ dbdriver = "dbi:@DEFAULT_DB_TYPE@"; dbaddress = 127.0.0.1; dbport = @db_port@
dbname = "@db_name@"; dbuser = "@db_user@"; dbpassword = "@db_password@"
}
echo "This script will update a Bacula MySQL database from version 10 to 11"
echo " which is needed to convert from Bacula version 2.0.x to 3.0.x or higher"
echo " "
-bindir=@SQL_BINDIR@
-db_name=@db_name@
+bindir=@MYSQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
-if $bindir/mysql $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
USE ${db_name};
-- Fix bad index on Media table
echo "This script will update a Bacula MySQL database from version 11 to 12"
echo " which is needed to convert from Bacula Community version 3.0.x to 5.0.x"
echo " "
-bindir=@SQL_BINDIR@
+bindir=@MYSQL_BINDIR@
PATH="$bindir:$PATH"
-db_name=@db_name@
+db_name=${db_name:-@db_name@}
mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
echo "Depending on the size of your database,"
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
-db_name=@db_name@
+bindir=@MYSQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
-if $bindir/mysql $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
USE ${db_name};
DROP TABLE IF EXISTS MAC;
echo "This script will update a Bacula PostgreSQL database from version 10 to 11"
echo " which is needed to convert from Bacula version 2.0.0 to 3.0.x or higher"
echo " "
-bindir=@SQL_BINDIR@
-db_name=@db_name@
-
-if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
+bindir=@POSTGRESQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+psql -f - -d ${db_name} $* <<END-OF-DATA
-- The alter table operation can be faster with a big maintenance_work_mem
-- Uncomment and adapt this value to your environment
-- SET maintenance_work_mem = '1GB';
echo " which is needed to convert from Bacula Community version 3.0.x to 5.0.x"
echo " "
-bindir=@SQL_BINDIR@
+bindir=@POSTGRESQL_BINDIR@
PATH="$bindir:$PATH"
-db_name=@db_name@
+db_name=${db_name:-@db_name@}
DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version" $*`
if [ $DBVERSION != 11 ] ; then
echo "Depending on the size of your database,"
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
-db_name=@db_name@
-if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
+bindir=@POSTGRESQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
ALTER TABLE media ADD COLUMN DeviceId integer;
UPDATE media SET DeviceId=0;
ALTER TABLE media ADD COLUMN MediaTypeId integer;
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=@SQLITE_BINDIR@
+PATH="$bindir:$PATH"
cd @working_dir@
-sqlite=@DB_TYPE@
db_name=@db_name@
-${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
+sqlite3 $* ${db_name}.db <<END-OF-DATA
-- Can be replaced by
-- ALTER TABLE Job ADD COLUMN (ReadBytes BIGINT UNSIGNED DEFAULT 0);
echo " which is needed to convert from Bacula Community version 3.0.x to 5.0.x"
echo " "
-bindir=@SQL_BINDIR@
+bindir=@SQLITE_BINDIR@
PATH="$bindir:$PATH"
cd @working_dir@
-sqlite=@DB_TYPE@
db_name=@db_name@
-DBV=`${sqlite} ${db_name} $sbin/regress.db <<END
+DBV=`${sqlite} ${db_name}.db <<END
select VersionId from Version;
END`
if [ $DBVERSION != 11 ] ; then
exit 1
fi
-
-${sqlite} $* ${db_name}.db <<END-OF-DATA
+sqlite3 $* ${db_name}.db <<END-OF-DATA
BEGIN;
ALTER TABLE Job ADD COLUMN HasCache TINYINT DEFAULT 0;
ALTER TABLE Job ADD COLUMN Reviewed TINYINT DEFAULT 0;
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=@SQLITE_BINDIR@
+PATH="$bindir:$PATH"
cd @working_dir@
-sqlite=@DB_TYPE@
db_name=@db_name@
-${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
+sqlite3 $* ${db_name}.db <<END-OF-DATA
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE Media_backup (
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=@SQLITE_BINDIR@
+PATH="$bindir:$PATH"
cd @working_dir@
-sqlite=@DB_TYPE@
db_name=@db_name@
-${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
+sqlite3 $* ${db_name}.db <<END-OF-DATA
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE job_backup AS SELECT * FROM Job;
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=@SQLITE_BINDIR@
+PATH="$bindir:$PATH"
cd @working_dir@
-sqlite=@DB_TYPE@
db_name=@db_name@
-${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
+sqlite3 $* ${db_name}.db <<END-OF-DATA
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE Media_backup (