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