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