]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/suse/bacula.spec.in
Correct mysql Requires: for suse in spec file, add process status check to suse init...
[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 for database support desired
30 %define mysql 0
31 %{?build_mysql:%define mysql 1}
32 %define sqlite 0
33 %{?build_sqlite:%define sqlite 1}
34 %define postgresql 0
35 %{?build_postgresql:%define postgresql 1}
36
37 Summary: Bacula - The Network Backup Solution
38 Name: bacula
39 Version: @VERSION@
40 Release: 1
41 Group: System Environment/Daemons
42 Copyright: GPL v2
43 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
44 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
45 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
46 BuildRoot: %{_tmppath}/%{name}-root
47 URL: http://www.bacula.org/
48 Vendor: The Bacula Team
49 Distribution: The Bacula Team
50 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
51 BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel
52 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel
53 %if %{rh7}
54 BuildRequires: libtermcap-devel
55 BuildRequires: gtk+-devel >= 1.2
56 BuildRequires: gnome-libs-devel >= 1.4
57 BuildRequires: glibc-devel >= 2.2
58 BuildRequires: ORBit-devel
59 BuildRequires: bonobo-devel
60 BuildRequires: GConf-devel
61 %endif
62 %if %{su9}
63 BuildRequires: termcap
64 BuildRequires: gtk2-devel >= 2.0
65 BuildRequires: libgnomeui-devel >= 2.0
66 BuildRequires: glibc-devel >= 2.3
67 BuildRequires: ORBit2-devel
68 BuildRequires: libart_lgpl-devel >= 2.0
69 BuildRequires: libbonobo-devel >= 2.0
70 BuildRequires: libbonoboui-devel >= 2.0
71 BuildRequires: bonobo-activation-devel
72 BuildRequires: gconf2-devel
73 BuildRequires: linc-devel
74 %endif
75 %if ! %{rh7} && ! %{su9}
76 BuildRequires: libtermcap-devel
77 BuildRequires: gtk2-devel >= 2.0
78 BuildRequires: libgnomeui-devel >= 2.0
79 BuildRequires: glibc-devel >= 2.3
80 BuildRequires: ORBit2-devel
81 BuildRequires: libart_lgpl-devel >= 2.0
82 BuildRequires: libbonobo-devel >= 2.0
83 BuildRequires: libbonoboui-devel >= 2.0
84 BuildRequires: bonobo-activation-devel
85 BuildRequires: GConf2-devel
86 BuildRequires: linc-devel
87 %endif
88
89 %if %{mysql}
90 BuildRequires: mysql-devel >= 3.23
91 %endif
92
93 %if %{postgresql} && %{wb3}
94 BuildRequires: rh-postgresql-devel >= 7
95 %endif
96
97 %if %{postgresql} && ! %{wb3}
98 BuildRequires: postgresql-devel >= 7
99 %endif
100
101 %description
102 Bacula - It comes by night and sucks the vital essence from your computers.
103
104 Bacula is a set of computer programs that permit you (or the system 
105 administrator) to manage backup, recovery, and verification of computer 
106 data across a network of computers of different kinds. In technical terms, 
107 it is a network client/server based backup program. Bacula is relatively 
108 easy to use and efficient, while offering many advanced storage management 
109 features that make it easy to find and recover lost or damaged files. 
110 Bacula source code has been released under the GPL version 2 license.
111
112 %if %{mysql}
113 %package mysql
114 %endif
115 %if %{sqlite}
116 %package sqlite
117 %endif
118 %if %{postgresql}
119 %package postgresql
120 %endif
121
122 Summary: Bacula - The Network Backup Solution
123 Group: System Environment/Daemons
124 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
125 Conflicts: bacula-client, bacula-gconsole
126 Requires: readline, perl, atk, ncurses, pango, libstdc++
127 Requires: libxml2, zlib
128 %if %{rh7}
129 Requires: gtk+ >= 1.2
130 Requires: gnome-libs >= 1.4
131 Requires: glibc >= 2.2
132 Requires: ORBit
133 Requires: bonobo
134 Requires: GConf
135 Requires: libtermcap
136 %endif
137 %if %{su9}
138 Requires: gtk2 >= 2.0
139 Requires: libgnomeui >= 2.0
140 Requires: glibc >= 2.3
141 Requires: ORBit2
142 Requires: libart_lgpl >= 2.0
143 Requires: libbonobo >= 2.0
144 Requires: libbonoboui >= 2.0
145 Requires: bonobo-activation
146 Requires: gconf2
147 Requires: linc
148 Requires: termcap
149 %endif
150 %if ! %{rh7} && ! %{su9}
151 Requires: gtk2 >= 2.0
152 Requires: libgnomeui >= 2.0
153 Requires: glibc >= 2.3
154 Requires: ORBit2
155 Requires: libart_lgpl >= 2.0
156 Requires: libbonobo >= 2.0
157 Requires: libbonoboui >= 2.0
158 Requires: bonobo-activation
159 Requires: GConf2
160 Requires: linc
161 Requires: libtermcap
162 %endif
163 %if %{mysql} && ! %{su9}
164 Requires: mysql >= 3.23
165 Requires: mysql-server >= 3.23
166 %endif
167 %if %{mysql} && %{su9}
168 Requires: mysql >= 3.23
169 Requires: mysql-client >= 3.23
170 %endif
171 %if %{postgresql} && %{wb3}
172 Requires: rh-postgresql >= 7
173 Requires: rh-postgresql-server >= 7
174 %endif
175 %if %{postgresql} && ! %{wb3}
176 Requires: postgresql >= 7
177 Requires: postgresql-server >= 7
178 %endif
179
180 %if %{mysql}
181 %description mysql
182 %endif
183 %if %{sqlite}
184 %description sqlite
185 %endif
186 %if %{postgresql}
187 %description postgresql
188 %endif
189
190 Bacula - It comes by night and sucks the vital essence from your computers.
191
192 Bacula is a set of computer programs that permit you (or the system 
193 administrator) to manage backup, recovery, and verification of computer 
194 data across a network of computers of different kinds. In technical terms, 
195 it is a network client/server based backup program. Bacula is relatively 
196 easy to use and efficient, while offering many advanced storage management 
197 features that make it easy to find and recover lost or damaged files. 
198 Bacula source code has been released under the GPL version 2 license.
199
200 %if %{mysql}
201 This build requires MySQL to be installed separately as the catalog database.
202 %endif
203 %if %{postgresql}
204 This build requires PostgreSQL to be installed separately as the catalog database.
205 %endif
206 %if %{sqlite}
207 This build incorporates sqlite as the catalog database, statically compiled.
208 %endif
209
210 %package client
211 Summary: Bacula - The Network Backup Solution
212 Group: System Environment/Daemons
213 Provides: bacula-fd
214 Requires: readline, perl, libstdc++, zlib
215
216 %if %{rh7}
217 Requires: glibc >= 2.2
218 Requires: libtermcap
219 %endif
220 %if %{su9}
221 Requires: glibc >= 2.3
222 Requires: termcap
223 %endif
224 %if ! %{rh7} && ! %{su9}
225 Requires: glibc >= 2.3
226 Requires: libtermcap
227 %endif
228
229 %description client
230 Bacula - It comes by night and sucks the vital essence from your computers.
231
232 Bacula is a set of computer programs that permit you (or the system 
233 administrator) to manage backup, recovery, and verification of computer 
234 data across a network of computers of different kinds. In technical terms, 
235 it is a network client/server based backup program. Bacula is relatively 
236 easy to use and efficient, while offering many advanced storage management 
237 features that make it easy to find and recover lost or damaged files. 
238 Bacula source code has been released under the GPL version 2 license.
239
240 This is the File daemon (Client) only package. It includes the command line 
241 console program.
242
243 %package rescue
244
245 Summary: Bacula - The Network Backup Solution
246 Group: System Environment/Daemons
247 Requires: coreutils, util-linux, libc5, bacula-fd
248
249 %description rescue
250 Bacula - It comes by night and sucks the vital essence from your computers.
251
252 Bacula is a set of computer programs that permit you (or the system 
253 administrator) to manage backup, recovery, and verification of computer 
254 data across a network of computers of different kinds. In technical terms, 
255 it is a network client/server based backup program. Bacula is relatively 
256 easy to use and efficient, while offering many advanced storage management 
257 features that make it easy to find and recover lost or damaged files. 
258 Bacula source code has been released under the GPL version 2 license.
259
260 This package installs scripts for disaster recovery and builds rescue 
261 floppy disks for bare metal recovery. This package includes tomsrtbt
262 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
263 to build a boot floppy disk.
264
265 You need to have the bacula-sqlite, bacula-mysql, bacula-postgresql or 
266 bacula-client package for your platform installed and configured before 
267 installing this package.
268
269 To create a boot disk run "./getdiskinfo" from the /etc/bacula/rescue
270 directory (this is done when the package is first installed), 
271 then run "./install.s" from the /etc/bacula/rescue/tomsrtbt/
272 directory. To make the bacula rescue disk run
273 "./make_rescue_disk --copy-static-bacula --copy-etc-files"
274 from the /etc/bacula/rescue directory. To recreate the rescue
275 information for this system run ./getdiskinfo again.
276
277 %package updatedb
278
279 Summary: Bacula - The Network Backup Solution
280 Group: System Environment/Daemons
281
282 %description updatedb
283 Bacula - It comes by night and sucks the vital essence from your computers.
284
285 Bacula is a set of computer programs that permit you (or the system 
286 administrator) to manage backup, recovery, and verification of computer 
287 data across a network of computers of different kinds. In technical terms, 
288 it is a network client/server based backup program. Bacula is relatively 
289 easy to use and efficient, while offering many advanced storage management 
290 features that make it easy to find and recover lost or damaged files. 
291 Bacula source code has been released under the GPL version 2 license.
292
293 This package installs scripts for updating older versions of the bacula
294 database.
295
296 %package gconsole
297 Summary: Bacula - The Network Backup Solution
298 Group: System Environment/Daemons
299 Requires: readline, libstdc++, zlib, pango, bacula-client
300 Conflicts: bacula-server
301
302 %if %{rh7}
303 Requires: gtk+ >= 1.2
304 Requires: gnome-libs >= 1.4
305 Requires: glibc >= 2.2
306 Requires: ORBit
307 Requires: bonobo
308 Requires: GConf
309 %endif
310 %if %{su9}
311 Requires: gtk2 >= 2.0
312 Requires: libgnomeui >= 2.0
313 Requires: glibc >= 2.3
314 Requires: ORBit2
315 Requires: libart_lgpl >= 2.0
316 Requires: libbonobo >= 2.0
317 Requires: libbonoboui >= 2.0
318 Requires: bonobo-activation
319 Requires: gconf2
320 Requires: linc
321 %endif
322 %if ! %{rh7} && ! %{su9}
323 Requires: gtk2 >= 2.0
324 Requires: libgnomeui >= 2.0
325 Requires: glibc >= 2.3
326 Requires: ORBit2
327 Requires: libart_lgpl >= 2.0
328 Requires: libbonobo >= 2.0
329 Requires: libbonoboui >= 2.0
330 Requires: bonobo-activation
331 Requires: GConf2
332 Requires: linc
333 %endif
334
335 %description gconsole
336 Bacula - It comes by night and sucks the vital essence from your computers.
337
338 Bacula is a set of computer programs that permit you (or the system 
339 administrator) to manage backup, recovery, and verification of computer 
340 data across a network of computers of different kinds. In technical terms, 
341 it is a network client/server based backup program. Bacula is relatively 
342 easy to use and efficient, while offering many advanced storage management 
343 features that make it easy to find and recover lost or damaged files. 
344 Bacula source code has been released under the GPL version 2 license.
345
346 This is the Gnome Console package. It is an add-on to the client package.
347
348 %prep
349
350 %setup -b 1
351 %setup -b 2
352
353 %build
354
355 %if %{su9}
356 export LDFLAGS="-L/usr/lib/termcap"
357 %endif
358
359 cwd=${PWD}
360 cd %{depkgs}
361 %if %{sqlite}
362 make sqlite
363 %endif
364 make mtx
365 cd ${cwd}
366
367 # patches for the bundled sqlite scripts
368
369 # patch the make_sqlite_tables script for installation bindir
370 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
371
372 # patch the create_sqlite_database script for installation bindir
373 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
374
375 # patch the make_catalog_backup script for installation bindir
376 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
377
378 # patch the update_sqlite_tables script for installation bindir
379 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
380
381 %configure \
382         --prefix=/usr \
383         --sbindir=/usr/sbin \
384         --sysconfdir=/etc/bacula \
385         --with-scriptdir=/etc/bacula \
386         --enable-smartalloc \
387         --enable-gnome \
388            --enable-static-fd \
389 %if %{mysql}
390         --with-mysql \
391 %endif
392 %if %{sqlite}
393         --with-sqlite=${cwd}/../depkgs/sqlite \
394 %endif
395 %if %{postgresql}
396         --with-postgresql \
397 %endif
398         --with-working-dir=%{working_dir} \
399         --with-pid-dir=/var/run \
400         --with-subsys-dir=/var/lock/subsys
401 make
402
403 cd src/filed
404 strip static-bacula-fd
405 cd ../../
406
407 %install
408  
409 cwd=${PWD}
410 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
411 mkdir -p $RPM_BUILD_ROOT/etc/init.d
412 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
413 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
414 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
415 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
416 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue
417 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt
418 mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
419
420 %if %{sqlite}
421 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
422 %endif
423
424 make \
425         prefix=$RPM_BUILD_ROOT/usr \
426         sbindir=$RPM_BUILD_ROOT/usr/sbin \
427         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
428         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
429         working_dir=$RPM_BUILD_ROOT%{working_dir} \
430         install
431
432 cd %{depkgs}
433 make \
434         prefix=$RPM_BUILD_ROOT/usr \
435         sbindir=$RPM_BUILD_ROOT/usr/sbin \
436         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
437         working_dir=$RPM_BUILD_ROOT%{working_dir} \
438         mandir=$RPM_BUILD_ROOT/usr/man \
439         mtx-install
440 cd ${cwd}
441
442 # fixme - make installs the mysql scripts for sqlite build
443 %if %{sqlite}
444 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
445 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
446 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
447 %endif
448
449 # fixme - make installs the mysql scripts for postgresql build
450 %if %{postgresql}
451 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
452 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
453 %endif
454
455 # install the init scripts
456 %if %{su9}
457 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
458 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
459 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
460 %else
461 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
462 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
463 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
464 %endif
465 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
466
467 # install the menu stuff
468 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
469 cp -p scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
470 cp -p scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
471
472 # install sqlite
473 %if %{sqlite}
474 cp -p ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
475 cp -p ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
476 cp -p ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
477 %endif
478
479 # install the logrotate file
480 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
481
482 # install the rescue stuff
483 # these are the rescue scripts
484 cp -p rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/
485 cp -p rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/
486 cp -p rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/
487 cp -p rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/
488 cp -p rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
489 cp -p rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
490 cp -p rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
491 cp -p rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
492 cp -p rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
493
494 # this is the static file daemon
495 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
496
497 # this is the tom's root boot disk
498 cp -p ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
499
500 # install the updatedb scripts
501 cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
502
503 # now clean up permissions that are left broken by the install
504 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
505 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
506
507 %clean
508 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
509
510 %if %{mysql}
511
512 %files mysql
513 %defattr(-,root,root)
514
515 /etc/bacula/bacula
516 /etc/bacula/bconsole
517 /etc/bacula/fd
518 /etc/bacula/gconsole
519 /etc/bacula/create_mysql_database
520 /etc/bacula/drop_mysql_database
521 /etc/bacula/make_mysql_tables
522 /etc/bacula/drop_mysql_tables
523 /etc/bacula/update_mysql_tables
524 /etc/bacula/grant_mysql_privileges
525 /etc/bacula/create_bacula_database
526 /etc/bacula/drop_bacula_database
527 /etc/bacula/grant_bacula_privileges
528 /etc/bacula/make_bacula_tables
529 /etc/bacula/drop_bacula_tables
530 /etc/bacula/update_bacula_tables
531 /etc/bacula/make_catalog_backup
532 /etc/bacula/delete_catalog_backup
533 /etc/bacula/startmysql
534 /etc/bacula/stopmysql
535 /etc/bacula/mtx-changer
536 /etc/init.d/bacula-dir
537 /etc/init.d/bacula-fd
538 /etc/init.d/bacula-sd
539
540 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
541 /usr/man/man1/*
542 /usr/share/pixmaps/bacula.png
543 /usr/share/gnome/apps/System/bacula.desktop
544 /usr/share/applications/bacula.desktop
545 %config(noreplace) /etc/bacula/gnome-console.conf
546 /etc/logrotate.d/bacula
547
548 %config(noreplace) /etc/bacula/bacula-dir.conf
549 %config(noreplace) /etc/bacula/bacula-fd.conf
550 %config(noreplace) /etc/bacula/bacula-sd.conf
551 %config(noreplace) /etc/bacula/bconsole.conf
552 /etc/bacula/query.sql
553 %dir %{working_dir}
554
555 /usr/sbin/*
556 /etc/bacula/btraceback.gdb
557
558 %pre mysql
559 # test for bacula database older than version 6
560 # note: this ASSUMES no password has been set for bacula database
561 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
562
563 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
564         echo "This bacula upgrade will update a bacula database from version 6 to 7."
565         echo "You appear to be running database version $DB_VER. You must first update"
566         echo "your database to version 6 and then install this upgrade. The alternative"
567         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
568         echo "catalog information, then do the upgrade. Information on updating a"
569         echo "database older than version 6 can be found in the release notes."
570         exit 1
571 fi
572 # check for and copy /etc/bacula/console.conf to bconsole.conf
573 if [ -s /etc/bacula/console.conf ];then
574         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
575 fi
576
577 %post mysql
578
579 # add our links
580 if [ "$1" -ge 1 ] ; then
581 /sbin/chkconfig --add bacula-dir
582 /sbin/chkconfig --add bacula-fd
583 /sbin/chkconfig --add bacula-sd
584 fi
585
586 # test for an existing database
587 # note: this ASSUMES no password has been set for bacula database
588 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
589
590 # grant privileges and create tables if they do not exist
591 if [ -z "$DB_VER" ]; then
592         echo "Hmm, doesn't look like you have an existing database."
593         echo "Granting privileges for MySQL user bacula..."
594         /etc/bacula/grant_mysql_privileges
595         echo "Creating MySQL bacula database..."
596         /etc/bacula/create_mysql_database
597         echo "Creating bacula tables..."
598         /etc/bacula/make_mysql_tables
599
600 # check to see if we need to upgrade a 1.32 or lower database
601 elif [ "$DB_VER" -lt "7" ]; then
602         echo "This release requires an upgrade to your bacula database."
603         echo "Backing up your current database..."
604         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
605         echo "Upgrading bacula database ..."
606         /etc/bacula/update_mysql_tables
607         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
608
609 fi
610
611 %preun mysql
612 # delete our links
613 if [ $1 = 0 ]; then
614 /sbin/chkconfig --del bacula-dir
615 /sbin/chkconfig --del bacula-fd
616 /sbin/chkconfig --del bacula-sd
617 fi
618
619 %endif
620
621 %if %{sqlite}
622
623 %files sqlite
624 %defattr(-,root,root)
625
626 /etc/bacula/bacula
627 /etc/bacula/bconsole
628 /etc/bacula/fd
629 /etc/bacula/gconsole
630 /etc/bacula/create_bacula_database
631 /etc/bacula/drop_bacula_database
632 /etc/bacula/grant_bacula_privileges
633 /etc/bacula/make_bacula_tables
634 /etc/bacula/drop_bacula_tables
635 /etc/bacula/update_bacula_tables
636 /etc/bacula/create_sqlite_database
637 /etc/bacula/drop_sqlite_database
638 /etc/bacula/grant_sqlite_privileges
639 /etc/bacula/make_sqlite_tables
640 /etc/bacula/drop_sqlite_tables
641 /etc/bacula/update_sqlite_tables
642 /etc/bacula/make_catalog_backup
643 /etc/bacula/delete_catalog_backup
644 /etc/bacula/mtx-changer
645 /etc/init.d/bacula-dir
646 /etc/init.d/bacula-fd
647 /etc/init.d/bacula-sd
648
649 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
650 /usr/man/man1/*
651 /usr/share/pixmaps/bacula.png
652 /usr/share/gnome/apps/System/bacula.desktop
653 /usr/share/applications/bacula.desktop
654 %config(noreplace) /etc/bacula/gnome-console.conf
655 /etc/logrotate.d/bacula
656
657 %config(noreplace) /etc/bacula/bacula-dir.conf
658 %config(noreplace) /etc/bacula/bacula-fd.conf
659 %config(noreplace) /etc/bacula/bacula-sd.conf
660 %config(noreplace) /etc/bacula/bconsole.conf
661 /etc/bacula/query.sql
662 %{sqlite_bindir}/libsqlite.a
663 %{sqlite_bindir}/sqlite.h
664 %dir %{working_dir}
665
666 /usr/sbin/*
667 %{sqlite_bindir}/sqlite
668 /etc/bacula/btraceback.gdb
669
670 %pre sqlite
671 # test for bacula database older than version 6
672 if [ -s %{working_dir}/bacula.db ];then
673         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
674         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
675                 echo "This bacula upgrade will update a bacula database from version 6 to 7."
676                 echo "You appear to be running database version $DB_VER. You must first update"
677                 echo "your database to version 6 and then install this upgrade. The alternative"
678                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
679                 echo "catalog information, then do the upgrade. Information on updating a"
680                 echo "database older than version 6 can be found in the release notes."
681                 exit 1
682         fi
683 fi
684 # check for and copy /etc/bacula/console.conf to bconsole.conf
685 if [ -s /etc/bacula/console.conf ];then
686         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
687 fi
688
689 %post sqlite
690 # add our links
691 if [ "$1" -ge 1 ] ; then
692 /sbin/chkconfig --add bacula-dir
693 /sbin/chkconfig --add bacula-fd
694 /sbin/chkconfig --add bacula-sd
695 fi
696
697 # test for an existing database
698 if [ -s %{working_dir}/bacula.db ]; then
699         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
700         # check to see if we need to upgrade a 1.32 or lower database
701         if [ "$DB_VER" -lt "7" ]; then
702                 echo "This release requires an upgrade to your bacula database."
703                 echo "Backing up your current database..."
704                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
705                 echo "Upgrading bacula database ..."
706                 /etc/bacula/update_sqlite_tables
707                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
708         fi
709 else
710         # create the database and tables
711         echo "Hmm, doesn't look like you have an existing database."
712         echo "Creating SQLite database..."
713         /etc/bacula/create_sqlite_database
714         echo "Creating the SQLite tables..."
715         /etc/bacula/make_sqlite_tables
716 fi
717
718 %preun sqlite
719 # delete our links
720 if [ $1 = 0 ]; then
721 /sbin/chkconfig --del bacula-dir
722 /sbin/chkconfig --del bacula-fd
723 /sbin/chkconfig --del bacula-sd
724 fi
725
726 %endif
727
728 %if %{postgresql}
729
730 %files postgresql
731 %defattr(-,root,root)
732
733 /etc/bacula/bacula
734 /etc/bacula/bconsole
735 /etc/bacula/fd
736 /etc/bacula/gconsole
737 /etc/bacula/create_postgresql_database
738 /etc/bacula/drop_postgresql_database
739 /etc/bacula/make_postgresql_tables
740 /etc/bacula/drop_postgresql_tables
741 /etc/bacula/update_postgresql_tables
742 /etc/bacula/grant_postgresql_privileges
743 /etc/bacula/create_bacula_database
744 /etc/bacula/drop_bacula_database
745 /etc/bacula/grant_bacula_privileges
746 /etc/bacula/make_bacula_tables
747 /etc/bacula/drop_bacula_tables
748 /etc/bacula/update_bacula_tables
749 /etc/bacula/make_catalog_backup
750 /etc/bacula/delete_catalog_backup
751 /etc/bacula/mtx-changer
752 /etc/init.d/bacula-dir
753 /etc/init.d/bacula-fd
754 /etc/init.d/bacula-sd
755
756 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
757 /usr/man/man1/*
758 /usr/share/pixmaps/bacula.png
759 /usr/share/gnome/apps/System/bacula.desktop
760 /usr/share/applications/bacula.desktop
761 %config(noreplace) /etc/bacula/gnome-console.conf
762 /etc/logrotate.d/bacula
763
764 %config(noreplace) /etc/bacula/bacula-dir.conf
765 %config(noreplace) /etc/bacula/bacula-fd.conf
766 %config(noreplace) /etc/bacula/bacula-sd.conf
767 %config(noreplace) /etc/bacula/bconsole.conf
768 /etc/bacula/query.sql
769 %dir %{working_dir}
770
771 /usr/sbin/*
772 /etc/bacula/btraceback.gdb
773
774 %post postgresql
775 # add our links
776 if [ "$1" -ge 1 ] ; then
777 /sbin/chkconfig --add bacula-dir
778 /sbin/chkconfig --add bacula-fd
779 /sbin/chkconfig --add bacula-sd
780 fi
781
782 # test for an existing database
783 # note: this ASSUMES no password has been set for bacula database
784 DB_VER=`echo 'select * from Version;' | psql bacula | tail -3 | head -1 2>/dev/null`
785
786 # grant privileges and create tables if they do not exist
787 if [ -z "$DB_VER" ]; then
788         echo "Hmm, doesn't look like you have an existing database."
789         echo "Granting privileges for PostgreSQL user bacula..."
790         /etc/bacula/grant_postgresql_privileges
791         echo "Creating PostgreSQL bacula database..."
792         /etc/bacula/create_postgresql_database
793         echo "Creating bacula tables..."
794         /etc/bacula/make_postgresql_tables
795
796 %preun postgresql
797 # delete our links
798 if [ $1 = 0 ]; then
799 /sbin/chkconfig --del bacula-dir
800 /sbin/chkconfig --del bacula-fd
801 /sbin/chkconfig --del bacula-sd
802 fi
803
804 %endif
805
806 %files client
807 %defattr(-,root,root)
808
809 /etc/bacula/fd
810 /etc/bacula/bconsole
811 /etc/init.d/bacula-fd
812
813 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
814 /etc/logrotate.d/bacula
815
816 %config(noreplace) /etc/bacula/bacula-fd.conf
817 %config(noreplace) /etc/bacula/bconsole.conf
818 %dir %{working_dir}
819
820 /usr/sbin/bacula-fd
821 /usr/sbin/btraceback
822 /etc/bacula/btraceback.gdb
823 /usr/sbin/bsmtp
824 /usr/sbin/bconsole
825
826
827 %post client
828 # add our link
829 if [ "$1" -ge 1 ] ; then
830 /sbin/chkconfig --add bacula-fd
831 fi
832
833 %preun client
834 # delete our link
835 if [ $1 = 0 ]; then
836 /sbin/chkconfig --del bacula-fd
837 fi
838
839 %files rescue
840 %defattr(-,root,root)
841 /etc/bacula/rescue/backup.etc.list
842 /etc/bacula/rescue/format_floppy
843 /etc/bacula/rescue/getdiskinfo
844 /etc/bacula/rescue/make_rescue_disk
845 /etc/bacula/rescue/restore_bacula
846 /etc/bacula/rescue/restore_etc
847 /etc/bacula/rescue/run_grub
848 /etc/bacula/rescue/run_lilo
849 /etc/bacula/rescue/sfdisk.bz2
850 /etc/bacula/rescue/bacula-fd
851 /etc/bacula/rescue/tomsrtbt/*
852
853 %post rescue
854 # link our current installed conf file to the rescue directory
855 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
856
857 # run getdiskinfo
858 echo "Creating rescue files for this system..."
859 cd /etc/bacula/rescue
860 ./getdiskinfo
861
862 %preun rescue
863 # remove the files created after the initial rpm installation
864 rm -f /etc/bacula/rescue/bacula-fd.conf
865 rm -f /etc/bacula/rescue/partition.*
866 rm -f /etc/bacula/rescue/format.*
867 rm -f /etc/bacula/rescue/mount_drives
868 rm -f /etc/bacula/rescue/start_network
869 rm -f /etc/bacula/rescue/sfdisk
870 rm -rf /etc/bacula/rescue/diskinfo/*
871
872 %files updatedb
873 %defattr(-,root,root)
874 /etc/bacula/updatedb/*
875
876 %post updatedb
877 echo "The database update scripts were installed to /etc/bacula/updatedb"
878
879 %files gconsole
880 %defattr(-,root,root)
881 /usr/sbin/gnome-console
882 /etc/bacula/gconsole
883 %config(noreplace) /etc/bacula/gnome-console.conf
884 /usr/share/pixmaps/bacula.png
885 /usr/share/gnome/apps/System/bacula.desktop
886 /usr/share/applications/bacula.desktop
887
888 %post gconsole
889
890
891 %changelog
892 * Sat Mar 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
893 - corrected mysql prerequisites for suse
894 * Mon Mar 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
895 - replaced all cp commands with cp -p
896 - removed addition of a+x permissions on gnome-console
897 - corrected permissions on init scripts
898 * Sat Feb 28 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
899 - corrected creation of sqlite_bindir in install from !mysql to sqlite
900 -
901 - various cleanup patches from Michael K. Johnson:
902 - corrected post install routines for nicer chkconfig
903 - removed chmod changes in post routines and moved to install section
904 - removed interactive nature of post routine for rescue package
905 - added description of building rescue disks to the description of rescue package
906 - added clean of build root to beginning of install
907 - removed specifying attr in all file lists
908 * Fri Feb 20 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
909 - added bconsole to client package
910 - added gconsole package as add-on to client
911 - removed spurious dependancies on updatedb package (!cut/paste)
912 * Thu Feb 19 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
913 - added updatedb package
914 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
915 - added postgresql package
916 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
917 - corrected the if else logic in the dependancy sections
918 - changes for 1.34 release
919 - /etc/bacula/console is now /etc/bacula/bconsole
920 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
921 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
922 - /usr/sbin/smtp is now /usr/sbin/bsmtp
923 - added new /etc/bacula/drop_mysql_database
924 - added new /etc/bacula/drop_sqlite_database
925 - added new /etc/bacula/grant_sqlite_privileges
926 - added new generic bacula database scripts in /etc/bacula
927 - added pre-install sections to check for database versions older than 6
928 - added check for /etc/bacula/console.conf and copy to bconsole.conf
929 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
930 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
931 - added testing for existing databases before executing any of the database creation scripts
932 - added defines working_dir and sqlite_bindir in place of hard coded paths
933 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
934 - added build configuration for SuSE.
935 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
936 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
937 - added patch for create_sqlite_database to fix the installed bindir
938 - added execute of create_sqlite_database to post of sqlite package
939 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
940 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
941 - added bacula-fd as Requires for rescue package
942 - added build tag for Fedora Core 1
943 - cleaned up dependancies for all builds
944 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
945 - removed rh_version from package names
946 - added platform build configuration section to beginning of file
947 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
948 - removed make_static_bacula script from rescue package install
949 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
950 - Added define at top of file for depkgs version
951 - Added rescue sub-package
952 - Moved requires statements into proper sub-package locations
953 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
954 - Corrected Requires for Gnome 1.4/2.0 builds
955 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
956 - Added separate source declaration for depkgs
957 - added patch for make_catalog_backup script
958 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
959 - Misc changes to mysql/sqlite build and rh7/8 menu differences
960 - Added rh_version to sub-package names
961 - Added installed but missing file /etc/bacula/gconsole
962 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
963 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
964 - Update spec for version 1.31 and combine client
965 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
966 - Initial spec file