]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
Add centos4 and x86_64 build tags.
[bacula/bacula] / bacula / platforms / redhat / bacula.spec.in
1 # Bacula RPM spec file
2 # Copyright (C) 2004 Kern Sibbald
3
4 # Platform Build Configuration
5
6 # basic defines for every build
7 %define depkgs ../depkgs
8 %define depkgs_version 29Oct04
9 %define tomsrtbt tomsrtbt-2.0.103
10 %define sqlite_bindir /usr/lib/sqlite
11 %define working_dir /var/bacula
12 %define daemon_user root
13 %define daemon_group bacula
14 %define group_file /etc/group
15 %define groupadd /usr/sbin/groupadd
16
17 # platform defines - set one below or define the build_xxx on the command line
18 # RedHat builds
19 %define rh7 0
20 %{?build_rh7:%define rh7 1}
21 %define rh8 0
22 %{?build_rh8:%define rh8 1}
23 %define rh9 0
24 %{?build_rh9:%define rh9 1}
25 # Fedora Core build
26 %define fc1 0
27 %{?build_fc1:%define fc1 1}
28 %define fc3 0
29 %{?build_fc3:%define fc3 1}
30 # Whitebox Enterprise build
31 %define wb3 0
32 %{?build_wb3:%define wb3 1}
33 # RedHat Enterprise builds
34 %define rhel3 0
35 %{?build_rhel3:%define rhel3 1}
36 %{?build_rhel3:%define wb3 1}
37 %define rhel4 0
38 %{?build_rhel4:%define rhel4 1}
39 %{?build_rhel4:%define fc3 1}
40 # CentOS build
41 %define centos4 0
42 %{?build_centos4:%define centos4 1}
43 %{?build_centos4:%define fc3 1}
44 # SuSE build
45 %define su9 0
46 %{?build_su9:%define su9 1}
47 # Mandrake build
48 %define mdk 0
49 %{?build_mdk:%define mdk 1}
50
51 # test for a platform definition
52 %if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{wb3} && ! %{su9} && ! %{mdk}
53 %{error: You must specify a platform. Please examine the spec file.}
54 exit 1
55 %endif
56
57 # database defines
58 # set for database support desired or define the build_xxx on the command line
59 %define mysql 0
60 %{?build_mysql:%define mysql 1}
61 # if using mysql 4.x define this and mysql above
62 # currently: Mandrake 10.1, SuSE 9.2, RHEL4
63 %define mysql4 0
64 %{?build_mysql4:%define mysql4 1}
65 %define sqlite 0
66 %{?build_sqlite:%define sqlite 1}
67 %define postgresql 0
68 %{?build_postgresql:%define postgresql 1}
69
70 # test for a database definition
71 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
72 %{error: You must specify database support. Please examine the spec file.}
73 exit 1
74 %endif
75
76 # 64 bit support
77 %define x86_64 0
78 %{?build_x86_64:%define x86_64 1}
79
80 # check what distribution we are
81 %if %{rh7} || %{rh8} || %{rh9} || %{rhel3} || %{rhel4}
82 %define _dist %(grep Red /etc/redhat-release)
83 %endif
84 %if %{fc1}
85 %define _dist %(grep Fedora /etc/redhat-release)
86 %endif
87 %if %{centos4}
88 %define _dist %(grep CentOS /etc/redhat-release)
89 %endif
90 %if %{fc3} && ! %{rhel4} && ! %{centos4}
91 %define _dist %(grep Fedora /etc/redhat-release)
92 %endif
93 %if %{wb3} && ! %{rhel3}
94 %define _dist %(grep White /etc/whitebox-release)
95 %endif
96 %if %{su9}
97 %define _dist %(grep SuSE /etc/SuSE-release)
98 %endif
99 %if %{mdk}
100 %define _dist %(grep Mandrake /etc/mandrake-release)
101 %endif
102
103 Summary: Bacula - The Network Backup Solution
104 Name: bacula
105 Version: @VERSION@
106 Release: 1
107 Group: System Environment/Daemons
108 Copyright: GPL v2
109 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
110 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
111 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
112 Source3: Release_Notes-%{version}-%{release}.tar.gz
113 BuildRoot: %{_tmppath}/%{name}-root
114 URL: http://www.bacula.org/
115 Vendor: The Bacula Team
116 Distribution: %{_dist}
117 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
118 BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel
119 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel, pkgconfig
120 %if %{rh7}
121 BuildRequires: libtermcap-devel
122 BuildRequires: gtk+-devel >= 1.2
123 BuildRequires: gnome-libs-devel >= 1.4
124 BuildRequires: glibc-devel >= 2.2
125 BuildRequires: ORBit-devel
126 BuildRequires: bonobo-devel
127 BuildRequires: GConf-devel
128 BuildRequires: freetype-devel
129 %endif
130 %if %{su9}
131 BuildRequires: termcap
132 BuildRequires: libgnome >= 2.0
133 BuildRequires: gtk2-devel >= 2.0
134 BuildRequires: libgnomeui-devel >= 2.0
135 BuildRequires: glibc-devel >= 2.3
136 BuildRequires: ORBit2-devel
137 BuildRequires: libart_lgpl-devel >= 2.0
138 BuildRequires: libbonobo-devel >= 2.0
139 BuildRequires: libbonoboui-devel >= 2.0
140 BuildRequires: bonobo-activation-devel
141 BuildRequires: gconf2-devel
142 BuildRequires: linc-devel
143 BuildRequires: freetype2-devel
144 %endif
145 %if %{mdk}
146 BuildRequires: libtermcap-devel
147 BuildRequires: gtk2-devel >= 2.0
148 BuildRequires: libgnomeui2-devel >= 2.0
149 BuildRequires: glibc-devel >= 2.3
150 BuildRequires: libORBit2-devel
151 BuildRequires: libart_lgpl-devel >= 2.0
152 BuildRequires: libbonobo2_0-devel
153 BuildRequires: libbonoboui2_0-devel
154 BuildRequires: libbonobo-activation-devel
155 BuildRequires: libGConf2-devel
156 BuildRequires: libstdc++-static-devel
157 BuildRequires: glibc-static-devel
158 BuildRequires: freetype2-devel
159 %endif
160 %if %{fc3}
161 BuildRequires: libtermcap-devel
162 BuildRequires: gtk2-devel >= 2.4
163 BuildRequires: libgnomeui-devel >= 2.8
164 BuildRequires: glibc-devel >= 2.3
165 BuildRequires: ORBit2-devel
166 BuildRequires: libart_lgpl-devel >= 2.3
167 BuildRequires: libbonobo-devel >= 2.8
168 BuildRequires: libbonoboui-devel >= 2.8
169 BuildRequires: bonobo-activation-devel
170 BuildRequires: GConf2-devel
171 BuildRequires: freetype-devel
172 %endif
173 %if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
174 BuildRequires: libtermcap-devel
175 BuildRequires: gtk2-devel >= 2.0
176 BuildRequires: libgnomeui-devel >= 2.0
177 BuildRequires: glibc-devel >= 2.3
178 BuildRequires: ORBit2-devel
179 BuildRequires: libart_lgpl-devel >= 2.0
180 BuildRequires: libbonobo-devel >= 2.0
181 BuildRequires: libbonoboui-devel >= 2.0
182 BuildRequires: bonobo-activation-devel
183 BuildRequires: GConf2-devel
184 BuildRequires: linc-devel
185 BuildRequires: freetype-devel
186 %endif
187
188 %if %{mysql} && ! %{mysql4}
189 BuildRequires: mysql-devel >= 3.23
190 %endif
191
192 %if %{mysql} && %{mysql4}
193 BuildRequires: mysql-devel >= 4.0
194 %endif
195
196 %if %{postgresql} && %{wb3}
197 BuildRequires: rh-postgresql-devel >= 7
198 %endif
199
200 %if %{postgresql} && ! %{wb3}
201 BuildRequires: postgresql-devel >= 7
202 %endif
203
204 %description
205 Bacula - It comes by night and sucks the vital essence from your computers.
206
207 Bacula is a set of computer programs that permit you (or the system 
208 administrator) to manage backup, recovery, and verification of computer 
209 data across a network of computers of different kinds. In technical terms, 
210 it is a network client/server based backup program. Bacula is relatively 
211 easy to use and efficient, while offering many advanced storage management 
212 features that make it easy to find and recover lost or damaged files. 
213 Bacula source code has been released under the GPL version 2 license.
214
215 %if %{mysql}
216 %package mysql
217 %endif
218 %if %{sqlite}
219 %package sqlite
220 %endif
221 %if %{postgresql}
222 %package postgresql
223 %endif
224
225 Summary: Bacula - The Network Backup Solution
226 Group: System Environment/Daemons
227 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
228 Conflicts: bacula-client
229 Requires: readline, ncurses, libstdc++, zlib
230 %if %{sqlite}
231 Conflicts: sqlite, sqlite-tools
232 %endif
233
234 %if %{rh7}
235 Requires: glibc >= 2.2
236 Requires: libtermcap
237 %endif
238 %if %{su9}
239 Requires: glibc >= 2.3
240 Requires: termcap
241 %endif
242 %if ! %{rh7} && ! %{su9}
243 Requires: glibc >= 2.3
244 Requires: libtermcap
245 %endif
246
247 %if %{mysql} && ! %{su9} && ! %{mdk} && ! %{mysql4}
248 Requires: mysql >= 3.23
249 Requires: mysql-server >= 3.23
250 %endif
251 %if %{mysql} && ! %{su9} && ! %{mdk} && %{mysql4}
252 Requires: mysql >= 4.0
253 Requires: mysql-server >= 4.0
254 %endif
255
256 %if %{mysql} && %{su9} && ! %{mysql4}
257 Requires: mysql >= 3.23
258 Requires: mysql-client >= 3.23
259 %endif
260 %if %{mysql} && %{su9} && %{mysql4}
261 Requires: mysql >= 4.0
262 Requires: mysql-client >= 4.0
263 %endif
264
265 %if %{mysql} && %{mdk} && ! %{mysql4}
266 Requires: mysql >= 3.23
267 Requires: mysql-client >= 3.23
268 %endif
269 %if %{mysql} && %{mdk} && %{mysql4}
270 Requires: mysql >= 4.0
271 Requires: mysql-client >= 4.0
272 %endif
273
274 %if %{postgresql} && %{wb3}
275 Requires: rh-postgresql >= 7
276 Requires: rh-postgresql-server >= 7
277 %endif
278 %if %{postgresql} && ! %{wb3}
279 Requires: postgresql >= 7
280 Requires: postgresql-server >= 7
281 %endif
282
283 %if %{mysql}
284 %description mysql
285 %endif
286 %if %{sqlite}
287 %description sqlite
288 %endif
289 %if %{postgresql}
290 %description postgresql
291 %endif
292
293 Bacula - It comes by night and sucks the vital essence from your computers.
294
295 Bacula is a set of computer programs that permit you (or the system 
296 administrator) to manage backup, recovery, and verification of computer 
297 data across a network of computers of different kinds. In technical terms, 
298 it is a network client/server based backup program. Bacula is relatively 
299 easy to use and efficient, while offering many advanced storage management 
300 features that make it easy to find and recover lost or damaged files. 
301 Bacula source code has been released under the GPL version 2 license.
302
303 %if %{mysql}
304 This build requires MySQL to be installed separately as the catalog database.
305 %endif
306 %if %{postgresql}
307 This build requires PostgreSQL to be installed separately as the catalog database.
308 %endif
309 %if %{sqlite}
310 This build incorporates sqlite as the catalog database, statically compiled.
311 %endif
312
313 %package client
314 Summary: Bacula - The Network Backup Solution
315 Group: System Environment/Daemons
316 Provides: bacula-fd
317 Requires: readline, libstdc++, zlib
318
319 %if %{rh7}
320 Requires: glibc >= 2.2
321 Requires: libtermcap
322 %endif
323 %if %{su9}
324 Requires: glibc >= 2.3
325 Requires: termcap
326 %endif
327 %if ! %{rh7} && ! %{su9}
328 Requires: glibc >= 2.3
329 Requires: libtermcap
330 %endif
331
332 %description client
333 Bacula - It comes by night and sucks the vital essence from your computers.
334
335 Bacula is a set of computer programs that permit you (or the system 
336 administrator) to manage backup, recovery, and verification of computer 
337 data across a network of computers of different kinds. In technical terms, 
338 it is a network client/server based backup program. Bacula is relatively 
339 easy to use and efficient, while offering many advanced storage management 
340 features that make it easy to find and recover lost or damaged files. 
341 Bacula source code has been released under the GPL version 2 license.
342
343 This is the File daemon (Client) only package. It includes the command line 
344 console program.
345
346 %package rescue
347
348 Summary: Bacula - The Network Backup Solution
349 Group: System Environment/Daemons
350 Requires: coreutils, util-linux, bacula-fd, cdrecord, mkisofs, make
351
352 %description rescue
353 Bacula - It comes by night and sucks the vital essence from your computers.
354
355 Bacula is a set of computer programs that permit you (or the system 
356 administrator) to manage backup, recovery, and verification of computer 
357 data across a network of computers of different kinds. In technical terms, 
358 it is a network client/server based backup program. Bacula is relatively 
359 easy to use and efficient, while offering many advanced storage management 
360 features that make it easy to find and recover lost or damaged files. 
361 Bacula source code has been released under the GPL version 2 license.
362
363 This package installs scripts for disaster recovery and builds rescue 
364 floppy disks and cdroms for bare metal recovery. This package includes tomsrtbt
365 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
366 to build a boot floppy disk.
367
368 You need to have the bacula-sqlite, bacula-mysql, bacula-postgresql or 
369 bacula-client package for your platform installed and configured before 
370 installing this package.
371
372 To create a floppy boot disk run "./getdiskinfo" from the /etc/bacula/rescue/floppy
373 directory (this is done when the package is first installed), 
374 then run "./install.s" from the /etc/bacula/rescue/floppy/tomsrtbt/
375 directory. To make the bacula rescue disk run
376 "./make_rescue_disk --copy-static-bacula --copy-etc-files"
377 from the /etc/bacula/rescue/floppy directory. To recreate the rescue
378 information for this system run ./getdiskinfo again.
379
380 To create a rescue cdrom run "make all" from the /etc/bacula/rescue/cdrom
381 directory which will create an iso image file. You can burn that image with your
382 favorite cd burning utility or run "make burn" after examining and possibly
383 adjusting /etc/bacula/rescue/cdrom/Makefile.  To recreate the rescue
384 information for this system run /etc/bacula/rescue/cdrom/bacula/getdiskinfo again.
385
386 %package updatedb
387
388 Summary: Bacula - The Network Backup Solution
389 Group: System Environment/Daemons
390
391 %description updatedb
392 Bacula - It comes by night and sucks the vital essence from your computers.
393
394 Bacula is a set of computer programs that permit you (or the system 
395 administrator) to manage backup, recovery, and verification of computer 
396 data across a network of computers of different kinds. In technical terms, 
397 it is a network client/server based backup program. Bacula is relatively 
398 easy to use and efficient, while offering many advanced storage management 
399 features that make it easy to find and recover lost or damaged files. 
400 Bacula source code has been released under the GPL version 2 license.
401
402 This package installs scripts for updating older versions of the bacula
403 database.
404
405 %package gconsole
406 Summary: Bacula - The Network Backup Solution
407 Group: System Environment/Daemons
408 Requires: readline, atk, libstdc++, zlib, pango, libxml2, bacula-fd
409
410 %if %{rh7}
411 Requires: gtk+ >= 1.2
412 Requires: gnome-libs >= 1.4
413 Requires: glibc >= 2.2
414 Requires: ORBit
415 Requires: bonobo
416 Requires: GConf
417 Requires: freetype
418 %endif
419 %if %{su9}
420 Requires: gtk2 >= 2.0
421 Requires: libgnome >= 2.0
422 Requires: libgnomeui >= 2.0
423 Requires: glibc >= 2.3
424 Requires: ORBit2
425 Requires: libart_lgpl >= 2.0
426 Requires: libbonobo >= 2.0
427 Requires: libbonoboui >= 2.0
428 Requires: bonobo-activation
429 Requires: gconf2
430 Requires: linc
431 Requires: freetype2
432 %endif
433 %if %{mdk}
434 Requires: gtk2 >= 2.0
435 Requires: libgnomeui2
436 Requires: glibc >= 2.3
437 Requires: ORBit2
438 Requires: libart_lgpl >= 2.0
439 Requires: libbonobo >= 2.0
440 Requires: libbonoboui >= 2.0
441 Requires: GConf2
442 Requires: freetype2
443 %endif
444 %if %{fc3}
445 Requires: gtk2 >= 2.4
446 Requires: libgnomeui >= 2.8
447 Requires: glibc >= 2.3
448 Requires: ORBit2
449 Requires: libart_lgpl >= 2.3
450 Requires: libbonobo >= 2.8
451 Requires: libbonoboui >= 2.8
452 Requires: bonobo-activation
453 Requires: GConf2
454 Requires: freetype
455 %endif
456 %if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
457 Requires: gtk2 >= 2.0
458 Requires: libgnomeui >= 2.0
459 Requires: glibc >= 2.3
460 Requires: ORBit2
461 Requires: libart_lgpl >= 2.0
462 Requires: libbonobo >= 2.0
463 Requires: libbonoboui >= 2.0
464 Requires: bonobo-activation
465 Requires: GConf2
466 Requires: linc
467 Requires: freetype
468 %endif
469 %if %{su9}
470 Requires: xsu
471 %else
472 Requires: usermode
473 %endif
474
475 %description gconsole
476 Bacula - It comes by night and sucks the vital essence from your computers.
477
478 Bacula is a set of computer programs that permit you (or the system 
479 administrator) to manage backup, recovery, and verification of computer 
480 data across a network of computers of different kinds. In technical terms, 
481 it is a network client/server based backup program. Bacula is relatively 
482 easy to use and efficient, while offering many advanced storage management 
483 features that make it easy to find and recover lost or damaged files. 
484 Bacula source code has been released under the GPL version 2 license.
485
486 This is the Gnome Console package. It is an add-on to the client or
487 server packages.
488
489 %prep
490
491 %setup
492 %setup -T -D -b 1
493 %setup -T -D -b 2
494 %setup -T -D -b 3
495
496 %build
497
498 %if %{su9}
499 export LDFLAGS="-L/usr/lib/termcap"
500 %endif
501
502 cwd=${PWD}
503 cd %{depkgs}
504 %if %{sqlite}
505 make sqlite
506 %endif
507 make mtx
508 cd ${cwd}
509
510 # patches for the bundled sqlite scripts
511
512 # patch the make_sqlite_tables script for installation bindir
513 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
514
515 # patch the create_sqlite_database script for installation bindir
516 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
517
518 # patch the make_catalog_backup script for installation bindir
519 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
520
521 # patch the update_sqlite_tables script for installation bindir
522 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
523
524 # patch the bacula-dir init script to remove sqlite service
525 %if %{sqlite} && %{su9}
526 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
527 %endif
528
529 # 64 bit lib location hacks
530 # this is the location on redhat type platforms, don't know about others yet
531 %if %{x86_64}
532 export LDFLAGS=-L/usr/lib64
533 %endif
534 %if %{mysql} && %{x86_64}
535 export LDFLAGS=-L/usr/lib64/mysql
536 %endif
537
538 %configure \
539         --prefix=/usr \
540         --sbindir=/usr/sbin \
541         --sysconfdir=/etc/bacula \
542         --with-scriptdir=/etc/bacula \
543         --enable-smartalloc \
544         --enable-gnome \
545         --enable-static-fd \
546 %if ! %{rh7} && ! %{rh8}
547         --enable-tray-monitor \
548 %endif
549 %if %{mysql}
550         --with-mysql \
551 %endif
552 %if %{sqlite}
553         --with-sqlite=${cwd}/%{depkgs}/sqlite \
554 %endif
555 %if %{postgresql}
556         --with-postgresql \
557 %endif
558         --with-working-dir=%{working_dir} \
559         --with-pid-dir=/var/run \
560         --with-subsys-dir=/var/lock/subsys \
561         --with-dir-user=%{daemon_user} \
562         --with-dir-group=%{daemon_group} \
563         --with-sd-user=%{daemon_user} \
564         --with-sd-group=%{daemon_group} \
565         --with-fd-user=%{daemon_user} \
566         --with-fd-group=%{daemon_group}
567 make
568
569 cd src/filed
570 strip static-bacula-fd
571 cd ../../
572
573 %install
574  
575 cwd=${PWD}
576 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
577 mkdir -p $RPM_BUILD_ROOT/etc/init.d
578 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
579 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
580 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
581 mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
582 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
583 %if %{rh7}
584 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
585 %else
586 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
587 %endif
588 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/floppy
589 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/tomsrtbt
590 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom
591 mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
592 %if ! %{su9}
593 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
594 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
595 mkdir -p $RPM_BUILD_ROOT/usr/bin
596 %endif
597
598 %if %{sqlite}
599 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
600 %endif
601
602 make \
603         prefix=$RPM_BUILD_ROOT/usr \
604         sbindir=$RPM_BUILD_ROOT/usr/sbin \
605         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
606         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
607         working_dir=$RPM_BUILD_ROOT%{working_dir} \
608         install
609
610 cd %{depkgs}
611 make \
612         prefix=$RPM_BUILD_ROOT/usr \
613         sbindir=$RPM_BUILD_ROOT/usr/sbin \
614         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
615         working_dir=$RPM_BUILD_ROOT%{working_dir} \
616         mandir=$RPM_BUILD_ROOT/usr/man \
617         mtx-install
618 cd ${cwd}
619
620 # setup the manual for the doc dir and correct some broken CVS permissions
621 mkdir html-manual
622 cp -p doc/html-manual/*.html html-manual/
623 cp -p doc/html-manual/*.jpg html-manual/
624 cp -p doc/html-manual/*.gif html-manual/
625 cp -p doc/html-manual/*.css html-manual/
626 chmod 644 html-manual/*
627 chmod 644 doc/bacula.pdf
628
629 # fixme - make installs the mysql scripts for sqlite build
630 %if %{sqlite}
631 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
632 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
633 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
634 %endif
635
636 # fixme - make installs the mysql scripts for postgresql build
637 %if %{postgresql}
638 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
639 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
640 %endif
641
642 # install the init scripts
643 %if %{su9}
644 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
645 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
646 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
647 %endif
648 %if %{mdk}
649 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
650 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
651 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
652 %endif
653 %if ! %{su9} && ! %{mdk}
654 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
655 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
656 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
657 %endif
658 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
659
660 # install the menu stuff
661 %if %{su9}
662 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
663 cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
664 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
665 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
666 %endif
667 %if %{rh7}
668 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
669 cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
670 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
671 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
672 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
673 %endif
674 %if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{mdk}
675 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
676 cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
677 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
678 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
679 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
680 %endif
681 %if ! %{rh7} && ! %{rh8}
682 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
683 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
684 %endif
685
686 # install sqlite
687 %if %{sqlite}
688 cp -p %{depkgs}/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
689 cp -p %{depkgs}/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
690 cp -p %{depkgs}/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
691 %endif
692
693 # install the logrotate file
694 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
695
696 # install the rescue stuff
697 # these are the floppy rescue scripts
698 cp -p rescue/linux/floppy/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
699 cp -p rescue/linux/floppy/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
700 cp -p rescue/linux/floppy/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
701 cp -p rescue/linux/floppy/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
702 cp -p rescue/linux/floppy/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
703 cp -p rescue/linux/floppy/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
704 cp -p rescue/linux/floppy/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
705 cp -p rescue/linux/floppy/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
706 cp -p rescue/linux/floppy/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
707
708 # this is the cdrom rescue stuff
709 cp -r -p rescue/linux/cdrom/* $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/
710 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bin/
711 rm -f $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/Makefile.in
712 rm -f $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bacula/Makefile.in
713 touch $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/rpm_release
714
715 # this is the static file daemon
716 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/bacula-fd
717 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bin/bacula-fd
718
719 # this is the tom's root boot disk
720 cp -p ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/tomsrtbt/
721
722 # install the updatedb scripts
723 cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
724
725 # install the logwatch scripts
726 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
727 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
728 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
729 chmod 755 $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
730 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
731 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
732
733 # now clean up permissions that are left broken by the install
734 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
735 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
736 %if ! %{rh7} && ! %{rh8}
737 chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
738 chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
739 %endif
740
741 %clean
742 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
743
744 %if %{mysql}
745
746 %files mysql
747 %defattr(-,root,root)
748
749 /etc/bacula/bacula
750 /etc/bacula/bconsole
751 /etc/bacula/create_mysql_database
752 /etc/bacula/drop_mysql_database
753 /etc/bacula/make_mysql_tables
754 /etc/bacula/drop_mysql_tables
755 /etc/bacula/update_mysql_tables
756 /etc/bacula/grant_mysql_privileges
757 /etc/bacula/create_bacula_database
758 /etc/bacula/drop_bacula_database
759 /etc/bacula/grant_bacula_privileges
760 /etc/bacula/make_bacula_tables
761 /etc/bacula/drop_bacula_tables
762 /etc/bacula/update_bacula_tables
763 /etc/bacula/make_catalog_backup
764 /etc/bacula/delete_catalog_backup
765 /etc/bacula/startmysql
766 /etc/bacula/stopmysql
767 /etc/bacula/mtx-changer
768 /etc/bacula/btraceback.dbx
769 /etc/bacula/btraceback.gdb
770 #/etc/bacula/dvd-freespace
771 #/etc/bacula/dvd-writepart
772 /etc/init.d/bacula-dir
773 /etc/init.d/bacula-fd
774 /etc/init.d/bacula-sd
775
776 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo doc/bacula.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
777 /usr/man/man1/*
778
779 /etc/logrotate.d/bacula
780 /etc/log.d/scripts/services/bacula
781 %config(noreplace) /etc/bacula/bacula-dir.conf
782 %config(noreplace) /etc/bacula/bacula-fd.conf
783 %config(noreplace) /etc/bacula/bacula-sd.conf
784 %config(noreplace) /etc/bacula/bconsole.conf
785 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
786 %config(noreplace) /etc/log.d/conf/services/bacula.conf
787 /etc/bacula/query.sql
788 %dir %{working_dir}
789
790 /usr/sbin/bacula-dir
791 /usr/sbin/bacula-fd
792 /usr/sbin/bacula-sd
793 /usr/sbin/bcopy
794 /usr/sbin/bextract
795 /usr/sbin/bls
796 /usr/sbin/bscan
797 /usr/sbin/btape
798 /usr/sbin/btraceback
799 /usr/sbin/bconsole
800 /usr/sbin/dbcheck
801 /usr/sbin/loaderinfo
802 /usr/sbin/mtx
803 /usr/sbin/scsitape
804 /usr/sbin/bsmtp
805 /usr/sbin/tapeinfo
806 /usr/sbin/static-bacula-fd
807
808 %pre mysql
809 # test for bacula database older than version 7
810 # note: this ASSUMES no password has been set for bacula database
811 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
812
813 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
814         echo "This bacula upgrade will update a bacula database from version 7 to 8."
815         echo "You appear to be running database version $DB_VER. You must first update"
816         echo "your database to version 7 and then install this upgrade. The alternative"
817         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
818         echo "catalog information, then do the upgrade. Information on updating a"
819         echo "database older than version 7 can be found in the release notes."
820         exit 1
821 fi
822 # check for and copy /etc/bacula/console.conf to bconsole.conf
823 if [ -s /etc/bacula/console.conf ];then
824         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
825 fi
826
827 %post mysql
828
829 # add our links
830 if [ "$1" -ge 1 ] ; then
831 /sbin/chkconfig --add bacula-dir
832 /sbin/chkconfig --add bacula-fd
833 /sbin/chkconfig --add bacula-sd
834 fi
835
836 # test for an existing database
837 # note: this ASSUMES no password has been set for bacula database
838 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
839
840 # grant privileges and create tables if they do not exist
841 if [ -z "$DB_VER" ]; then
842         echo "Hmm, doesn't look like you have an existing database."
843         echo "Granting privileges for MySQL user bacula..."
844         /etc/bacula/grant_mysql_privileges
845         echo "Creating MySQL bacula database..."
846         /etc/bacula/create_mysql_database
847         echo "Creating bacula tables..."
848         /etc/bacula/make_mysql_tables
849
850 # check to see if we need to upgrade a 1.34 or lower database
851 elif [ "$DB_VER" -lt "8" ]; then
852         echo "This release requires an upgrade to your bacula database."
853         echo "Backing up your current database..."
854         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
855         echo "Upgrading bacula database ..."
856         /etc/bacula/update_mysql_tables
857         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
858
859 fi
860
861 # create the daemon group
862 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
863 if [ -z $HAVE_BACULA ]; then
864         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
865         echo "The group %{daemon_group} has been added to %{group_file}."
866         echo "See the manual chapter Running Bacula for details."
867 fi
868
869 %preun mysql
870 # delete our links
871 if [ $1 = 0 ]; then
872 /sbin/chkconfig --del bacula-dir
873 /sbin/chkconfig --del bacula-fd
874 /sbin/chkconfig --del bacula-sd
875 fi
876
877 %endif
878
879 %if %{sqlite}
880
881 %files sqlite
882 %defattr(-,root,root)
883
884 /etc/bacula/bacula
885 /etc/bacula/bconsole
886 /etc/bacula/create_bacula_database
887 /etc/bacula/drop_bacula_database
888 /etc/bacula/grant_bacula_privileges
889 /etc/bacula/make_bacula_tables
890 /etc/bacula/drop_bacula_tables
891 /etc/bacula/update_bacula_tables
892 /etc/bacula/create_sqlite_database
893 /etc/bacula/drop_sqlite_database
894 /etc/bacula/grant_sqlite_privileges
895 /etc/bacula/make_sqlite_tables
896 /etc/bacula/drop_sqlite_tables
897 /etc/bacula/update_sqlite_tables
898 /etc/bacula/make_catalog_backup
899 /etc/bacula/delete_catalog_backup
900 /etc/bacula/mtx-changer
901 /etc/bacula/btraceback.dbx
902 /etc/bacula/btraceback.gdb
903 #/etc/bacula/dvd-freespace
904 #/etc/bacula/dvd-writepart
905 /etc/init.d/bacula-dir
906 /etc/init.d/bacula-fd
907 /etc/init.d/bacula-sd
908
909 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo doc/bacula.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
910 /usr/man/man1/*
911
912 /etc/logrotate.d/bacula
913 /etc/log.d/scripts/services/bacula
914 %config(noreplace) /etc/bacula/bacula-dir.conf
915 %config(noreplace) /etc/bacula/bacula-fd.conf
916 %config(noreplace) /etc/bacula/bacula-sd.conf
917 %config(noreplace) /etc/bacula/bconsole.conf
918 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
919 %config(noreplace) /etc/log.d/conf/services/bacula.conf
920 /etc/bacula/query.sql
921 %{sqlite_bindir}/libsqlite.a
922 %{sqlite_bindir}/sqlite.h
923 %dir %{working_dir}
924
925 /usr/sbin/bacula-dir
926 /usr/sbin/bacula-fd
927 /usr/sbin/bacula-sd
928 /usr/sbin/bcopy
929 /usr/sbin/bextract
930 /usr/sbin/bls
931 /usr/sbin/bscan
932 /usr/sbin/btape
933 /usr/sbin/btraceback
934 /usr/sbin/bconsole
935 /usr/sbin/dbcheck
936 /usr/sbin/loaderinfo
937 /usr/sbin/mtx
938 /usr/sbin/scsitape
939 /usr/sbin/bsmtp
940 /usr/sbin/tapeinfo
941 /usr/sbin/static-bacula-fd
942 %{sqlite_bindir}/sqlite
943
944
945 %pre sqlite
946 # test for bacula database older than version 7
947 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
948         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
949         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
950                 echo "This bacula upgrade will update a bacula database from version 7 to 8."
951                 echo "You appear to be running database version $DB_VER. You must first update"
952                 echo "your database to version 7 and then install this upgrade. The alternative"
953                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
954                 echo "catalog information, then do the upgrade. Information on updating a"
955                 echo "database older than version 7 can be found in the release notes."
956                 exit 1
957         fi
958 fi
959 # check for and copy /etc/bacula/console.conf to bconsole.conf
960 if [ -s /etc/bacula/console.conf ];then
961         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
962 fi
963
964 %post sqlite
965 # add our links
966 if [ "$1" -ge 1 ] ; then
967 /sbin/chkconfig --add bacula-dir
968 /sbin/chkconfig --add bacula-fd
969 /sbin/chkconfig --add bacula-sd
970 fi
971
972 # test for an existing database
973 if [ -s %{working_dir}/bacula.db ]; then
974         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
975         # check to see if we need to upgrade a 1.34 or lower database
976         if [ "$DB_VER" -lt "7" ]; then
977                 echo "This bacula upgrade requires a database update to version 8. You appear to"
978                 echo "be running database version $DB_VER. You must update your database using the"
979                 echo "upgrade scripts in the bacula-updatedb package. The alternative"
980                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
981                 echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a"
982                 echo "database older than version 7 can be found in the release notes."
983         fi      
984         
985         if [ "$DB_VER" -lt "8" ] && [ "$DB_VER" -ge "7" ]; then
986                 echo "This release requires an upgrade to your bacula database."
987                 echo "Backing up your current database..."
988                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
989                 echo "Upgrading bacula database ..."
990                 /etc/bacula/update_sqlite_tables
991                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
992         fi
993 else
994         # create the database and tables
995         echo "Hmm, doesn't look like you have an existing database."
996         echo "Creating SQLite database..."
997         /etc/bacula/create_sqlite_database
998         echo "Creating the SQLite tables..."
999         /etc/bacula/make_sqlite_tables
1000 fi
1001
1002 # create the daemon group
1003 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1004 if [ -z $HAVE_BACULA ]; then
1005         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1006         echo "The group %{daemon_group} has been added to %{group_file}."
1007         echo "See the manual chapter Running Bacula for details."
1008 fi
1009
1010 %preun sqlite
1011 # delete our links
1012 if [ $1 = 0 ]; then
1013 /sbin/chkconfig --del bacula-dir
1014 /sbin/chkconfig --del bacula-fd
1015 /sbin/chkconfig --del bacula-sd
1016 fi
1017
1018 %endif
1019
1020 %if %{postgresql}
1021
1022 %files postgresql
1023 %defattr(-,root,root)
1024
1025 /etc/bacula/bacula
1026 /etc/bacula/bconsole
1027 /etc/bacula/create_postgresql_database
1028 /etc/bacula/drop_postgresql_database
1029 /etc/bacula/make_postgresql_tables
1030 /etc/bacula/drop_postgresql_tables
1031 /etc/bacula/update_postgresql_tables
1032 /etc/bacula/grant_postgresql_privileges
1033 /etc/bacula/create_bacula_database
1034 /etc/bacula/drop_bacula_database
1035 /etc/bacula/grant_bacula_privileges
1036 /etc/bacula/make_bacula_tables
1037 /etc/bacula/drop_bacula_tables
1038 /etc/bacula/update_bacula_tables
1039 /etc/bacula/make_catalog_backup
1040 /etc/bacula/delete_catalog_backup
1041 /etc/bacula/mtx-changer
1042 /etc/bacula/btraceback.dbx
1043 /etc/bacula/btraceback.gdb
1044 #/etc/bacula/dvd-freespace
1045 #/etc/bacula/dvd-writepart
1046 /etc/init.d/bacula-dir
1047 /etc/init.d/bacula-fd
1048 /etc/init.d/bacula-sd
1049
1050 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo doc/bacula.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
1051 /usr/man/man1/*
1052
1053 /etc/logrotate.d/bacula
1054 /etc/log.d/scripts/services/bacula
1055 %config(noreplace) /etc/bacula/bacula-dir.conf
1056 %config(noreplace) /etc/bacula/bacula-fd.conf
1057 %config(noreplace) /etc/bacula/bacula-sd.conf
1058 %config(noreplace) /etc/bacula/bconsole.conf
1059 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
1060 %config(noreplace) /etc/log.d/conf/services/bacula.conf
1061 /etc/bacula/query.sql
1062 %dir %{working_dir}
1063
1064 /usr/sbin/bacula-dir
1065 /usr/sbin/bacula-fd
1066 /usr/sbin/bacula-sd
1067 /usr/sbin/bcopy
1068 /usr/sbin/bextract
1069 /usr/sbin/bls
1070 /usr/sbin/bscan
1071 /usr/sbin/btape
1072 /usr/sbin/btraceback
1073 /usr/sbin/bconsole
1074 /usr/sbin/dbcheck
1075 /usr/sbin/loaderinfo
1076 /usr/sbin/mtx
1077 /usr/sbin/scsitape
1078 /usr/sbin/bsmtp
1079 /usr/sbin/tapeinfo
1080 /usr/sbin/static-bacula-fd
1081
1082 %pre postgresql
1083 # test for bacula database older than version 7
1084 # note: this ASSUMES no password has been set for bacula database
1085 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1086
1087 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
1088         echo "This bacula upgrade will update a bacula database from version 7 to 8."
1089         echo "You appear to be running database version $DB_VER. You must first update"
1090         echo "your database to version 7 and then install this upgrade. The alternative"
1091         echo "is to use /etc/bacula/drop_postgresql_tables to delete all your your current"
1092         echo "catalog information, then do the upgrade. Information on updating a"
1093         echo "database older than version 7 can be found in the release notes."
1094         exit 1
1095 fi
1096
1097 %post postgresql
1098 # add our links
1099 if [ "$1" -ge 1 ] ; then
1100 /sbin/chkconfig --add bacula-dir
1101 /sbin/chkconfig --add bacula-fd
1102 /sbin/chkconfig --add bacula-sd
1103 fi
1104
1105 # test for an existing database
1106 # note: this ASSUMES no password has been set for bacula database
1107 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1108
1109 # grant privileges and create tables if they do not exist
1110 if [ -z "$DB_VER" ]; then
1111         echo "Hmm, doesn't look like you have an existing database."
1112         echo "Creating PostgreSQL bacula database..."
1113         /etc/bacula/create_postgresql_database
1114         echo "Creating bacula tables..."
1115         /etc/bacula/make_postgresql_tables
1116         echo "Granting privileges for PostgreSQL user bacula..."
1117         /etc/bacula/grant_postgresql_privileges
1118
1119 # check to see if we need to upgrade a 1.34 or lower database
1120 elif [ "$DB_VER" -lt "8" ]; then
1121         echo "This release requires an upgrade to your bacula database."
1122         echo "Backing up your current database..."
1123         pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1124         echo "Upgrading bacula database ..."
1125         /etc/bacula/update_postgresql_tables
1126         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1127         
1128 fi
1129
1130 # create the daemon group
1131 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1132 if [ -z $HAVE_BACULA ]; then
1133         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1134         echo "The group %{daemon_group} has been added to %{groupfile}."
1135         echo "See the manual chapter Running Bacula for details."
1136 fi
1137         
1138
1139 %preun postgresql
1140 # delete our links
1141 if [ $1 = 0 ]; then
1142 /sbin/chkconfig --del bacula-dir
1143 /sbin/chkconfig --del bacula-fd
1144 /sbin/chkconfig --del bacula-sd
1145 fi
1146
1147 %endif
1148
1149 %files client
1150 %defattr(-,root,root)
1151
1152 /etc/bacula/bconsole
1153 /etc/init.d/bacula-fd
1154
1155 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo doc/bacula.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
1156 /etc/logrotate.d/bacula
1157
1158 %config(noreplace) /etc/bacula/bacula-fd.conf
1159 %config(noreplace) /etc/bacula/bconsole.conf
1160 %dir %{working_dir}
1161
1162 /usr/sbin/bacula-fd
1163 /usr/sbin/btraceback
1164 /etc/bacula/btraceback.gdb
1165 /etc/bacula/btraceback.dbx
1166 /usr/sbin/bsmtp
1167 /usr/sbin/bconsole
1168
1169
1170 %post client
1171 # add our link
1172 if [ "$1" -ge 1 ] ; then
1173 /sbin/chkconfig --add bacula-fd
1174 fi
1175
1176 # create the daemon group
1177 HAVE_BACULA=`cat %{group_file} | grep %{daemon_group} 2>/dev/null`
1178 if [ -z $HAVE_BACULA ]; then
1179         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1180         echo "The group %{daemon_group} has been added to %{group_file}."
1181         echo "See the manual chapter Running Bacula for details."
1182 fi
1183
1184 %preun client
1185 # delete our link
1186 if [ $1 = 0 ]; then
1187 /sbin/chkconfig --del bacula-fd
1188 fi
1189
1190 %files rescue
1191 %defattr(-,root,root)
1192 /etc/bacula/rescue/floppy/*
1193 /etc/bacula/rescue/cdrom/*
1194
1195 %post rescue
1196 # link our current installed conf file to the rescue directory
1197 ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/floppy/bacula-fd.conf
1198 ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/cdrom/bin/bacula-fd.conf
1199
1200 # run getdiskinfo
1201 echo "Creating rescue files for this system..."
1202 cd /etc/bacula/rescue/floppy
1203 ./getdiskinfo
1204 cd /etc/bacula/rescue/cdrom/bacula
1205 ./getdiskinfo
1206
1207 %preun rescue
1208 # remove the files created after the initial rpm installation
1209 rm -f /etc/bacula/rescue/floppy/bacula-fd.conf
1210 rm -f /etc/bacula/rescue/floppy/partition.*
1211 rm -f /etc/bacula/rescue/floppy/format.*
1212 rm -f /etc/bacula/rescue/floppy/mount_drives
1213 rm -f /etc/bacula/rescue/floppy/start_network
1214 rm -f /etc/bacula/rescue/floppy/sfdisk
1215 rm -rf /etc/bacula/rescue/floppy/diskinfo/*
1216
1217 rm -f /etc/bacula/rescue/cdrom/bacula/bacula-fd.conf
1218 rm -f /etc/bacula/rescue/cdrom/bacula/partition.*
1219 rm -f /etc/bacula/rescue/cdrom/bacula/format.*
1220 rm -f /etc/bacula/rescue/cdrom/bacula/mount_drives
1221 rm -f /etc/bacula/rescue/cdrom/bacula/start_network
1222 rm -rf /etc/bacula/rescue/cdrom/bacula/diskinfo/*
1223
1224 %files updatedb
1225 %defattr(-,root,root)
1226 /etc/bacula/updatedb/*
1227
1228 %post updatedb
1229 echo "The database update scripts were installed to /etc/bacula/updatedb"
1230
1231 %files gconsole
1232 %defattr(-,root,root)
1233 /usr/sbin/gnome-console
1234 /etc/bacula/gconsole
1235 %config(noreplace) /etc/bacula/gnome-console.conf
1236 /usr/share/pixmaps/bacula.png
1237
1238 %if %{rh7}
1239 /usr/share/gnome/apps/System/bacula.desktop
1240 %else
1241 /usr/share/applications/bacula.desktop
1242 %endif
1243
1244 %if ! %{rh7} && ! %{rh8}
1245 /usr/sbin/bacula-tray-monitor
1246 %config(noreplace) /etc/bacula/tray-monitor.conf
1247 /usr/share/pixmaps/bacula-tray-monitor.xpm
1248 /usr/share/applications/bacula-tray-monitor.desktop
1249 %endif
1250
1251 %if ! %{su9} 
1252 # add the console helper files
1253 %config(noreplace,missingok) /etc/pam.d/gnome-console
1254 %config(noreplace,missingok) /etc/security/console.apps/gnome-console
1255 /usr/bin/gnome-console
1256 %endif
1257
1258
1259 %changelog
1260 * Tue Apr 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1261 - add centos4 build tag
1262 - add x86_64 build tag
1263 * Sun Apr 03 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1264 - add rhel4 build tag
1265 - clean up for mysql4 which is now mdk-10.1, suse-9.2 and rhel4
1266 * Sun Mar 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1267 - add rhel3 build tag
1268 * Tue Mar 01 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1269 - fix tray-monitor.conf for noreplace
1270 * Mon Feb 28 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1271 - fix distribution check for Fedora and Whitebox
1272 * Sun Feb 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1273 - add logwatch script
1274 - add dvd scripts
1275 * Sat Jan 15 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1276 - add build for Fedora Core 3 (linc now included in ORDit2)
1277 - add mysql4 define for Mandrake 10.1
1278 * Fri Jan 14 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1279 - fix {group_file} variable in post scripts
1280 * Thu Dec 30 2004 D. Scott Barninger <barninger@fairfieldcomputers.com>
1281 - add distribution checking and custom Distribution tag
1282 * Thu Dec 09 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1283 - ASSIGNMENT OF COPYRIGHT
1284 - FOR VALUE RECEIVED, D. Scott Barninger hereby sells, transfers and 
1285 - assigns unto Kern Sibbald, his successors, assigns and personal representatives, 
1286 - all right, title and interest in and to the copyright in this software RPM
1287 - spec file. D. Scott Barninger warrants good title to said copyright, that it is 
1288 - free of all liens, encumbrances or any known claims against said copyright.
1289 * Sat Dec 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1290 - bug 183 fixes
1291 - thanks to Daniel Widyono
1292 - update description for rescue package to describe cdrom creation
1293 * Thu Nov 18 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1294 - update depkgs to 29Oct04
1295 * Fri Nov 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1296 - add cdrom rescue to bacula-rescue package
1297 * Sun Oct 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1298 - misc fixes from 1.36.0 suse feedback
1299 - fix situation where sqlite database exists but sqlite has been removed.
1300 * Fri Oct 22 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1301 - remove tray-monitor from RH8 build
1302 - fix permissions on tray-monitor files
1303 * Wed Oct 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1304 - add Mandrake support and tray-monitor, misc changes for 1.35.8/1.36.0,
1305 - change database update to 7 to 8 upgrade,
1306 - revert depkgs to 08Mar04 as there seems to be a bug in the sqlite
1307 - build in 30Jul04, add freetype dependancy to gnome package.
1308 * Sun Sep 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1309 - add documentation to console for groupadd
1310 * Sat Sep 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1311 - add support for running daemons as root.bacula
1312 - correct for change in location of floppy rescue files in 1.35.2
1313 - removed /etc/bacula/fd script from all packages as it has disappeared from 1.35.2
1314 - updated depgkgs to 30Jul04
1315 * Thu Jun 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1316 - really, really fix symlink creation for gconsole
1317 * Thu Jun 17 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1318 - fix symlink creation in gconsole post install
1319 * Sat Jun 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1320 - fixed error in gconsole post script
1321 * Fri Apr 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1322 - add check for gconsole symlink before trying to create it
1323 * Sun Apr 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1324 - fix some minor permissions issues on doc files that CVS won't let us fix
1325 * Sun Apr 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1326 - add pkgconfig to BuildRequires
1327 - clean up gnome1/2 menu entries for appropriate packages
1328 * Fri Apr 02 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1329 - tightened up doc distribution
1330 * Tue Mar 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1331 - added usermode (Redhat) and xsu (SuSE) support for gnome-console;
1332 - rpm's horrible bug that prevents nested conditional macros prevents me
1333 - from implementing these 2 separate approaches within the conditionals which
1334 - create the separate server packages.
1335 - the solution adopted is to remove the gnome-console files from the server packages
1336 - so bacula-gconsole is now an add on for both client and server packages.
1337 - this also now allows the server packages to be install on machines without
1338 - an X-server and we can still maintain a single spec file.
1339 - added tests to make sure we have defined platform and database macros.
1340 * Sat Mar 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1341 - corrected mysql prerequisites for suse
1342 * Mon Mar 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1343 - replaced all cp commands with cp -p
1344 - removed addition of a+x permissions on gnome-console
1345 - corrected permissions on init scripts
1346 * Sat Feb 28 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1347 - corrected creation of sqlite_bindir in install from !mysql to sqlite
1348 -
1349 - various cleanup patches from Michael K. Johnson:
1350 - corrected post install routines for nicer chkconfig
1351 - removed chmod changes in post routines and moved to install section
1352 - removed interactive nature of post routine for rescue package
1353 - added description of building rescue disks to the description of rescue package
1354 - added clean of build root to beginning of install
1355 - removed specifying attr in all file lists
1356 * Fri Feb 20 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1357 - added bconsole to client package
1358 - added gconsole package as add-on to client
1359 - removed spurious dependancies on updatedb package (!cut/paste)
1360 * Thu Feb 19 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1361 - added updatedb package
1362 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1363 - added postgresql package
1364 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1365 - corrected the if else logic in the dependancy sections
1366 - changes for 1.34 release
1367 - /etc/bacula/console is now /etc/bacula/bconsole
1368 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
1369 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
1370 - /usr/sbin/smtp is now /usr/sbin/bsmtp
1371 - added new /etc/bacula/drop_mysql_database
1372 - added new /etc/bacula/drop_sqlite_database
1373 - added new /etc/bacula/grant_sqlite_privileges
1374 - added new generic bacula database scripts in /etc/bacula
1375 - added pre-install sections to check for database versions older than 6
1376 - added check for /etc/bacula/console.conf and copy to bconsole.conf
1377 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1378 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
1379 - added testing for existing databases before executing any of the database creation scripts
1380 - added defines working_dir and sqlite_bindir in place of hard coded paths
1381 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1382 - added build configuration for SuSE.
1383 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
1384 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1385 - added patch for create_sqlite_database to fix the installed bindir
1386 - added execute of create_sqlite_database to post of sqlite package
1387 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1388 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
1389 - added bacula-fd as Requires for rescue package
1390 - added build tag for Fedora Core 1
1391 - cleaned up dependancies for all builds
1392 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1393 - removed rh_version from package names
1394 - added platform build configuration section to beginning of file
1395 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1396 - removed make_static_bacula script from rescue package install
1397 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1398 - Added define at top of file for depkgs version
1399 - Added rescue sub-package
1400 - Moved requires statements into proper sub-package locations
1401 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1402 - Corrected Requires for Gnome 1.4/2.0 builds
1403 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1404 - Added separate source declaration for depkgs
1405 - added patch for make_catalog_backup script
1406 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1407 - Misc changes to mysql/sqlite build and rh7/8 menu differences
1408 - Added rh_version to sub-package names
1409 - Added installed but missing file /etc/bacula/gconsole
1410 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
1411 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
1412 - Update spec for version 1.31 and combine client
1413 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1414 - Initial spec file