]> git.sur5r.net Git - bacula/bacula/commitdiff
Move btraceback.gdb to scriptdir on install + hammer DB Version update
authorKern Sibbald <kern@sibbald.com>
Mon, 29 Dec 2003 20:43:00 +0000 (20:43 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 29 Dec 2003 20:43:00 +0000 (20:43 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@972 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/platforms/mandrake/bacula.spec.in
bacula/scripts/Makefile.in
bacula/scripts/btraceback.in
bacula/src/cats/update_mysql_tables.in
bacula/src/cats/update_postgresql_tables.in
bacula/src/cats/update_sqlite_tables.in

index cd629282b2d220121adaf4fbe4eae7e9ad4a1721..7f645fa8c7773febd681e07aad06db74653957ee 100644 (file)
+%define name bacula
+%define version 1.32d
+%define release 1mdk
 
-%define depkgs ../depkgs
-
-#
-#  Good base, but needs to be updated for Mandrake
-# 
-# You must build the package with at least one define
-#  e.g.  rpmbuild -ba  bacula.spec
-#
-# If you want the MySQL version, use:
-#        rpmbuild -ba --define "build_mysql 1" bacula.spec
-#
-# If you want the MySQL version and static builds, use:
-#      rpmbuild -ba --define "build_mysql 1" --define "build_static 1" bacula.spec
-# If you want the MySQL version and static builds + come console , use:
-#      rpmbuild -ba --define "build_mysql 1" --define "build_static 1" --define "build_gnome 1" bacula.spec
-
-%define mysql 0
-%define static 0
-%define gnome 0
-%{?build_mysql:%define mysql 1}
-%{?build_static:%define static 1}
-%{?build_gnome:%define gnome 1}
+%define MYSQL 0
+%define GNOME 0
+%define TCPW 1
 
+%{?_with_mysql: %{expand: %%global MYSQL 1}}
+%{?_without_mysql: %{expand: %%global MYSQL 0}}
+%{?_with_gnome: %{expand: %%global GNOME 1}}
+%{?_without_gnome: %{expand: %%global GNOME 0}}
+%{?_with_wrap: %{expand: %%global TCPW 1}}
+%{?_without_wrap: %{expand: %%global TCPW 0}}
 
+%define blurb Bacula - It comes by night and sucks the vital essence from your computers.
 
 Summary: Bacula - The Network Backup Solution
-Name: bacula
-Version: @VERSION@
-Release: 1
-Group: System Environment/Daemons
-Copyright: GPL v2
-Source: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Group: Archiving/Backup
+License: GPL
+Source: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.bz2
+Source1: %{name}-icons.tar.bz2
 BuildRoot: %{_tmppath}/%{name}-root
 URL: http://www.bacula.org/
-Vendor: The Bacula Team
-Distribution: The Bacula Team
-Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
-Requires: gnome-libs >= 1.4
-Requires: readline
-BuildRequires: readline-devel
-%if %{gnome}
-Requires: gnome-libs >= 1.4
-BuildRequires: gnome-libs-devel >= 1.4
-%endif
-
-%if %{mysql}
-Requires: mysql >= 3.23
-Requires: mysql-server >= 3.23
-BuildRequires: mysql-devel >= 3.23
+BuildRequires: readline-devel, perl-base, zlib-devel
+%if %{TCPW}
+BuildRequires: tcp_wrappers-devel
 %endif
-
+Patch0: bacula-1.32d-config.diff.bz2
+Patch1: bacula-1.30a-prompt.diff.bz2
 
 %description
-Bacula - It comes by night and sucks the vital essence from your computers.
-
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
-
-%if %{mysql}
-%package mysql
+%{blurb}
+Bacula is a set of computer programs that permit you (or the system
+administrator) to manage backup, recovery, and verification of computer
+data across a network of computers of different kinds. In technical terms,
+it is a network client/server based backup program. Bacula is relatively
+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
+Summary: Bacula Director and Catalog services
+Group: Archiving/Backup
+Prereq: rpm-helper, perl-base
+%if %{MYSQL}
+Requires: MySQL >= 3.23
+BuildRequires: MySQL-devel >= 3.23
 %else
-%package sqlite
+Requires: sqlite-tools
+BuildRequires: sqlite-devel
 %endif
-
-Summary: Bacula - The Network Backup Solution
-Group: System Environment/Daemons
-
-%if %{mysql}
-%description mysql
-%else
-%description sqlite
-%endif
-
-Bacula - It comes by night and sucks the vital essence from your computers.
-
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
-
-%if %{mysql}
+Conflicts: bacula-fd < %{version}
+Conflicts: bacula-sd < %{version}
+
+%description dir
+%{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.
+%if %{MYSQL}
 This build requires MySQL to be installed separately as the catalog database.
 %else
-This build incorporates sqlite as the catalog database, statically compiled.
+This build requires sqlite to be installed separately as the catalog database.
 %endif
 
-%package client
-Summary: Bacula - The Network Backup Solution
-Group: System Environment/Daemons
-%description client
-Bacula - It comes by night and sucks the vital essence from your computers.
-
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
-
-This is the File daemon (Client) only package.
+%package console
+Summary: Bacula Console
+Group: Archiving/Backup
+Prereq: sed
+
+%description console
+%{blurb}
+Bacula Console is the program that allows the administrator or user to
+communicate with the Bacula Director.
+This is the text only console interface.
+
+%if %{GNOME}
+%package console-gnome
+Summary: Bacula Gnome Console
+Group: Archiving/Backup
+#BuildRequires: libgnome32-devel
+BuildRequires: libgnomeui2-devel
+Prereq: sed
+
+%description console-gnome
+%{blurb}
+Bacula Console is the program that allows the administrator or user to
+communicate with the Bacula Director.
+This is the GNOME GUI interface.
+%endif
 
+%package fd
+Summary: Bacula File services (Client)
+Group: Archiving/Backup
+Prereq: rpm-helper
+Prereq: sed
+Conflicts: bacula-dir < %{version}
+
+%description fd
+%{blurb}
+Bacula File services (or Client program) is the software program that is
+installed on the machine to be backed up. It is specific to the operating
+system on which it runs and is responsible for providing the file attributes
+and data when requested by the Director. The File services are also responsible
+for the file system dependent part of restoring the file attributes and data
+during a recovery operation.
+This program runs as a daemon on the machine to be backed up, and in some of
+the documentation, the File daemon is referred to as the Client (for example in
+Bacula configuration file). 
+
+%package sd
+Summary: Bacula Storage services
+Group: Archiving/Backup
+Prereq: rpm-helper
+Prereq: sed
+Conflicts: bacula-dir < %{version}
+
+%description sd
+%{blurb}
+Bacula Storage services consist of the software programs that perform the
+storage and recovery of the file attributes and data to the physical backup
+media or volumes. In other words, the Storage daemon is responsible for reading
+and writing your tapes (or other storage media, e.g. files).
+The Storage services runs as a daemon on the machine that has the backup
+device (usually a tape drive).
 
 %prep
-
-%setup
+%setup -q -c
+cd %{name}-%{version}
+%patch0 -p1 -b .config
+%patch1 -p1 -b .prompt
+mkdir doc/manual
+mv doc/html-manual/*.html doc/manual
+mv doc/html-manual/*.css doc/manual
+mv doc/html-manual/*.gif doc/manual
 
 %build
-
-cwd=${PWD}
-cd %{depkgs}
-%if ! %{mysql}
-make sqlite
-%endif
-make mtx
-cd ${cwd}
-
-# patch the make_sqlite_tables script for installation bindir
-patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
-
+cd %{name}-%{version}
+%serverbuild
 %configure \
-        --prefix=/usr \
-        --sbindir=/usr/sbin \
-        --sysconfdir=/etc/bacula \
-        --with-scriptdir=/etc/bacula \
-        --enable-smartalloc \
-%if %{gnome}
-        --enable-gnome \
-%endif
-%if %{static}
-        --enable-static-fd \
-        --enable-static-sd \
-        --enable-static-dir \
-        --enable-static-tools \
-        --enable-static-cons \
-%endif
-%if %{mysql}
+       --enable-smartalloc \
+%if %{MYSQL}
         --with-mysql \
 %else
-        --with-sqlite=${cwd}/../depkgs/sqlite \
+        --with-sqlite \
+%endif
+%if %{GNOME}
+               --enable-gnome \
 %endif
-        --with-working-dir=/var/bacula \
-        --with-pid-dir=/var/run \
-        --with-subsys-dir=/var/lock/subsys
-make
+%if %{TCPW}
+               --with-tcp-wrappers \
+%endif
+        --sysconfdir=%{_sysconfdir}/%{name} \
+        --with-scriptdir=%{_libexecdir}/%{name} \
+        --with-working-dir=%{_localstatedir}/%{name} \
+        --with-subsys-dir=/var/lock/subsys \
+               --with-dir-password="#FAKE#DIR#PASSWORD#" \
+               --with-fd-password="#FAKE#FD#PASSWORD#" \
+               --with-sd-password="#FAKE#SD#PASSWORD#"
+
+%make
 
 %install
-cwd=${PWD}
-mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
-mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
-mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
-mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
-mkdir -p $RPM_BUILD_ROOT/usr/share/applications
-
-%if ! %{mysql}
-mkdir -p $RPM_BUILD_ROOT/usr/lib/sqlite
-%endif
+cd %{name}-%{version}
+rm -rf %{buildroot}
+%makeinstall sysconfdir=%{buildroot}%{_sysconfdir}/%{name} scriptdir=%{buildroot}%{_libexecdir}/%{name} working_dir=%{buildroot}%{_localstatedir}/%{name}
 
-make \
-        prefix=$RPM_BUILD_ROOT/usr \
-        sbindir=$RPM_BUILD_ROOT/usr/sbin \
-        sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
-        scriptdir=$RPM_BUILD_ROOT/etc/bacula \
-        working_dir=$RPM_BUILD_ROOT/var/bacula \
-        install
-
-cd %{depkgs}
-make \
-        prefix=$RPM_BUILD_ROOT/usr \
-        sbindir=$RPM_BUILD_ROOT/usr/sbin \
-        sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
-        working_dir=$RPM_BUILD_ROOT/var/bacula \
-        mandir=$RPM_BUILD_ROOT/usr/man \
-        mtx-install
-cd ${cwd}
-
-%if ! %{mysql}
-# fixme - make installs the mysql scripts for sqlite build
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
+# install the upgrade scripts
+%if %{MYSQL}
+install -m 755 src/cats/alter_mysql_tables %{buildroot}%{_libexecdir}/%{name}
+%else
+install -m 755 src/cats/alter_sqlite_tables %{buildroot}%{_libexecdir}/%{name}
 %endif
 
 # install the init scripts
-cp platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
-cp platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
-cp platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
+mkdir -p %{buildroot}%{_initrddir}
+install -m 755 platforms/mandrake/bacula-dir %{buildroot}%{_initrddir}/bacula-dir
+install -m 755 platforms/mandrake/bacula-fd %{buildroot}%{_initrddir}/bacula-fd
+install -m 755 platforms/mandrake/bacula-sd %{buildroot}%{_initrddir}/bacula-sd
+
+# install the logrotate file
+mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
+cp scripts/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/bacula-dir
 
+mkdir -p %{buildroot}%{_localstatedir}/%{name}
+
+%if %{GNOME}
 # install the menu stuff
-cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
-cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
-cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
-
-# install sqlite
-%if ! %{mysql}
-cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite
-cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite.h
-cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT/usr/lib/sqlite/libsqlite.a
+mkdir -p $RPM_BUILD_ROOT%{_menudir}
+cat << EOF > $RPM_BUILD_ROOT%{_menudir}/%{name}-console-gnome
+?package(%{name}-console-gnome): command="%{_sbindir}/gnome-console" icon="%{name}.png" needs="x11" title="Bacula Console" longtitle="Bacula Director Console" section="Applications/Archiving/Backup"
+EOF
+mkdir -p %{buildroot}%{_iconsdir}
+tar jxvf %{SOURCE1} -C %{buildroot}%{_iconsdir}
 %endif
 
-# install the logrotate file
-cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
+perl -spi -e 's/"#FAKE#(\w+)#PASSWORD#"/#YOU MUST SET THE $1 PASSWORD#/' %{buildroot}%{_sysconfdir}/%{name}/*.conf
+touch %{buildroot}%{_sysconfdir}/%{name}/.pw.sed
 
 %clean
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
-
-%if %{mysql}
-
-%files mysql
-%defattr(-,root,root)
-
-%attr(0754,root,root) /etc/bacula/bacula
-%attr(0754,root,root) /etc/bacula/console
-%attr(0754,root,root) /etc/bacula/fd
-%attr(0754,root,root) /etc/bacula/gconsole
-%attr(0754,root,root) /etc/bacula/create_mysql_database
-%attr(0754,root,root) /etc/bacula/delete_catalog_backup
-%attr(0754,root,root) /etc/bacula/drop_bacula_tables
-%attr(0754,root,root) /etc/bacula/drop_mysql_tables
-%attr(0754,root,root) /etc/bacula/make_bacula_tables
-%attr(0754,root,root) /etc/bacula/make_catalog_backup
-%attr(0754,root,root) /etc/bacula/make_mysql_tables
-%attr(0754,root,root) /etc/bacula/grant_mysql_privileges
-%attr(0754,root,root) /etc/bacula/startmysql
-%attr(0754,root,root) /etc/bacula/stopmysql
-%attr(0754,root,root) /etc/bacula/mtx-changer
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
-
-%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
-%attr(0644,root,root) /usr/man/man1/*
-%attr(0644,root,root) /usr/share/pixmaps/bacula.png
-%attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
-%attr(0644,root,root) /usr/share/applications/bacula.desktop
-%attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
-%attr(0644,root,root) /etc/logrotate.d/bacula
-
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
-%attr(0640,root,root) /etc/bacula/query.sql
-%attr(0640,root,root) %dir /var/bacula
-
-%attr(0750,root,root) /usr/sbin/*
-
-%post mysql
-# delete then add our links
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-
-# add execute permissions for console
-chmod 0755 /usr/sbin/gnome-console
-
+rm -rf %{buildroot}
+
+%files dir
+%defattr(644, root, root, 755)
+%doc %{name}-%{version}/ChangeLog %{name}-%{version}/CheckList %{name}-%{version}/ReleaseNotes %{name}-%{version}/kernstodo
+%doc %{name}-%{version}/doc/*.pdf %{name}-%{version}/doc/manual %{name}-%{version}/examples
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-dir.conf
+%ghost %{_sysconfdir}/%{name}/.pw.sed
+%config(noreplace) %{_sysconfdir}/logrotate.d/bacula-dir
+%defattr (755, root, root)
+%config(noreplace) %{_initrddir}/bacula-dir
+%{_sbindir}/bacula-dir
+%{_sbindir}/btraceback
+%{_sbindir}/dbcheck
+%{_sbindir}/smtp
+%dir %{_libexecdir}/%{name}
+%attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
+%if %{MYSQL}
+%{_libexecdir}/%{name}/create_mysql_database
+%{_libexecdir}/%{name}/drop_mysql_tables
+%{_libexecdir}/%{name}/grant_mysql_privileges
+%{_libexecdir}/%{name}/make_mysql_tables
+%{_libexecdir}/%{name}/alter_mysql_tables
+%else
+%{_libexecdir}/%{name}/create_sqlite_database
+%{_libexecdir}/%{name}/drop_sqlite_tables
+%exclude %{_libexecdir}/%{name}/grant_mysql_privileges
+%{_libexecdir}/%{name}/make_sqlite_tables
+%{_libexecdir}/%{name}/alter_sqlite_tables
+%endif
+%{_libexecdir}/%{name}/delete_catalog_backup
+%{_libexecdir}/%{name}/drop_bacula_tables
+%{_libexecdir}/%{name}/make_bacula_tables
+%{_libexecdir}/%{name}/make_catalog_backup
+%attr(644, root, root) %{_libexecdir}/%{name}/query.sql
+%attr(700, root, root) %dir %{_localstatedir}/%{name}
+
+%pre dir -p /usr/bin/perl
+umask(0077);
+if ( -f "%{_sysconfdir}/%{name}/.pw.sed") {
+       if ( -f "%{_sysconfdir}/%{name}/bacula-dir.conf") {
+       system "sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed";
+       system "sed -f %{_sysconfdir}/%{name}/.upw.sed %{_sysconfdir}/%{name}/bacula-dir.conf > %{_sysconfdir}/%{name}/bacula-dir.conf.tmp";
+       unlink "%{_sysconfdir}/%{name}/bacula-dir.conf";
+       rename "%{_sysconfdir}/%{name}/bacula-dir.conf.tmp", "%{_sysconfdir}/%{name}/bacula-dir.conf";
+       unlink "%{_sysconfdir}/%{name}/.upw.sed";
+       }
+} else {
+       mkdir("%{_sysconfdir}/%{name}");
+       open(IN, "/dev/random") or die "$!";
+       open(OUT, ">%{_sysconfdir}/%{name}/.pw.sed") or die "$!";
+       foreach $c ("DIR","SD","FD") {
+               read(IN, $buf, 32);
+               my $res = pack("u", $buf);
+               $res =~ s/^.//mg;
+               $res =~ s/\n//g;
+               $res =~ tr|` -_|AA-Za-z0-9+/|;
+               print OUT "s!#YOU MUST SET THE $c PASSWORD#!\"$res\"!\n";
+       }
+       close (IN);
+       close (OUT);
+}
+
+%post dir
+%if %{MYSQL}
+# NOTE: IF THIS FAILS DUE TO MYSQL NEEDING A PASSWORD YOU ARE ON YOUR OWN
+DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
+if [ -z "$DB_VER" ]; then
 # grant privileges and create tables
-# this will error out harmlessly if tables already exist
-echo "Granting privileges for MySQL user bacula..."
-/etc/bacula/grant_mysql_privileges
-echo "Creating MySQL bacula database..."
-/etc/bacula/create_mysql_database
-echo "Creating bacula tables..."
-/etc/bacula/make_mysql_tables
-
-%preun mysql
-# delete our links
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-
+       echo "Granting privileges for MySQL user bacula..."
+       %{_libexecdir}/%{name}/grant_mysql_privileges > dev/null
+       echo "Creating MySQL bacula database..."
+       %{_libexecdir}/%{name}/create_mysql_database > dev/null
+       echo "Creating bacula tables..."
+       %{_libexecdir}/%{name}/make_mysql_tables > dev/null
+elif [ "$DB_VER" -lt "6" ]; then
+       echo "Backing up bacula tables"
+       mysqldump -f --opt bacula | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
+       echo "Upgrading bacula tables"
+       %{_libexecdir}/%{name}/alter_mysql_tables
+       echo "If bacula works correctly you can remove the backup file %{_localstatedir}/%{name}/bacula_backup.sql.bz2"
+fi
 %else
-
-%files sqlite
-%defattr(-,root,root)
-
-%attr(0754,root,root) /etc/bacula/bacula
-%attr(0754,root,root) /etc/bacula/console
-%attr(0754,root,root) /etc/bacula/fd
-%attr(0754,root,root) /etc/bacula/gconsole
-%attr(0754,root,root) /etc/bacula/create_sqlite_database
-%attr(0754,root,root) /etc/bacula/delete_catalog_backup
-%attr(0754,root,root) /etc/bacula/drop_bacula_tables
-%attr(0754,root,root) /etc/bacula/drop_sqlite_tables
-%attr(0754,root,root) /etc/bacula/make_bacula_tables
-%attr(0754,root,root) /etc/bacula/make_catalog_backup
-%attr(0754,root,root) /etc/bacula/make_sqlite_tables
-%attr(0754,root,root) /etc/bacula/mtx-changer
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
-
-%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
-%attr(0644,root,root) /usr/man/man1/*
-%attr(0644,root,root) /usr/share/pixmaps/bacula.png
-%attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
-%attr(0644,root,root) /usr/share/applications/bacula.desktop
-%attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
-%attr(0644,root,root) /etc/logrotate.d/bacula
-
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
-%attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
-%attr(0640,root,root) /etc/bacula/query.sql
-%attr(0640,root,root) /usr/lib/sqlite/libsqlite.a
-%attr(0640,root,root) /usr/lib/sqlite/sqlite.h
-%attr(0640,root,root) %dir /var/bacula
-
-%attr(0750,root,root) /usr/sbin/*
-%attr(0750,root,root) /usr/lib/sqlite/sqlite
-
-%post sqlite
-# delete then add our links
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-
-# add execute permission for console
-chmod 0755 /usr/sbin/gnome-console
-
+if [ -s %{_localstatedir}/%{name}/bacula.db ]; then
+DB_VER=`echo "select * from Version;" | sqlite %{_localstatedir}/%{name}/bacula.db|tail -n 1 2>/dev/null`
+       if [ "$DB_VER" -lt "6" ]; then
+               echo "Backing up bacula tables"
+               echo ".dump" | sqlite %{_localstatedir}/%{name}/bacula.db | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
+               echo "Upgrading bacula tables"
+               %{_libexecdir}/%{name}/alter_sqlite_tables
+               echo "If bacula works correctly you can remove the backup file %{_localstatedir}/%{name}/bacula_backup.sql.bz2"
+       fi
+else
 # create the tables
-/etc/bacula/make_sqlite_tables
-
-%preun sqlite
-# delete our links
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-
+       echo "Creating bacula tables..."
+       %{_libexecdir}/%{name}/make_sqlite_tables > dev/null
+fi
 %endif
+chmod -R 600 %{_localstatedir}/%{name}/*
+for i in %{_sysconfdir}/%{name}/*.conf %{_sysconfdir}/%{name}/*.conf.rpmnew %{_sysconfdir}/%{name}/*.conf.rpmsave; do
+       if [ -s $i ]; then
+       sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
+# this is needed if upgrading from 1.30a or lower
+       sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
+       rm -f $i.tmp
+       fi
+done
+%_post_service bacula-dir
+
+%preun dir
+%_preun_service bacula-dir
+
+%files fd
+%defattr(755, root, root)
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-fd.conf
+%config(noreplace) %{_initrddir}/bacula-fd
+%{_sbindir}/bacula-fd
+%{_sbindir}/btraceback
+%{_sbindir}/smtp
+%dir %{_libexecdir}/%{name}
+%attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
+%attr(700, root, root) %dir %{_localstatedir}/%{name}
+
+%pre fd
+umask 077
+i=%{_sysconfdir}/%{name}/bacula-fd.conf
+if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
+       sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
+       sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
+       mv -f $i.tmp $i
+       rm -f %{_sysconfdir}/%{name}/.upw.sed
+fi
+
+%post fd
+%_post_service bacula-fd
+if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
+       for i in %{_sysconfdir}/%{name}/bacula-fd.conf %{_sysconfdir}/%{name}/bacula-fd.conf.rpmnew %{_sysconfdir}/%{name}/bacula-fd.conf.rpmsave; do
+       if [ -s $i ]; then
+               sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
+# this is needed if upgrading from 1.30a or lower
+               sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
+               rm -f $i.tmp
+       fi
+       done
+fi
+
+%preun fd
+%_preun_service bacula-fd
+
+%files sd
+%defattr(755, root, root)
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-sd.conf
+%config(noreplace) %{_initrddir}/bacula-sd
+%{_sbindir}/bacula-sd
+%{_sbindir}/bcopy
+%{_sbindir}/bextract
+%{_sbindir}/bls
+%{_sbindir}/bscan
+%{_sbindir}/btape
+%{_sbindir}/btraceback
+%{_sbindir}/smtp
+%dir %{_libexecdir}/%{name}
+%attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
+%{_libexecdir}/%{name}/mtx-changer
+%attr(700, root, root) %dir %{_localstatedir}/%{name}
+
+%pre sd
+umask 077
+i=%{_sysconfdir}/%{name}/bacula-sd.conf
+if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
+       sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
+       sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
+       mv -f $i.tmp $i
+       rm -f %{_sysconfdir}/%{name}/.upw.sed
+fi
+
+%post sd
+%_post_service bacula-sd
+if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
+       for i in %{_sysconfdir}/%{name}/bacula-sd.conf %{_sysconfdir}/%{name}/bacula-sd.conf.rpmnew %{_sysconfdir}/%{name}/bacula-sd.conf.rpmsave; do
+       if [ -s $i ]; then
+               sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
+# this is needed if upgrading from 1.30a or lower
+               sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
+               rm -f $i.tmp
+       fi
+       done
+fi
+
+%preun sd
+%_preun_service bacula-sd
+
+%files console
+%defattr(755, root, root)
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/console.conf
+%{_sbindir}/console
+%{_sbindir}/btraceback
+%{_sbindir}/smtp
+%dir %{_libexecdir}/%{name}
+%attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
+
+%pre console
+umask 077
+i=%{_sysconfdir}/%{name}/console.conf
+if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
+       sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
+       sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
+       mv -f $i.tmp $i
+       rm -f %{_sysconfdir}/%{name}/.upw.sed
+fi
+
+%post console
+if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
+       for i in %{_sysconfdir}/%{name}/console.conf %{_sysconfdir}/%{name}/console.conf.rpmnew %{_sysconfdir}/%{name}/console.conf.rpmsave; do
+       if [ -s $i ]; then
+               sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
+# this is needed if upgrading from 1.30a or lower
+               sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
+               rm -f $i.tmp
+       fi
+       done
+fi
+
+%if %{GNOME}
+%files console-gnome
+%defattr(644, root, root, 755)
+%{_iconsdir}/bacula.png
+%{_iconsdir}/mini/bacula.png
+%{_iconsdir}/large/bacula.png
+%{_menudir}/bacula-console-gnome
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/gnome-console.conf
+%attr(755, root, root) %{_sbindir}/gnome-console
+%attr(755, root, root) %{_sbindir}/btraceback
+%attr(755, root, root) %{_sbindir}/smtp
+%dir %{_libexecdir}/%{name}
+%{_libexecdir}/%{name}/btraceback.gdb
+
+%pre console-gnome
+umask 077
+i=%{_sysconfdir}/%{name}/gnome-console.conf
+if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
+       sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
+       sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
+       mv -f $i.tmp $i
+       rm -f %{_sysconfdir}/%{name}/.upw.sed
+fi
+
+%post console-gnome
+%update_menus
+if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
+       for i in %{_sysconfdir}/%{name}/gnome-console.conf %{_sysconfdir}/%{name}/gnome-console.conf.rpmnew %{_sysconfdir}/%{name}/gnome-console.conf.rpmsave; do
+       if [ -s $i ]; then
+               sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
+# this is needed if upgrading from 1.30a or lower
+               sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
+               rm -f $i.tmp
+       fi
+       done
+fi
+               
+%postun console-gnome
+%clean_menus
 
-%files client
-%defattr(-,root,root)
-
-%attr(0754,root,root) /etc/bacula/fd
-%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
-
-%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
-%attr(0644,root,root) /etc/logrotate.d/bacula
-
-%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(0640,root,root) %dir /var/bacula
-
-%attr(0750,root,root) /usr/sbin/bacula-fd
-%attr(0750,root,root) /usr/sbin/btraceback
-%attr(0750,root,root) /usr/sbin/btraceback.gdb
-%attr(0750,root,root) /usr/sbin/smtp
-
-
-%post client
-# delete then add our links
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --add bacula-fd
-
-%preun client
-# delete our links
-/sbin/chkconfig --del bacula-fd
+%endif
 
 %changelog
-* Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
-- Misc changes to mysql/sqlite build and rh7/8 menu differences
-- Added rh_version to sub-package names
-- Added installed but missing file /etc/bacula/gconsole
-- rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
-* Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
-- Update spec for version 1.31 and combine client
-* Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
-- Initial spec file
+* Tue Nov 04 2003 Luca Berra <bluca@vodka.it> 1.32d-1mdk
+- 1.32d
+- use gnome2 for console
+- use tcp_wrappers
+- try not to create unneeded .rpmnew in configuration
+
+* Fri Aug 12 2003 Luca Berra <bluca@vodka.it> 1.31a-1mdk
+- 1.31a
+- modified %%post script to upgrade database if needed and do not try to create if it already exists.
+- %%post_service should be last in %%post script
+- changed sql upgrade script to remove multiple Version rows introduced by %%post
+- trying to create the tables multiple times in previous releases.
+- smtp is required by btraceback which is required by every daemon.
+- added conflicts for lower version
+
+* Wed Aug  6 2003 Luca Berra <bluca@vodka.it> 1.30a-3mdk
+- changed sqlite requires to match package in contrib
+- set passwords for single components to produce an error until user changes them
+- try to change passwords automatically if dir package is installed
+
+* Sun Aug  3 2003 Luca Berra <bluca@vodka.it> 1.30a-2mdk
+- many spec changes
+- almost please rpmlint
+- fixed readline eats last message bug in console
+
+* Fri Aug  1 2003 Luca Berra <bluca@vodka.it> 1.30a-1mdk
+- Initial spec file from spec by D. Scott Barninger <barninger at fairfieldcomputers.com>
index 9690a97d09becf668613aec79a93bdf6ae3a0037..2c0064c6293a39764ba064a0bb17bdea4df93c73 100755 (executable)
@@ -39,8 +39,8 @@ install: installdirs
        $(INSTALL_SCRIPT) bacula $(DESTDIR)$(scriptdir)/bacula
        $(INSTALL_SCRIPT) fd $(DESTDIR)$(scriptdir)/fd
        $(INSTALL_SCRIPT) mtx-changer $(DESTDIR)$(scriptdir)/mtx-changer
+       $(INSTALL_DATA)   btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb
        $(INSTALL_SCRIPT) btraceback $(DESTDIR)$(sbindir)/btraceback
-       $(INSTALL_DATA)   btraceback.gdb $(DESTDIR)$(sbindir)/btraceback.gdb
 
 uninstall:
        (cd $(DESTDIR)$(scriptdir); $(RMF) startmysql)
@@ -50,8 +50,9 @@ uninstall:
        (cd $(DESTDIR)$(scriptdir); $(RMF) bacula)
        (cd $(DESTDIR)$(scriptdir); $(RMF) fd)
        (cd $(DESTDIR)$(scriptdir); $(RMF) mtx-changer)
-       (cd $(DESTDIR)$(sbindir); $(RMF) btraceback)
+       (cd $(DESTDIR)$(scriptdir); $(RMF) btraceback.gdb)
        (cd $(DESTDIR)$(sbindir); $(RMF) btraceback.gdb)
+       (cd $(DESTDIR)$(sbindir); $(RMF) btraceback)
 
 Makefile: Makefile.in
        cd $(topdir) \
index 79df59979d183bc2fa3ab48889e30558f0f2d63c..36be613534ea108136e49651de72620c829bbe95 100755 (executable)
@@ -8,12 +8,13 @@
 #  $1 = path to executable
 #  $2 = main pid of running program to be traced back.
 #
-gdb -quiet -batch -x @sbindir@/btraceback.gdb $1 $2 2>&1 \
+gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 2>&1 \
  | @sbindir@/bsmtp -h @smtp_host@ -s "Bacula traceback" @dump_email@
 
+#
 # Below is some old code that did the traceback from a core
-#  dump. However, for some odd reason, core dumps are not
-#  always produced.
+#  dump. However, for security reasons, core dumps of uid=root  
+#  programs are not always produced.
 #i=0
 #core=
 #echo "In modified btraceback"
@@ -32,7 +33,7 @@ gdb -quiet -batch -x @sbindir@/btraceback.gdb $1 $2 2>&1 \
 #done
 
 #if test x$core != x; then
-#   gdb -quiet -batch -x @sbindir@/btraceback.gdb $1 $core 2>&1 | mail -s "Bacula traceback" @dump_email@
+#   gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $core 2>&1 | mail -s "Bacula traceback" @dump_email@
 #else
-#   gdb -quiet -batch -x @sbindir@/btraceback.gdb $1 $2 2>&1 | mail -s "Bacula traceback" @dump_email@
+#   gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 2>&1 | mail -s "Bacula traceback" @dump_email@
 #fi
index 7767308c52464b72489849bc3fe31c0cb9e2e0f7..217416ec648c5f66d6d5dd0c5f85efd7e0a0d7ce 100755 (executable)
@@ -52,7 +52,8 @@ CREATE TABLE BaseFiles (
    PRIMARY KEY(BaseId)
    );
 
-UPDATE Version SET VersionId=7;
+DELETE FROM Version;
+INSERT INTO VERSION (VersionId) VALUES (7);
 
 END-OF-DATA
 then
index 5a1d49281449aa051a6376ccdadedc228042675e..548faf7b7d1d876b60ca6e10d8bc4ee13b1df220 100755 (executable)
@@ -11,7 +11,8 @@ bindir=@SQL_BINDIR@
 if $bindir/psql $* -f - <<END-OF-DATA
 \c bacula
 
-UPDATE Version SET VersionId=7;
+DELETE FROM Version;
+INSERT INTO VERSION (VersionId) VALUES (7);
 
 END-OF-DATA
 then
index c841a38a9be7549ed70f1aa9f004c7ed25fcc9f0..6f6bab713fb33daa87e9c27cc2a05e6bf20c569e 100755 (executable)
@@ -208,6 +208,7 @@ CREATE TABLE BaseFiles (
 
 COMMIT;
 
-UPDATE Version SET VersionId=7;
+DELETE FROM Version;
+INSERT INTO VERSION (VersionId) VALUES (7);
 
 END-OF-DATA