Author: bluca
Date: Sun Feb 4 21:02:55 2007
New Revision: 116167
Added:
packages/cooker/bacula/current/SOURCES/bacula-2.0.2-cats.diff
packages/cooker/bacula/current/SOURCES/bacula-2.0.2-db.diff
packages/cooker/bacula/current/SOURCES/bacula-2.0.2-gnome2ssl.diff
packages/cooker/bacula/current/SOURCES/bacula-2.0.2-listen.diff
packages/cooker/bacula/current/SOURCES/bacula-2.0.2-updatedb.diff
- copied, changed from r116056,
/packages/cooker/bacula/current/SOURCES/bacula-1.34-updatedb.diff
Removed:
packages/cooker/bacula/current/SOURCES/bacula-1.34-updatedb.diff
Modified:
packages/cooker/bacula/current/SPECS/bacula.spec
Log:
- build multiple directors to support different databases
- add support for sqlite3 database backend
- move bscan to director package, since it is db dependent
- do not link bcopy to database libs
- rework db upgrade scriplets, so it is more difficult to forget next time
- force all daemons to bind only to localhost by default
- minor fixes to some scripts
Added: packages/cooker/bacula/current/SOURCES/bacula-2.0.2-cats.diff
==============================================================================
--- (empty file)
+++ packages/cooker/bacula/current/SOURCES/bacula-2.0.2-cats.diff Sun Feb
4 21:02:55 2007
@@ -0,0 +1,24 @@
+--- bacula-2.0.2/src/cats/make_catalog_backup.in.cats 2006-12-06
19:30:07.000000000 +0100
++++ bacula-2.0.2/src/cats/make_catalog_backup.in 2007-02-03
14:24:59.000000000 +0100
+@@ -15,10 +15,10 @@
+
+ cd @working_dir@
+ rm -f bacula.sql
+-if test xsqlite = [EMAIL PROTECTED]@ ; then
++if test -x @sbindir@/bacula-dir-sqlite; then
+ echo ".dump" | ${BINDIR}/sqlite $1.db >$1.sql
+ else
+- if test xmysql = [EMAIL PROTECTED]@ ; then
++ if test -x @sbindir@/bacula-dir-mysql; 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 = [EMAIL PROTECTED]@ ; then
++ if test -x @sbindir@/bacula-dir-postgresql; then
+ if test $# -gt 2; then
+ PGPASSWORD=$3
+ export PGPASSWORD
Added: packages/cooker/bacula/current/SOURCES/bacula-2.0.2-db.diff
==============================================================================
--- (empty file)
+++ packages/cooker/bacula/current/SOURCES/bacula-2.0.2-db.diff Sun Feb 4
21:02:55 2007
@@ -0,0 +1,11 @@
+--- bacula-2.0.2/src/stored/Makefile.in.db 2007-02-03 21:54:58.000000000
+0100
++++ bacula-2.0.2/src/stored/Makefile.in 2007-02-03 21:55:41.000000000
+0100
+@@ -145,7 +145,7 @@
+
+ bcopy: $(COPYOBJS) ../findlib/libfind.a ../lib/libbac.a
+ $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@
$(COPYOBJS) \
+- $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
++ $(FDLIBS) -lfind -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
+
+
+ Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
Added: packages/cooker/bacula/current/SOURCES/bacula-2.0.2-gnome2ssl.diff
==============================================================================
--- (empty file)
+++ packages/cooker/bacula/current/SOURCES/bacula-2.0.2-gnome2ssl.diff Sun Feb
4 21:02:55 2007
@@ -0,0 +1,12 @@
+diff -urN bacula-2.0.2.orig/src/gnome2-console/Makefile.in
bacula-2.0.2/src/gnome2-console/Makefile.in
+--- bacula-2.0.2.orig/src/gnome2-console/Makefile.in 2006-06-25
15:58:36.000000000 +0200
++++ bacula-2.0.2/src/gnome2-console/Makefile.in 2007-02-03
09:40:19.000000000 +0100
+@@ -20,7 +20,7 @@
+ dummy:
+
+ GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
+-GNOMEUI_LIBS = @GNOMEUI_LIBS@
++GNOMEUI_LIBS = @GNOMEUI_LIBS@ -lssl -lcrypto
+ GNOME_LIBDIR = @GNOME_LIBDIR@
+ GNOME_LIBS = @GNOME_LIBS@
+
Added: packages/cooker/bacula/current/SOURCES/bacula-2.0.2-listen.diff
==============================================================================
--- (empty file)
+++ packages/cooker/bacula/current/SOURCES/bacula-2.0.2-listen.diff Sun Feb
4 21:02:55 2007
@@ -0,0 +1,44 @@
+diff -urN bacula-2.0.2.orig/src/dird/bacula-dir.conf.in
bacula-2.0.2/src/dird/bacula-dir.conf.in
+--- bacula-2.0.2.orig/src/dird/bacula-dir.conf.in 2006-08-20
15:27:55.000000000 +0200
++++ bacula-2.0.2/src/dird/bacula-dir.conf.in 2007-02-03 09:40:19.000000000
+0100
+@@ -21,6 +21,7 @@
+ Maximum Concurrent Jobs = 1
+ Password = "@dir_password@" # Console password
+ Messages = Daemon
++ DirAddress = 127.0.0.1
+ }
+
+ JobDefs {
+diff -urN bacula-2.0.2.orig/src/filed/bacula-fd.conf.in
bacula-2.0.2/src/filed/bacula-fd.conf.in
+--- bacula-2.0.2.orig/src/filed/bacula-fd.conf.in 2006-03-24
17:37:56.000000000 +0100
++++ bacula-2.0.2/src/filed/bacula-fd.conf.in 2007-02-03 09:40:19.000000000
+0100
+@@ -34,6 +34,7 @@
+ WorkingDirectory = @working_dir@
+ Pid Directory = @piddir@
+ Maximum Concurrent Jobs = 20
++ FDAddress = 127.0.0.1
+ }
+
+ # Send all messages except skipped files back to Director
+diff -urN bacula-2.0.2.orig/src/stored/bacula-sd.conf.in
bacula-2.0.2/src/stored/bacula-sd.conf.in
+--- bacula-2.0.2.orig/src/stored/bacula-sd.conf.in 2005-10-19
16:50:27.000000000 +0200
++++ bacula-2.0.2/src/stored/bacula-sd.conf.in 2007-02-03 09:40:19.000000000
+0100
+@@ -16,6 +16,7 @@
+ WorkingDirectory = "@working_dir@"
+ Pid Directory = "@piddir@"
+ Maximum Concurrent Jobs = 20
++ SDAddress = 127.0.0.1
+ }
+
+ #
+diff -urN bacula-2.0.2.orig/src/stored/stored.conf.in
bacula-2.0.2/src/stored/stored.conf.in
+--- bacula-2.0.2.orig/src/stored/stored.conf.in 2002-04-23
21:49:20.000000000 +0200
++++ bacula-2.0.2/src/stored/stored.conf.in 2007-02-03 09:40:19.000000000
+0100
+@@ -13,6 +13,7 @@
+ WorkingDirectory = "@working_dir@"
+ Pid Directory = "@piddir@"
+ Subsys Directory = "@subsysdir@"
++ SDAddress = 127.0.0.1
+ }
+
+ #
Copied: packages/cooker/bacula/current/SOURCES/bacula-2.0.2-updatedb.diff (from
r116056, /packages/cooker/bacula/current/SOURCES/bacula-1.34-updatedb.diff)
==============================================================================
--- /packages/cooker/bacula/current/SOURCES/bacula-1.34-updatedb.diff
(original)
+++ packages/cooker/bacula/current/SOURCES/bacula-2.0.2-updatedb.diff Sun Feb
4 21:02:55 2007
@@ -82,3 +82,25 @@
if [ -s bacula.db ];then
DB_VER=`echo "select * from Version;" | $bindir/sqlite bacula.db |
tail -n 1 2>/dev/null`
+--- bacula-2.0.2.orig/updatedb/update_sqlite_tables_8_to_9 2005-11-06
19:04:08.000000000 +0100
++++ bacula-2.0.2/updatedb/update_sqlite_tables_8_to_9 2007-02-03
09:40:19.000000000 +0100
+@@ -9,7 +9,7 @@
+ echo " "
+
+ bindir=/usr/bin
+-cd /var/bacula/working
++cd /var/lib/bacula
+ sqlite=sqlite
+
+ ${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+--- bacula-2.0.2.orig/updatedb/update_mysql_tables_7_to_8 2004-11-21
09:53:22.000000000 +0100
++++ bacula-2.0.2/updatedb/update_mysql_tables_7_to_8 2007-02-03
09:40:19.000000000 +0100
+@@ -9,7 +9,7 @@
+ echo " "
+ bindir=/usr/bin
+
+-DB_VER="$bindir/mysql $* bacula -e 'select * from Version;'|tail -n 1
2>/dev/null"
++DB_VER="`$bindir/mysql $* bacula -e 'select * from Version;'|tail -n 1
2>/dev/null`"
+ if [ -z "$DB_VER" ]; then
+ echo "Sorry, I can't seem to locate a bacula database."
+ exit 1
Modified: packages/cooker/bacula/current/SPECS/bacula.spec
==============================================================================
--- packages/cooker/bacula/current/SPECS/bacula.spec (original)
+++ packages/cooker/bacula/current/SPECS/bacula.spec Sun Feb 4 21:02:55 2007
@@ -1,11 +1,11 @@
-# compatability macros
-%{?!mkrel:%define mkrel(c:) %{-c:0.%{-c*}.}%{!?_with_unstable:%(perl -e
'$_="%{1}";m/(.\*\\D\+)?(\\d+)$/;$rel=${2}-1;re;print
"$1$rel";').%{?subrel:%subrel}%{!?subrel:1}.%{?distversion:%distversion}%{?!distversion:%(echo
$[%{mdkversion}/10])}}%{?_with_unstable:%{1}}%{?distsuffix:%distsuffix}%{?!distsuffix:mdk}}
-
%define _rescuever 1.8.3
%define _guiver 2.0.2
-%define MYSQL 0
-%define PGSQL 0
+%define _cur_db_ver 10
+
+%define MYSQL 1
+%define PGSQL 1
+%define SQLITE3 1
%define GNOME 1
%define WXWINDOWS 1
%define TCPW 1
@@ -16,6 +16,8 @@
%{?_without_mysql: %{expand: %%global MYSQL 0}}
%{?_with_pgsql: %{expand: %%global PGSQL 1}}
%{?_without_pgsql: %{expand: %%global PGSQL 0}}
+%{?_with_sqlite3: %{expand: %%global SQLITE3 1}}
+%{?_without_sqlite3: %{expand: %%global SQLITE3 0}}
%{?_with_gnome: %{expand: %%global GNOME 1}}
%{?_without_gnome: %{expand: %%global GNOME 0}}
%{?_with_wx: %{expand: %%global WXWINDOWS 1}}
@@ -27,20 +29,6 @@
%{?_with_rescue: %{expand: %%global RESCUE 1}}
%{?_without_rescue: %{expand: %%global RESCUE 0}}
-%if %{MYSQL}
- %if %{PGSQL}
- %{error: You must specify only one database database support.}
- exit 1
- %endif
- %define db_type mysql
-%else
- %if %{PGSQL}
- %define db_type postgresql
- %else
- %define db_type sqlite
- %endif
-%endif
-
%define blurb Bacula - It comes by night and sucks the vital essence from your
computers.
# fixes passwords in configuration files
@@ -50,7 +38,7 @@
Summary: Bacula - The Network Backup Solution
Name: bacula
Version: 2.0.2
-Release: %mkrel 1
+Release: %mkrel 2
Epoch: 1
Group: Archiving/Backup
License: GPL
@@ -63,10 +51,14 @@
Source7: bacula.pam.bz2
Patch0: bacula-2.0.0-config.diff
Patch2: bacula-1.36.1-pidfile.diff
-Patch3: bacula-1.34-updatedb.diff
+Patch3: bacula-2.0.2-updatedb.diff
Patch5: bacula-gui-1.38.5-php_header.diff
Patch6: bacula-manpages.diff
Patch7: bacula-web-mdv_conf.diff
+Patch8: bacula-2.0.2-gnome2ssl.diff
+Patch9: bacula-2.0.2-listen.diff
+Patch10: bacula-2.0.2-cats.diff
+Patch11: bacula-2.0.2-db.diff
BuildRequires: XFree86-devel
BuildRequires: cdrecord
BuildRequires: dvd+rw-tools
@@ -107,11 +99,17 @@
Group: Archiving/Backup
Requires(post): rpm-helper
Requires(preun): rpm-helper
-Conflicts: bacula-dir < %{epoch}:%{version}-%{release}
+Conflicts: bacula-dir-common < %{epoch}:%{version}-%{release}
+Conflicts: bacula-dir-mysql < %{epoch}:%{version}-%{release}
+Conflicts: bacula-dir-pgsql < %{epoch}:%{version}-%{release}
+Conflicts: bacula-dir-sqlite < %{epoch}:%{version}-%{release}
+Conflicts: bacula-dir-sqlite3 < %{epoch}:%{version}-%{release}
Conflicts: bacula-fd < %{epoch}:%{version}-%{release}
Conflicts: bacula-sd < %{epoch}:%{version}-%{release}
Conflicts: bacula-console < %{epoch}:%{version}-%{release}
Conflicts: bacula-console-gnome < %{epoch}:%{version}-%{release}
+Conflicts: bacula-console-wx < %{epoch}:%{version}-%{release}
+Conflicts: bacula-tray-monitor < %{epoch}:%{version}-%{release}
%description common
%{blurb}
@@ -122,28 +120,16 @@
easy to use and efficient, while offering many advanced storage management
features that make it easy to find and recover lost or damaged files.
-%package dir
+%package dir-common
Summary: Bacula Director and Catalog services
Group: Archiving/Backup
Requires(post): rpm-helper perl-base sed bacula-common =
%{epoch}:%{version}-%{release}
Requires(preun): rpm-helper perl-base sed bacula-common =
%{epoch}:%{version}-%{release}
-%if %{MYSQL}
-Requires: MySQL-client
-BuildRequires: MySQL-devel >= 3.23
-%else
-%if %{PGSQL}
-Requires: postgresql
-BuildRequires: postgresql-devel
-%else
-Requires: sqlite-tools
-BuildRequires: sqlite-devel
-%endif
-%endif
%if %{TCPW}
Requires: tcp_wrappers
%endif
-%description dir
+%description dir-common
%{blurb}
Bacula Director is the program that supervises all the backup, restore, verify
and archive operations. The system administrator uses the Bacula Director to
@@ -153,16 +139,99 @@
The Catalog services permit the System Administrator or user to quickly locate
and restore any desired file, since it maintains a record of all Volumes used,
all Jobs run, and all Files saved.
+
%if %{MYSQL}
+%package dir-mysql
+Summary: Bacula Director and Catalog services
+Group: Archiving/Backup
+Requires: MySQL-client
+BuildRequires: MySQL-devel >= 3.23
+Requires: bacula-dir-common
+Provides: bacula-dir = %{epoch}:${version}-%{release}
+Conflicts: bacula-dir-pgsql bacula-dir-sqlite bacula-dir-sqlite3
+
+%description dir-mysql
+%{blurb}
+Bacula Director is the program that supervises all the backup, restore, verify
+and archive operations. The system administrator uses the Bacula Director to
+schedule backups and to recover files.
+Catalog services are comprised of the software programs responsible for
+maintaining the file indexes and volume databases for all files backed up.
+The Catalog services permit the System Administrator or user to quickly locate
+and restore any desired file, since it maintains a record of all Volumes used,
+all Jobs run, and all Files saved.
This build requires MySQL to be installed separately as the catalog database.
-%else
+%endif
+
%if %{PGSQL}
+%package dir-pgsql
+Summary: Bacula Director and Catalog services
+Group: Archiving/Backup
+Requires: postgresql
+BuildRequires: postgresql-devel
+Requires: bacula-dir-common
+Provides: bacula-dir = %{epoch}:${version}-%{release}
+Conflicts: bacula-dir-mysql bacula-dir-sqlite bacula-dir-sqlite3
+
+%description dir-pgsql
+%{blurb}
+Bacula Director is the program that supervises all the backup, restore, verify
+and archive operations. The system administrator uses the Bacula Director to
+schedule backups and to recover files.
+Catalog services are comprised of the software programs responsible for
+maintaining the file indexes and volume databases for all files backed up.
+The Catalog services permit the System Administrator or user to quickly locate
+and restore any desired file, since it maintains a record of all Volumes used,
+all Jobs run, and all Files saved.
This build requires Postgres to be installed separately as the catalog
database.
-%else
-This build uses an embedded sqlite catalog database.
%endif
+
+%if %{SQLITE3}
+%package dir-sqlite3
+Summary: Bacula Director and Catalog services
+Group: Archiving/Backup
+Requires: sqlite3-tools
+BuildRequires: sqlite3-devel
+Requires: bacula-dir-common
+Provides: bacula-dir = %{epoch}:${version}-%{release}
+Conflicts: bacula-dir-mysql bacula-dir-pgsql bacula-dir-sqlite
+
+%description dir-sqlite3
+%{blurb}
+Bacula Director is the program that supervises all the backup, restore, verify
+and archive operations. The system administrator uses the Bacula Director to
+schedule backups and to recover files.
+Catalog services are comprised of the software programs responsible for
+maintaining the file indexes and volume databases for all files backed up.
+The Catalog services permit the System Administrator or user to quickly locate
+and restore any desired file, since it maintains a record of all Volumes used,
+all Jobs run, and all Files saved.
+This build uses an embedded sqlite catalog database.
%endif
+%package dir-sqlite
+Summary: Bacula Director and Catalog services
+Group: Archiving/Backup
+Requires: sqlite-tools
+BuildRequires: sqlite-devel
+Requires: bacula-dir-common
+Provides: bacula-dir = %{epoch}:${version}-%{release}
+Conflicts: bacula-dir-mysql bacula-dir-pgsql bacula-dir-sqlite3
+# this might allow urpmi to upgrade correctly
+Obsoletes: bacula-dir
+
+%description dir-sqlite
+%{blurb}
+Bacula Director is the program that supervises all the backup, restore, verify
+and archive operations. The system administrator uses the Bacula Director to
+schedule backups and to recover files.
+Catalog services are comprised of the software programs responsible for
+maintaining the file indexes and volume databases for all files backed up.
+The Catalog services permit the System Administrator or user to quickly locate
+and restore any desired file, since it maintains a record of all Volumes used,
+all Jobs run, and all Files saved.
+This build uses an embedded sqlite catalog database.
+
%package console
Summary: Bacula Console
Group: Archiving/Backup
@@ -294,7 +363,6 @@
Requires: webserver
Requires: perl-DBI
Requires: perl-DBD-mysql
-#Requires: mysqlserver
%description gui-bimagemgr
%{blurb}
@@ -331,9 +399,14 @@
%patch0 -p1 -b .config
%patch2 -p1 -b .pidfile
%patch3 -p1 -b .updatedb
-%patch5 -p1
-%patch6 -p0
+%patch5 -p1 -b .php_header
+%patch6 -p0 -b .manpages
%patch7 -p1
+%patch8 -p1 -b .gnome2ssl
+%patch9 -p1 -b .listen
+%patch10 -p1 -b .cats
+%patch11 -p1 -b .db
+perl -spi -e 's/[EMAIL PROTECTED]@/localhost/g' `find . -name \*.in`
# fix conditional pam config file
%if %{mdkversion} < 200610
@@ -342,38 +415,77 @@
bzcat %{SOURCE7} > bacula.pam
%endif
+%define _configure_common --enable-smartalloc
--sysconfdir=%{_sysconfdir}/%{name}
--with-working-dir=%{_localstatedir}/%{name}
--with-scriptdir=%{_libexecdir}/%{name} --with-subsys-dir=/var/lock/subsys
--with-python --with-openssl --with-readline %{?TCPW: --with-tcp-wrappers}
%build
-
%serverbuild
-%configure \
- --enable-smartalloc \
- --with-%{db_type} \
-%if %{GNOME}
- --enable-gnome \
+%if %{MYSQL}
+%configure --with-mysql \
+ %_configure_common \
+ --without-sqlite --without-postgresql --without-sqlite3 \
+ --disable-gnome --disable-wx-console --disable-tray-monitor
+%make
+for i in src/dird/bacula-dir src/stored/bscan src/tools/dbcheck; do
+ mv $i $i-mysql
+done
+for i in src/cats/*_mysql_*.in; do
+ mv ${i%.in} $i
+done
+%make clean
%endif
-%if %{WXWINDOWS}
- --enable-wx-console \
+
+%if %{PGSQL}
+%configure --with-postgresql \
+ %_configure_common \
+ --without-sqlite --without-mysql --without-sqlite3 \
+ --disable-gnome --disable-wx-console --disable-tray-monitor
+%make
+for i in src/dird/bacula-dir src/stored/bscan src/tools/dbcheck; do
+ mv $i $i-postgresql
+done
+for i in src/cats/*_postgresql*.in; do
+ mv ${i%.in} $i
+done
+%make clean
%endif
-%if %{TCPW}
- --with-tcp-wrappers \
+
+%if %{SQLITE3}
+%configure --with-sqlite3 \
+ %_configure_common \
+ --without-mysql --without-postgresql --without-sqlite \
+ --disable-gnome --disable-wx-console --disable-tray-monitor
+%make
+for i in src/dird/bacula-dir src/stored/bscan src/tools/dbcheck; do
+ mv $i $i-sqlite3
+done
+for i in src/cats/*_sqlite3*.in; do
+ mv ${i%.in} $i
+done
+%make clean
%endif
- --with-python \
- --sysconfdir=%{_sysconfdir}/%{name} \
- --with-scriptdir=%{_libexecdir}/%{name} \
- --with-working-dir=%{_localstatedir}/%{name} \
- --with-subsys-dir=/var/lock/subsys \
+
+%configure --with-sqlite \
+ %_configure_common \
+ --without-mysql --without-postgresql --without-sqlite3 \
--with-dir-password="#FAKE#DIR#PASSWORD#" \
--with-fd-password="#FAKE#FD#PASSWORD#" \
--with-sd-password="#FAKE#SD#PASSWORD#" \
--with-mon-dir-password="#FAKE#MON#DIR#PASSWORD#" \
--with-mon-fd-password="#FAKE#MON#FD#PASSWORD#" \
--with-mon-sd-password="#FAKE#MON#SD#PASSWORD#" \
- --with-openssl \
- --with-readline \
+%if %{GNOME}
+ --enable-gnome \
+%endif
+%if %{WXWINDOWS}
+ --enable-wx-console \
+%endif
--enable-tray-monitor
%make
+for i in src/dird/bacula-dir src/stored/bscan src/tools/dbcheck; do
+ mv $i $i-sqlite
+ ln -s ${i##*/}-sqlite $i
+done
%if %{GUI}
# Now we build the gui
@@ -389,8 +501,21 @@
%makeinstall sysconfdir=%{buildroot}%{_sysconfdir}/%{name}
scriptdir=%{buildroot}%{_libexecdir}/%{name}
working_dir=%{buildroot}%{_localstatedir}/%{name}
-# install the upgrade scripts
-install -m 755 updatedb/update_%{db_type}_tables_?_to_?
%{buildroot}%{_libexecdir}/%{name}
+# install the catalog scripts and binaries
+for db_type in %{?MYSQL: mysql} %{?PGSQL: postgresql} %{?SQLITE3: sqlite3}
sqlite; do
+ install -m 755 updatedb/update_${db_type}_tables_?_to_?
%{buildroot}%{_libexecdir}/%{name}
+ for f in create_${db_type}_database drop_${db_type}_database
drop_${db_type}_tables \
+ grant_${db_type}_privileges make_${db_type}_tables
update_${db_type}_tables ; do
+ install -m 755 src/cats/$f %{buildroot}%{_libexecdir}/%{name}
+ ln -snf $f %{buildroot}%{_libexecdir}/%{name}/${f/${db_type}/bacula}
+ done
+ install -m 755 src/dird/bacula-dir-${db_type} %{buildroot}%{_sbindir}
+ install -m 755 src/stored/bscan-${db_type} %{buildroot}%{_sbindir}
+ install -m 755 src/tools/dbcheck-${db_type} %{buildroot}%{_sbindir}
+ ln -snf bacula-dir-${db_type} %{buildroot}%{_sbindir}/bacula-dir
+ ln -snf bscan-${db_type} %{buildroot}%{_sbindir}/bscan
+ ln -snf dbcheck-${db_type} %{buildroot}%{_sbindir}/dbcheck
+done
# install the init scripts
install -d %{buildroot}%{_initrddir}
@@ -557,13 +682,11 @@
%pre common
%_pre_useradd bacula %{_localstatedir}/%{name} /bin/false
-#__pre_groupadd TAPE_GROUP bacula
%postun common
%_postun_userdel bacula
-
-%pre dir
+%pre dir-common
/usr/bin/perl -e '
$confdir="%{_sysconfdir}/%{name}";
$conffile="$confdir/.pw.sed";
@@ -591,62 +714,166 @@
close (OUT);
'
-%post dir
+%post dir-common
+%post_fix_config *
+%_post_service bacula-dir
+
+%preun dir-common
+%_preun_service bacula-dir
+
+%post dir-mysql
umask 077
-%if %{MYSQL}
+for f in create_mysql_database drop_mysql_database drop_mysql_tables \
+ grant_mysql_privileges make_mysql_tables update_mysql_tables ; do
+ ln -snf $f %{_libexecdir}/%{name}/${f/mysql/bacula}
+done
+ln -snf bacula-dir-mysql %{_sbindir}/bacula-dir
+ln -snf bscan-mysql %{_sbindir}/bscan
+ln -snf dbcheck-mysql %{_sbindir}/dbcheck
# NOTE: IF THIS FAILS DUE TO MYSQL/PGSQL NEEDING A PASSWORD YOU ARE ON YOUR OWN
DB_VER=`mysql bacula -e 'select * from Version;' | tail -n 1 2>/dev/null`
-%else
-%if %{PGSQL}
+if [ -z "$DB_VER" ]; then
+ echo cannot connect to bacula catalog database
+ echo if this is the first bacula installation please check
+ echo and run the following scripts
+ echo %{_libexecdir}/%{name}/grant_bacula_privileges
+ echo %{_libexecdir}/%{name}/create_bacula_database
+ echo %{_libexecdir}/%{name}/make_bacula_tables
+ echo else manually update the database to version %{_cur_db_ver} using
the script
+ echo %{_libexecdir}/%{name}/update_bacula_tables
+elif [ "$DB_VER" -lt "%{_cur_db_ver}" ]; then
+ echo "Backing up bacula tables"
+ mysqldump -f --opt bacula | bzip2 >
%{_localstatedir}/%{name}/bacula_backup.sql.bz2
+ echo "Upgrading bacula tables"
+ if [ "$DB_VER" -lt "4" ]; then
+ echo "your bacula database version is too old to be upgraded
automatically"
+ else
+ for v in `seq 5 $((%{_cur_db_ver} - 1))`; do
+ if [ "$DB_VER" -lt "$v" ]; then
+ %{_libexecdir}/%{name}/update_%{db_type}_tables_$((v -
1))_to_$v
+ fi
+ done
+ fi
+ %{_libexecdir}/%{name}/update_bacula_tables
+
+ echo "If bacula works correctly you can remove the backup file
%{_localstatedir}/%{name}/bacula_backup.sql.bz2"
+fi
+chown -R bacula:bacula %{_localstatedir}/%{name}
+chmod -R u+rX,go-rwx %{_localstatedir}/%{name}
+
+%post dir-pgsql
+umask 077
+for f in create_postgresql_database drop_postgresql_database
drop_postgresql_tables \
+ grant_postgresql_privileges make_postgresql_tables
update_postgresql_tables ; do
+ ln -snf $f %{_libexecdir}/%{name}/${f/postgresql/bacula}
+done
+ln -snf bacula-dir-postgresql %{_sbindir}/bacula-dir
+ln -snf bscan-postgresql %{_sbindir}/bscan
+ln -snf dbcheck-postgresql %{_sbindir}/dbcheck
+# NOTE: IF THIS FAILS DUE TO MYSQL/PGSQL NEEDING A PASSWORD YOU ARE ON YOUR OWN
DB_VER=`psql bacula -c 'select * from Version;' | tail -n 1 2>/dev/null`
-%else
+if [ -z "$DB_VER" ]; then
+ echo cannot connect to bacula catalog database
+ echo if this is the first bacula installation please check
+ echo and run the following scripts
+ echo %{_libexecdir}/%{name}/grant_bacula_privileges
+ echo %{_libexecdir}/%{name}/create_bacula_database
+ echo %{_libexecdir}/%{name}/make_bacula_tables
+ echo else manually update the database to version %{_cur_db_ver} using
the script
+ echo %{_libexecdir}/%{name}/update_bacula_tables
+elif [ "$DB_VER" -lt "%{_cur_db_ver}" ]; then
+ echo "Backing up bacula tables"
+ pg_dump bacula | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
+ echo "Upgrading bacula tables"
+ if [ "$DB_VER" -lt "7" ]; then
+ echo "your bacula database version is too old to be upgraded
automatically"
+ else
+ for v in `seq 8 $((%{_cur_db_ver} - 1))`; do
+ if [ "$DB_VER" -lt "$v" ]; then
+ %{_libexecdir}/%{name}/update_%{db_type}_tables_$((v -
1))_to_$v
+ fi
+ done
+ fi
+ %{_libexecdir}/%{name}/update_bacula_tables
+
+ echo "If bacula works correctly you can remove the backup file
%{_localstatedir}/%{name}/bacula_backup.sql.bz2"
+fi
+chown -R bacula:bacula %{_localstatedir}/%{name}
+chmod -R u+rX,go-rwx %{_localstatedir}/%{name}
+
+%post dir-sqlite3
+umask 077
+for f in create_sqlite3_database drop_sqlite3_database drop_sqlite3_tables \
+ grant_sqlite3_privileges make_sqlite3_tables update_sqlite3_tables ; do
+ ln -snf $f %{_libexecdir}/%{name}/${f/sqlite3/bacula}
+done
+ln -snf bacula-dir-sqlite3 %{_sbindir}/bacula-dir
+ln -snf bscan-sqlite3 %{_sbindir}/bscan
+ln -snf dbcheck-sqlite3 %{_sbindir}/dbcheck
+[ -s %{_localstatedir}/%{name}/bacula.db ] && \
+ DB_VER=`echo "select * from Version;" | \
+ sqlite3 %{_localstatedir}/%{name}/bacula.db | tail -n 1
2>/dev/null`
+if [ -z "$DB_VER" ]; then
+# grant privileges and create tables
+ %{_libexecdir}/%{name}/grant_bacula_privileges > dev/null
+ %{_libexecdir}/%{name}/create_bacula_database > dev/null
+ %{_libexecdir}/%{name}/make_bacula_tables > dev/null
+elif [ "$DB_VER" -lt "%{_cur_db_ver}" ]; then
+ echo "Backing up bacula tables"
+ echo ".dump" | sqlite3 %{_localstatedir}/%{name}/bacula.db | bzip2 >
%{_localstatedir}/%{name}/bacula_backup.sql.bz2
+ echo "Upgrading bacula tables"
+ if [ "$DB_VER" -lt "8" ]; then
+ echo "your bacula database version is too old to be upgraded
automatically"
+ else
+ for v in `seq 9 $((%{_cur_db_ver} - 1))`; do
+ if [ "$DB_VER" -lt "$v" ]; then
+ %{_libexecdir}/%{name}/update_%{db_type}_tables_$((v -
1))_to_$v
+ fi
+ done
+ fi
+ %{_libexecdir}/%{name}/update_bacula_tables
+
+ echo "If bacula works correctly you can remove the backup file
%{_localstatedir}/%{name}/bacula_backup.sql.bz2"
+fi
+chown -R bacula:bacula %{_localstatedir}/%{name}
+chmod -R u+rX,go-rwx %{_localstatedir}/%{name}
+
+%post dir-sqlite
+umask 077
+for f in create_sqlite_database drop_sqlite_database drop_sqlite_tables \
+ grant_sqlite_privileges make_sqlite_tables update_sqlite_tables ; do
+ ln -snf $f %{_libexecdir}/%{name}/${f/sqlite/bacula}
+done
+ln -snf bacula-dir-sqlite %{_sbindir}/bacula-dir
+ln -snf bscan-sqlite %{_sbindir}/bscan
+ln -snf dbcheck-sqlite %{_sbindir}/dbcheck
[ -s %{_localstatedir}/%{name}/bacula.db ] && \
DB_VER=`echo "select * from Version;" | \
sqlite %{_localstatedir}/%{name}/bacula.db | tail -n 1
2>/dev/null`
-%endif
-%endif
if [ -z "$DB_VER" ]; then
# grant privileges and create tables
%{_libexecdir}/%{name}/grant_bacula_privileges > dev/null
%{_libexecdir}/%{name}/create_bacula_database > dev/null
%{_libexecdir}/%{name}/make_bacula_tables > dev/null
-elif [ "$DB_VER" -lt "9" ]; then
+elif [ "$DB_VER" -lt "%{_cur_db_ver}" ]; then
echo "Backing up bacula tables"
-%if %{MYSQL}
- mysqldump -f --opt bacula | bzip2 >
%{_localstatedir}/%{name}/bacula_backup.sql.bz2
-%else
-%if %{PGSQL}
- pg_dump bacula | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
-%else
echo ".dump" | sqlite %{_localstatedir}/%{name}/bacula.db | bzip2 >
%{_localstatedir}/%{name}/bacula_backup.sql.bz2
-%endif
-%endif
echo "Upgrading bacula tables"
if [ "$DB_VER" -lt "4" ]; then
echo "your bacula database version is too old to be upgraded
automatically"
- elif [ "$DB_VER" -lt "8" ]; then
- if [ "$DB_VER" -lt "7" ]; then
- if [ "$DB_VER" -lt "6" ]; then
- if [ "$DB_VER" -lt "5" ]; then
-
%{_libexecdir}/%{name}/update_%{db_type}_tables_4_to_5
- fi
-
%{_libexecdir}/%{name}/update_%{db_type}_tables_5_to_6
- fi
- %{_libexecdir}/%{name}/update_%{db_type}_tables_6_to_7
+ else
+ for v in `seq 5 $((%{_cur_db_ver} - 1))`; do
+ if [ "$DB_VER" -lt "$v" ]; then
+ %{_libexecdir}/%{name}/update_%{db_type}_tables_$((v -
1))_to_$v
fi
- %{_libexecdir}/%{name}/update_%{db_type}_tables_7_to_8
+ done
fi
%{_libexecdir}/%{name}/update_bacula_tables
+
echo "If bacula works correctly you can remove the backup file
%{_localstatedir}/%{name}/bacula_backup.sql.bz2"
fi
chown -R bacula:bacula %{_localstatedir}/%{name}
chmod -R u+rX,go-rwx %{_localstatedir}/%{name}
-%post_fix_config *
-%_post_service bacula-dir
-
-%preun dir
-%_preun_service bacula-dir
-
%post fd
%post_fix_config bacula-fd
@@ -735,8 +962,14 @@
%{_mandir}/man8/bacula.8*
%{_mandir}/man8/btraceback.8*
%exclude %{_libexecdir}/%{name}/bacula
+%if ! %{GNOME}
+%exclude %{_mandir}/man1/gnome-console.1*
+%endif
+%if ! %{WXWINDOWS}
+%exclude %{_mandir}/man1/wx-console.1*
+%endif
-%files dir
+%files dir-common
%defattr(644, root, root, 755)
%doc ChangeLog CheckList ReleaseNotes kernstodo LICENSE
# FIXME : Merge baculs-docs and use it
@@ -746,33 +979,67 @@
%config(noreplace) %{_sysconfdir}/logrotate.d/bacula-dir
%{_mandir}/man8/bacula-dir.8*
%{_mandir}/man8/dbcheck.8*
+%{_mandir}/man8/bscan.8*
%defattr (755, root, root)
%attr(0755,root,root) %{_initrddir}/bacula-dir
-%{_sbindir}/bacula-dir
-%{_sbindir}/dbcheck
-%{_libexecdir}/%{name}/create_%{db_type}_database
-%{_libexecdir}/%{name}/drop_%{db_type}_database
-%{_libexecdir}/%{name}/drop_%{db_type}_tables
-%{_libexecdir}/%{name}/grant_%{db_type}_privileges
-%{_libexecdir}/%{name}/make_%{db_type}_tables
-%{_libexecdir}/%{name}/update_%{db_type}_tables*
-%{_libexecdir}/%{name}/create_bacula_database
-%{_libexecdir}/%{name}/drop_bacula_database
-%{_libexecdir}/%{name}/drop_bacula_tables
-%{_libexecdir}/%{name}/grant_bacula_privileges
-%{_libexecdir}/%{name}/make_bacula_tables
-%{_libexecdir}/%{name}/update_bacula_tables
+%ghost %{_sbindir}/bacula-dir
+%ghost %{_sbindir}/dbcheck
+%ghost %{_sbindir}/bscan
+%ghost %{_libexecdir}/%{name}/create_bacula_database
+%ghost %{_libexecdir}/%{name}/drop_bacula_database
+%ghost %{_libexecdir}/%{name}/drop_bacula_tables
+%ghost %{_libexecdir}/%{name}/grant_bacula_privileges
+%ghost %{_libexecdir}/%{name}/make_bacula_tables
+%ghost %{_libexecdir}/%{name}/update_bacula_tables
%{_libexecdir}/%{name}/make_catalog_backup
%{_libexecdir}/%{name}/delete_catalog_backup
%attr(644, root, root) %{_libexecdir}/%{name}/query.sql
-%if ! %{GNOME}
-%exclude %{_mandir}/man1/gnome-console.1*
-%endif
-%if ! %{WXWINDOWS}
-%exclude %{_mandir}/man1/wx-console.1*
-%endif
%exclude %{_libexecdir}/%{name}/bacula-ctl-dir
+%files dir-sqlite
+%{_sbindir}/bacula-dir-sqlite
+%{_sbindir}/dbcheck-sqlite
+%{_sbindir}/bscan-sqlite
+%{_libexecdir}/%{name}/create_sqlite_database
+%{_libexecdir}/%{name}/drop_sqlite_database
+%{_libexecdir}/%{name}/drop_sqlite_tables
+%{_libexecdir}/%{name}/grant_sqlite_privileges
+%{_libexecdir}/%{name}/make_sqlite_tables
+%{_libexecdir}/%{name}/update_sqlite_tables*
+
+%files dir-mysql
+%{_sbindir}/bacula-dir-mysql
+%{_sbindir}/dbcheck-mysql
+%{_sbindir}/bscan-mysql
+%{_libexecdir}/%{name}/create_mysql_database
+%{_libexecdir}/%{name}/drop_mysql_database
+%{_libexecdir}/%{name}/drop_mysql_tables
+%{_libexecdir}/%{name}/grant_mysql_privileges
+%{_libexecdir}/%{name}/make_mysql_tables
+%{_libexecdir}/%{name}/update_mysql_tables*
+
+%files dir-pgsql
+%{_sbindir}/bacula-dir-postgresql
+%{_sbindir}/dbcheck-postgresql
+%{_sbindir}/bscan-postgresql
+%{_libexecdir}/%{name}/create_postgresql_database
+%{_libexecdir}/%{name}/drop_postgresql_database
+%{_libexecdir}/%{name}/drop_postgresql_tables
+%{_libexecdir}/%{name}/grant_postgresql_privileges
+%{_libexecdir}/%{name}/make_postgresql_tables
+%{_libexecdir}/%{name}/update_postgresql_tables*
+
+%files dir-sqlite3
+%{_sbindir}/bacula-dir-sqlite3
+%{_sbindir}/dbcheck-sqlite3
+%{_sbindir}/bscan-sqlite3
+%{_libexecdir}/%{name}/create_sqlite3_database
+%{_libexecdir}/%{name}/drop_sqlite3_database
+%{_libexecdir}/%{name}/drop_sqlite3_tables
+%{_libexecdir}/%{name}/grant_sqlite3_privileges
+%{_libexecdir}/%{name}/make_sqlite3_tables
+%{_libexecdir}/%{name}/update_sqlite3_tables*
+
%files fd
%defattr(755, root, root)
%doc LICENSE
@@ -792,7 +1059,6 @@
%{_sbindir}/bcopy
%{_sbindir}/bextract
%{_sbindir}/bls
-%{_sbindir}/bscan
%{_sbindir}/btape
%{_libexecdir}/%{name}/mtx-changer
%{_libexecdir}/%{name}/disk-changer
@@ -801,7 +1067,6 @@
%{_mandir}/man8/bcopy.8*
%{_mandir}/man8/bextract.8*
%{_mandir}/man8/bls.8*
-%{_mandir}/man8/bscan.8*
%{_mandir}/man8/btape.8*
%exclude %{_libexecdir}/%{name}/bacula-ctl-sd
@@ -815,7 +1080,7 @@
%verify(link) %{_bindir}/bconsole
%{_mandir}/man8/bconsole.8*
%attr(755, root, root) %{_libdir}/%{name}/bconsole
-
+%exclude %{_libexecdir}/%{name}/bconsole
%if %{GNOME}
%files console-gnome