Группа :: Архивирование/Резервное копирование
Пакет: bacula
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: bacula-1.38.5-alt-dbscripts.patch
diff -uNr bacula-1.38.5.orig/src/cats/create_bacula_database.in bacula-1.38.5/src/cats/create_bacula_database.in
--- bacula-1.38.5.orig/src/cats/create_bacula_database.in 2005-12-11 01:18:02 +1200
+++ bacula-1.38.5/src/cats/create_bacula_database.in 2006-03-20 12:59:07 +1200
@@ -1,17 +1,34 @@
-#!/bin/sh
+#!/bin/bash
#
# This routine creates the Bacula database
# using PostgreSQL, MySQL, or SQLite.
#
-if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then
- echo "Creating SQLite database"
- @scriptdir@/create_@DB_NAME@_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 $*
- fi
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Creating PostgreSQL database"
+ @scriptdir@/create_postgresql_database $*
+ ;;
+ sqlite)
+ echo "Creating SQLite database"
+ @scriptdir@/create_sqlite_database $*
+ ;;
+ sqlite3)
+ echo "Creating SQLite3 database"
+ @scriptdir@/create_sqlite3_database $*
+ ;;
+ mysql)
+ echo "Creating MySQL database"
+ @scriptdir@/create_mysql_database $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/create_bdb_database.in bacula-1.38.5/src/cats/create_bdb_database.in
--- bacula-1.38.5.orig/src/cats/create_bdb_database.in 2002-07-08 03:41:19 +1300
+++ bacula-1.38.5/src/cats/create_bdb_database.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula database(s)
#
diff -uNr bacula-1.38.5.orig/src/cats/create_mysql_database.in bacula-1.38.5/src/cats/create_mysql_database.in
--- bacula-1.38.5.orig/src/cats/create_mysql_database.in 2003-04-04 05:01:51 +1300
+++ bacula-1.38.5/src/cats/create_mysql_database.in 2006-03-20 12:55:28 +1200
@@ -1,16 +1,17 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula database(s)
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/mysql $* -f <<END-OF-DATA
CREATE DATABASE bacula;
END-OF-DATA
then
echo "Creation of bacula database succeeded."
+ exit 0
else
echo "Creation of bacula database failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/create_postgresql_database.in bacula-1.38.5/src/cats/create_postgresql_database.in
--- bacula-1.38.5.orig/src/cats/create_postgresql_database.in 2005-02-21 12:09:38 +1200
+++ bacula-1.38.5/src/cats/create_postgresql_database.in 2006-03-20 12:55:28 +1200
@@ -1,16 +1,17 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula database(s)
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/psql -f - -d template1 $* <<END-OF-DATA
CREATE DATABASE bacula;
END-OF-DATA
then
echo "Creation of bacula database succeeded."
+ exit 0
else
echo "Creation of bacula database failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/create_sqlite3_database.in bacula-1.38.5/src/cats/create_sqlite3_database.in
--- bacula-1.38.5.orig/src/cats/create_sqlite3_database.in 2005-02-01 20:13:19 +1200
+++ bacula-1.38.5/src/cats/create_sqlite3_database.in 2006-03-20 12:55:28 +1200
@@ -1,11 +1,12 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula SQLite tables
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
+
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite3 $* bacula.db <<END-OF-DATA
END-OF-DATA
+
exit 0
diff -uNr bacula-1.38.5.orig/src/cats/create_sqlite_database.in bacula-1.38.5/src/cats/create_sqlite_database.in
--- bacula-1.38.5.orig/src/cats/create_sqlite_database.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/create_sqlite_database.in 2006-03-20 12:55:28 +1200
@@ -1,11 +1,12 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula SQLite tables
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
+
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite $* bacula.db <<END-OF-DATA
END-OF-DATA
+
exit 0
diff -uNr bacula-1.38.5.orig/src/cats/delete_catalog_backup.in bacula-1.38.5/src/cats/delete_catalog_backup.in
--- bacula-1.38.5.orig/src/cats/delete_catalog_backup.in 2003-01-04 07:09:11 +1200
+++ bacula-1.38.5/src/cats/delete_catalog_backup.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# This script deletes a catalog dump
#
diff -uNr bacula-1.38.5.orig/src/cats/drop_bacula_database.in bacula-1.38.5/src/cats/drop_bacula_database.in
--- bacula-1.38.5.orig/src/cats/drop_bacula_database.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/drop_bacula_database.in 2006-03-20 12:55:28 +1200
@@ -1,15 +1,34 @@
-#!/bin/sh
+#!/bin/bash
#
# 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 $*
-else
- if test xmysql = x@DB_NAME@ ; then
- echo "Making MySQL database"
- @scriptdir@/drop_mysql_database $*
- else
- @scriptdir@/drop_postgresql_database $*
- fi
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Dropping PostgreSQL database"
+ @scriptdir@/drop_postgresql_database $*
+ ;;
+ sqlite)
+ echo "Dropping SQLite database"
+ @scriptdir@/drop_sqlite_database $*
+ ;;
+ sqlite3)
+ echo "Dropping SQLite3 database"
+ @scriptdir@/drop_sqlite3_database $*
+ ;;
+ mysql)
+ echo "Dropping MySQL database"
+ @scriptdir@/drop_mysql_database $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/drop_bacula_tables.in bacula-1.38.5/src/cats/drop_bacula_tables.in
--- bacula-1.38.5.orig/src/cats/drop_bacula_tables.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/drop_bacula_tables.in 2006-03-20 12:55:28 +1200
@@ -1,19 +1,34 @@
-#!/bin/sh
+#!/bin/bash
#
# 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 $*
- echo "Dropped SQLite tables"
-else
- if test xmysql = x@DB_NAME@ ; then
- echo "Making MySQL tables"
- @scriptdir@/drop_mysql_tables $*
- echo "Dropped MySQL tables"
- else
- # hardcoded database name - should be a parameter
- @scriptdir@/drop_postgresql_tables $*
- echo "Dropped PostgreSQL tables"
- fi
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Dropping PostgreSQL tables"
+ @scriptdir@/drop_postgresql_tables $*
+ ;;
+ sqlite)
+ echo "Dropping SQLite tables"
+ @scriptdir@/drop_sqlite_tables $*
+ ;;
+ sqlite3)
+ echo "Dropping SQLite3 tables"
+ @scriptdir@/drop_sqlite3_tables $*
+ ;;
+ mysql)
+ echo "Dropping MySQL tables"
+ @scriptdir@/drop_mysql_tables $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/drop_bdb_database.in bacula-1.38.5/src/cats/drop_bdb_database.in
--- bacula-1.38.5.orig/src/cats/drop_bdb_database.in 2003-12-22 11:23:52 +1200
+++ bacula-1.38.5/src/cats/drop_bdb_database.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to drop Bacula database(s)
#
diff -uNr bacula-1.38.5.orig/src/cats/drop_bdb_tables.in bacula-1.38.5/src/cats/drop_bdb_tables.in
--- bacula-1.38.5.orig/src/cats/drop_bdb_tables.in 2002-07-08 03:41:19 +1300
+++ bacula-1.38.5/src/cats/drop_bdb_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to Delete the Bacula database (same as deleting
# the tables)
diff -uNr bacula-1.38.5.orig/src/cats/drop_mysql_database.in bacula-1.38.5/src/cats/drop_mysql_database.in
--- bacula-1.38.5.orig/src/cats/drop_mysql_database.in 2004-06-08 03:40:44 +1300
+++ bacula-1.38.5/src/cats/drop_mysql_database.in 2006-03-20 12:55:28 +1200
@@ -1,20 +1,17 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to drop Bacula database(s)
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
-if test xmysql = x@DB_NAME@ ; then
- $bindir/mysql $* -f <<END-OF-DATA
+if $bindir/mysql $* -f <<END-OF-DATA
DROP DATABASE bacula;
END-OF-DATA
- if test $? -eq 0 ; then
+then
echo "Drop of bacula database succeeded."
- else
- echo "Drop of bacula database failed."
- fi
+ exit 0
else
- echo "Bacula is not configured for a MySQL database."
+ echo "Drop of bacula database failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/drop_mysql_tables.in bacula-1.38.5/src/cats/drop_mysql_tables.in
--- bacula-1.38.5.orig/src/cats/drop_mysql_tables.in 2005-04-18 21:06:51 +1300
+++ bacula-1.38.5/src/cats/drop_mysql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to delete Bacula tables for MySQL
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/mysql $* <<END-OF-DATA
USE bacula;
@@ -30,7 +30,8 @@
END-OF-DATA
then
echo "Deletion of Bacula MySQL tables succeeded."
+ exit 0
else
echo "Deletion of Bacula MySQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/drop_postgresql_database.in bacula-1.38.5/src/cats/drop_postgresql_database.in
--- bacula-1.38.5.orig/src/cats/drop_postgresql_database.in 2004-01-04 10:26:34 +1200
+++ bacula-1.38.5/src/cats/drop_postgresql_database.in 2006-03-20 12:55:28 +1200
@@ -1,14 +1,15 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to drop Bacula database(s)
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/dropdb bacula
then
echo "Drop of bacula database succeeded."
+ exit 0
else
echo "Drop of bacula database failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/drop_postgresql_tables.in bacula-1.38.5/src/cats/drop_postgresql_tables.in
--- bacula-1.38.5.orig/src/cats/drop_postgresql_tables.in 2005-08-03 05:09:50 +1300
+++ bacula-1.38.5/src/cats/drop_postgresql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to delete Bacula tables for PostgreSQL
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/psql -f - -d bacula $* <<END-OF-DATA
drop table unsavedfiles;
@@ -26,7 +26,8 @@
END-OF-DATA
then
echo "Deletion of Bacula PostgreSQL tables succeeded."
+ exit 0
else
echo "Deletion of Bacula PostgreSQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/drop_sqlite3_database.in bacula-1.38.5/src/cats/drop_sqlite3_database.in
--- bacula-1.38.5.orig/src/cats/drop_sqlite3_database.in 2005-02-01 20:13:19 +1200
+++ bacula-1.38.5/src/cats/drop_sqlite3_database.in 2006-03-20 12:55:28 +1200
@@ -1,11 +1,6 @@
-#!/bin/sh
+#!/bin/bash
#
-# shell script to drop Bacula SQLite tables
+# shell script to drop Bacula SQLite3 tables
-if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then
- cd @working_dir@
- rm -rf bacula.db
- echo "SQLite database dropped."
-else
- echo "Bacula is not configured for an SQLite database."
-fi
+rm -f @working_dir@/bacula.db
+echo "SQLite3 database dropped."
diff -uNr bacula-1.38.5.orig/src/cats/drop_sqlite3_tables.in bacula-1.38.5/src/cats/drop_sqlite3_tables.in
--- bacula-1.38.5.orig/src/cats/drop_sqlite3_tables.in 2005-02-01 20:13:19 +1200
+++ bacula-1.38.5/src/cats/drop_sqlite3_tables.in 2006-03-20 12:55:28 +1200
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
#
-# shell script to Delete the SQLite Bacula database (same as deleting
+# shell script to Delete the SQLite3 Bacula database (same as deleting
# the tables)
#
diff -uNr bacula-1.38.5.orig/src/cats/drop_sqlite_database.in bacula-1.38.5/src/cats/drop_sqlite_database.in
--- bacula-1.38.5.orig/src/cats/drop_sqlite_database.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/drop_sqlite_database.in 2006-03-20 12:55:28 +1200
@@ -1,11 +1,6 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to drop Bacula SQLite tables
-if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then
- cd @working_dir@
- rm -rf bacula.db
- echo "SQLite database dropped."
-else
- echo "Bacula is not configured for an SQLite database."
-fi
+rm -f @working_dir@/bacula.db
+echo "SQLite database dropped."
diff -uNr bacula-1.38.5.orig/src/cats/drop_sqlite_tables.in bacula-1.38.5/src/cats/drop_sqlite_tables.in
--- bacula-1.38.5.orig/src/cats/drop_sqlite_tables.in 2002-05-09 18:46:11 +1300
+++ bacula-1.38.5/src/cats/drop_sqlite_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to Delete the SQLite Bacula database (same as deleting
# the tables)
diff -uNr bacula-1.38.5.orig/src/cats/fix_postgresql_tables bacula-1.38.5/src/cats/fix_postgresql_tables
--- bacula-1.38.5.orig/src/cats/fix_postgresql_tables 2004-11-25 05:16:43 +1200
+++ bacula-1.38.5/src/cats/fix_postgresql_tables 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Shell script to fix PostgreSQL tables in version 8
#
@@ -9,7 +9,7 @@
echo " "
#
# Set the following to the path to psql.
-bindir=****EDIT-ME to be the path to psql****
+bindir=/usr/bin
if $bindir/psql $* -f - <<END-OF-DATA
\c bacula
@@ -29,7 +29,8 @@
END-OF-DATA
then
echo "Update of Bacula PostgreSQL tables succeeded."
+ exit 0
else
echo "Update of Bacula PostgreSQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/grant_bacula_privileges.in bacula-1.38.5/src/cats/grant_bacula_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_bacula_privileges.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/grant_bacula_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,20 +1,35 @@
-#!/bin/sh
+#!/bin/bash
#
# This routine makes the appropriately configured
# Bacula tables for PostgreSQL or MySQL.
# SQLite does not have permissions.
#
-if test xmysql = x@DB_NAME@ ; then
- echo "Granting MySQL privileges"
- @scriptdir@/grant_mysql_privileges $*
-else
- if test xpostgresql = x@DB_NAME@ ; then
- echo "Granting PostgreSQL privileges"
- @scriptdir@/grant_postgresql_privileges $*
- else
- if test xsqlite = x@DB_NAME@ -o xsqlite3 = x@DB_NAME@ ; then
- echo "Granting SQLite privileges"
- @scriptdir@/grant_@DB_NAME@_privileges $*
- fi
- fi
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Granting PostgreSQL privileges"
+ @scriptdir@/grant_postgresql_privileges $*
+ ;;
+ sqlite)
+ echo "Granting SQLite privileges"
+ @scriptdir@/grant_sqlite_privileges $*
+ ;;
+ sqlite3)
+ echo "Granting SQLite3 privileges"
+ @scriptdir@/grant_sqlite3_privileges $*
+ ;;
+ mysql)
+ echo "Granting MySQL privileges"
+ @scriptdir@/grant_mysql_privileges $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/grant_bdb_privileges.in bacula-1.38.5/src/cats/grant_bdb_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_bdb_privileges.in 2003-12-23 02:58:22 +1200
+++ bacula-1.38.5/src/cats/grant_bdb_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to grant privileges to the bdb database
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
-# nothing to do here
\ В конце файла нет новой строки
+# nothing to do here
diff -uNr bacula-1.38.5.orig/src/cats/grant_mysql_privileges.in bacula-1.38.5/src/cats/grant_mysql_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_mysql_privileges.in 2004-05-02 10:10:17 +1300
+++ bacula-1.38.5/src/cats/grant_mysql_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to grant privileges to the bacula database
#
USER=bacula
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/mysql $* -u root -f <<END-OF-DATA
use mysql
diff -uNr bacula-1.38.5.orig/src/cats/grant_postgresql_privileges.in bacula-1.38.5/src/cats/grant_postgresql_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_postgresql_privileges.in 2005-11-07 06:07:04 +1200
+++ bacula-1.38.5/src/cats/grant_postgresql_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to grant privileges to the bacula database
#
USER=bacula
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/psql -f - -d bacula $* <<END-OF-DATA
diff -uNr bacula-1.38.5.orig/src/cats/grant_sqlite3_privileges.in bacula-1.38.5/src/cats/grant_sqlite3_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_sqlite3_privileges.in 2005-02-01 20:13:19 +1200
+++ bacula-1.38.5/src/cats/grant_sqlite3_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to grant privileges to the bacula database
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
-# nothing to do here
\ В конце файла нет новой строки
+# nothing to do here
diff -uNr bacula-1.38.5.orig/src/cats/grant_sqlite_privileges.in bacula-1.38.5/src/cats/grant_sqlite_privileges.in
--- bacula-1.38.5.orig/src/cats/grant_sqlite_privileges.in 2003-12-19 01:35:29 +1200
+++ bacula-1.38.5/src/cats/grant_sqlite_privileges.in 2006-03-20 12:55:28 +1200
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to grant privileges to the bacula database
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
-# nothing to do here
\ В конце файла нет новой строки
+# nothing to do here
diff -uNr bacula-1.38.5.orig/src/cats/make_bacula_tables.in bacula-1.38.5/src/cats/make_bacula_tables.in
--- bacula-1.38.5.orig/src/cats/make_bacula_tables.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/make_bacula_tables.in 2006-03-20 12:55:28 +1200
@@ -1,17 +1,34 @@
-#!/bin/sh
+#!/bin/bash
#
# 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
- echo "Making SQLite tables"
- @scriptdir@/make_@DB_NAME@_tables $*
-else
- if test xmysql = x@DB_NAME@ ; then
- echo "Making MySQL tables"
- @scriptdir@/make_mysql_tables $*
- else
- echo "Making PostgreSQL tables"
- @scriptdir@/make_postgresql_tables $*
- fi
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Making PostgreSQL tables"
+ @scriptdir@/make_postgresql_tables $*
+ ;;
+ sqlite)
+ echo "Making SQLite tables"
+ @scriptdir@/make_sqlite_tables $*
+ ;;
+ sqlite3)
+ echo "Making SQLite3 tables"
+ @scriptdir@/make_sqlite3_tables $*
+ ;;
+ mysql)
+ echo "Making SQLite tables"
+ @scriptdir@/make_sqlite_tables $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/make_bdb_tables.in bacula-1.38.5/src/cats/make_bdb_tables.in
--- bacula-1.38.5.orig/src/cats/make_bdb_tables.in 2002-07-08 03:41:19 +1300
+++ bacula-1.38.5/src/cats/make_bdb_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula tables
#
diff -uNr bacula-1.38.5.orig/src/cats/make_catalog_backup.in bacula-1.38.5/src/cats/make_catalog_backup.in
--- bacula-1.38.5.orig/src/cats/make_catalog_backup.in 2005-09-09 22:34:28 +1300
+++ bacula-1.38.5/src/cats/make_catalog_backup.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# This script dumps your Bacula catalog in ASCII format
# It works for MySQL, SQLite, and PostgreSQL
@@ -10,31 +10,6 @@
# $3 is the password with which to access the database or "" if no password
# (default "")
#
-#
-cd @working_dir@
-rm -f bacula.sql
-if test xsqlite = x@DB_NAME@ ; then
- echo ".dump" | @SQL_BINDIR@/sqlite $1.db >$1.sql
-else
- if test xmysql = x@DB_NAME@ ; then
- if test $# -gt 2; then
- MYSQLPASSWORD=" --password=$3"
- else
- MYSQLPASSWORD=""
- fi
- @SQL_BINDIR@/mysqldump -u $2$MYSQLPASSWORD -f --opt $1 >$1.sql
- else
- if test xpostgresql = x@DB_NAME@ ; then
- if test $# -gt 2; then
- export PGPASSWORD=$3
- fi
- exec @SQL_BINDIR@/pg_dump -U $2 $1 >$1.sql
- else
- echo ".dump" | @SQL_BINDIR@/sqlite3 $1.db >$1.sql
- fi
- fi
-fi
-#
# To read back a MySQL database use:
# cd @working_dir@
# rm -f @SQL_BINDIR@/../var/bacula/*
@@ -50,3 +25,30 @@
# dropdb bacula
# psql bacula <bacula.sql
#
+
+RETVAL=0
+
+bindir=/usr/bin
+
+. /etc/sysconfig/bacula
+
+cd @working_dir@
+rm -f bacula.sql
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ $bindir/pg_dump -U $2 $1 >$1.sql
+ ;;
+ sqlite)
+ echo ".dump" | $bindir/sqlite $1.db >$1.sql
+ ;;
+ mysql)
+ $bindir/mysqldump -u $2 -f --opt $1 >$1.sql
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/make_mysql_tables.in bacula-1.38.5/src/cats/make_mysql_tables.in
--- bacula-1.38.5.orig/src/cats/make_mysql_tables.in 2005-12-18 05:10:46 +1200
+++ bacula-1.38.5/src/cats/make_mysql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula MySQL tables
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/mysql $* -f <<END-OF-DATA
USE bacula;
@@ -293,7 +293,8 @@
END-OF-DATA
then
echo "Creation of Bacula MySQL tables succeeded."
+ exit 0
else
echo "Creation of Bacula MySQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/make_postgresql_tables.in bacula-1.38.5/src/cats/make_postgresql_tables.in
--- bacula-1.38.5.orig/src/cats/make_postgresql_tables.in 2005-12-18 05:10:46 +1200
+++ bacula-1.38.5/src/cats/make_postgresql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula PostgreSQL tables
#
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/psql -f - -d bacula $* <<END-OF-DATA
@@ -327,7 +327,8 @@
END-OF-DATA
then
echo "Creation of Bacula PostgreSQL tables succeeded."
+ exit 0
else
echo "Creation of Bacula PostgreSQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/make_sqlite3_tables.in bacula-1.38.5/src/cats/make_sqlite3_tables.in
--- bacula-1.38.5.orig/src/cats/make_sqlite3_tables.in 2005-12-18 05:10:46 +1200
+++ bacula-1.38.5/src/cats/make_sqlite3_tables.in 2006-03-20 12:55:28 +1200
@@ -1,12 +1,11 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula SQLite tables
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite3 $* bacula.db <<END-OF-DATA
CREATE TABLE Filename (
FilenameId INTEGER,
Name TEXT DEFAULT "",
@@ -318,4 +317,6 @@
END-OF-DATA
chmod 640 bacula.db
+chown bacula:bacula bacula.db
+
exit 0
diff -uNr bacula-1.38.5.orig/src/cats/make_sqlite_tables.in bacula-1.38.5/src/cats/make_sqlite_tables.in
--- bacula-1.38.5.orig/src/cats/make_sqlite_tables.in 2005-12-18 05:10:46 +1200
+++ bacula-1.38.5/src/cats/make_sqlite_tables.in 2006-03-20 12:55:28 +1200
@@ -1,12 +1,11 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to create Bacula SQLite tables
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite $* bacula.db <<END-OF-DATA
CREATE TABLE Filename (
FilenameId INTEGER,
Name TEXT DEFAULT "",
@@ -317,4 +316,6 @@
END-OF-DATA
chmod 640 bacula.db
+chown bacula:bacula bacula.db
+
exit 0
diff -uNr bacula-1.38.5.orig/src/cats/update_bacula_tables.in bacula-1.38.5/src/cats/update_bacula_tables.in
--- bacula-1.38.5.orig/src/cats/update_bacula_tables.in 2005-01-30 10:38:58 +1200
+++ bacula-1.38.5/src/cats/update_bacula_tables.in 2006-03-20 12:55:28 +1200
@@ -1,17 +1,34 @@
-#!/bin/sh
+#!/bin/bash
#
# 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
- echo "Altering SQLite tables"
- @scriptdir@/update_@DB_NAME@_tables $*
-fi
-if test xmysql = x@DB_NAME@ ; then
- echo "Altering MySQL tables"
- @scriptdir@/update_mysql_tables $*
-fi
-if test xpostgresql = x@DB_NAME@ ; then
- echo "Altering PostgreSQL tables"
- @scriptdir@/update_postgresql_tables $*
-fi
+
+RETVAL=0
+
+. /etc/sysconfig/bacula
+
+case "$BACULA_BACKEND" in
+ postgresql)
+ echo "Altering PostgreSQL tables"
+ @scriptdir@/update_postgresql_tables $*
+ ;;
+ sqlite)
+ echo "Altering SQLite tables"
+ @scriptdir@/update_sqlite_tables $*
+ ;;
+ sqlite3)
+ echo "Altering SQLite3 tables"
+ @scriptdir@/update_sqlite3_tables $*
+ ;;
+ mysql)
+ echo "Altering MySQL tables"
+ @scriptdir@/update_mysql_tables $*
+ ;;
+ *)
+ echo "Unknown database type"
+ $RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff -uNr bacula-1.38.5.orig/src/cats/update_bdb_tables.in bacula-1.38.5/src/cats/update_bdb_tables.in
--- bacula-1.38.5.orig/src/cats/update_bdb_tables.in 2003-12-23 02:58:22 +1200
+++ bacula-1.38.5/src/cats/update_bdb_tables.in 2006-03-20 12:55:28 +1200
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/bin/bash
#
# Shell script to update bdb tables
# Nothing to do here.
#
echo " "
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
exit 0
diff -uNr bacula-1.38.5.orig/src/cats/update_mysql_tables.in bacula-1.38.5/src/cats/update_mysql_tables.in
--- bacula-1.38.5.orig/src/cats/update_mysql_tables.in 2005-11-11 08:25:27 +1200
+++ bacula-1.38.5/src/cats/update_mysql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Shell script to update MySQL tables from version 1.36 to 1.38
#
@@ -7,7 +7,7 @@
echo "Depending on the size of your database,"
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/mysql $* -f <<END-OF-DATA
USE bacula;
@@ -93,7 +93,8 @@
END-OF-DATA
then
echo "Update of Bacula MySQL tables succeeded."
+ exit 0
else
echo "Update of Bacula MySQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/update_postgresql_tables.in bacula-1.38.5/src/cats/update_postgresql_tables.in
--- bacula-1.38.5.orig/src/cats/update_postgresql_tables.in 2005-11-07 06:07:04 +1200
+++ bacula-1.38.5/src/cats/update_postgresql_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Shell script to update PostgreSQL tables from version 1.36 to 1.38
#
@@ -7,7 +7,7 @@
echo "Depending on the size of your database,"
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
if $bindir/psql -f - -d bacula $* <<END-OF-DATA
@@ -127,7 +127,8 @@
END-OF-DATA
then
echo "Update of Bacula PostgreSQL tables succeeded."
+ exit 0
else
echo "Update of Bacula PostgreSQL tables failed."
+ exit 1
fi
-exit 0
diff -uNr bacula-1.38.5.orig/src/cats/update_sqlite3_tables.in bacula-1.38.5/src/cats/update_sqlite3_tables.in
--- bacula-1.38.5.orig/src/cats/update_sqlite3_tables.in 2005-11-11 08:25:27 +1200
+++ bacula-1.38.5/src/cats/update_sqlite3_tables.in 2006-03-20 12:55:28 +1200
@@ -8,11 +8,10 @@
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite3 $* bacula.db <<END-OF-DATA
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE Media_backup (
MediaId INTEGER UNSIGNED AUTOINCREMENT,
diff -uNr bacula-1.38.5.orig/src/cats/update_sqlite_tables.in bacula-1.38.5/src/cats/update_sqlite_tables.in
--- bacula-1.38.5.orig/src/cats/update_sqlite_tables.in 2005-12-11 01:18:02 +1200
+++ bacula-1.38.5/src/cats/update_sqlite_tables.in 2006-03-20 12:55:28 +1200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# shell script to update SQLite from version 1.36 to 1.38
#
@@ -8,11 +8,10 @@
echo "this script may take several minutes to run."
echo " "
-bindir=@SQL_BINDIR@
+bindir=/usr/bin
cd @working_dir@
-sqlite=@DB_NAME@
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+$bindir/sqlite $* bacula.db <<END-OF-DATA
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE Media_backup (
MediaId INTEGER UNSIGNED AUTOINCREMENT,
diff -uNr bacula-1.38.5.orig/src/cats/update_sqlite_tables.in.orig bacula-1.38.5/src/cats/update_sqlite_tables.in.orig
--- bacula-1.38.5.orig/src/cats/update_sqlite_tables.in.orig 1970-01-01 12:00:00 +1200
+++ bacula-1.38.5/src/cats/update_sqlite_tables.in.orig 2005-12-11 01:18:02 +1200
@@ -0,0 +1,338 @@
+#!/bin/sh
+#
+# shell script to update SQLite from version 1.36 to 1.38
+#
+echo " "
+echo "This script will update a Bacula SQLite database from version 8 to 9"
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+
+bindir=@SQL_BINDIR@
+cd @working_dir@
+sqlite=@DB_NAME@
+
+${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+BEGIN TRANSACTION;
+CREATE TEMPORARY TABLE Media_backup (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+ MediaType VARCHAR(128) NOT NULL,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media_backup SELECT
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, 0, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, 0, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, InChanger, 0, MediaAddressing,
+ VolReadTime, VolWriteTime, EndFile, EndBlock
+ FROM Media;
+
+
+DROP TABLE Media;
+
+CREATE TABLE Media (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+ MediaType VARCHAR(128) NOT NULL,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media (
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, LabelType, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolParts, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes,
+ InChanger, StorageId, MediaAddressing,
+ VolReadTime, VolWriteTime,
+ EndFile, EndBlock)
+ SELECT * FROM Media_backup;
+
+DROP TABLE Media_backup;
+CREATE INDEX inx8 ON Media (PoolId);
+
+
+CREATE TEMPORARY TABLE JobMedia_backup (
+ JobMediaId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media NOT NULL,
+ FirstIndex INTEGER UNSIGNED NOT NULL,
+ LastIndex INTEGER UNSIGNED NOT NULL,
+ StartFile INTEGER UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ StartBlock INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ VolIndex INTEGER UNSIGNED DEFAULT 0,
+ Copy INTEGER UNSIGNED DEFAULT 0,
+ Stripe INTEGER UNSIGNED DEFAULT 0,
+ PRIMARY KEY(JobMediaId)
+ );
+
+INSERT INTO JobMedia_backup SELECT
+ JobMediaId, JobId, MediaId,
+ FirstIndex, LastIndex, StartFile,
+ EndFile, StartBlock, EndBlock,
+ VolIndex, 0, 0
+ FROM JobMedia;
+
+DROP TABLE JobMedia;
+
+CREATE TABLE JobMedia (
+ JobMediaId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media NOT NULL,
+ FirstIndex INTEGER UNSIGNED NOT NULL,
+ LastIndex INTEGER UNSIGNED NOT NULL,
+ StartFile INTEGER UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ StartBlock INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ VolIndex INTEGER UNSIGNED DEFAULT 0,
+ Copy INTEGER UNSIGNED DEFAULT 0,
+ Stripe INTEGER UNSIGNED DEFAULT 0,
+ PRIMARY KEY(JobMediaId)
+ );
+
+INSERT INTO JobMedia (
+ JobMediaId, JobId, MediaId,
+ FirstIndex, LastIndex, StartFile,
+ EndFile, StartBlock, EndBlock,
+ VolIndex, Copy, Stripe)
+ SELECT * FROM JobMedia_backup;
+
+DROP TABLE JobMedia_backup;
+
+CREATE TEMPORARY TABLE Pool_backup (
+ PoolId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ NumVols INTEGER UNSIGNED DEFAULT 0,
+ MaxVols INTEGER UNSIGNED DEFAULT 0,
+ UseOnce TINYINT DEFAULT 0,
+ UseCatalog TINYINT DEFAULT 1,
+ AcceptAnyVolume TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ AutoPrune TINYINT DEFAULT 0,
+ Recycle TINYINT DEFAULT 0,
+ PoolType VARCHAR(20) NOT NULL,
+ LabelType TINYINT DEFAULT 0,
+ LabelFormat VARCHAR(128) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ NextPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MigrationHighBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationLowBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationTime BIGINT UNSIGNED DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY (PoolId)
+ );
+
+INSERT INTO Pool_backup SELECT
+ PoolId, Name, NumVols, MaxVols,
+ UseOnce, UseCatalog, AcceptAnyVolume,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, AutoPrune,
+ Recycle, PoolType, 0, LabelFormat,
+ Enabled, ScratchPoolId, RecyclePoolId,
+ 0, 0, 0, 0
+ FROM Pool;
+
+DROP TABLE Pool;
+
+CREATE TABLE Pool (
+ PoolId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ NumVols INTEGER UNSIGNED DEFAULT 0,
+ MaxVols INTEGER UNSIGNED DEFAULT 0,
+ UseOnce TINYINT DEFAULT 0,
+ UseCatalog TINYINT DEFAULT 1,
+ AcceptAnyVolume TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ AutoPrune TINYINT DEFAULT 0,
+ Recycle TINYINT DEFAULT 0,
+ PoolType VARCHAR(20) NOT NULL,
+ LabelType TINYINT DEFAULT 0,
+ LabelFormat VARCHAR(128) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ NextPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MigrationHighBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationLowBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationTime BIGINT UNSIGNED DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY (PoolId)
+ );
+
+INSERT INTO Pool (
+ PoolId, Name, NumVols, MaxVols,
+ UseOnce, UseCatalog, AcceptAnyVolume,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, AutoPrune,
+ Recycle, PoolType, LabelType, LabelFormat,
+ Enabled, ScratchPoolId, RecyclePoolId,
+ NextPoolId, MigrationHighBytes,
+ MigrationLowBytes, MigrationTime )
+ SELECT * FROM Pool_backup;
+
+DROP TABLE Pool_backup;
+
+CREATE TABLE MediaType (
+ MediaTypeId INTEGER,
+ MediaType VARCHAR(128) NOT NULL,
+ ReadOnly TINYINT DEFAULT 0,
+ PRIMARY KEY(MediaTypeId)
+ );
+
+CREATE TABLE Storage (
+ StorageId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ AutoChanger TINYINT DEFAULT 0,
+ PRIMARY KEY(StorageId)
+ );
+
+CREATE TABLE Device (
+ DeviceId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType NOT NULL,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ DevMounts INTEGER UNSIGNED DEFAULT 0,
+ DevReadBytes BIGINT UNSIGNED DEFAULT 0,
+ DevWriteBytes BIGINT UNSIGNED DEFAULT 0,
+ DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevReadTime BIGINT UNSIGNED DEFAULT 0,
+ DevWriteTime BIGINT UNSIGNED DEFAULT 0,
+ DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ CleaningDate DATETIME DEFAULT 0,
+ CleaningPeriod BIGINT UNSIGNED DEFAULT 0,
+ PRIMARY KEY(DeviceId)
+ );
+
+
+CREATE TABLE Status (
+ JobStatus CHAR(1) NOT NULL,
+ JobStatusLong BLOB,
+ PRIMARY KEY (JobStatus)
+ );
+
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('C', 'Created, not yet running');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('R', 'Running');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('B', 'Blocked');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('T', 'Completed successfully');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('E', 'Terminated with errors');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('e', 'Non-fatal error');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('f', 'Fatal error');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('D', 'Verify found differences');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('A', 'Canceled by user');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('F', 'Waiting for Client');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('S', 'Waiting for Storage daemon');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('m', 'Waiting for new media');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('M', 'Waiting for media mount');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('s', 'Waiting for storage resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('j', 'Waiting for job resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('c', 'Waiting for client resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('d', 'Waiting on maximum jobs');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('t', 'Waiting on start time');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('p', 'Waiting on higher priority jobs');
+
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (9);
+
+COMMIT;
+
+END-OF-DATA