VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+BDB_VERSION=`sed -n -e 's/^.*BDB_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
AC_SUBST(VERSION)dnl
AC_SUBST(DATE)dnl
AC_SUBST(LSMDATE)dnl
AC_SUBST(BACULA)dnl
AC_SUBST(post_host)dnl
+AC_SUBST(BDB_VERSION)dnl
dnl src/lib
dnl can be overwritten by specific values from version.h
dnl
if test x$with_afsdir = x; then
for root in /usr /usr/local; do
- if test -d ${root}/include/afs/ ; then
- with_afsdir=${root}
- break
- fi
+ if test -d ${root}/include/afs/ ; then
+ with_afsdir=${root}
+ break
+ fi
done
fi
do
for arch_type in .a .so
do
- A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} | grep pioctl`
- pkg=$?
- if test $pkg = 0; then
- have_afs=yes
- AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util.a"
- break
- fi
+ A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} | grep pioctl`
+ pkg=$?
+ if test $pkg = 0; then
+ have_afs=yes
+ AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util.a"
+ break
+ fi
done
done
else
if test $have_afs = yes; then
AC_DEFINE([HAVE_AFS],1,[Defines if your system has AFS support])
- AC_DEFINE([HAVE_AFS_ACL],1,[Andrew FileSystem ACL support])
+ AC_DEFINE([HAVE_AFS_ACL],1,[Andrew FileSystem ACL support])
fi
fi
fi
AC_CHECK_LIB(acl, acl_get_file,
[
have_acl=yes;
- if test $have_afs = yes; then
- dnl
- dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!!
- dnl
+ if test $have_afs = yes; then
+ dnl
+ dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!!
+ dnl
if test -d /usr/lib64/; then
FDLIBS="-L/usr/lib64 -lacl $FDLIBS"
- else
+ else
FDLIBS="-L/usr/lib -lacl $FDLIBS"
- fi
- else
+ fi
+ else
FDLIBS="-lacl $FDLIBS"
- fi
+ fi
], [
AC_CHECK_LIB(pacl, acl_get_file,
[
updatedb/update_mysql_tables_10_to_11 \
updatedb/update_sqlite3_tables_10_to_11 \
updatedb/update_postgresql_tables_10_to_11 \
+ updatedb/update_mysql_tables_11_to_12 \
+ updatedb/update_sqlite3_tables_11_to_12 \
+ updatedb/update_postgresql_tables_11_to_12 \
examples/nagios/check_bacula/Makefile \
$PFILES ],
[ ]
build-dird: ${build_dird}
build-stored: ${build_stored}
Plugin support: ${have_plugins}
- AFS support: ${have_afs}
+ AFS support: ${have_afs}
ACL support: ${have_acl}
XATTR support: ${have_xattr}
Python support: ${support_python} ${PYTHON_LIBS}
#ifdef __SQL_C
+/* Current database version number for all drivers */
+#define BDB_VERSION 13
+
+
#if defined(BUILDING_CATS)
#ifdef HAVE_SQLITE
#error "SQLite2 is now deprecated, use SQLite3 instead."
-#define BDB_VERSION 12
-
#include <sqlite.h>
/* Define opaque structure for sqlite */
#ifdef HAVE_SQLITE3
-
-#define BDB_VERSION 12
-
#include <sqlite3.h>
/* Define opaque structure for sqlite */
#ifdef HAVE_MYSQL
-#define BDB_VERSION 12
-
#include <mysql.h>
/*
#ifdef HAVE_POSTGRESQL
-#define BDB_VERSION 12
-
#include <libpq-fe.h>
/* TEMP: the following is taken from select OID, typname from pg_type; */
#include "myingres.h"
-#define BDB_VERSION 12
-
/* TEMP: the following is taken from $(II_SYSTEM)/ingres/files/eqsqlda.h IISQ_ types */
#define IS_NUM(x) ((x) == 10 || (x) == 30 || (x) == 31)
#define IS_NOT_NULL(x) ((x) == 1)
#ifdef HAVE_DBI
-#define BDB_VERSION 12
-
#include <dbi/dbi.h>
#ifdef HAVE_BATCH_FILE_INSERT
INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
('i', 'Doing batch insert file records',15);
-INSERT INTO Version (VersionId) VALUES (12);
+INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
-- Make sure we have appropriate permissions
\g
);
-- Initialize Version
-INSERT INTO Version (VersionId) VALUES (12);
+INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
END-OF-DATA
then
INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
('i', 'Doing batch insert file records',15);
-INSERT INTO Version (VersionId) VALUES (12);
+INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
-- Make sure we have appropriate permissions
-- Initialize Version
-INSERT INTO Version (VersionId) VALUES (12);
+INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
PRAGMA default_cache_size = 100000;
#!/bin/sh
#
-# Shell script to update MySQL tables from Bacula Enterprise 2.6 to 4.0 or
-# Standard version 3.0 to 5.0
+# Shell script to update MySQL Community version 3.0.x to 5.0.x
#
echo " "
echo "This script will update a Bacula MySQL database from version 11 to 12"
-echo " which is needed to convert from Bacula Enterprise 2.6 to 4.0 or "
-echo " Standard version 3.0 to 5.0"
+echo " which is needed to convert from Bacula Community version 3.0.x to 5.0.x"
echo " "
bindir=@SQL_BINDIR@
PATH="$bindir:$PATH"
db_name=@db_name@
+mysql ${db_name} -e "select VersionId from Version\G" >/tmp/$$
+DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
if mysql $* -f <<END-OF-DATA
USE ${db_name};
);
CREATE INDEX pathhierarchy_ppathid
- ON PathHierarchy (PPathId);
+ ON PathHierarchy (PPathId);
CREATE TABLE PathVisibility
(
CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
);
CREATE INDEX pathvisibility_jobid
- ON PathVisibility (JobId);
+ ON PathVisibility (JobId);
CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );
#!/bin/sh
#
-# Shell script to update PostgreSQL tables from version 11 to 12
+# Shell script to update MySQL tables from Bacula Community version 3.0.x to 5.0.0
#
echo " "
-echo "This script will update a Bacula PostgreSQL database from version 11 to 12"
-echo " which is needed to convert from Bacula Enterprise 2.6 to 4.0 or "
-echo " Standard version 3.0 to 5.0"
+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@
PATH="$bindir:$PATH"
db_name=@db_name@
+DBVERSION=`psql ${db_name} -t --pset format=unaligned -c "select VersionId from Version"`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
if psql -f - -d ${db_name} $* <<END-OF-DATA
BEGIN; -- Necessary for Bacula core
ALTER TABLE JobMedia DROP Copy ;
);
CREATE INDEX pathhierarchy_ppathid
- ON PathHierarchy (PPathId);
+ ON PathHierarchy (PPathId);
CREATE TABLE PathVisibility
(
);
CREATE INDEX pathvisibility_jobid
- ON PathVisibility (JobId);
+ ON PathVisibility (JobId);
COMMIT;
ANALYSE;
+UPDATE Version SET VersionId=12;
+
END-OF-DATA
then
echo "Update of Bacula PostgreSQL tables succeeded."
#!/bin/sh
#
-# This script is needed to convert from Bacula Enterprise 2.6 to 4.0 or
-# Standard version 3.0 to 5.0
+# Shell script to update MySQL tables from Bacula Community version 3.0.x to 5.0.0
#
echo " "
-echo "This script will update a Bacula SQLite database from version 11 to 12"
-echo " which is needed to convert from Bacula Enterprise 2.6 to 4.0 or "
-echo " Standard version 3.0 to 5.0"
-echo "Depending on the size of your database,"
-echo "this script may take several minutes to run."
+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@
sqlite=@DB_TYPE@
db_name=@db_name@
+DBV=`${sqlite} ${db_name} $sbin/regress.db <<END
+select VersionId from Version;
+END`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+
${sqlite} $* ${db_name}.db <<END-OF-DATA
BEGIN;
ALTER TABLE Job ADD COLUMN HasCache TINYINT DEFAULT 0;
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update MySQL Community version 3.0.x to 5.0.x
+#
+echo " "
+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@
+PATH="$bindir:$PATH"
+db_name=@db_name@
+
+mysql ${db_name} -e "select VersionId from Version\G" >/tmp/$$
+DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
+ALTER TABLE JobMedia DROP Stripe ;
+ALTER TABLE JobMedia DROP Copy ;
+ALTER TABLE Job ADD COLUMN HasCache tinyint default 0 after HasBase;
+ALTER TABLE Job ADD COLUMN Reviewed tinyint default 0 after HasCache;
+ALTER TABLE Job ADD COLUMN Comment BLOB AFTER Reviewed;
+ALTER TABLE JobHisto ADD COLUMN HasCache tinyint default 0 after HasBase;
+ALTER TABLE JobHisto ADD COLUMN Reviewed tinyint default 0 after HasCache;
+ALTER TABLE JobHisto ADD COLUMN Comment BLOB AFTER Reviewed;
+
+ALTER TABLE Status ADD COLUMN Severity int;
+UPDATE Status SET Severity = 15;
+UPDATE Status SET Severity = 100 where JobStatus = 'f';
+UPDATE Status SET Severity = 90 where JobStatus = 'A';
+UPDATE Status SET Severity = 10 where JobStatus = 'T';
+UPDATE Status SET Severity = 20 where JobStatus = 'e';
+UPDATE Status SET Severity = 25 where JobStatus = 'E';
+
+CREATE TABLE PathHierarchy
+(
+ PathId integer NOT NULL,
+ PPathId integer NOT NULL,
+ CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
+);
+
+CREATE INDEX pathhierarchy_ppathid
+ ON PathHierarchy (PPathId);
+
+CREATE TABLE PathVisibility
+(
+ PathId integer NOT NULL,
+ JobId integer NOT NULL,
+ Size int8 DEFAULT 0,
+ Files int4 DEFAULT 0,
+ CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
+);
+CREATE INDEX pathvisibility_jobid
+ ON PathVisibility (JobId);
+
+CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (12);
+
+END-OF-DATA
+then
+ echo "Update of Bacula MySQL tables succeeded."
+else
+ echo "Update of Bacula MySQL tables failed."
+fi
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update MySQL tables from Bacula Community version 3.0.x to 5.0.0
+#
+echo " "
+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@
+PATH="$bindir:$PATH"
+db_name=@db_name@
+
+DBVERSION=`psql ${db_name} -t --pset format=unaligned -c "select VersionId from Version"`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+if psql -f - -d ${db_name} $* <<END-OF-DATA
+BEGIN; -- Necessary for Bacula core
+ALTER TABLE JobMedia DROP Copy ;
+ALTER TABLE Job ADD COLUMN HasCache smallint default 0;
+ALTER TABLE Job ADD COLUMN Reviewed smallint default 0;
+ALTER TABLE Job ADD COLUMN Comment text;
+ALTER TABLE JobHisto ADD COLUMN HasCache smallint default 0;
+ALTER TABLE JobHisto ADD COLUMN Reviewed smallint default 0;
+ALTER TABLE JobHisto ADD COLUMN Comment text;
+UPDATE Version SET VersionId=12;
+COMMIT;
+
+BEGIN; -- Can conflict with previous Bweb installation
+ALTER TABLE Status ADD COLUMN Severity int;
+UPDATE Status SET Severity = 15;
+UPDATE Status SET Severity = 100 where JobStatus = 'f';
+UPDATE Status SET Severity = 90 where JobStatus = 'A';
+UPDATE Status SET Severity = 10 where JobStatus = 'T';
+UPDATE Status SET Severity = 20 where JobStatus = 'e';
+UPDATE Status SET Severity = 25 where JobStatus = 'E';
+COMMIT;
+
+BEGIN; -- Can already exists if using 3.1.x release
+CREATE TABLE PathHierarchy
+(
+ PathId integer NOT NULL,
+ PPathId integer NOT NULL,
+ CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
+);
+
+CREATE INDEX pathhierarchy_ppathid
+ ON PathHierarchy (PPathId);
+
+CREATE TABLE PathVisibility
+(
+ PathId integer NOT NULL,
+ JobId integer NOT NULL,
+ Size int8 DEFAULT 0,
+ Files int4 DEFAULT 0,
+ CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
+);
+
+CREATE INDEX pathvisibility_jobid
+ ON PathVisibility (JobId);
+
+COMMIT;
+
+CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );
+
+-- Remove bad PostgreSQL index
+DROP INDEX file_fp_idx;
+
+-- Create the good one
+-- If you want to create this index during production, you can use
+-- CREATE INDEX CONCURRENTLY file_jpf_idx ON File (JobId, PathId, FilenameId)
+-- to make it without locks (require PostgreSQL 8.2 version)
+
+CREATE INDEX file_jpfid_idx on File (JobId, PathId, FilenameId);
+
+ANALYSE;
+
+UPDATE Version SET VersionId=12;
+
+END-OF-DATA
+then
+ echo "Update of Bacula PostgreSQL tables succeeded."
+else
+ echo "Update of Bacula PostgreSQL tables failed."
+fi
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update MySQL tables from Bacula Community version 3.0.x to 5.0.0
+#
+echo " "
+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@
+PATH="$bindir:$PATH"
+cd @working_dir@
+sqlite=@DB_TYPE@
+db_name=@db_name@
+
+DBV=`${sqlite} ${db_name} $sbin/regress.db <<END
+select VersionId from Version;
+END`
+if [ $DBVERSION != 11 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 11 database to version 12."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+
+${sqlite} $* ${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;
+ALTER TABLE Job ADD COLUMN Comment TEXT;
+ALTER TABLE JobHisto ADD COLUMN HasCache TINYINT DEFAULT 0;
+ALTER TABLE JobHisto ADD COLUMN Reviewed TINYINT DEFAULT 0;
+ALTER TABLE JobHisto ADD COLUMN Comment TEXT;
+
+ALTER TABLE Status ADD COLUMN Severity int;
+UPDATE Status SET Severity = 15;
+UPDATE Status SET Severity = 100 where JobStatus = 'f';
+UPDATE Status SET Severity = 90 where JobStatus = 'A';
+UPDATE Status SET Severity = 10 where JobStatus = 'T';
+UPDATE Status SET Severity = 20 where JobStatus = 'e';
+UPDATE Status SET Severity = 25 where JobStatus = 'E';
+
+CREATE TABLE PathHierarchy
+(
+ PathId integer NOT NULL,
+ PPathId integer NOT NULL,
+ CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
+);
+
+CREATE INDEX pathhierarchy_ppathid
+ ON PathHierarchy (PPathId);
+
+CREATE TABLE PathVisibility
+(
+ PathId integer NOT NULL,
+ JobId integer NOT NULL,
+ Size int8 DEFAULT 0,
+ Files int4 DEFAULT 0,
+ CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
+);
+
+CREATE INDEX pathvisibility_jobid
+ ON PathVisibility (JobId);
+
+CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );
+
+UPDATE Version SET VersionId=12;
+COMMIT;
+
+DROP INDEX inx4;
+DROP INDEX IF EXISTS inx9;
+CREATE INDEX file_jpf_idx ON File (JobId, PathId, FilenameId);
+
+END-OF-DATA