9 %{?_with_mysql: %{expand: %%global MYSQL 1}}
10 %{?_without_mysql: %{expand: %%global MYSQL 0}}
11 %{?_with_gnome: %{expand: %%global GNOME 1}}
12 %{?_without_gnome: %{expand: %%global GNOME 0}}
13 %{?_with_wrap: %{expand: %%global TCPW 1}}
14 %{?_without_wrap: %{expand: %%global TCPW 0}}
16 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
18 Summary: Bacula - The Network Backup Solution
22 Group: Archiving/Backup
24 Source: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.bz2
25 Source1: %{name}-icons.tar.bz2
26 BuildRoot: %{_tmppath}/%{name}-root
27 URL: http://www.bacula.org/
28 BuildRequires: readline-devel, perl-base, zlib-devel
30 BuildRequires: tcp_wrappers-devel
32 Patch0: bacula-1.32d-config.diff.bz2
33 Patch1: bacula-1.30a-prompt.diff.bz2
37 Bacula is a set of computer programs that permit you (or the system
38 administrator) to manage backup, recovery, and verification of computer
39 data across a network of computers of different kinds. In technical terms,
40 it is a network client/server based backup program. Bacula is relatively
41 easy to use and efficient, while offering many advanced storage management
42 features that make it easy to find and recover lost or damaged files.
45 Summary: Bacula Director and Catalog services
46 Group: Archiving/Backup
47 Prereq: rpm-helper, perl-base
49 Requires: MySQL >= 3.23
50 BuildRequires: MySQL-devel >= 3.23
52 Requires: sqlite-tools
53 BuildRequires: sqlite-devel
55 Conflicts: bacula-fd < %{version}
56 Conflicts: bacula-sd < %{version}
60 Bacula Director is the program that supervises all the backup, restore, verify
61 and archive operations. The system administrator uses the Bacula Director to
62 schedule backups and to recover files.
63 Catalog services are comprised of the software programs responsible for
64 maintaining the file indexes and volume databases for all files backed up.
65 The Catalog services permit the System Administrator or user to quickly locate
66 and restore any desired file, since it maintains a record of all Volumes used,
67 all Jobs run, and all Files saved.
69 This build requires MySQL to be installed separately as the catalog database.
71 This build requires sqlite to be installed separately as the catalog database.
75 Summary: Bacula Console
76 Group: Archiving/Backup
81 Bacula Console is the program that allows the administrator or user to
82 communicate with the Bacula Director.
83 This is the text only console interface.
86 %package console-gnome
87 Summary: Bacula Gnome Console
88 Group: Archiving/Backup
89 #BuildRequires: libgnome32-devel
90 BuildRequires: libgnomeui2-devel
93 %description console-gnome
95 Bacula Console is the program that allows the administrator or user to
96 communicate with the Bacula Director.
97 This is the GNOME GUI interface.
101 Summary: Bacula File services (Client)
102 Group: Archiving/Backup
105 Conflicts: bacula-dir < %{version}
109 Bacula File services (or Client program) is the software program that is
110 installed on the machine to be backed up. It is specific to the operating
111 system on which it runs and is responsible for providing the file attributes
112 and data when requested by the Director. The File services are also responsible
113 for the file system dependent part of restoring the file attributes and data
114 during a recovery operation.
115 This program runs as a daemon on the machine to be backed up, and in some of
116 the documentation, the File daemon is referred to as the Client (for example in
117 Bacula configuration file).
120 Summary: Bacula Storage services
121 Group: Archiving/Backup
124 Conflicts: bacula-dir < %{version}
128 Bacula Storage services consist of the software programs that perform the
129 storage and recovery of the file attributes and data to the physical backup
130 media or volumes. In other words, the Storage daemon is responsible for reading
131 and writing your tapes (or other storage media, e.g. files).
132 The Storage services runs as a daemon on the machine that has the backup
133 device (usually a tape drive).
137 cd %{name}-%{version}
138 %patch0 -p1 -b .config
139 %patch1 -p1 -b .prompt
141 mv doc/html-manual/*.html doc/manual
142 mv doc/html-manual/*.css doc/manual
143 mv doc/html-manual/*.gif doc/manual
146 cd %{name}-%{version}
149 --enable-smartalloc \
159 --with-tcp-wrappers \
161 --sysconfdir=%{_sysconfdir}/%{name} \
162 --with-scriptdir=%{_libexecdir}/%{name} \
163 --with-working-dir=%{_localstatedir}/%{name} \
164 --with-subsys-dir=/var/lock/subsys \
165 --with-dir-password="#FAKE#DIR#PASSWORD#" \
166 --with-fd-password="#FAKE#FD#PASSWORD#" \
167 --with-sd-password="#FAKE#SD#PASSWORD#"
172 cd %{name}-%{version}
174 %makeinstall sysconfdir=%{buildroot}%{_sysconfdir}/%{name} scriptdir=%{buildroot}%{_libexecdir}/%{name} working_dir=%{buildroot}%{_localstatedir}/%{name}
176 # install the upgrade scripts
178 install -m 755 src/cats/alter_mysql_tables %{buildroot}%{_libexecdir}/%{name}
180 install -m 755 src/cats/alter_sqlite_tables %{buildroot}%{_libexecdir}/%{name}
183 # install the init scripts
184 mkdir -p %{buildroot}%{_initrddir}
185 install -m 755 platforms/mandrake/bacula-dir %{buildroot}%{_initrddir}/bacula-dir
186 install -m 755 platforms/mandrake/bacula-fd %{buildroot}%{_initrddir}/bacula-fd
187 install -m 755 platforms/mandrake/bacula-sd %{buildroot}%{_initrddir}/bacula-sd
189 # install the logrotate file
190 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
191 cp scripts/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/bacula-dir
193 mkdir -p %{buildroot}%{_localstatedir}/%{name}
196 # install the menu stuff
197 mkdir -p $RPM_BUILD_ROOT%{_menudir}
198 cat << EOF > $RPM_BUILD_ROOT%{_menudir}/%{name}-console-gnome
199 ?package(%{name}-console-gnome): command="%{_sbindir}/gnome-console" icon="%{name}.png" needs="x11" title="Bacula Console" longtitle="Bacula Director Console" section="Applications/Archiving/Backup"
201 mkdir -p %{buildroot}%{_iconsdir}
202 tar jxvf %{SOURCE1} -C %{buildroot}%{_iconsdir}
205 perl -spi -e 's/"#FAKE#(\w+)#PASSWORD#"/#YOU MUST SET THE $1 PASSWORD#/' %{buildroot}%{_sysconfdir}/%{name}/*.conf
206 touch %{buildroot}%{_sysconfdir}/%{name}/.pw.sed
212 %defattr(644, root, root, 755)
213 %doc %{name}-%{version}/ChangeLog %{name}-%{version}/CheckList %{name}-%{version}/ReleaseNotes %{name}-%{version}/kernstodo
214 %doc %{name}-%{version}/doc/*.pdf %{name}-%{version}/doc/manual %{name}-%{version}/examples
215 %attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-dir.conf
216 %ghost %{_sysconfdir}/%{name}/.pw.sed
217 %config(noreplace) %{_sysconfdir}/logrotate.d/bacula-dir
218 %defattr (755, root, root)
219 %config(noreplace) %{_initrddir}/bacula-dir
220 %{_sbindir}/bacula-dir
221 %{_sbindir}/btraceback
224 %dir %{_libexecdir}/%{name}
225 %attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
227 %{_libexecdir}/%{name}/create_mysql_database
228 %{_libexecdir}/%{name}/drop_mysql_tables
229 %{_libexecdir}/%{name}/grant_mysql_privileges
230 %{_libexecdir}/%{name}/make_mysql_tables
231 %{_libexecdir}/%{name}/alter_mysql_tables
233 %{_libexecdir}/%{name}/create_sqlite_database
234 %{_libexecdir}/%{name}/drop_sqlite_tables
235 %exclude %{_libexecdir}/%{name}/grant_mysql_privileges
236 %{_libexecdir}/%{name}/make_sqlite_tables
237 %{_libexecdir}/%{name}/alter_sqlite_tables
239 %{_libexecdir}/%{name}/delete_catalog_backup
240 %{_libexecdir}/%{name}/drop_bacula_tables
241 %{_libexecdir}/%{name}/make_bacula_tables
242 %{_libexecdir}/%{name}/make_catalog_backup
243 %attr(644, root, root) %{_libexecdir}/%{name}/query.sql
244 %attr(700, root, root) %dir %{_localstatedir}/%{name}
246 %pre dir -p /usr/bin/perl
248 if ( -f "%{_sysconfdir}/%{name}/.pw.sed") {
249 if ( -f "%{_sysconfdir}/%{name}/bacula-dir.conf") {
250 system "sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed";
251 system "sed -f %{_sysconfdir}/%{name}/.upw.sed %{_sysconfdir}/%{name}/bacula-dir.conf > %{_sysconfdir}/%{name}/bacula-dir.conf.tmp";
252 unlink "%{_sysconfdir}/%{name}/bacula-dir.conf";
253 rename "%{_sysconfdir}/%{name}/bacula-dir.conf.tmp", "%{_sysconfdir}/%{name}/bacula-dir.conf";
254 unlink "%{_sysconfdir}/%{name}/.upw.sed";
257 mkdir("%{_sysconfdir}/%{name}");
258 open(IN, "/dev/random") or die "$!";
259 open(OUT, ">%{_sysconfdir}/%{name}/.pw.sed") or die "$!";
260 foreach $c ("DIR","SD","FD") {
262 my $res = pack("u", $buf);
265 $res =~ tr|` -_|AA-Za-z0-9+/|;
266 print OUT "s!#YOU MUST SET THE $c PASSWORD#!\"$res\"!\n";
274 # NOTE: IF THIS FAILS DUE TO MYSQL NEEDING A PASSWORD YOU ARE ON YOUR OWN
275 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
276 if [ -z "$DB_VER" ]; then
277 # grant privileges and create tables
278 echo "Granting privileges for MySQL user bacula..."
279 %{_libexecdir}/%{name}/grant_mysql_privileges > dev/null
280 echo "Creating MySQL bacula database..."
281 %{_libexecdir}/%{name}/create_mysql_database > dev/null
282 echo "Creating bacula tables..."
283 %{_libexecdir}/%{name}/make_mysql_tables > dev/null
284 elif [ "$DB_VER" -lt "6" ]; then
285 echo "Backing up bacula tables"
286 mysqldump -f --opt bacula | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
287 echo "Upgrading bacula tables"
288 %{_libexecdir}/%{name}/alter_mysql_tables
289 echo "If bacula works correctly you can remove the backup file %{_localstatedir}/%{name}/bacula_backup.sql.bz2"
292 if [ -s %{_localstatedir}/%{name}/bacula.db ]; then
293 DB_VER=`echo "select * from Version;" | sqlite %{_localstatedir}/%{name}/bacula.db|tail -n 1 2>/dev/null`
294 if [ "$DB_VER" -lt "6" ]; then
295 echo "Backing up bacula tables"
296 echo ".dump" | sqlite %{_localstatedir}/%{name}/bacula.db | bzip2 > %{_localstatedir}/%{name}/bacula_backup.sql.bz2
297 echo "Upgrading bacula tables"
298 %{_libexecdir}/%{name}/alter_sqlite_tables
299 echo "If bacula works correctly you can remove the backup file %{_localstatedir}/%{name}/bacula_backup.sql.bz2"
303 echo "Creating bacula tables..."
304 %{_libexecdir}/%{name}/make_sqlite_tables > dev/null
307 chmod -R 600 %{_localstatedir}/%{name}/*
308 for i in %{_sysconfdir}/%{name}/*.conf %{_sysconfdir}/%{name}/*.conf.rpmnew %{_sysconfdir}/%{name}/*.conf.rpmsave; do
310 sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
311 # this is needed if upgrading from 1.30a or lower
312 sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
316 %_post_service bacula-dir
319 %_preun_service bacula-dir
322 %defattr(755, root, root)
323 %attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-fd.conf
324 %config(noreplace) %{_initrddir}/bacula-fd
325 %{_sbindir}/bacula-fd
326 %{_sbindir}/btraceback
328 %dir %{_libexecdir}/%{name}
329 %attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
330 %attr(700, root, root) %dir %{_localstatedir}/%{name}
334 i=%{_sysconfdir}/%{name}/bacula-fd.conf
335 if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
336 sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
337 sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
339 rm -f %{_sysconfdir}/%{name}/.upw.sed
343 %_post_service bacula-fd
344 if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
345 for i in %{_sysconfdir}/%{name}/bacula-fd.conf %{_sysconfdir}/%{name}/bacula-fd.conf.rpmnew %{_sysconfdir}/%{name}/bacula-fd.conf.rpmsave; do
347 sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
348 # this is needed if upgrading from 1.30a or lower
349 sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
356 %_preun_service bacula-fd
359 %defattr(755, root, root)
360 %attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/bacula-sd.conf
361 %config(noreplace) %{_initrddir}/bacula-sd
362 %{_sbindir}/bacula-sd
368 %{_sbindir}/btraceback
370 %dir %{_libexecdir}/%{name}
371 %attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
372 %{_libexecdir}/%{name}/mtx-changer
373 %attr(700, root, root) %dir %{_localstatedir}/%{name}
377 i=%{_sysconfdir}/%{name}/bacula-sd.conf
378 if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
379 sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
380 sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
382 rm -f %{_sysconfdir}/%{name}/.upw.sed
386 %_post_service bacula-sd
387 if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
388 for i in %{_sysconfdir}/%{name}/bacula-sd.conf %{_sysconfdir}/%{name}/bacula-sd.conf.rpmnew %{_sysconfdir}/%{name}/bacula-sd.conf.rpmsave; do
390 sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
391 # this is needed if upgrading from 1.30a or lower
392 sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
399 %_preun_service bacula-sd
402 %defattr(755, root, root)
403 %attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/console.conf
405 %{_sbindir}/btraceback
407 %dir %{_libexecdir}/%{name}
408 %attr(644, root, root) %{_libexecdir}/%{name}/btraceback.gdb
412 i=%{_sysconfdir}/%{name}/console.conf
413 if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
414 sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
415 sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
417 rm -f %{_sysconfdir}/%{name}/.upw.sed
421 if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
422 for i in %{_sysconfdir}/%{name}/console.conf %{_sysconfdir}/%{name}/console.conf.rpmnew %{_sysconfdir}/%{name}/console.conf.rpmsave; do
424 sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
425 # this is needed if upgrading from 1.30a or lower
426 sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
434 %defattr(644, root, root, 755)
435 %{_iconsdir}/bacula.png
436 %{_iconsdir}/mini/bacula.png
437 %{_iconsdir}/large/bacula.png
438 %{_menudir}/bacula-console-gnome
439 %attr(600, root, root) %config(noreplace) %{_sysconfdir}/%{name}/gnome-console.conf
440 %attr(755, root, root) %{_sbindir}/gnome-console
441 %attr(755, root, root) %{_sbindir}/btraceback
442 %attr(755, root, root) %{_sbindir}/smtp
443 %dir %{_libexecdir}/%{name}
444 %{_libexecdir}/%{name}/btraceback.gdb
448 i=%{_sysconfdir}/%{name}/gnome-console.conf
449 if [ -s %{_sysconfdir}/%{name}/.pw.sed -a -s $i ]; then
450 sed -e 's/s!\(.*\)!\(.*\)!/s!\2!\1!/' %{_sysconfdir}/%{name}/.pw.sed > %{_sysconfdir}/%{name}/.upw.sed
451 sed -f %{_sysconfdir}/%{name}/.upw.sed $i > $i.tmp
453 rm -f %{_sysconfdir}/%{name}/.upw.sed
458 if [ -s %{_sysconfdir}/%{name}/.pw.sed ]; then
459 for i in %{_sysconfdir}/%{name}/gnome-console.conf %{_sysconfdir}/%{name}/gnome-console.conf.rpmnew %{_sysconfdir}/%{name}/gnome-console.conf.rpmsave; do
461 sed -f %{_sysconfdir}/%{name}/.pw.sed $i > $i.tmp
462 # this is needed if upgrading from 1.30a or lower
463 sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i
469 %postun console-gnome
475 * Tue Nov 04 2003 Luca Berra <bluca@vodka.it> 1.32d-1mdk
477 - use gnome2 for console
479 - try not to create unneeded .rpmnew in configuration
481 * Fri Aug 12 2003 Luca Berra <bluca@vodka.it> 1.31a-1mdk
483 - modified %%post script to upgrade database if needed and do not try to create if it already exists.
484 - %%post_service should be last in %%post script
485 - changed sql upgrade script to remove multiple Version rows introduced by %%post
486 - trying to create the tables multiple times in previous releases.
487 - smtp is required by btraceback which is required by every daemon.
488 - added conflicts for lower version
490 * Wed Aug 6 2003 Luca Berra <bluca@vodka.it> 1.30a-3mdk
491 - changed sqlite requires to match package in contrib
492 - set passwords for single components to produce an error until user changes them
493 - try to change passwords automatically if dir package is installed
495 * Sun Aug 3 2003 Luca Berra <bluca@vodka.it> 1.30a-2mdk
497 - almost please rpmlint
498 - fixed readline eats last message bug in console
500 * Fri Aug 1 2003 Luca Berra <bluca@vodka.it> 1.30a-1mdk
501 - Initial spec file from spec by D. Scott Barninger <barninger at fairfieldcomputers.com>