- Release Notes for Bacula 1.38.2
+ Release Notes for Bacula 1.38.3
- Bacula code: Total files = 420 Total lines = 138,440 (*.h *.c *.in)
+ Bacula code: Total files = 424 Total lines = 140,955 (*.h *.c *.in)
20,440 additional lines of code since version 1.36.3
+Changes to 1.38.3:
+- This is mainly a bug release fix. In addition, the multiple drive
+ reservation algorithm has been rewritten.
+- Simplify the O_NONBLOCK open() code for tape drives,
+ and always open nonblocking.
+- Do not wait for open() if EIO returned (shouldn't happen).
+- Eliminate 3 argument to tape open().
+- Correct the slot # edited in the 3995 Bad autochanger unload
+ message.
+- With -S on bscan (show progress) do not divide by zero.
+- Make cancel pthread_cond_signal() pthread_cond_broadcast().
+- When dcr is freed, also broadcast dev->wait_next_vol signal.
+- Remove unused code in wait_for_device.
+- Make wait_for_device() always return after 60 seconds of wait.
+- Use localhost if no network configured
+- Eliminated duplicate MaxVolBytes in cat update -- bug 509.
+- Update specs to include mysql4 define.
+- Return rec->FileIndex in dcr->VolLastIndex for normal
+ and partial records in read_record(). This allows bscan
+ to get FileIndex at EOT correct.
+- Fix butil.c to correctly set dcr -- fixes seg fault in bls.
+- Apply patch supplied by user (slightly modified) to fix
+ correct detection of holes in block devices and FIFOs.
+ Bug # 506.
+- Apply patch supplied by user (slightly modified)
+ to fix SD hang with multiple pools and bad client
+ IP. Fixes bug # 508.
+- Add nagios plugin to the examples directory. Submitted by
+ Christian Masopust.
+- Remove warning message about multiple saves of hardlinked files
+ from find_one.c as it can generate too many warning messages.
+- Reset timeout values before select() per patch from
+ Frank Sweetser for problems with non-blocking sockets.
+- Unlink the state file if either reading or writing it gets
+ errors. Hopefully this will fix Win32 exit problems.
+- Get next volume from Scratch pool before creating a volume.
+- Set new Pool defaults in Vol when moved from Scratch Pool.
+- Remove argument from create_bacula_database for SQLite as it
+ caused an error.
+- Fix reservation so that mutexes are properly applied.
+- Rework reservation algorithm so that two drives can be used
+ at the same time.
+- Apply days keyword patch from Alexander.Bergolth at wu-wien.ac.at
+ If this patch is applied, the number of days can be specified with
+ "list nextvol days=xx"
+ or
+ "status dir days=xx"
+ My use case is to be able to preview the next scheduled job (and the
+ next tape to be used) on fridays if there are no scheduled jobs during
+ the weekend.
+- Fix font code in gnome2 console user patch. Fixes bug #501.
+- Fix malformatted bnet error message that caused seg fault
+ fixes bug 502
+- Applied user patch to improve README.vc8 in src/win32.
+- Ensure that StorageId is stored in Media record when ever possible.
+- Remove old code from winservice.cpp
+- Break on error in scan.
+- Fix typo in signal.c
+- Separate read/write DCR in SD. Add jcr->read_dcr.
+- Cleanup how find_device() works.
+- Remove abs() in bfile.c so that it compiles on Solaris. Bug #491.
+
Changes to 1.38.2:
- Fix crash in tray-monitor when daemon disconnects. Bug #479.
- Fix bnet-server bug found on OpenBSD. Bug #486
--- /dev/null
+#!/usr/bin/perl
+#
+# A bacula job report generator.
+# It require MySQL 4.1.x or later
+#
+# If you have any comments question feel free to contact me, jb@soe.se
+#
+# /Jonas Björklund
+#
+
+use DBI;
+
+$db_host = "localhost";
+$database = "bacula";
+$db_username = "bacula";
+$db_password = "bacula";
+$email = "$ARGV[0]";
+$from = "backup\@example.net";
+$when = "$ARGV[1]";
+
+if (!@ARGV) {
+ print "\n report.pl email@hostname.com (TODAY|YESTERDAY|WEEK|MONTH)\n\n";
+ exit;
+}
+
+
+if ($when eq "MONTH") {
+ $where = "StartTime > DATE_FORMAT(now() - INTERVAL 1 MONTH, '%Y-%m-%d')";
+ $order = "ORDER BY StartTime DESC";
+} elsif ($when eq "WEEK") {
+ $where = "StartTime > DATE_FORMAT(now() - INTERVAL 7 DAY, '%Y-%m-%d')";
+ $order = "ORDER BY StartTime DESC";
+} elsif ($when eq "YESTERDAY") {
+ $where = "StartTime > DATE_FORMAT(now() - INTERVAL 1 DAY, '%Y-%m-%d') AND StartTime < DATE_FORMAT(now(), '%Y-%m-%d')";
+ $order = "ORDER BY JobStatus,Time DESC";
+} else {
+ $when = "TODAY";
+ $where = "StartTime > curdate()";
+ $order = "ORDER BY JobStatus,Time DESC";
+}
+
+$sqlquery = "SELECT JobStatus,Name,Level,JobBytes,JobFiles,DATE_FORMAT(StartTime, '%Y-%m-%d %H:%i') AS Start, TIMEDIFF(EndTime,StartTime) AS Time,PoolId
+ FROM Job WHERE
+ $where
+ $order";
+
+$dbh = DBI->connect("DBI:mysql:database=$database:host=$db_host", $db_username,$db_password) or die;
+
+my $sth = $dbh->prepare("$sqlquery"); $sth->execute() or die "Can't execute SQL statement : $dbh->errstr";
+while(($jobstatus,$name,$level,$jobbytes,$jobfiles,$start,$time,$poolid) = $sth->fetchrow_array()) {
+ my $sth2 = $dbh->prepare("SELECT Name FROM Pool WHERE PoolId = $poolid"); $sth2->execute() or die "Can't execute SQL statement : $dbh->errstr";
+ ($poolname) = $sth2->fetchrow_array();
+ ($hours,$minutes,$seconds) = split(":", $time);
+ $seconds = sprintf("%.1f", $seconds + ($minutes * 60) + ($hours * 60 * 60));
+ $time = sprintf("%.1f", ($seconds + ($minutes * 60) + ($hours * 60 * 60)) / 60);
+ $bytesANDfiles = sprintf "%7.0f/%d", $jobbytes/1024/1024,$jobfiles;
+ $kbs = 0;
+ if ($jobbytes != 0) {
+ $kbs = ($jobbytes/$seconds)/1024;
+ }
+
+ $text .= sprintf "%s %18.18s %1s %14s %16s %5sm %4.0f %9.9s\n", $jobstatus,$name,$level,$bytesANDfiles,$start,$time,$kbs,$poolname;
+ $totalfiles = $totalfiles + $jobfiles;
+ $totalbytes = $totalbytes + $jobbytes;
+}
+$totalbytes = sprintf("%.1f",$totalbytes / 1024 / 1024 / 1024);
+
+my $sth = $dbh->prepare("SELECT count(*) FROM Job WHERE $where"); $sth->execute() or die "Can't execute SQL statement : $dbh->errstr";
+($count_total) = $sth->fetchrow_array();
+my $sth = $dbh->prepare("SELECT count(*) FROM Job WHERE $where AND JobStatus = 'T'"); $sth->execute() or die "Can't execute SQL statement : $dbh->errstr";
+($count_ok) = $sth->fetchrow_array();
+$count_fail = $count_total - $count_ok;
+$counts = sprintf("%.1f", 100- (($count_fail/$count_total)*100));
+
+
+open(MAIL,"|/usr/lib/sendmail -f$from -t");
+print MAIL "From: $from\n";
+print MAIL "To: $email\n";
+print MAIL "Subject: Backup ($when) $counts% OK - Total $count_total jobs, $count_fail failed\n";
+print MAIL "\n";
+print MAIL "Total $count_total jobs - $count_ok jobs are OK.\n";
+print MAIL "Total $totalbytes GB / $totalfiles files\n";
+print MAIL "\n";
+
+print MAIL "Status JobName Lvl MBytes/Files Start Time KB/s Pool\n";
+print MAIL "============================================================================\n";
+print MAIL $text;
+
+print MAIL "============================================================================\n";
+print MAIL <<EOF;
+
+
+Status codes:
+
+ T Terminated normally
+ E Terminated in Error
+ A Canceled by the user
+ C Created but not yet running
+ R Running
+ B Blocked
+ e Non-fatal error
+ f Fatal error
+ D Verify Differences
+ F Waiting on the File daemon
+ S Waiting on the Storage daemon
+ m Waiting for a new Volume to be mounted
+ M Waiting for a Mount
+ s Waiting for Storage resource
+ j Waiting for Job resource
+ c Waiting for Client resource
+ d Wating for Maximum jobs
+ t Waiting for Start Time
+ p Waiting for higher priority job to finish
+
+EOF
+close(MAIL);
--- /dev/null
+From: Joshua Kugler <joshua.kugler@uaf.edu>
+To: bacula-users@lists.sourceforge.net
+Subject: [Bacula-users] SSH tunneling mini-howto
+Date: Tue, 13 Dec 2005 16:59:47 -0900
+
+Here is an outline of the steps I took to get ssh tunneling to work for me.
+
+NOTES:
+I modified to ssh-tunnel.sh file from CVS because:
+1) I didn't need director->client communications encrypted. My main reason
+for using SSH tunneling was so the clients in the DMZ could get back through
+the firewall to connect to the storage server.
+2) There was a bug in the method it used to get the PID of the tunnel.
+It used 'cut -d" " -f1' The problem was that ps sometimes has a leading space
+in front of the PID if PID < 10,000, so cut would return a blank PID.
+Instead I used awk '{ print $1 }' and that worked even with leading spaces.
+3) I also took out ssh's 'v' option for production work
+4) I added '> /dev/null 2> /dev/null' because for some reason ssh wasn't fully
+disconnecting from the terminal, thus the ssh-tunnel script would actually
+hang the job
+5) I changed it to exit with the status of the SSH command, so the job would
+fail right away if the tunnel didn't go up.
+6) The $CLIENT is now specified on the command line so it can be specified in
+the Run Before Job directive. As a result, you must specify the client when
+you start *and* stop the tunnel.
+
+OK, on to the how to:
+
+1. I placed the attached script in /usr/local/bacula/scripts
+
+2. I modified bacula-dir.conf to have a second Storage directive entry that
+referenced the same storage resource in bacula-sd.conf. (Based on a recent
+e-mail, might this be dangerous? Testing will tell.)
+
+The modified Storage entry looked like this:
+
+Storage {
+ Name = herodotus-sd-ops
+ Address = localhost
+ SDPort = 9103
+ Password = "Apassword"
+ Device = AdicFastStor22
+ Media Type = DLT8000
+ Autochanger = yes
+ Maximum Concurrent Jobs = 30
+}
+
+The Address is set to localhost, because when the tunnel is up, the client
+will connect to localhost:9103 in order to connect to the Storage director.
+
+3. In the client configuration, each client that uses this configuration has
+these lines added:
+
+Run Before Job =3D "/usr/local/bacula/scripts/ssh-tunnel start FQDN"
+Run After Job =3D "/usr/local/bacula/scripts/ssh-tunnel stop FQDN"
+
+=46QDN =3D fully qualifed domain name (i.e. full host name)
+
+And their storage is set to "herodotus-sd-ops" (in our case, OPS is the name
+of our DMZ).
+
+4. Now, ssh keys must be created in order for all this to go on unattended.
+
+At the prompt, type:
+
+ssh -b 2048 -t dsa
+
+(if you want less bit strength, you can use a number less than 2048)
+
+When asked where to save the key, specify a location, or accept the default
+Just remember the location, because you will have to put it in the script
+(replace "/usr/local/bacula/ssh/id_dsa" with your file's location). Make
+sure the user as which bacula runs can read the file.
+
+When asked for a password, leave that blank also as this will be running
+unattended.
+
+After it generates the key, it will save a file called id_dsa, and in that
+same directory, there will be a file called id_dsa.pub, which is your public
+SSH key.
+
+On your backup client, create a user ('bacula' is probably a good choice).
+In that user's home directory, create a directory named '.ssh' (note the
+leading dot). In that directory, copy the id_dsa.pub file you create
+earlier. Once that file is in that user's directory copy it to a file name
+"authorized_keys" in that same directory. If you're not doing this as the
+user, make sure the directory and files a owned by that user. And for good
+measure make sure only the user can read them.
+
+5. Now, the test. Your keys are generated. They are in place on the client.
+You've pointed your script to your private key's file (id_dsa). Now, at the
+prompt on your server type:
+
+location_of_script/ssh-tunnel start client.host.name
+
+then type
+
+echo $?
+
+That should be 0, which will mean everything went well.
+
+If you need to debug, remove the redirection on the ssh command and add 'v' to
+the switches for verbose output.
+
+If the test went well, reload your modified config, and try running a job. If
+all goes well, the job report will look like it always does, save notices at
+the top and bottom letting you know that the tunnel went up and down.
+
+I've also gotten this to work on a Windows box using CopSSH (and OpenSSH
+server for Windows), so this isn't a Unix-only solution.
+
+The script is in <bacula-source>/examples/ssh-tunnel.sh
#!/bin/sh
# script for creating / stopping a ssh-tunnel to a backupclient
# Stephan Holl<sholl@gmx.net>
+# Modified by Joshua Kugler <joshua.kugler@uaf.edu>
#
#
# variables
-USER=xxxx
-CLIENT=domain.com
-CLIENT_PORT=9112
-LOCAL=192.168.2.4
-LOCAL_PORT=$CLIENT_PORT
+USER=bacula
+CLIENT=$2
+LOCAL=your.backup.server.host.name
SSH=/usr/bin/ssh
-
case "$1" in
start)
# create ssh-tunnel
-
- echo "Start SSH-tunnel to $CLIENT..."
- $SSH -vfnCNg2 -o PreferredAuthentications=publickey -i /var/lib/bacula/.ssh/id_dsa -l $USER -L $CLIENT_PORT:$CLIENT:$LOCAL_PORT -R 9101:$LOCAL:9101 -R 9103:$LOCAL:9103 $CLIENT
- exit 0
- ;;
+ echo "Starting SSH-tunnel to $CLIENT..."
+ $SSH -fnCN2 -o PreferredAuthentications=publickey -i /usr/local/bacula/ssh/id_dsa -l $USER -R 9101:$LOCAL:9101 -R 9103:$LOCAL:9103 $CLIENT > /dev/null 2> /dev/null
+ exit $?
+ ;;
stop)
- # remove tunnel
- echo "Stop SSH-tunnel to $CLIENT..."
-
- # find PID killem
- PID=`ps ax|grep "/usr/bin/ssh -vfnCNg2 -o PreferredAuthentications=publickey -i /var/lib/bacula/.ssh/id_dsa -l $USER -L $CLIENT_PORT:$CLIENT:$LOCAL_PORT -R 9101:$LOCAL:9101 -R 9103:$LOCAL:9103 $CLIENT &"|cut -d" " -f1`
- kill $PID
- exit 0
- ;;
+ # remove tunnel
+ echo "Stopping SSH-tunnel to $CLIENT..."
+ # find PID killem
+ PID=`ps ax | grep "ssh -fnCN2 -o PreferredAuthentications=publickey -i /usr/local/bacula/ssh/id_dsa" | grep "$CLIENT" | awk '{ print $1 }'`
+ kill $PID
+ exit $?
+ ;;
*)
- # usage:
- echo " "
- echo " Start SSH-tunnel to client-host"
- echo " to bacula-director and storage-daemon"
- echo " "
- echo " USAGE:"
- echo " ssh-tunnel.sh {start|stop}"
- echo " "
- exit 1
- ;;
+ # usage:
+ echo " "
+ echo " Start SSH-tunnel to client-host"
+ echo " to bacula-director and storage-daemon"
+ echo " "
+ echo " USAGE:"
+ echo " ssh-tunnel.sh {start|stop} client.fqdn"
+ echo ""
+ exit 1
+ ;;
esac
-
-
General:
Changes to 1.38.3:
+17Dec05
+- Fix seg fault if user labels a drive directory bug #513
+- Remove quotes around Version as it breaks things.
+16Dec05
+- Merge in Aleksandar Milivojevic's mods to the spec file.
+- Apply sparse code fix for raw drives and fifos. Bug 506
+- Thorsten fixed Unicode cd problem with wx-console bug 505.
+Beta release 14Dec05:
+14Dec05
+- Correct reservation system to do a last ditch try
+ for any mounted volume, then anyone anywhere.
+- Add quotes around table Version because of
+ error in MySQL 4.1.15 -- bug report submitted.
+- Correct some minor problems with btape in the fill
+ command.
+- Updates to ssh-tunnel from Joshua Kugler.
+- Added a report.pl program from Jonas Bjorklund.
+- Simplify the O_NONBLOCK open() code for tape drives,
+ and always open nonblocking.
+- Do not wait for open() if EIO returned (shouldn't happen).
+- Eliminate 3 argument to tape open().
+- Correct the slot # edited in the 3995 Bad autochanger unload
+ message.
+- With -S on bscan (show progress) do not divide by zero.
+ Bug #510
+13Dec05
+- Make cancel pthread_cond_signal() pthread_cond_broadcast().
+- When dcr is freed, also broadcast dev->wait_next_vol signal.
+- Remove unused code in wait_for_device.
+- Make wait_for_device() always return after 60 seconds of wait.
12Dec05
- Use localhost if no network configured
11Dec05
- Eliminated duplicate MaxVolBytes in cat update -- bug 509.
- Remove debug print.
- Add bail_out in error during state file reading.
+Beta release 10Dec05:
09Dec05
- Merge updates into 1.38 branch
- Update specs to include mysql4 define.
My use case is to be able to preview the next scheduled job (and the
next tape to be used) on fridays if there are no scheduled jobs during
the weekend.
-Changes to 1.39.1:
03Dec05
- Fix font code in gnome2 console user patch. Fixes bug #501.
- Fix malformatted bnet error message that caused seg fault
General:
+Changes to 1.39.3:
+17Dec05
+- Fix seg fault if user labels a drive directory bug #513
+- Remove quotes around Version as it breaks things.
+16Dec05
+- Merge in Aleksandar Milivojevic's mods to the spec file.
+- Apply sparse code fix for raw drives and fifos. Bug 506
+- Thorsten fixed Unicode cd problem with wx-console bug 505.
+14Dec05
+- Correct reservation system to do a last ditch try
+ for any mounted volume, then anyone anywhere.
+- Add quotes around table Version because of
+ error in MySQL 4.1.15 -- bug report submitted.
+- Correct some minor problems with btape in the fill
+ command.
+- Updates to ssh-tunnel from Joshua Kugler.
+- Added a report.pl program from Jonas Bjorklund.
+- Simplify the O_NONBLOCK open() code for tape drives,
+ and always open nonblocking.
+- Do not wait for open() if EIO returned (shouldn't happen).
+- Eliminate 3 argument to tape open().
+- Correct the slot # edited in the 3995 Bad autochanger unload
+ message.
+- With -S on bscan (show progress) do not divide by zero.
+13Dec05
+- Make cancel pthread_cond_signal() pthread_cond_broadcast().
+- When dcr is freed, also broadcast dev->wait_next_vol signal.
+- Remove unused code in wait_for_device.
+- Make wait_for_device() always return after 60 seconds of wait.
+
Changes to 1.39.2:
13Dec05
- Add stubs for non-crypto build.
%define depkgs_version 22Jun05
%define sqlite_bindir /usr/lib/bacula/sqlite
%define working_dir /var/bacula
-%define daemon_user root
+%define director_daemon_user bacula
+%define storage_daemon_user bacula
+%define file_daemon_user root
%define daemon_group bacula
+# group that has write access to tape devices, usually disk on Linux
+%define device_group disk
+%define user_file /etc/passwd
%define group_file /etc/group
+%define useradd /usr/sbin/useradd
%define groupadd /usr/sbin/groupadd
%define _rescuever 1.8.1
%define fc3 0
%{?build_fc3:%define fc3 1}
%define fc4 0
-%{?build_fc4:%define fc4 1}
+%{?build_fc4:%define fc3 1}
# Whitebox Enterprise build
%define wb3 0
%{?build_wb3:%define wb3 1}
%{?build_rhel3:%define wb3 1}
%define rhel4 0
%{?build_rhel4:%define rhel4 1}
-%{?build_rhel4:%define fc4 1}
+%{?build_rhel4:%define fc3 1}
# CentOS build
%define centos4 0
%{?build_centos4:%define centos4 1}
-%{?build_centos4:%define fc4 1}
+%{?build_centos4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%{?build_mdk:%define mdk 1}
# test for a platform definition
-%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{fc4} && ! %{wb3} && ! %{su9} && ! %{mdk}
+%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{wb3} && ! %{su9} && ! %{mdk}
%{error: You must specify a platform. Please examine the spec file.}
exit 1
%endif
%{?build_postgresql:%define postgresql 1}
# test for a database definition
-%if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{mysql4}
+%if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
%{error: You must specify database support. Please examine the spec file.}
exit 1
%endif
+%if %{mysql}
+%define db_backend mysql
+%endif
+%if %{sqlite}
+%define db_backend sqlite
+%endif
+%if %{postgresql}
+%define db_backend postgresql
+%endif
+
# 64 bit support
%define x86_64 0
%{?build_x86_64:%define x86_64 1}
%if %{centos4}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} || %{fc4} && ! %{rhel4} && ! %{centos4}
+%if %{fc3} && ! %{rhel4} && ! %{centos4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
%if %{wb3} && ! %{rhel3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9}
-%define _dist %(grep -i SuSE /etc/SuSE-release)
+%define _dist %(grep SuSE /etc/SuSE-release)
%endif
%if %{mdk}
%define _dist %(grep Mandrake /etc/mandrake-release)
%endif
+# Should we build gconsole, possible only if gnome >= 2.0 available
+%if %{rh7}
+%define gconsole 0
+%else
+%define gconsole 1
+%endif
+
Summary: Bacula - The Network Backup Solution
Name: bacula
Version: @VERSION@
-Release: 2
+Release: 1
Group: System Environment/Daemons
License: GPL v2
Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
BuildRequires: atk-devel, ncurses-devel, pango-devel, perl
BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel, pkgconfig
+BuildRequires: openssl-devel
%if %{rh7}
BuildRequires: libtermcap-devel
-BuildRequires: gtk+-devel >= 1.2
-BuildRequires: gnome-libs-devel >= 1.4
BuildRequires: glibc-devel >= 2.2
BuildRequires: ORBit-devel
-BuildRequires: bonobo-devel
-BuildRequires: GConf-devel
-BuildRequires: freetype-devel
%endif
%if %{su9}
BuildRequires: termcap
BuildRequires: glibc-static-devel
BuildRequires: freetype2-devel
%endif
-%if %{fc3} || %{fc4}
+%if %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.4
BuildRequires: libgnomeui-devel >= 2.8
BuildRequires: GConf2-devel
BuildRequires: freetype-devel
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && !%{fc4}
+%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.0
BuildRequires: libgnomeui-devel >= 2.0
Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
Conflicts: bacula-client
Obsoletes: bacula-rescue
-Requires: ncurses, libstdc++, zlib
+Requires: ncurses, libstdc++, zlib, openssl, mtx
%if %{rh7}
Requires: glibc >= 2.2
This build incorporates sqlite as the catalog database, statically compiled.
%endif
+%package mtx
+Summary: Bacula - The Network Backup Solution
+Group: System Environment/Daemons
+Provides: mtx
+
+%description mtx
+This is Bacula's version of mtx tape utilities for Linux distributions that
+do not provide their own mtx package
+
%package client
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Provides: bacula-fd
+Conflicts: bacula-mysql
+Conflicts: bacula-sqlite
+Conflicts: bacula-postgresql
Obsoletes: bacula-rescue
-Requires: libstdc++, zlib
+Requires: libstdc++, zlib, openssl
%if %{rh7}
Requires: glibc >= 2.2
This package installs scripts for updating older versions of the bacula
database.
+%if %{gconsole}
%package gconsole
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Requires: atk, libstdc++, zlib, pango, libxml2, bacula-fd
-
-%if %{rh7}
-Requires: gtk+ >= 1.2
-Requires: gnome-libs >= 1.4
-Requires: glibc >= 2.2
-Requires: ORBit
-Requires: bonobo
-Requires: GConf
-Requires: freetype
+Requires: usermode, openssl
%endif
-%if %{su9}
+
+%if %{gconsole} && %{su9}
Requires: gtk2 >= 2.0
Requires: libgnome >= 2.0
Requires: libgnomeui >= 2.0
Requires: linc
Requires: freetype2
%endif
-%if %{mdk}
+%if %{gconsole} && %{mdk}
Requires: gtk2 >= 2.0
Requires: libgnomeui2
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype2
%endif
-%if %{fc3} || %{fc4}
+%if %{gconsole} && %{fc3}
Requires: gtk2 >= 2.4
Requires: libgnomeui >= 2.8
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && ! %{fc4}
+%if %{gconsole} && ! %{su9} && ! %{mdk} && ! %{fc3}
Requires: gtk2 >= 2.0
Requires: libgnomeui >= 2.0
Requires: glibc >= 2.3
Requires: linc
Requires: freetype
%endif
-%if %{su9}
+%if %{gconsole} && %{su9}
Requires: xsu
-%else
-Requires: usermode
%endif
+%if %{gconsole}
%description gconsole
Bacula - It comes by night and sucks the vital essence from your computers.
This is the Gnome Console package. It is an add-on to the client or
server packages.
+%endif
%prep
--sysconfdir=/etc/bacula \
--with-scriptdir=/etc/bacula \
--enable-smartalloc \
+%if %{gconsole}
--enable-gnome \
-%if ! %{rh7} && ! %{rh8}
+%endif
+%if %{gconsole} && ! %{rh8}
--enable-tray-monitor \
%endif
%if %{mysql}
--with-working-dir=%{working_dir} \
--with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
- --with-dir-user=%{daemon_user} \
+ --with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
- --with-sd-user=%{daemon_user} \
+ --with-sd-user=%{storage_daemon_user} \
--with-sd-group=%{daemon_group} \
- --with-fd-user=%{daemon_user} \
- --with-fd-group=%{daemon_group}
+ --with-fd-user=%{file_daemon_user} \
+ --with-fd-group=%{daemon_group} \
+ --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
+ --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
+ --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
+ --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
+ --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
+ --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
+ --with-openssl
+
make
%install
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
-%if %{rh7}
-mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
-%else
+%if %{gconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
%endif
mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
mkdir -p $RPM_BUILD_ROOT/usr/bin
chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
# install the menu stuff
-%if %{su9}
+%if %{gconsole} && %{su9}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if %{rh7}
-cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
-cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
-cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
-cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
-ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
+%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{mdk}
+%define iftrick 1
+%else
+%define iftrick 0
%endif
-%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{mdk}
+%if %{gconsole} && %{iftrick}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
# now clean up permissions that are left broken by the install
chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
chmod o-rwx $RPM_BUILD_ROOT/var/bacula
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
%endif
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
-%if %{mysql}
+%if %{mysql}
+# MySQL specific files
%files mysql
+%defattr(-, root, root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/startmysql
+%attr(0750, root, %{daemon_group}) /etc/bacula/stopmysql
+%endif
+
+%if %{sqlite}
+%files sqlite
%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%{sqlite_bindir}/libsqlite.a
+%{sqlite_bindir}/sqlite.h
+%{sqlite_bindir}/sqlite
+%endif
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_mysql_database
-/etc/bacula/drop_mysql_database
-/etc/bacula/make_mysql_tables
-/etc/bacula/drop_mysql_tables
-/etc/bacula/update_mysql_tables
-/etc/bacula/grant_mysql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/startmysql
-/etc/bacula/stopmysql
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
+%if %{postgresql}
+%files postgresql
+%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%endif
+
+# The rest is DB backend independent
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/mtx-changer
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-freespace
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-writepart
+%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-handler
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-dir
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-fd
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-sd
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
+%attr(0640, root, %{daemon_group}) /etc/bacula/query.sql
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-dir
/usr/sbin/bacula-fd
/usr/sbin/btraceback
/usr/sbin/bconsole
/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
+%if %{mysql}
%pre mysql
# test for bacula database older than version 8
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
+%endif
+
+%if %{sqlite}
+%pre sqlite
+# test for bacula database older than version 8
+if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
+ DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
+%endif
+
+%if %{postgresql}
+%pre postgresql
+DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
+%endif
if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
echo "This bacula upgrade will update a bacula database from version 8 to 9."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
+ echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 8 can be found in the release notes."
exit 1
fi
+
+%if %{sqlite}
+fi
+%endif
+
# check for and copy /etc/bacula/console.conf to bconsole.conf
if [ -s /etc/bacula/console.conf ];then
cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
fi
+# create the daemon user and group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -G %{device_group} -M -n -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
+ echo "The user %{storage_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
+ echo "The user %{director_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%if %{mysql}
%post mysql
+%endif
+%if %{sqlite}
+%post sqlite
+%endif
+%if %{postgresql}
+%post postgresql
+%endif
# add our links
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-sd
fi
+%if %{mysql}
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun mysql
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{sqlite}
-
-%files sqlite
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/create_sqlite_database
-/etc/bacula/drop_sqlite_database
-/etc/bacula/grant_sqlite_privileges
-/etc/bacula/make_sqlite_tables
-/etc/bacula/drop_sqlite_tables
-/etc/bacula/update_sqlite_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%{sqlite_bindir}/libsqlite.a
-%{sqlite_bindir}/sqlite.h
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-%{sqlite_bindir}/sqlite
-
-
-%pre sqlite
-# test for bacula database older than version 8
-if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
- DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
- if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
- fi
-fi
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
-fi
-
-%post sqlite
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
if [ -s %{working_dir}/bacula.db ]; then
DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
# check to see if we need to upgrade a 1.36 or lower database
- if [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade requires a database update to version 9. You appear to"
- echo "be running database version $DB_VER. You must update your database using the"
- echo "upgrade scripts in the bacula-updatedb package. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- fi
-
if [ "$DB_VER" -lt "9" ] && [ "$DB_VER" -ge "8" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
echo "Creating the SQLite tables..."
/etc/bacula/make_sqlite_tables
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun sqlite
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{postgresql}
-
-%files postgresql
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_postgresql_database
-/etc/bacula/drop_postgresql_database
-/etc/bacula/make_postgresql_tables
-/etc/bacula/drop_postgresql_tables
-/etc/bacula/update_postgresql_tables
-/etc/bacula/grant_postgresql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-
-%pre postgresql
-# test for bacula database older than version 8
-# note: this ASSUMES no password has been set for bacula database
-DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
-
-if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_postgresql_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
-fi
-
-%post postgresql
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
+%endif
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{groupfile}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
-
+%if %{mysql}
+%preun mysql
+%endif
+%if %{sqlite}
+%preun sqlite
+%endif
+%if %{postgresql}
%preun postgresql
+%endif
+
# delete our links
if [ $1 = 0 ]; then
/sbin/chkconfig --del bacula-dir
/sbin/chkconfig --del bacula-sd
fi
-%endif
+
+%files mtx
+/usr/sbin/loaderinfo
+/usr/sbin/mtx
+/usr/sbin/scsitape
+/usr/sbin/tapeinfo
+/usr/man/man1/*
+
%files client
%defattr(-,root,root)
-
-/etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
/etc/init.d/bacula-fd
-/etc/bacula/rescue
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-/etc/bacula/btraceback.gdb
-/etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
/usr/sbin/bsmtp
/usr/sbin/bconsole
+%pre client
+# create the daemon group and user
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post client
# add our link
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-fd
fi
-# create the daemon group
-HAVE_BACULA=`cat %{group_file} | grep %{daemon_group} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
%preun client
fi
%files updatedb
-%defattr(-,root,root)
+%defattr(-,root,%{daemon_group})
/etc/bacula/updatedb/*
+%pre updatedb
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post updatedb
echo "The database update scripts were installed to /etc/bacula/updatedb"
+%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-/etc/bacula/gconsole
-%config(noreplace) /etc/bacula/gnome-console.conf
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(075, root, %{daemon_group}) /etc/bacula/gconsole
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
/usr/share/pixmaps/bacula.png
+%endif
-%if %{rh7}
-/usr/share/gnome/apps/System/bacula.desktop
-%else
+%if %{gconsole}
/usr/share/applications/bacula.desktop
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
%config(noreplace) /etc/bacula/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
# add the console helper files
%config(noreplace,missingok) /etc/pam.d/gnome-console
%config(noreplace,missingok) /etc/security/console.apps/gnome-console
/usr/bin/gnome-console
%endif
+%if %{gconsole}
+%pre gconsole
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%post gconsole
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
+fi
+%endif
%changelog
+* Wed Dec 14 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- 1.38.2 release
+- Reorganize files and pre/post sections to remove repetitions
+- Always build separate mtx package
+- Fix file ownerships for /etc/bacula and Bacula's working dir
+* Wed Nov 23 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Disable GNOME on RH7
+* Fri Nov 18 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Red Hat and look alikes have mtx RPM, do not build/package our version
* Sun Nov 13 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
- minor edit to _dist for SLES9 compatibility
* Sat Nov 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
%define depkgs_version 22Jun05
%define sqlite_bindir /usr/lib/bacula/sqlite
%define working_dir /var/bacula
-%define daemon_user root
+%define director_daemon_user bacula
+%define storage_daemon_user bacula
+%define file_daemon_user root
%define daemon_group bacula
+# group that has write access to tape devices, usually disk on Linux
+%define device_group disk
+%define user_file /etc/passwd
%define group_file /etc/group
+%define useradd /usr/sbin/useradd
%define groupadd /usr/sbin/groupadd
%define _rescuever 1.8.1
%define fc3 0
%{?build_fc3:%define fc3 1}
%define fc4 0
-%{?build_fc4:%define fc4 1}
+%{?build_fc4:%define fc3 1}
# Whitebox Enterprise build
%define wb3 0
%{?build_wb3:%define wb3 1}
%{?build_rhel3:%define wb3 1}
%define rhel4 0
%{?build_rhel4:%define rhel4 1}
-%{?build_rhel4:%define fc4 1}
+%{?build_rhel4:%define fc3 1}
# CentOS build
%define centos4 0
%{?build_centos4:%define centos4 1}
-%{?build_centos4:%define fc4 1}
+%{?build_centos4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%{?build_mdk:%define mdk 1}
# test for a platform definition
-%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{fc4} && ! %{wb3} && ! %{su9} && ! %{mdk}
+%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{wb3} && ! %{su9} && ! %{mdk}
%{error: You must specify a platform. Please examine the spec file.}
exit 1
%endif
%{?build_postgresql:%define postgresql 1}
# test for a database definition
-%if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{mysql4}
+%if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
%{error: You must specify database support. Please examine the spec file.}
exit 1
%endif
+%if %{mysql}
+%define db_backend mysql
+%endif
+%if %{sqlite}
+%define db_backend sqlite
+%endif
+%if %{postgresql}
+%define db_backend postgresql
+%endif
+
# 64 bit support
%define x86_64 0
%{?build_x86_64:%define x86_64 1}
%if %{centos4}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} || %{fc4} && ! %{rhel4} && ! %{centos4}
+%if %{fc3} && ! %{rhel4} && ! %{centos4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
%if %{wb3} && ! %{rhel3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9}
-%define _dist %(grep -i SuSE /etc/SuSE-release)
+%define _dist %(grep SuSE /etc/SuSE-release)
%endif
%if %{mdk}
%define _dist %(grep Mandrake /etc/mandrake-release)
%endif
+# Should we build gconsole, possible only if gnome >= 2.0 available
+%if %{rh7}
+%define gconsole 0
+%else
+%define gconsole 1
+%endif
+
Summary: Bacula - The Network Backup Solution
Name: bacula
Version: @VERSION@
-Release: 2
+Release: 1
Group: System Environment/Daemons
License: GPL v2
Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
BuildRequires: atk-devel, ncurses-devel, pango-devel, perl
BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel, pkgconfig
+BuildRequires: openssl-devel
%if %{rh7}
BuildRequires: libtermcap-devel
-BuildRequires: gtk+-devel >= 1.2
-BuildRequires: gnome-libs-devel >= 1.4
BuildRequires: glibc-devel >= 2.2
BuildRequires: ORBit-devel
-BuildRequires: bonobo-devel
-BuildRequires: GConf-devel
-BuildRequires: freetype-devel
%endif
%if %{su9}
BuildRequires: termcap
BuildRequires: glibc-static-devel
BuildRequires: freetype2-devel
%endif
-%if %{fc3} || %{fc4}
+%if %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.4
BuildRequires: libgnomeui-devel >= 2.8
BuildRequires: GConf2-devel
BuildRequires: freetype-devel
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && !%{fc4}
+%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.0
BuildRequires: libgnomeui-devel >= 2.0
Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
Conflicts: bacula-client
Obsoletes: bacula-rescue
-Requires: ncurses, libstdc++, zlib
+Requires: ncurses, libstdc++, zlib, openssl, mtx
%if %{rh7}
Requires: glibc >= 2.2
This build incorporates sqlite as the catalog database, statically compiled.
%endif
+%package mtx
+Summary: Bacula - The Network Backup Solution
+Group: System Environment/Daemons
+Provides: mtx
+
+%description mtx
+This is Bacula's version of mtx tape utilities for Linux distributions that
+do not provide their own mtx package
+
%package client
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Provides: bacula-fd
+Conflicts: bacula-mysql
+Conflicts: bacula-sqlite
+Conflicts: bacula-postgresql
Obsoletes: bacula-rescue
-Requires: libstdc++, zlib
+Requires: libstdc++, zlib, openssl
%if %{rh7}
Requires: glibc >= 2.2
This package installs scripts for updating older versions of the bacula
database.
+%if %{gconsole}
%package gconsole
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Requires: atk, libstdc++, zlib, pango, libxml2, bacula-fd
-
-%if %{rh7}
-Requires: gtk+ >= 1.2
-Requires: gnome-libs >= 1.4
-Requires: glibc >= 2.2
-Requires: ORBit
-Requires: bonobo
-Requires: GConf
-Requires: freetype
+Requires: usermode, openssl
%endif
-%if %{su9}
+
+%if %{gconsole} && %{su9}
Requires: gtk2 >= 2.0
Requires: libgnome >= 2.0
Requires: libgnomeui >= 2.0
Requires: linc
Requires: freetype2
%endif
-%if %{mdk}
+%if %{gconsole} && %{mdk}
Requires: gtk2 >= 2.0
Requires: libgnomeui2
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype2
%endif
-%if %{fc3} || %{fc4}
+%if %{gconsole} && %{fc3}
Requires: gtk2 >= 2.4
Requires: libgnomeui >= 2.8
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && ! %{fc4}
+%if %{gconsole} && ! %{su9} && ! %{mdk} && ! %{fc3}
Requires: gtk2 >= 2.0
Requires: libgnomeui >= 2.0
Requires: glibc >= 2.3
Requires: linc
Requires: freetype
%endif
-%if %{su9}
+%if %{gconsole} && %{su9}
Requires: xsu
-%else
-Requires: usermode
%endif
+%if %{gconsole}
%description gconsole
Bacula - It comes by night and sucks the vital essence from your computers.
This is the Gnome Console package. It is an add-on to the client or
server packages.
+%endif
%prep
--sysconfdir=/etc/bacula \
--with-scriptdir=/etc/bacula \
--enable-smartalloc \
+%if %{gconsole}
--enable-gnome \
-%if ! %{rh7} && ! %{rh8}
+%endif
+%if %{gconsole} && ! %{rh8}
--enable-tray-monitor \
%endif
%if %{mysql}
--with-working-dir=%{working_dir} \
--with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
- --with-dir-user=%{daemon_user} \
+ --with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
- --with-sd-user=%{daemon_user} \
+ --with-sd-user=%{storage_daemon_user} \
--with-sd-group=%{daemon_group} \
- --with-fd-user=%{daemon_user} \
- --with-fd-group=%{daemon_group}
+ --with-fd-user=%{file_daemon_user} \
+ --with-fd-group=%{daemon_group} \
+ --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
+ --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
+ --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
+ --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
+ --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
+ --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
+ --with-openssl
+
make
%install
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
-%if %{rh7}
-mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
-%else
+%if %{gconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
%endif
mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
mkdir -p $RPM_BUILD_ROOT/usr/bin
chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
# install the menu stuff
-%if %{su9}
+%if %{gconsole} && %{su9}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if %{rh7}
-cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
-cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
-cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
-cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
-ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
+%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{mdk}
+%define iftrick 1
+%else
+%define iftrick 0
%endif
-%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{mdk}
+%if %{gconsole} && %{iftrick}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
# now clean up permissions that are left broken by the install
chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
chmod o-rwx $RPM_BUILD_ROOT/var/bacula
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
%endif
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
-%if %{mysql}
+%if %{mysql}
+# MySQL specific files
%files mysql
+%defattr(-, root, root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/startmysql
+%attr(0750, root, %{daemon_group}) /etc/bacula/stopmysql
+%endif
+
+%if %{sqlite}
+%files sqlite
%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%{sqlite_bindir}/libsqlite.a
+%{sqlite_bindir}/sqlite.h
+%{sqlite_bindir}/sqlite
+%endif
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_mysql_database
-/etc/bacula/drop_mysql_database
-/etc/bacula/make_mysql_tables
-/etc/bacula/drop_mysql_tables
-/etc/bacula/update_mysql_tables
-/etc/bacula/grant_mysql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/startmysql
-/etc/bacula/stopmysql
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
+%if %{postgresql}
+%files postgresql
+%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%endif
+
+# The rest is DB backend independent
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/mtx-changer
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-freespace
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-writepart
+%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-handler
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-dir
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-fd
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-sd
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
+%attr(0640, root, %{daemon_group}) /etc/bacula/query.sql
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-dir
/usr/sbin/bacula-fd
/usr/sbin/btraceback
/usr/sbin/bconsole
/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
+%if %{mysql}
%pre mysql
# test for bacula database older than version 8
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
+%endif
+
+%if %{sqlite}
+%pre sqlite
+# test for bacula database older than version 8
+if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
+ DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
+%endif
+
+%if %{postgresql}
+%pre postgresql
+DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
+%endif
if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
echo "This bacula upgrade will update a bacula database from version 8 to 9."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
+ echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 8 can be found in the release notes."
exit 1
fi
+
+%if %{sqlite}
+fi
+%endif
+
# check for and copy /etc/bacula/console.conf to bconsole.conf
if [ -s /etc/bacula/console.conf ];then
cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
fi
+# create the daemon user and group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -G %{device_group} -M -n -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
+ echo "The user %{storage_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
+ echo "The user %{director_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%if %{mysql}
%post mysql
+%endif
+%if %{sqlite}
+%post sqlite
+%endif
+%if %{postgresql}
+%post postgresql
+%endif
# add our links
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-sd
fi
+%if %{mysql}
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun mysql
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{sqlite}
-
-%files sqlite
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/create_sqlite_database
-/etc/bacula/drop_sqlite_database
-/etc/bacula/grant_sqlite_privileges
-/etc/bacula/make_sqlite_tables
-/etc/bacula/drop_sqlite_tables
-/etc/bacula/update_sqlite_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%{sqlite_bindir}/libsqlite.a
-%{sqlite_bindir}/sqlite.h
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-%{sqlite_bindir}/sqlite
-
-
-%pre sqlite
-# test for bacula database older than version 8
-if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
- DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
- if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
- fi
-fi
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
-fi
-
-%post sqlite
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
if [ -s %{working_dir}/bacula.db ]; then
DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
# check to see if we need to upgrade a 1.36 or lower database
- if [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade requires a database update to version 9. You appear to"
- echo "be running database version $DB_VER. You must update your database using the"
- echo "upgrade scripts in the bacula-updatedb package. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- fi
-
if [ "$DB_VER" -lt "9" ] && [ "$DB_VER" -ge "8" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
echo "Creating the SQLite tables..."
/etc/bacula/make_sqlite_tables
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun sqlite
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{postgresql}
-
-%files postgresql
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_postgresql_database
-/etc/bacula/drop_postgresql_database
-/etc/bacula/make_postgresql_tables
-/etc/bacula/drop_postgresql_tables
-/etc/bacula/update_postgresql_tables
-/etc/bacula/grant_postgresql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-
-%pre postgresql
-# test for bacula database older than version 8
-# note: this ASSUMES no password has been set for bacula database
-DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
-
-if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_postgresql_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
-fi
-
-%post postgresql
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
+%endif
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{groupfile}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
-
+%if %{mysql}
+%preun mysql
+%endif
+%if %{sqlite}
+%preun sqlite
+%endif
+%if %{postgresql}
%preun postgresql
+%endif
+
# delete our links
if [ $1 = 0 ]; then
/sbin/chkconfig --del bacula-dir
/sbin/chkconfig --del bacula-sd
fi
-%endif
+
+%files mtx
+/usr/sbin/loaderinfo
+/usr/sbin/mtx
+/usr/sbin/scsitape
+/usr/sbin/tapeinfo
+/usr/man/man1/*
+
%files client
%defattr(-,root,root)
-
-/etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
/etc/init.d/bacula-fd
-/etc/bacula/rescue
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-/etc/bacula/btraceback.gdb
-/etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
/usr/sbin/bsmtp
/usr/sbin/bconsole
+%pre client
+# create the daemon group and user
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post client
# add our link
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-fd
fi
-# create the daemon group
-HAVE_BACULA=`cat %{group_file} | grep %{daemon_group} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
%preun client
fi
%files updatedb
-%defattr(-,root,root)
+%defattr(-,root,%{daemon_group})
/etc/bacula/updatedb/*
+%pre updatedb
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post updatedb
echo "The database update scripts were installed to /etc/bacula/updatedb"
+%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-/etc/bacula/gconsole
-%config(noreplace) /etc/bacula/gnome-console.conf
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(075, root, %{daemon_group}) /etc/bacula/gconsole
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
/usr/share/pixmaps/bacula.png
+%endif
-%if %{rh7}
-/usr/share/gnome/apps/System/bacula.desktop
-%else
+%if %{gconsole}
/usr/share/applications/bacula.desktop
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
%config(noreplace) /etc/bacula/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
# add the console helper files
%config(noreplace,missingok) /etc/pam.d/gnome-console
%config(noreplace,missingok) /etc/security/console.apps/gnome-console
/usr/bin/gnome-console
%endif
+%if %{gconsole}
+%pre gconsole
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%post gconsole
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
+fi
+%endif
%changelog
+* Wed Dec 14 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- 1.38.2 release
+- Reorganize files and pre/post sections to remove repetitions
+- Always build separate mtx package
+- Fix file ownerships for /etc/bacula and Bacula's working dir
+* Wed Nov 23 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Disable GNOME on RH7
+* Fri Nov 18 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Red Hat and look alikes have mtx RPM, do not build/package our version
* Sun Nov 13 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
- minor edit to _dist for SLES9 compatibility
* Sat Nov 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
%define depkgs_version 22Jun05
%define sqlite_bindir /usr/lib/bacula/sqlite
%define working_dir /var/bacula
-%define daemon_user root
+%define director_daemon_user bacula
+%define storage_daemon_user bacula
+%define file_daemon_user root
%define daemon_group bacula
+# group that has write access to tape devices, usually disk on Linux
+%define device_group disk
+%define user_file /etc/passwd
%define group_file /etc/group
+%define useradd /usr/sbin/useradd
%define groupadd /usr/sbin/groupadd
%define _rescuever 1.8.1
%define fc3 0
%{?build_fc3:%define fc3 1}
%define fc4 0
-%{?build_fc4:%define fc4 1}
+%{?build_fc4:%define fc3 1}
# Whitebox Enterprise build
%define wb3 0
%{?build_wb3:%define wb3 1}
%{?build_rhel3:%define wb3 1}
%define rhel4 0
%{?build_rhel4:%define rhel4 1}
-%{?build_rhel4:%define fc4 1}
+%{?build_rhel4:%define fc3 1}
# CentOS build
%define centos4 0
%{?build_centos4:%define centos4 1}
-%{?build_centos4:%define fc4 1}
+%{?build_centos4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%{?build_mdk:%define mdk 1}
# test for a platform definition
-%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{fc4} && ! %{wb3} && ! %{su9} && ! %{mdk}
+%if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{wb3} && ! %{su9} && ! %{mdk}
%{error: You must specify a platform. Please examine the spec file.}
exit 1
%endif
%{?build_postgresql:%define postgresql 1}
# test for a database definition
-%if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{mysql4}
+%if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
%{error: You must specify database support. Please examine the spec file.}
exit 1
%endif
+%if %{mysql}
+%define db_backend mysql
+%endif
+%if %{sqlite}
+%define db_backend sqlite
+%endif
+%if %{postgresql}
+%define db_backend postgresql
+%endif
+
# 64 bit support
%define x86_64 0
%{?build_x86_64:%define x86_64 1}
%if %{centos4}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} || %{fc4} && ! %{rhel4} && ! %{centos4}
+%if %{fc3} && ! %{rhel4} && ! %{centos4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
%if %{wb3} && ! %{rhel3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9}
-%define _dist %(grep -i SuSE /etc/SuSE-release)
+%define _dist %(grep SuSE /etc/SuSE-release)
%endif
%if %{mdk}
%define _dist %(grep Mandrake /etc/mandrake-release)
%endif
+# Should we build gconsole, possible only if gnome >= 2.0 available
+%if %{rh7}
+%define gconsole 0
+%else
+%define gconsole 1
+%endif
+
Summary: Bacula - The Network Backup Solution
Name: bacula
Version: @VERSION@
-Release: 2
+Release: 1
Group: System Environment/Daemons
License: GPL v2
Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
BuildRequires: atk-devel, ncurses-devel, pango-devel, perl
BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel, pkgconfig
+BuildRequires: openssl-devel
%if %{rh7}
BuildRequires: libtermcap-devel
-BuildRequires: gtk+-devel >= 1.2
-BuildRequires: gnome-libs-devel >= 1.4
BuildRequires: glibc-devel >= 2.2
BuildRequires: ORBit-devel
-BuildRequires: bonobo-devel
-BuildRequires: GConf-devel
-BuildRequires: freetype-devel
%endif
%if %{su9}
BuildRequires: termcap
BuildRequires: glibc-static-devel
BuildRequires: freetype2-devel
%endif
-%if %{fc3} || %{fc4}
+%if %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.4
BuildRequires: libgnomeui-devel >= 2.8
BuildRequires: GConf2-devel
BuildRequires: freetype-devel
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && !%{fc4}
+%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
BuildRequires: libtermcap-devel
BuildRequires: gtk2-devel >= 2.0
BuildRequires: libgnomeui-devel >= 2.0
Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
Conflicts: bacula-client
Obsoletes: bacula-rescue
-Requires: ncurses, libstdc++, zlib
+Requires: ncurses, libstdc++, zlib, openssl, mtx
%if %{rh7}
Requires: glibc >= 2.2
This build incorporates sqlite as the catalog database, statically compiled.
%endif
+%package mtx
+Summary: Bacula - The Network Backup Solution
+Group: System Environment/Daemons
+Provides: mtx
+
+%description mtx
+This is Bacula's version of mtx tape utilities for Linux distributions that
+do not provide their own mtx package
+
%package client
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Provides: bacula-fd
+Conflicts: bacula-mysql
+Conflicts: bacula-sqlite
+Conflicts: bacula-postgresql
Obsoletes: bacula-rescue
-Requires: libstdc++, zlib
+Requires: libstdc++, zlib, openssl
%if %{rh7}
Requires: glibc >= 2.2
This package installs scripts for updating older versions of the bacula
database.
+%if %{gconsole}
%package gconsole
Summary: Bacula - The Network Backup Solution
Group: System Environment/Daemons
Requires: atk, libstdc++, zlib, pango, libxml2, bacula-fd
-
-%if %{rh7}
-Requires: gtk+ >= 1.2
-Requires: gnome-libs >= 1.4
-Requires: glibc >= 2.2
-Requires: ORBit
-Requires: bonobo
-Requires: GConf
-Requires: freetype
+Requires: usermode, openssl
%endif
-%if %{su9}
+
+%if %{gconsole} && %{su9}
Requires: gtk2 >= 2.0
Requires: libgnome >= 2.0
Requires: libgnomeui >= 2.0
Requires: linc
Requires: freetype2
%endif
-%if %{mdk}
+%if %{gconsole} && %{mdk}
Requires: gtk2 >= 2.0
Requires: libgnomeui2
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype2
%endif
-%if %{fc3} || %{fc4}
+%if %{gconsole} && %{fc3}
Requires: gtk2 >= 2.4
Requires: libgnomeui >= 2.8
Requires: glibc >= 2.3
Requires: GConf2
Requires: freetype
%endif
-%if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3} && ! %{fc4}
+%if %{gconsole} && ! %{su9} && ! %{mdk} && ! %{fc3}
Requires: gtk2 >= 2.0
Requires: libgnomeui >= 2.0
Requires: glibc >= 2.3
Requires: linc
Requires: freetype
%endif
-%if %{su9}
+%if %{gconsole} && %{su9}
Requires: xsu
-%else
-Requires: usermode
%endif
+%if %{gconsole}
%description gconsole
Bacula - It comes by night and sucks the vital essence from your computers.
This is the Gnome Console package. It is an add-on to the client or
server packages.
+%endif
%prep
--sysconfdir=/etc/bacula \
--with-scriptdir=/etc/bacula \
--enable-smartalloc \
+%if %{gconsole}
--enable-gnome \
-%if ! %{rh7} && ! %{rh8}
+%endif
+%if %{gconsole} && ! %{rh8}
--enable-tray-monitor \
%endif
%if %{mysql}
--with-working-dir=%{working_dir} \
--with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
- --with-dir-user=%{daemon_user} \
+ --with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
- --with-sd-user=%{daemon_user} \
+ --with-sd-user=%{storage_daemon_user} \
--with-sd-group=%{daemon_group} \
- --with-fd-user=%{daemon_user} \
- --with-fd-group=%{daemon_group}
+ --with-fd-user=%{file_daemon_user} \
+ --with-fd-group=%{daemon_group} \
+ --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
+ --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
+ --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
+ --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
+ --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
+ --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
+ --with-openssl
+
make
%install
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
-%if %{rh7}
-mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
-%else
+%if %{gconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
%endif
mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
mkdir -p $RPM_BUILD_ROOT/usr/bin
chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
# install the menu stuff
-%if %{su9}
+%if %{gconsole} && %{su9}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if %{rh7}
-cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
-cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
-cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
-cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
-ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
+%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{mdk}
+%define iftrick 1
+%else
+%define iftrick 0
%endif
-%if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{mdk}
+%if %{gconsole} && %{iftrick}
cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
%endif
# now clean up permissions that are left broken by the install
chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
chmod o-rwx $RPM_BUILD_ROOT/var/bacula
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
%endif
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
-%if %{mysql}
+%if %{mysql}
+# MySQL specific files
%files mysql
+%defattr(-, root, root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_mysql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/startmysql
+%attr(0750, root, %{daemon_group}) /etc/bacula/stopmysql
+%endif
+
+%if %{sqlite}
+%files sqlite
%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%{sqlite_bindir}/libsqlite.a
+%{sqlite_bindir}/sqlite.h
+%{sqlite_bindir}/sqlite
+%endif
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_mysql_database
-/etc/bacula/drop_mysql_database
-/etc/bacula/make_mysql_tables
-/etc/bacula/drop_mysql_tables
-/etc/bacula/update_mysql_tables
-/etc/bacula/grant_mysql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/startmysql
-/etc/bacula/stopmysql
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
+%if %{postgresql}
+%files postgresql
+%defattr(-,root,root)
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%endif
+
+# The rest is DB backend independent
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) /etc/bacula/create_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_database
+%attr(0750, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/update_bacula_tables
+%attr(0750, root, %{daemon_group}) /etc/bacula/make_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
+%attr(0750, root, %{daemon_group}) /etc/bacula/mtx-changer
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-freespace
+#%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-writepart
+%attr(0750, root, %{daemon_group}) /etc/bacula/dvd-handler
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-dir
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-fd
+%attr(0750, root, %{daemon_group}) /etc/init.d/bacula-sd
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
+%attr(0640, root, %{daemon_group}) /etc/bacula/query.sql
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-dir
/usr/sbin/bacula-fd
/usr/sbin/btraceback
/usr/sbin/bconsole
/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
+%if %{mysql}
%pre mysql
# test for bacula database older than version 8
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
+%endif
+
+%if %{sqlite}
+%pre sqlite
+# test for bacula database older than version 8
+if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
+ DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
+%endif
+
+%if %{postgresql}
+%pre postgresql
+DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
+%endif
if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
echo "This bacula upgrade will update a bacula database from version 8 to 9."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
+ echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 8 can be found in the release notes."
exit 1
fi
+
+%if %{sqlite}
+fi
+%endif
+
# check for and copy /etc/bacula/console.conf to bconsole.conf
if [ -s /etc/bacula/console.conf ];then
cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
fi
+# create the daemon user and group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -G %{device_group} -M -n -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
+ echo "The user %{storage_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
+ echo "The user %{director_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%if %{mysql}
%post mysql
+%endif
+%if %{sqlite}
+%post sqlite
+%endif
+%if %{postgresql}
+%post postgresql
+%endif
# add our links
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-sd
fi
+%if %{mysql}
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun mysql
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{sqlite}
-
-%files sqlite
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/create_sqlite_database
-/etc/bacula/drop_sqlite_database
-/etc/bacula/grant_sqlite_privileges
-/etc/bacula/make_sqlite_tables
-/etc/bacula/drop_sqlite_tables
-/etc/bacula/update_sqlite_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%{sqlite_bindir}/libsqlite.a
-%{sqlite_bindir}/sqlite.h
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-%{sqlite_bindir}/sqlite
-
-
-%pre sqlite
-# test for bacula database older than version 8
-if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
- DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
- if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
- fi
-fi
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
-fi
-
-%post sqlite
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
if [ -s %{working_dir}/bacula.db ]; then
DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
# check to see if we need to upgrade a 1.36 or lower database
- if [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade requires a database update to version 9. You appear to"
- echo "be running database version $DB_VER. You must update your database using the"
- echo "upgrade scripts in the bacula-updatedb package. The alternative"
- echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
- echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- fi
-
if [ "$DB_VER" -lt "9" ] && [ "$DB_VER" -ge "8" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
echo "Creating the SQLite tables..."
/etc/bacula/make_sqlite_tables
fi
-
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
-fi
-
-%preun sqlite
-# delete our links
-if [ $1 = 0 ]; then
-/sbin/chkconfig --del bacula-dir
-/sbin/chkconfig --del bacula-fd
-/sbin/chkconfig --del bacula-sd
-fi
-
%endif
%if %{postgresql}
-
-%files postgresql
-%defattr(-,root,root)
-
-/etc/bacula/bacula
-/etc/bacula/bconsole
-/etc/bacula/create_postgresql_database
-/etc/bacula/drop_postgresql_database
-/etc/bacula/make_postgresql_tables
-/etc/bacula/drop_postgresql_tables
-/etc/bacula/update_postgresql_tables
-/etc/bacula/grant_postgresql_privileges
-/etc/bacula/create_bacula_database
-/etc/bacula/drop_bacula_database
-/etc/bacula/grant_bacula_privileges
-/etc/bacula/make_bacula_tables
-/etc/bacula/drop_bacula_tables
-/etc/bacula/update_bacula_tables
-/etc/bacula/make_catalog_backup
-/etc/bacula/delete_catalog_backup
-/etc/bacula/mtx-changer
-/etc/bacula/btraceback.dbx
-/etc/bacula/btraceback.gdb
-#/etc/bacula/dvd-freespace
-#/etc/bacula/dvd-writepart
-/etc/bacula/dvd-handler
-/etc/init.d/bacula-dir
-/etc/init.d/bacula-fd
-/etc/init.d/bacula-sd
-/etc/bacula/rescue
-
-%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
-%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
-/usr/man/man1/*
-
-/etc/logrotate.d/bacula
-/etc/log.d/scripts/services/bacula
-%config(noreplace) /etc/bacula/bacula-dir.conf
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bacula-sd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
-%config(noreplace) /etc/log.d/conf/services/bacula.conf
-/etc/bacula/query.sql
-%dir %{working_dir}
-
-/usr/sbin/bacula-dir
-/usr/sbin/bacula-fd
-/usr/sbin/bacula-sd
-/usr/sbin/bcopy
-/usr/sbin/bextract
-/usr/sbin/bls
-/usr/sbin/bscan
-/usr/sbin/btape
-/usr/sbin/btraceback
-/usr/sbin/bconsole
-/usr/sbin/dbcheck
-/usr/sbin/loaderinfo
-/usr/sbin/mtx
-/usr/sbin/scsitape
-/usr/sbin/bsmtp
-/usr/sbin/tapeinfo
-
-%pre postgresql
-# test for bacula database older than version 8
-# note: this ASSUMES no password has been set for bacula database
-DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
-
-if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
- echo "This bacula upgrade will update a bacula database from version 8 to 9."
- echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 8 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_postgresql_tables to delete all your your current"
- echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 8 can be found in the release notes."
- exit 1
-fi
-
-%post postgresql
-# add our links
-if [ "$1" -ge 1 ] ; then
-/sbin/chkconfig --add bacula-dir
-/sbin/chkconfig --add bacula-fd
-/sbin/chkconfig --add bacula-sd
-fi
-
# test for an existing database
# note: this ASSUMES no password has been set for bacula database
DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
+%endif
-# create the daemon group
-HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{groupfile}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
-
+%if %{mysql}
+%preun mysql
+%endif
+%if %{sqlite}
+%preun sqlite
+%endif
+%if %{postgresql}
%preun postgresql
+%endif
+
# delete our links
if [ $1 = 0 ]; then
/sbin/chkconfig --del bacula-dir
/sbin/chkconfig --del bacula-sd
fi
-%endif
+
+%files mtx
+/usr/sbin/loaderinfo
+/usr/sbin/mtx
+/usr/sbin/scsitape
+/usr/sbin/tapeinfo
+/usr/man/man1/*
+
%files client
%defattr(-,root,root)
-
-/etc/bacula/bconsole
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(0750, root, %{daemon_group}) /etc/bacula/bconsole
/etc/init.d/bacula-fd
-/etc/bacula/rescue
+%attr(0750, root, %{daemon_group}) /etc/bacula/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%config(noreplace) /etc/bacula/bacula-fd.conf
-%config(noreplace) /etc/bacula/bconsole.conf
-%dir %{working_dir}
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(0770, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-/etc/bacula/btraceback.gdb
-/etc/bacula/btraceback.dbx
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.gdb
+%attr(0640, root, %{daemon_group}) /etc/bacula/btraceback.dbx
/usr/sbin/bsmtp
/usr/sbin/bconsole
+%pre client
+# create the daemon group and user
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+ echo "The user %{file_daemon_user} has been added to %{user_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post client
# add our link
if [ "$1" -ge 1 ] ; then
/sbin/chkconfig --add bacula-fd
fi
-# create the daemon group
-HAVE_BACULA=`cat %{group_file} | grep %{daemon_group} 2>/dev/null`
-if [ -z $HAVE_BACULA ]; then
- %{groupadd} -r %{daemon_group} > /dev/null 2>&1
- echo "The group %{daemon_group} has been added to %{group_file}."
- echo "See the manual chapter Running Bacula for details."
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
fi
%preun client
fi
%files updatedb
-%defattr(-,root,root)
+%defattr(-,root,%{daemon_group})
/etc/bacula/updatedb/*
+%pre updatedb
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
%post updatedb
echo "The database update scripts were installed to /etc/bacula/updatedb"
+%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-/etc/bacula/gconsole
-%config(noreplace) /etc/bacula/gnome-console.conf
+%attr(0750, root, %{daemon_group}) %dir /etc/bacula
+%attr(075, root, %{daemon_group}) /etc/bacula/gconsole
+%attr(0640, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
/usr/share/pixmaps/bacula.png
+%endif
-%if %{rh7}
-/usr/share/gnome/apps/System/bacula.desktop
-%else
+%if %{gconsole}
/usr/share/applications/bacula.desktop
%endif
-%if ! %{rh7} && ! %{rh8}
+%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
%config(noreplace) /etc/bacula/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%endif
-%if ! %{su9}
+%if %{gconsole} && ! %{su9}
# add the console helper files
%config(noreplace,missingok) /etc/pam.d/gnome-console
%config(noreplace,missingok) /etc/security/console.apps/gnome-console
/usr/bin/gnome-console
%endif
+%if %{gconsole}
+%pre gconsole
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+ %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+ echo "The group %{daemon_group} has been added to %{group_file}."
+ echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%post gconsole
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+ cd /etc/bacula
+ for file in *.conf; do
+ for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+ need_password=`grep $string $file 2>/dev/null`
+ if [ -n "$need_password" ]; then
+ pass=`openssl rand -base64 33`
+ sed "s-$string-$pass-g" $file > $file.new
+ cp -f $file.new $file; rm -f $file.new
+ fi
+ done
+ done
+fi
+%endif
%changelog
+* Wed Dec 14 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- 1.38.2 release
+- Reorganize files and pre/post sections to remove repetitions
+- Always build separate mtx package
+- Fix file ownerships for /etc/bacula and Bacula's working dir
+* Wed Nov 23 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Disable GNOME on RH7
+* Fri Nov 18 2005 Aleksandar Milivojevic <alex@milivojevic.org>
+- Red Hat and look alikes have mtx RPM, do not build/package our version
* Sun Nov 13 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
- minor edit to _dist for SLES9 compatibility
* Sat Nov 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
but one additional database record must be written, which does
not need any database change.
+ Kern: see if we can correct restoration of directories if
+ replace=ifnewer is set. Currently, if the directory does not
+ exist, a "dummy" directory is created, then when all the files
+ are updated, the dummy directory is newer so the real values
+ are not updated.
+
Item 4: Implement a Bacula GUI/management tool using Python.
Origin: Kern
Date: 28 October 2005
/*
* Default network buffer size
*/
-#define DEFAULT_NETWORK_BUFFER_SIZE (32 * 1024)
+#define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024)
/*
* Stream definitions. Once defined these must NEVER
void
t_char(char c)
{
- write(1, &c, 1);
+ (void)write(1, &c, 1);
}
Pw(con_lock); /* get write lock on console message file */
errno = 0;
if (dtlen) {
- fwrite(dt, dtlen, 1, con_fd);
+ (void)fwrite(dt, dtlen, 1, con_fd);
}
len = strlen(msg);
if (len > 0) {
- fwrite(msg, len, 1, con_fd);
+ (void)fwrite(msg, len, 1, con_fd);
if (msg[len-1] != '\n') {
- fwrite("\n", 2, 1, con_fd);
+ (void)fwrite("\n", 2, 1, con_fd);
}
} else {
- fwrite("\n", 2, 1, con_fd);
+ (void)fwrite("\n", 2, 1, con_fd);
}
fflush(con_fd);
console_msg_pending = TRUE;
sprintf(s + strlen(s), "%lu", (unsigned long)getpid());
sprintf(s + strlen(s), "%lu", (unsigned long)getppid());
- getcwd(s + strlen(s), 256);
+ (void)getcwd(s + strlen(s), 256);
sprintf(s + strlen(s), "%lu", (unsigned long)clock());
sprintf(s + strlen(s), "%lu", (unsigned long)time(NULL));
#ifdef Solaris
}
if (strcmp(cmd, "drives") == 0) {
AUTOCHANGER *changer_res = dcr->device->changer_res;
- bnet_fsend(dir, "drives=%d\n", changer_res->device->size());
- Dmsg1(100, "drives=%d\n", changer_res->device->size());
+ int drives = 1;
+ if (changer_res) {
+ drives = changer_res->device->size();
+ }
+ bnet_fsend(dir, "drives=%d\n", drives);
+ Dmsg1(100, "drives=%d\n", drives);
return true;
}
* Note, re-reading last block may have caused us to
* loose track of where we are (block number unknown).
*/
+ Pmsg0(-1, _("Rewinding.\n"));
if (!rewind_dev(dev)) { /* get to a known place on tape */
goto bail_out;
}
/* Read the first 10000 records */
- Pmsg0(-1, _("Reading the first 10000 records.\n"));
+ Pmsg2(-1, _("Reading the first 10000 records from %u:%u.\n"),
+ dev->file, dev->block_num);
quickie_count = 0;
read_records(dcr, quickie_cb, my_mount_next_read_volume);
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
static bool quickie_cb(DCR *dcr, DEV_RECORD *rec)
{
DEVICE *dev = dcr->dev;
- if (dev->file != 0) {
- Pmsg3(-1, _("ERROR! device at %d:%d count=%d\n"), dev->file, dev->block_num,
- quickie_count);
- return false;
- }
quickie_count++;
if (quickie_count == 10000) {
- Pmsg2(-1, _("1000 records read now at %d:%d\n"), dev->file, dev->block_num);
+ Pmsg2(-1, _("10000 records read now at %d:%d\n"), dev->file, dev->block_num);
}
return quickie_count < 10000;
}
*/
void DEVICE::open_tape_device(DCR *dcr, int omode)
{
- int nonblocking = 0;
file_size = 0;
int timeout;
- int ioerrcnt = 10;
+ int nonblocking = O_NONBLOCK;
Dmsg0(29, "open dev: device is tape\n");
if (is_tape() && is_autochanger()) {
set_mode(omode);
timeout = max_open_wait;
errno = 0;
-#ifdef HAVE_LINUX_OS
- if (open_nowait) {
- /* Set wait counters to zero for no wait */
- timeout = ioerrcnt = 0;
- /* Open drive in non-block mode */
- nonblocking = O_NONBLOCK;
- }
-#endif
if (is_fifo() && timeout) {
/* Set open timer */
tid = start_thread_timer(pthread_self(), timeout);
Dmsg3(100, "Try open %s mode=%s nonblocking=%d\n", print_name(),
mode_to_str(omode), nonblocking);
/* Use system open() */
- while ((fd = ::open(dev_name, mode+nonblocking, MODE_RW)) < 0) {
+ while ((fd = ::open(dev_name, mode+nonblocking)) < 0) {
berrno be;
dev_errno = errno;
Dmsg5(050, "Open omode=%d mode=%x nonblock=%d error errno=%d ERR=%s\n",
bmicrosleep(1, 0);
continue;
}
- /* IO error (no volume) try 10 times every 6 seconds */
- if (dev_errno == EIO && ioerrcnt-- > 0) {
- bmicrosleep(5, 0);
- Dmsg0(100, "Continue open\n");
- continue;
- }
Mmsg2(errmsg, _("Unable to open device %s: ERR=%s\n"),
print_name(), be.strerror(dev_errno));
/* Stop any open timer we set */
break;
}
- if (nonblocking) {
- set_blocking();
- }
-
if (fd >= 0) {
openmode = omode; /* save open mode */
+ set_blocking();
Dmsg2(100, "openmode=%d %s\n", openmode, mode_to_str(openmode));
dev_errno = 0;
set_opened();
{
int oflags;
/* Try to reset blocking */
+#ifdef xxx
if ((oflags = fcntl(fd, F_GETFL, 0)) < 0 ||
fcntl(fd, F_SETFL, oflags & ~O_NONBLOCK) < 0) {
berrno be;
::close(fd); /* use system close() */
- fd = ::open(dev_name, mode, MODE_RW);
+ fd = ::open(dev_name, mode);
Dmsg2(100, "fcntl error. ERR=%s. Close-reopen fd=%d\n", be.strerror(), fd);
}
+#endif
+ oflags = fcntl(fd, F_GETFL, 0);
+ if (oflags > 0 && (oflags & O_NONBLOCK)) {
+ fcntl(fd, F_SETFL, oflags & ~O_NONBLOCK);
+ }
}
/*
}
/* If thread waiting on mount, wake him */
if (jcr->dcr && jcr->dcr->dev && jcr->dcr->dev->waiting_for_mount()) {
- pthread_cond_signal(&jcr->dcr->dev->wait_next_vol);
+ pthread_cond_broadcast(&jcr->dcr->dev->wait_next_vol);
pthread_cond_broadcast(&wait_device_release);
}
if (jcr->read_dcr && jcr->read_dcr->dev && jcr->read_dcr->dev->waiting_for_mount()) {
- pthread_cond_signal(&jcr->read_dcr->dev->wait_next_vol);
+ pthread_cond_broadcast(&jcr->read_dcr->dev->wait_next_vol);
pthread_cond_broadcast(&wait_device_release);
}
bnet_fsend(dir, _("3000 Job %s marked to be canceled.\n"), jcr->Job);
if ((ok = find_suitable_device_for_job(jcr, rctx))) {
goto done;
}
+ /* Look for any mounted drive */
+ rctx.exact_match = false;
+ if ((ok = find_suitable_device_for_job(jcr, rctx))) {
+ goto done;
+ }
/* Wait for any drive anywhere */
+ rctx.PreferMountedVols = false;
rctx.exact_match = false;
rctx.do_not_wait = false;
if ((ok = find_suitable_device_for_job(jcr, rctx))) {
Dmsg1(100, "!prefMnt && busy. JobId=%d\n", jcr->JobId);
return 0;
}
- Dmsg3(100, "prefmnt=%d busy=%d res=%d\n", rctx.PreferMountedVols,
+ Dmsg3(100, "can_reserve_drive: prefmnt=%d busy=%d res=%d\n", rctx.PreferMountedVols,
dev->is_busy(), dev->reserved_device);
/* Check for prefer mounted volumes */
if (rctx.PreferMountedVols && !dev->VolHdr.VolumeName[0] && dev->is_tape()) {
- Dmsg1(100, "want mounted -- no vol JobId=%d\n", jcr->JobId);
+ Dmsg1(100, "failed: want mounted -- no vol JobId=%d\n", jcr->JobId);
return 0; /* No volume mounted */
}
/* Check for exact Volume name match */
if (rctx.exact_match && rctx.have_volume &&
strcmp(dev->VolHdr.VolumeName, rctx.VolumeName) != 0) {
- Dmsg2(100, "Not exact match have=%s want=%s\n",
+ Dmsg2(100, "failed: Not exact match have=%s want=%s\n",
dev->VolHdr.VolumeName, rctx.VolumeName);
return 0;
}
if (rctx.available_autochanger && dev->num_writers == 0 &&
dev->VolHdr.VolumeName[0] == 0) {
/* Device is available but not yet reserved, reserve it for us */
- Dmsg2(100, "Res Unused autochanger %s JobId=%d.\n",
+ Dmsg2(100, "OK Res Unused autochanger %s JobId=%d.\n",
dev->print_name(), jcr->JobId);
bstrncpy(dev->pool_name, dcr->pool_name, sizeof(dev->pool_name));
bstrncpy(dev->pool_type, dcr->pool_type, sizeof(dev->pool_type));
if (strcmp(dev->pool_name, dcr->pool_name) == 0 &&
strcmp(dev->pool_type, dcr->pool_type) == 0) {
/* OK, compatible device */
- Dmsg2(100, "got dev: %s num_writers=0, reserved, pool matches JobId=%d\n",
+ Dmsg2(100, "OK got dev: %s num_writers=0, reserved, pool matches JobId=%d\n",
dev->print_name(), jcr->JobId);
return 1;
} else {
/* Drive not suitable for us */
- Dmsg2(100, "busy: num_writers=0, reserved, pool=%s wanted=%s\n",
+ Dmsg2(100, "failed: busy num_writers=0, reserved, pool=%s wanted=%s\n",
dev->pool_name, dcr->pool_name);
return 0; /* wait */
}
/* Device in append mode, check if changing pool */
if (strcmp(dev->pool_name, dcr->pool_name) == 0 &&
strcmp(dev->pool_type, dcr->pool_type) == 0) {
- Dmsg2(100, "got dev: %s num_writers=0, can_append, pool matches. JobId=%d\n",
+ Dmsg2(100, "OK got dev: %s num_writers=0, can_append, pool matches. JobId=%d\n",
dev->print_name(), jcr->JobId);
/* OK, compatible device */
return 1;
}
}
/* Device is available but not yet reserved, reserve it for us */
- Dmsg2(100, "Dev avail reserved %s JobId=%d\n", dev->print_name(),
+ Dmsg2(100, "OK Dev avail reserved %s JobId=%d\n", dev->print_name(),
jcr->JobId);
bstrncpy(dev->pool_name, dcr->pool_name, sizeof(dev->pool_name));
bstrncpy(dev->pool_type, dcr->pool_type, sizeof(dev->pool_type));
/* Yes, now check if we want the same Pool and pool type */
if (strcmp(dev->pool_name, dcr->pool_name) == 0 &&
strcmp(dev->pool_type, dcr->pool_type) == 0) {
- Dmsg2(100, "got dev: %s num_writers>=0, can_append, pool matches. JobId=%d\n",
+ Dmsg2(100, "OK got dev: %s num_writers>=0, can_append, pool matches. JobId=%d\n",
dev->print_name(), jcr->JobId);
/* OK, compatible device */
return 1;
} else {
/* Drive not suitable for us */
- Dmsg2(100, "busy: num_writers>0, can_append, pool=%s wanted=%s\n",
+ Dmsg2(100, "failed: busy num_writers>0, can_append, pool=%s wanted=%s\n",
dev->pool_name, dcr->pool_name);
return 0; /* wait */
}
Jmsg0(jcr, M_FATAL, 0, _("Logic error!!!! Should not get here.\n"));
return -1; /* error, should not get here */
}
- Dmsg2(100, "No reserve %s JobId=%d\n", dev->print_name(), jcr->JobId);
+ Dmsg2(100, "failed: No reserve %s JobId=%d\n", dev->print_name(), jcr->JobId);
return 0;
}
#include "bacula.h" /* pull in global headers */
#include "stored.h" /* pull in Storage Deamon headers */
-static bool double_jcr_wait_time(JCR *jcr);
+//static bool double_jcr_wait_time(JCR *jcr);
/*
struct timeval tv;
struct timezone tz;
struct timespec timeout;
-// time_t last_heartbeat = 0;
int stat = 0;
- int add_wait;
- bool ok = false;
+ bool ok = true;
Dmsg0(100, "Enter wait_for_device\n");
P(device_release_mutex);
Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting to reserve a device.\n"), jcr->Job);
}
- /*
- * Wait requested time (dev->rem_wait_sec). However, we also wake up every
- * HB_TIME seconds and send a heartbeat to the FD and the Director
- * to keep stateful firewalls from closing them down while waiting
- * for the operator.
- */
- add_wait = jcr->rem_wait_sec;
- if (me->heartbeat_interval && add_wait > me->heartbeat_interval) {
- add_wait = me->heartbeat_interval;
- }
+ gettimeofday(&tv, &tz);
+ timeout.tv_nsec = tv.tv_usec * 1000;
+ timeout.tv_sec = tv.tv_sec + 120;
- for ( ; !job_canceled(jcr); ) {
- time_t now, start;
+ Dmsg0(100, "I'm going to wait for a device.\n");
- gettimeofday(&tv, &tz);
- timeout.tv_nsec = tv.tv_usec * 1000;
- timeout.tv_sec = tv.tv_sec + add_wait;
-
- Dmsg3(100, "I'm going to wait for a device. HB=%d wait=%d remwait=%d\n",
- (int)me->heartbeat_interval, jcr->wait_sec, jcr->rem_wait_sec);
- start = time(NULL);
- /* Wait required time */
- stat = pthread_cond_timedwait(&wait_device_release, &device_release_mutex, &timeout);
- Dmsg1(100, "Wokeup from sleep on device stat=%d\n", stat);
+ /* Wait required time */
+ stat = pthread_cond_timedwait(&wait_device_release, &device_release_mutex, &timeout);
+ Dmsg1(100, "Wokeup from sleep on device stat=%d\n", stat);
- now = time(NULL);
- jcr->rem_wait_sec -= (now - start);
-
-/* Not turned on yet */
-#ifdef needed
- /* Note, this always triggers the first time. We want that. */
- if (me->heartbeat_interval) {
- if (now - last_heartbeat >= me->heartbeat_interval) {
- /* send heartbeats */
- if (jcr->file_bsock) {
- bnet_sig(jcr->file_bsock, BNET_HEARTBEAT);
- Dmsg0(400, "Send heartbeat to FD.\n");
- }
- if (jcr->dir_bsock) {
- bnet_sig(jcr->dir_bsock, BNET_HEARTBEAT);
- }
- last_heartbeat = now;
- }
- }
-#endif
-
- if (stat != ETIMEDOUT) { /* if someone woke us up */
- ok = true;
- break; /* allow caller to examine device */
- }
- if (jcr->rem_wait_sec <= 0) { /* on exceeding wait time return */
- Dmsg0(400, "Exceed wait time.\n");
- if (!double_jcr_wait_time(jcr)) {
- break; /* give up */
- }
- Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting to reserve a device.\n"), jcr->Job);
- }
-
- add_wait = jcr->wait_sec - (now - start);
- if (add_wait < 0) {
- add_wait = 0;
- }
- if (me->heartbeat_interval && add_wait > me->heartbeat_interval) {
- add_wait = me->heartbeat_interval;
- }
- }
V(device_release_mutex);
Dmsg1(100, "Return from wait_device ok=%d\n", ok);
return ok;
}
+#ifdef xxx
/*
* The jcr timers are used for waiting on any device *
* Returns: true if time doubled
}
return true;
}
+#endif
*/
#undef VERSION
-#define VERSION "1.39.2"
-#define BDATE "13 December 2005"
-#define LSMDATE "13Dec05"
+#define VERSION "1.39.3"
+#define BDATE "17 December 2005"
+#define LSMDATE "17Dec05"
/* Debug flags */
#undef DEBUG