]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/suse/bacula.spec.in
Corrected src/cats/make_catalog_backup.in.patch for changes to that script. Changes...
[bacula/bacula] / bacula / platforms / suse / bacula.spec.in
1 # Platform Build Configuration
2
3 # basic defines for every build
4 %define depkgs ../depkgs
5 %define depkgs_version 24Jul03
6 %define tomsrtbt tomsrtbt-2.0.103
7 %define sqlite_bindir /usr/lib/sqlite
8 %define working_dir /var/bacula
9
10 # platform defines - set one below or define the build_xxx on the command line
11 # RedHat builds
12 %define rh7 0
13 %{?build_rh7:%define rh7 1}
14 %define rh8 0
15 %{?build_rh8:%define rh8 1}
16 %define rh9 0
17 %{?build_rh9:%define rh9 1}
18 # Fedora Core 1 build
19 %define fc1 0
20 %{?build_fc1:%define fc1 1}
21 # Whitebox Enterprise build
22 %define wb3 0
23 %{?build_wb3:%define wb3 1}
24 # SuSE 9.0 build
25 %define su9 0
26 %{?build_su9:%define su9 1}
27
28 # database defines
29 # set mysql for MySQL support, leave unset for sqlite support
30 %define mysql 0
31 %{?build_mysql:%define mysql 1}
32
33 Summary: Bacula - The Network Backup Solution
34 Name: bacula
35 Version: @VERSION@
36 Release: 1
37 Group: System Environment/Daemons
38 Copyright: GPL v2
39 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
40 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
41 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
42 BuildRoot: %{_tmppath}/%{name}-root
43 URL: http://www.bacula.org/
44 Vendor: The Bacula Team
45 Distribution: The Bacula Team
46 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
47 BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel
48 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel
49 %if %{rh7}
50 BuildRequires: libtermcap-devel
51 BuildRequires: gtk+-devel >= 1.2
52 BuildRequires: gnome-libs-devel >= 1.4
53 BuildRequires: glibc-devel >= 2.2
54 BuildRequires: ORBit-devel
55 BuildRequires: bonobo-devel
56 BuildRequires: GConf-devel
57 %endif
58 %if %{su9}
59 BuildRequires: termcap
60 BuildRequires: gtk2-devel >= 2.0
61 BuildRequires: libgnomeui-devel >= 2.0
62 BuildRequires: glibc-devel >= 2.3
63 BuildRequires: ORBit2-devel
64 BuildRequires: libart_lgpl-devel >= 2.0
65 BuildRequires: libbonobo-devel >= 2.0
66 BuildRequires: libbonoboui-devel >= 2.0
67 BuildRequires: bonobo-activation-devel
68 BuildRequires: gconf2-devel
69 BuildRequires: linc-devel
70 %endif
71 %if ! %{rh7} && ! %{su9}
72 BuildRequires: libtermcap-devel
73 BuildRequires: gtk2-devel >= 2.0
74 BuildRequires: libgnomeui-devel >= 2.0
75 BuildRequires: glibc-devel >= 2.3
76 BuildRequires: ORBit2-devel
77 BuildRequires: libart_lgpl-devel >= 2.0
78 BuildRequires: libbonobo-devel >= 2.0
79 BuildRequires: libbonoboui-devel >= 2.0
80 BuildRequires: bonobo-activation-devel
81 BuildRequires: GConf2-devel
82 BuildRequires: linc-devel
83 %endif
84
85 %if %{mysql}
86 BuildRequires: mysql-devel >= 3.23
87 %endif
88
89 %description
90 Bacula - It comes by night and sucks the vital essence from your computers.
91
92 Bacula is a set of computer programs that permit you (or the system 
93 administrator) to manage backup, recovery, and verification of computer 
94 data across a network of computers of different kinds. In technical terms, 
95 it is a network client/server based backup program. Bacula is relatively 
96 easy to use and efficient, while offering many advanced storage management 
97 features that make it easy to find and recover lost or damaged files. 
98 Bacula source code has been released under the GPL version 2 license.
99
100 %if %{mysql}
101 %package mysql
102 %else
103 %package sqlite
104 %endif
105
106 Summary: Bacula - The Network Backup Solution
107 Group: System Environment/Daemons
108 Provides: bacula-dir, bacula-sd, bacula-fd
109 Requires: readline, perl, atk, ncurses, pango, libstdc++
110 Requires: libxml2, zlib
111 %if %{rh7}
112 Requires: gtk+ >= 1.2
113 Requires: gnome-libs >= 1.4
114 Requires: glibc >= 2.2
115 Requires: ORBit
116 Requires: bonobo
117 Requires: GConf
118 Requires: libtermcap
119 %endif
120 %if %{su9}
121 Requires: gtk2 >= 2.0
122 Requires: libgnomeui >= 2.0
123 Requires: glibc >= 2.3
124 Requires: ORBit2
125 Requires: libart_lgpl >= 2.0
126 Requires: libbonobo >= 2.0
127 Requires: libbonoboui >= 2.0
128 Requires: bonobo-activation
129 Requires: gconf2
130 Requires: linc
131 Requires: termcap
132 %endif
133 %if ! %{rh7} && ! %{su9}
134 Requires: gtk2 >= 2.0
135 Requires: libgnomeui >= 2.0
136 Requires: glibc >= 2.3
137 Requires: ORBit2
138 Requires: libart_lgpl >= 2.0
139 Requires: libbonobo >= 2.0
140 Requires: libbonoboui >= 2.0
141 Requires: bonobo-activation
142 Requires: GConf2
143 Requires: linc
144 Requires: libtermcap
145 %endif
146 %if %{mysql}
147 Requires: mysql >= 3.23
148 Requires: mysql-server >= 3.23
149 %endif
150
151 %if %{mysql}
152 %description mysql
153 %else
154 %description sqlite
155 %endif
156
157 Bacula - It comes by night and sucks the vital essence from your computers.
158
159 Bacula is a set of computer programs that permit you (or the system 
160 administrator) to manage backup, recovery, and verification of computer 
161 data across a network of computers of different kinds. In technical terms, 
162 it is a network client/server based backup program. Bacula is relatively 
163 easy to use and efficient, while offering many advanced storage management 
164 features that make it easy to find and recover lost or damaged files. 
165 Bacula source code has been released under the GPL version 2 license.
166
167 %if %{mysql}
168 This build requires MySQL to be installed separately as the catalog database.
169 %else
170 This build incorporates sqlite as the catalog database, statically compiled.
171 %endif
172
173 %package client
174 Summary: Bacula - The Network Backup Solution
175 Group: System Environment/Daemons
176 Provides: bacula-fd
177 Requires: readline, perl, libstdc++, zlib
178 %if %{rh7}
179 Requires: gtk+ >= 1.2
180 Requires: gnome-libs >= 1.4
181 Requires: glibc >= 2.2
182 %else
183 Requires: gtk2 >= 2.0
184 Requires: libgnomeui >= 2.0
185 Requires: glibc >= 2.3
186 %endif
187
188 %description client
189 Bacula - It comes by night and sucks the vital essence from your computers.
190
191 Bacula is a set of computer programs that permit you (or the system 
192 administrator) to manage backup, recovery, and verification of computer 
193 data across a network of computers of different kinds. In technical terms, 
194 it is a network client/server based backup program. Bacula is relatively 
195 easy to use and efficient, while offering many advanced storage management 
196 features that make it easy to find and recover lost or damaged files. 
197 Bacula source code has been released under the GPL version 2 license.
198
199 This is the File daemon (Client) only package.
200
201 %package rescue
202
203 Summary: Bacula - The Network Backup Solution
204 Group: System Environment/Daemons
205 Requires: coreutils, util-linux, libc5, bacula-fd
206
207 %description rescue
208 Bacula - It comes by night and sucks the vital essence from your computers.
209
210 Bacula is a set of computer programs that permit you (or the system 
211 administrator) to manage backup, recovery, and verification of computer 
212 data across a network of computers of different kinds. In technical terms, 
213 it is a network client/server based backup program. Bacula is relatively 
214 easy to use and efficient, while offering many advanced storage management 
215 features that make it easy to find and recover lost or damaged files. 
216 Bacula source code has been released under the GPL version 2 license.
217
218 This package installs scripts for disaster recovery and builds rescue 
219 floppy disks for bare metal recovery. This package includes tomsrtbt
220 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
221 to build a boot floppy disk.
222
223 You need to have the bacula-sqlite, bacula-mysql or bacula-client package for 
224 your platform installed and configured before installing this package.
225
226 %prep
227
228 %setup -b 1
229 %setup -b 2
230
231 %build
232
233 %if %{su9}
234 export LDFLAGS="-L/usr/lib/termcap"
235 %endif
236
237 cwd=${PWD}
238 cd %{depkgs}
239 %if ! %{mysql}
240 make sqlite
241 %endif
242 make mtx
243 cd ${cwd}
244
245 # patches for the bundled sqlite scripts
246
247 # patch the make_sqlite_tables script for installation bindir
248 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
249
250 # patch the create_sqlite_database script for installation bindir
251 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
252
253 # patch the make_catalog_backup script for installation bindir
254 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
255
256 # patch the update_sqlite_tables script for installation bindir
257 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
258
259 %configure \
260         --prefix=/usr \
261         --sbindir=/usr/sbin \
262         --sysconfdir=/etc/bacula \
263         --with-scriptdir=/etc/bacula \
264         --enable-smartalloc \
265         --enable-gnome \
266            --enable-static-fd \
267 %if %{mysql}
268         --with-mysql \
269 %else
270         --with-sqlite=${cwd}/../depkgs/sqlite \
271 %endif
272         --with-working-dir=%{working_dir} \
273         --with-pid-dir=/var/run \
274         --with-subsys-dir=/var/lock/subsys
275 make
276
277 cd src/filed
278 strip static-bacula-fd
279 cd ../../
280
281 %install
282  
283 cwd=${PWD}
284 mkdir -p $RPM_BUILD_ROOT/etc/init.d
285 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
286 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
287 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
288 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
289 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue
290 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt
291
292 %if ! %{mysql}
293 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
294 %endif
295
296 make \
297         prefix=$RPM_BUILD_ROOT/usr \
298         sbindir=$RPM_BUILD_ROOT/usr/sbin \
299         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
300         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
301         working_dir=$RPM_BUILD_ROOT%{working_dir} \
302         install
303
304 cd %{depkgs}
305 make \
306         prefix=$RPM_BUILD_ROOT/usr \
307         sbindir=$RPM_BUILD_ROOT/usr/sbin \
308         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
309         working_dir=$RPM_BUILD_ROOT%{working_dir} \
310         mandir=$RPM_BUILD_ROOT/usr/man \
311         mtx-install
312 cd ${cwd}
313
314 %if ! %{mysql}
315 # fixme - make installs the mysql scripts for sqlite build
316 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
317 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
318 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
319 %endif
320
321 # install the init scripts
322 %if %{su9}
323 cp platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
324 cp platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
325 cp platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
326 %else
327 cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
328 cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
329 cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
330 %endif
331
332 # install the menu stuff
333 cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
334 cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
335 cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
336
337 # install sqlite
338 %if ! %{mysql}
339 cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
340 cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
341 cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
342 %endif
343
344 # install the logrotate file
345 cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
346
347 # install the rescue stuff
348 # these are the rescue scripts
349 cp rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/
350 cp rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/
351 cp rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/
352 cp rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/
353 cp rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
354 cp rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
355 cp rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
356 cp rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
357 cp rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
358
359 # this is the static file daemon
360 cp src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
361
362 # this is the tom's root boot disk
363 cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
364
365 %clean
366 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
367
368 %if %{mysql}
369
370 %files mysql
371 %defattr(-,root,root)
372
373 %attr(0754,root,root) /etc/bacula/bacula
374 %attr(0754,root,root) /etc/bacula/bconsole
375 %attr(0754,root,root) /etc/bacula/fd
376 %attr(0754,root,root) /etc/bacula/gconsole
377 %attr(0754,root,root) /etc/bacula/create_mysql_database
378 %attr(0754,root,root) /etc/bacula/drop_mysql_database
379 %attr(0754,root,root) /etc/bacula/make_mysql_tables
380 %attr(0754,root,root) /etc/bacula/drop_mysql_tables
381 %attr(0754,root,root) /etc/bacula/update_mysql_tables
382 %attr(0754,root,root) /etc/bacula/grant_mysql_privileges
383 %attr(0754,root,root) /etc/bacula/create_bacula_database
384 %attr(0754,root,root) /etc/bacula/drop_bacula_database
385 %attr(0754,root,root) /etc/bacula/grant_bacula_privileges
386 %attr(0754,root,root) /etc/bacula/make_bacula_tables
387 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
388 %attr(0754,root,root) /etc/bacula/update_bacula_tables
389 %attr(0754,root,root) /etc/bacula/make_catalog_backup
390 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
391 %attr(0754,root,root) /etc/bacula/startmysql
392 %attr(0754,root,root) /etc/bacula/stopmysql
393 %attr(0754,root,root) /etc/bacula/mtx-changer
394 %attr(0754,root,root) /etc/init.d/bacula-dir
395 %attr(0754,root,root) /etc/init.d/bacula-fd
396 %attr(0754,root,root) /etc/init.d/bacula-sd
397
398 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
399 %attr(0644,root,root) /usr/man/man1/*
400 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
401 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
402 %attr(0644,root,root) /usr/share/applications/bacula.desktop
403 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
404 %attr(0644,root,root) /etc/logrotate.d/bacula
405
406 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
407 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
408 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
409 %attr(0640,root,root) %config(noreplace) /etc/bacula/bconsole.conf
410 %attr(0640,root,root) /etc/bacula/query.sql
411 %attr(0640,root,root) %dir %{working_dir}
412
413 %attr(0750,root,root) /usr/sbin/*
414 %attr(0750,root,root) /etc/bacula/btraceback.gdb
415
416 %pre mysql
417 # test for bacula database older than version 6
418 # note: this ASSUMES no password has been set for bacula database
419 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
420
421 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
422         echo "This bacula upgrade will update a bacula database from version 6 to 7."
423         echo "You appear to be running database version $DB_VER. You must first update"
424         echo "your database to version 6 and then install this upgrade. The alternative"
425         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
426         echo "catalog information, then do the upgrade. Information on updating a"
427         echo "database older than version 6 can be found in the release notes."
428         exit 1
429 fi
430 # check for and copy /etc/bacula/console.conf to bconsole.conf
431 if [ -s /etc/bacula/console.conf ];then
432         cp /etc/bacula/console.conf /etc/bacula/bconsole.conf
433 fi
434
435 %post mysql
436 # delete then add our links
437 /sbin/chkconfig --del bacula-dir
438 /sbin/chkconfig --del bacula-fd
439 /sbin/chkconfig --del bacula-sd
440 /sbin/chkconfig --add bacula-dir
441 /sbin/chkconfig --add bacula-fd
442 /sbin/chkconfig --add bacula-sd
443
444 # add execute permissions for console
445 chmod 0755 /usr/sbin/gnome-console
446
447 # test for an existing database
448 # note: this ASSUMES no password has been set for bacula database
449 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
450
451 # grant privileges and create tables if they do not exist
452 if [ -z "$DB_VER" ]; then
453         echo "Hmm, doesn't look like you have an existing database."
454         echo "Granting privileges for MySQL user bacula..."
455         /etc/bacula/grant_mysql_privileges
456         echo "Creating MySQL bacula database..."
457         /etc/bacula/create_mysql_database
458         echo "Creating bacula tables..."
459         /etc/bacula/make_mysql_tables
460
461 # check to see if we need to upgrade a 1.32 or lower database
462 elif [ "$DB_VER" -lt "7" ]; then
463         echo "This release requires an upgrade to your bacula database."
464         echo "Backing up your current database..."
465         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
466         echo "Upgrading bacula database ..."
467         /etc/bacula/update_mysql_tables
468         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
469
470 fi
471
472 %preun mysql
473 # delete our links
474 /sbin/chkconfig --del bacula-dir
475 /sbin/chkconfig --del bacula-fd
476 /sbin/chkconfig --del bacula-sd
477
478 %else
479
480 %files sqlite
481 %defattr(-,root,root)
482
483 %attr(0754,root,root) /etc/bacula/bacula
484 %attr(0754,root,root) /etc/bacula/bconsole
485 %attr(0754,root,root) /etc/bacula/fd
486 %attr(0754,root,root) /etc/bacula/gconsole
487 %attr(0754,root,root) /etc/bacula/create_bacula_database
488 %attr(0754,root,root) /etc/bacula/drop_bacula_database
489 %attr(0754,root,root) /etc/bacula/grant_bacula_privileges
490 %attr(0754,root,root) /etc/bacula/make_bacula_tables
491 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
492 %attr(0754,root,root) /etc/bacula/update_bacula_tables
493 %attr(0754,root,root) /etc/bacula/create_sqlite_database
494 %attr(0754,root,root) /etc/bacula/drop_sqlite_database
495 %attr(0754,root,root) /etc/bacula/grant_sqlite_privileges
496 %attr(0754,root,root) /etc/bacula/make_sqlite_tables
497 %attr(0754,root,root) /etc/bacula/drop_sqlite_tables
498 %attr(0754,root,root) /etc/bacula/update_sqlite_tables
499 %attr(0754,root,root) /etc/bacula/make_catalog_backup
500 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
501 %attr(0754,root,root) /etc/bacula/mtx-changer
502 %attr(0754,root,root) /etc/init.d/bacula-dir
503 %attr(0754,root,root) /etc/init.d/bacula-fd
504 %attr(0754,root,root) /etc/init.d/bacula-sd
505
506 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
507 %attr(0644,root,root) /usr/man/man1/*
508 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
509 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
510 %attr(0644,root,root) /usr/share/applications/bacula.desktop
511 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
512 %attr(0644,root,root) /etc/logrotate.d/bacula
513
514 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
515 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
516 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
517 %attr(0640,root,root) %config(noreplace) /etc/bacula/bconsole.conf
518 %attr(0640,root,root) /etc/bacula/query.sql
519 %attr(0640,root,root) %{sqlite_bindir}/libsqlite.a
520 %attr(0640,root,root) %{sqlite_bindir}/sqlite.h
521 %attr(0640,root,root) %dir %{working_dir}
522
523 %attr(0750,root,root) /usr/sbin/*
524 %attr(0750,root,root) %{sqlite_bindir}/sqlite
525 %attr(0750,root,root) /etc/bacula/btraceback.gdb
526
527 %pre sqlite
528 # test for bacula database older than version 6
529 if [ -s %{working_dir}/bacula.db ];then
530         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
531         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
532                 echo "This bacula upgrade will update a bacula database from version 6 to 7."
533                 echo "You appear to be running database version $DB_VER. You must first update"
534                 echo "your database to version 6 and then install this upgrade. The alternative"
535                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
536                 echo "catalog information, then do the upgrade. Information on updating a"
537                 echo "database older than version 6 can be found in the release notes."
538                 exit 1
539         fi
540 fi
541 # check for and copy /etc/bacula/console.conf to bconsole.conf
542 if [ -s /etc/bacula/console.conf ];then
543         cp /etc/bacula/console.conf /etc/bacula/bconsole.conf
544 fi
545
546 %post sqlite
547 # delete then add our links
548 /sbin/chkconfig --del bacula-dir
549 /sbin/chkconfig --del bacula-fd
550 /sbin/chkconfig --del bacula-sd
551 /sbin/chkconfig --add bacula-dir
552 /sbin/chkconfig --add bacula-fd
553 /sbin/chkconfig --add bacula-sd
554
555 # add execute permission for console
556 chmod 0755 /usr/sbin/gnome-console
557
558 # test for an existing database
559 if [ -s %{working_dir}/bacula.db ]; then
560         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
561         # check to see if we need to upgrade a 1.32 or lower database
562         if [ "$DB_VER" -lt "7" ]; then
563                 echo "This release requires an upgrade to your bacula database."
564                 echo "Backing up your current database..."
565                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
566                 echo "Upgrading bacula database ..."
567                 /etc/bacula/update_sqlite_tables
568                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
569         fi
570 else
571         # create the database and tables
572         echo "Hmm, doesn't look like you have an existing database."
573         echo "Creating SQLite database..."
574         /etc/bacula/create_sqlite_database
575         echo "Creating the SQLite tables..."
576         /etc/bacula/make_sqlite_tables
577 fi
578
579 %preun sqlite
580 # delete our links
581 /sbin/chkconfig --del bacula-dir
582 /sbin/chkconfig --del bacula-fd
583 /sbin/chkconfig --del bacula-sd
584
585 %endif
586
587 %files client
588 %defattr(-,root,root)
589
590 %attr(0754,root,root) /etc/bacula/fd
591 %attr(0754,root,root) /etc/init.d/bacula-fd
592
593 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
594 %attr(0644,root,root) /etc/logrotate.d/bacula
595
596 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
597 %attr(0640,root,root) %dir %{working_dir}
598
599 %attr(0750,root,root) /usr/sbin/bacula-fd
600 %attr(0750,root,root) /usr/sbin/btraceback
601 %attr(0750,root,root) /etc/bacula/btraceback.gdb
602 %attr(0750,root,root) /usr/sbin/bsmtp
603
604
605 %post client
606 # delete then add our links
607 /sbin/chkconfig --del bacula-fd
608 /sbin/chkconfig --add bacula-fd
609
610 %preun client
611 # delete our links
612 /sbin/chkconfig --del bacula-fd
613
614 %files rescue
615 %defattr(-,root,root)
616 %attr(0644,root,root) /etc/bacula/rescue/backup.etc.list
617 %attr(0754,root,root) /etc/bacula/rescue/format_floppy
618 %attr(0754,root,root) /etc/bacula/rescue/getdiskinfo
619 %attr(0754,root,root) /etc/bacula/rescue/make_rescue_disk
620 %attr(0754,root,root) /etc/bacula/rescue/restore_bacula
621 %attr(0754,root,root) /etc/bacula/rescue/restore_etc
622 %attr(0754,root,root) /etc/bacula/rescue/run_grub
623 %attr(0754,root,root) /etc/bacula/rescue/run_lilo
624 %attr(0644,root,root) /etc/bacula/rescue/sfdisk.bz2
625 %attr(0754,root,root) /etc/bacula/rescue/bacula-fd
626 /etc/bacula/rescue/tomsrtbt/*
627
628 %post rescue
629 # link our current installed conf file to the rescue directory
630 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
631
632 echo
633 echo "Ready to create the rescue files for this system."
634 echo "Press <enter> to continue..."
635 read A
636 echo
637
638 # run getdiskinfo
639 echo "Running getdiskinfo..."
640 cd /etc/bacula/rescue
641 ./getdiskinfo
642
643 echo
644 echo "Finished."
645 echo "To create a boot disk run \"./install.s\" from the /etc/bacula/rescue/tomsrtbt/"
646 echo "directory. To make the bacula rescue disk run"
647 echo "\"./make_rescue_disk --copy-static-bacula --copy-etc-files\" "
648 echo "from the /etc/bacula/rescue directory. To recreate the rescue"
649 echo "information for this system run ./getdiskinfo again."
650 echo
651
652 %preun rescue
653 # remove the files created after the initial rpm installation
654 rm -f /etc/bacula/rescue/bacula-fd.conf
655 rm -f /etc/bacula/rescue/partition.*
656 rm -f /etc/bacula/rescue/format.*
657 rm -f /etc/bacula/rescue/mount_drives
658 rm -f /etc/bacula/rescue/start_network
659 rm -f /etc/bacula/rescue/sfdisk
660 rm -rf /etc/bacula/rescue/diskinfo/*
661
662 %changelog
663 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
664 - corrected the if else logic in the dependancy sections
665 - changes for 1.34 release
666 - /etc/bacula/console is now /etc/bacula/bconsole
667 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
668 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
669 - /usr/sbin/smtp is now /usr/sbin/bsmtp
670 - added new /etc/bacula/drop_mysql_database
671 - added new /etc/bacula/drop_sqlite_database
672 - added new /etc/bacula/grant_sqlite_privileges
673 - added new generic bacula database scripts in /etc/bacula
674 - added pre-install sections to check for database versions older than 6
675 - added check for /etc/bacula/console.conf and copy to bconsole.conf
676 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
677 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
678 - added testing for existing databases before executing any of the database creation scripts
679 - added defines working_dir and sqlite_bindir in place of hard coded paths
680 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
681 - added build configuration for SuSE.
682 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
683 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
684 - added patch for create_sqlite_database to fix the installed bindir
685 - added execute of create_sqlite_database to post of sqlite package
686 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
687 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
688 - added bacula-fd as Requires for rescue package
689 - added build tag for Fedora Core 1
690 - cleaned up dependancies for all builds
691 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
692 - removed rh_version from package names
693 - added platform build configuration section to beginning of file
694 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
695 - removed make_static_bacula script from rescue package install
696 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
697 - Added define at top of file for depkgs version
698 - Added rescue sub-package
699 - Moved requires statements into proper sub-package locations
700 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
701 - Corrected Requires for Gnome 1.4/2.0 builds
702 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
703 - Added separate Source declaration for depkgs
704 - added patch for make_catalog_backup script
705 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
706 - Misc changes to mysql/sqlite build and rh7/8 menu differences
707 - Added rh_version to sub-package names
708 - Added installed but missing file /etc/bacula/gconsole
709 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
710 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
711 - Update spec for version 1.31 and combine client
712 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
713 - Initial spec file