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