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