]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/suse/bacula.spec.in
Fix link failure of static-fd on Mandrake with --disable-nls in 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         %if %{mdk}
617         --disable-nls \
618         %endif
619         --enable-static-fd
620
621 make
622
623 %configure \
624         --prefix=/usr \
625         --sbindir=/usr/sbin \
626         --sysconfdir=/etc/bacula \
627         --with-scriptdir=/etc/bacula \
628         --enable-smartalloc \
629 %if %{gconsole}
630         --enable-gnome \
631 %endif
632 %if %{gconsole} && ! %{rh8}
633         --enable-tray-monitor \
634 %endif
635 %if %{mysql}
636         --with-mysql \
637 %endif
638 %if %{sqlite}
639         --with-sqlite=${cwd}/%{depkgs}/sqlite \
640 %endif
641 %if %{postgresql}
642         --with-postgresql \
643 %endif
644         --with-working-dir=%{working_dir} \
645         --with-pid-dir=/var/run \
646         --with-subsys-dir=/var/lock/subsys \
647         --with-dir-user=%{director_daemon_user} \
648         --with-dir-group=%{daemon_group} \
649         --with-sd-user=%{storage_daemon_user} \
650         --with-sd-group=%{storage_daemon_group} \
651         --with-fd-user=%{file_daemon_user} \
652         --with-fd-group=%{daemon_group} \
653         --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
654         --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
655         --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
656         --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
657         --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
658         --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
659         --with-openssl
660
661 make
662
663 %install
664  
665 cwd=${PWD}
666 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
667 mkdir -p $RPM_BUILD_ROOT/etc/init.d
668 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
669 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
670 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
671 mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
672 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
673 %if %{gconsole}
674 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
675 %endif
676 mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
677 %if %{gconsole} && ! %{su9} && ! %{su10}
678 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
679 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
680 mkdir -p $RPM_BUILD_ROOT/usr/bin
681 %endif
682
683 %if %{sqlite}
684 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
685 %endif
686
687 make \
688         prefix=$RPM_BUILD_ROOT/usr \
689         sbindir=$RPM_BUILD_ROOT/usr/sbin \
690         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
691         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
692         working_dir=$RPM_BUILD_ROOT%{working_dir} \
693         install
694
695 cd %{depkgs}
696 make \
697         prefix=$RPM_BUILD_ROOT/usr \
698         sbindir=$RPM_BUILD_ROOT/usr/sbin \
699         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
700         working_dir=$RPM_BUILD_ROOT%{working_dir} \
701         mandir=$RPM_BUILD_ROOT/usr/man \
702         mtx-install
703 cd ${cwd}
704
705 # fixme - make installs the mysql scripts for sqlite build
706 %if %{sqlite}
707 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
708 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
709 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
710 %endif
711
712 # fixme - make installs the mysql scripts for postgresql build
713 %if %{postgresql}
714 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
715 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
716 %endif
717
718 rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd
719
720 # install the init scripts
721 %if %{su9} || %{su10}
722 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
723 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
724 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
725 %endif
726 %if %{mdk}
727 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
728 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
729 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
730 %endif
731 %if ! %{su9} && ! %{su10} && ! %{mdk}
732 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
733 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
734 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
735 %endif
736 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
737
738 # install the menu stuff
739 %if %{gconsole} && %{su9}
740 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
741 cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
742 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
743 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
744 %endif
745 %if %{gconsole} && %{su10}
746 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
747 cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
748 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
749 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
750 %endif
751 %if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{mdk}
752 %define iftrick 1
753 %else
754 %define iftrick 0
755 %endif
756 %if %{gconsole} && %{iftrick}
757 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
758 cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
759 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
760 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
761 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
762 %endif
763 %if %{gconsole} && ! %{rh8}
764 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
765 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
766 %endif
767
768 # install sqlite
769 %if %{sqlite}
770 cp -p %{depkgs}/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
771 cp -p %{depkgs}/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
772 cp -p %{depkgs}/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
773 %endif
774
775 # install the logrotate file
776 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
777
778 # install the updatedb scripts
779 cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
780
781 # install the logwatch scripts
782 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
783 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
784 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
785 chmod 755 $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
786 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
787 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
788
789 # install the rescue files
790 mkdir $RPM_BUILD_ROOT/etc/bacula/rescue
791 cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT/etc/bacula/rescue/
792 cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT/etc/bacula/rescue/
793 cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/
794 cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/
795 cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/
796 cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/
797 touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release
798 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd
799 rm -f src/filed/static-bacula-fd
800
801 # now clean up permissions that are left broken by the install
802 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
803 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
804 %if %{gconsole} && ! %{rh8}
805 chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
806 chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
807 %endif
808
809 %clean
810 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
811
812 %if %{mysql}
813 # MySQL specific files
814 %files mysql
815 %defattr(-, root, root)
816 %attr(-, root, %{daemon_group}) /etc/bacula/create_mysql_database
817 %attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_database
818 %attr(-, root, %{daemon_group}) /etc/bacula/make_mysql_tables
819 %attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
820 %attr(-, root, %{daemon_group}) /etc/bacula/update_mysql_tables
821 %attr(-, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
822 %attr(-, root, %{daemon_group}) /etc/bacula/startmysql
823 %attr(-, root, %{daemon_group}) /etc/bacula/stopmysql
824 %endif
825
826 %if %{sqlite}
827 %files sqlite
828 %defattr(-,root,root)
829 %attr(-, root, %{daemon_group}) /etc/bacula/create_sqlite_database
830 %attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
831 %attr(-, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
832 %attr(-, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
833 %attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
834 %attr(-, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
835 %{sqlite_bindir}/libsqlite.a
836 %{sqlite_bindir}/sqlite.h
837 %{sqlite_bindir}/sqlite
838 %endif
839
840 %if %{postgresql}
841 %files postgresql
842 %defattr(-,root,root)
843 %attr(-, root, %{daemon_group}) /etc/bacula/create_postgresql_database
844 %attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
845 %attr(-, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
846 %attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
847 %attr(-, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
848 %attr(-, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
849 %endif
850
851 # The rest is DB backend independent
852 %attr(-, root, %{daemon_group}) %dir /etc/bacula
853 %attr(-, root, %{daemon_group}) /etc/bacula/bacula
854 %attr(-, root, %{daemon_group}) /etc/bacula/bconsole
855 %attr(-, root, %{daemon_group}) /etc/bacula/create_bacula_database
856 %attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_database
857 %attr(-, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
858 %attr(-, root, %{daemon_group}) /etc/bacula/make_bacula_tables
859 %attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
860 %attr(-, root, %{daemon_group}) /etc/bacula/update_bacula_tables
861 %attr(-, root, %{daemon_group}) /etc/bacula/make_catalog_backup
862 %attr(-, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
863 %attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
864 %attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
865 %attr(-, root, %{daemon_group}) /etc/bacula/rescue
866 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
867 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
868 %attr(-, root, %{storage_daemon_group}) /etc/bacula/dvd-handler
869 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
870 %attr(-, root, %{storage_daemon_group}) /etc/bacula/mtx-changer
871
872 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
873 %doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
874
875 /etc/logrotate.d/bacula
876 /etc/log.d/scripts/services/bacula
877 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
878 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
879 %attr(-, root, %{storage_daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
880 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
881 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
882 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
883 %attr(-, root, %{daemon_group}) /etc/bacula/query.sql
884 %attr(-, root, %{daemon_group}) %dir %{working_dir}
885
886 /usr/sbin/bacula-dir
887 /usr/sbin/bacula-fd
888 /usr/sbin/bacula-sd
889 /usr/sbin/bcopy
890 /usr/sbin/bextract
891 /usr/sbin/bls
892 /usr/sbin/bscan
893 /usr/sbin/btape
894 /usr/sbin/btraceback
895 /usr/sbin/bconsole
896 /usr/sbin/dbcheck
897 /usr/sbin/bsmtp
898
899 %if %{mysql}
900 %pre mysql
901 # test for bacula database older than version 8
902 # note: this ASSUMES no password has been set for bacula database
903 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
904 %endif
905
906 %if %{sqlite}
907 %pre sqlite
908 # test for bacula database older than version 8
909 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
910         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
911 %endif
912
913 %if %{postgresql}
914 %pre postgresql
915 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
916 %endif
917
918 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "8" ]; then
919         echo "This bacula upgrade will update a bacula database from version 8 to 9."
920         echo "You appear to be running database version $DB_VER. You must first update"
921         echo "your database to version 8 and then install this upgrade. The alternative"
922         echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
923         echo "catalog information, then do the upgrade. Information on updating a"
924         echo "database older than version 8 can be found in the release notes."
925         exit 1
926 fi
927
928 %if %{sqlite}
929 fi
930 %endif
931
932 # check for and copy /etc/bacula/console.conf to bconsole.conf
933 if [ -s /etc/bacula/console.conf ];then
934         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
935 fi
936
937 # create the daemon user and group
938 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
939 if [ -z "$HAVE_BACULA" ]; then
940         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
941         echo "The group %{daemon_group} has been added to %{group_file}."
942         echo "See the manual chapter \"Running Bacula\" for details."
943 fi
944 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
945 if [ -z "$HAVE_BACULA" ]; then
946         %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
947         echo "The group %{storage_daemon_group} has been added to %{group_file}."
948         echo "See the manual chapter \"Running Bacula\" for details."
949 fi
950 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
951 if [ -z "$HAVE_BACULA" ]; then
952         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -n -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
953         echo "The user %{storage_daemon_user} has been added to %{user_file}."
954         echo "See the manual chapter \"Running Bacula\" for details."
955 fi
956 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
957 if [ -z "$HAVE_BACULA" ]; then
958         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
959         echo "The user %{director_daemon_user} has been added to %{user_file}."
960         echo "See the manual chapter \"Running Bacula\" for details."
961 fi
962 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
963 if [ -z "$HAVE_BACULA" ]; then
964         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
965         echo "The user %{file_daemon_user} has been added to %{user_file}."
966         echo "See the manual chapter \"Running Bacula\" for details."
967 fi
968
969 %if %{mysql}
970 %post mysql
971 %endif
972 %if %{sqlite}
973 %post sqlite
974 %endif
975 %if %{postgresql}
976 %post postgresql
977 %endif
978
979 # add our links
980 if [ "$1" -ge 1 ] ; then
981 /sbin/chkconfig --add bacula-dir
982 /sbin/chkconfig --add bacula-fd
983 /sbin/chkconfig --add bacula-sd
984 fi
985
986 %if %{mysql}
987 # test for an existing database
988 # note: this ASSUMES no password has been set for bacula database
989 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
990
991 # grant privileges and create tables if they do not exist
992 if [ -z "$DB_VER" ]; then
993         echo "Hmm, doesn't look like you have an existing database."
994         echo "Granting privileges for MySQL user bacula..."
995         /etc/bacula/grant_mysql_privileges
996         echo "Creating MySQL bacula database..."
997         /etc/bacula/create_mysql_database
998         echo "Creating bacula tables..."
999         /etc/bacula/make_mysql_tables
1000
1001 # check to see if we need to upgrade a 1.36 or lower database
1002 elif [ "$DB_VER" -lt "9" ]; then
1003         echo "This release requires an upgrade to your bacula database."
1004         echo "Backing up your current database..."
1005         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1006         echo "Upgrading bacula database ..."
1007         /etc/bacula/update_mysql_tables
1008         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1009
1010 fi
1011 %endif
1012
1013 %if %{sqlite}
1014 # test for an existing database
1015 if [ -s %{working_dir}/bacula.db ]; then
1016         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1017         # check to see if we need to upgrade a 1.36 or lower database
1018         if [ "$DB_VER" -lt "9" ] && [ "$DB_VER" -ge "8" ]; then
1019                 echo "This release requires an upgrade to your bacula database."
1020                 echo "Backing up your current database..."
1021                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1022                 echo "Upgrading bacula database ..."
1023                 /etc/bacula/update_sqlite_tables
1024                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1025         fi
1026 else
1027         # create the database and tables
1028         echo "Hmm, doesn't look like you have an existing database."
1029         echo "Creating SQLite database..."
1030         /etc/bacula/create_sqlite_database
1031         echo "Creating the SQLite tables..."
1032         /etc/bacula/make_sqlite_tables
1033 fi
1034 %endif
1035
1036 %if %{postgresql}
1037 # test for an existing database
1038 # note: this ASSUMES no password has been set for bacula database
1039 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1040
1041 # grant privileges and create tables if they do not exist
1042 if [ -z "$DB_VER" ]; then
1043         echo "Hmm, doesn't look like you have an existing database."
1044         echo "Creating PostgreSQL bacula database..."
1045         /etc/bacula/create_postgresql_database
1046         echo "Creating bacula tables..."
1047         /etc/bacula/make_postgresql_tables
1048         echo "Granting privileges for PostgreSQL user bacula..."
1049         /etc/bacula/grant_postgresql_privileges
1050
1051 # check to see if we need to upgrade a 1.36 or lower database
1052 elif [ "$DB_VER" -lt "9" ]; then
1053         echo "This release requires an upgrade to your bacula database."
1054         echo "Backing up your current database..."
1055         pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1056         echo "Upgrading bacula database ..."
1057         /etc/bacula/update_postgresql_tables
1058         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1059         
1060 fi
1061 %endif
1062
1063 # generate passwords if needed
1064 if [ -d /etc/bacula ]; then
1065         cd /etc/bacula
1066         for file in *.conf; do
1067                 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
1068                         need_password=`grep $string $file 2>/dev/null`
1069                         if [ -n "$need_password" ]; then
1070                                 pass=`openssl rand -base64 33`
1071                                 sed "s-$string-$pass-g" $file > $file.new
1072                                 cp -f $file.new $file; rm -f $file.new
1073                         fi
1074                 done
1075         done
1076 fi
1077
1078 %if %{mysql}
1079 %preun mysql
1080 %endif
1081 %if %{sqlite}
1082 %preun sqlite
1083 %endif
1084 %if %{postgresql}
1085 %preun postgresql
1086 %endif
1087
1088 # delete our links
1089 if [ $1 = 0 ]; then
1090 /sbin/chkconfig --del bacula-dir
1091 /sbin/chkconfig --del bacula-fd
1092 /sbin/chkconfig --del bacula-sd
1093 fi
1094
1095
1096 %files mtx
1097 %attr(-, root, %{storage_daemon_group}) /usr/sbin/loaderinfo
1098 %attr(-, root, %{storage_daemon_group}) /usr/sbin/mtx
1099 %attr(-, root, %{storage_daemon_group}) /usr/sbin/scsitape
1100 %attr(-, root, %{storage_daemon_group}) /usr/sbin/tapeinfo
1101 /usr/man/man1/*
1102
1103
1104 %files client
1105 %defattr(-,root,root)
1106 %attr(-, root, %{daemon_group}) %dir /etc/bacula
1107 %attr(-, root, %{daemon_group}) /etc/bacula/bconsole
1108 /etc/init.d/bacula-fd
1109 %attr(-, root, %{daemon_group}) /etc/bacula/rescue
1110
1111 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
1112 %doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
1113
1114 /etc/logrotate.d/bacula
1115
1116 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
1117 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
1118 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1119
1120 /usr/sbin/bacula-fd
1121 /usr/sbin/btraceback
1122 %attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
1123 %attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
1124 /usr/sbin/bsmtp
1125 /usr/sbin/bconsole
1126
1127
1128 %pre client
1129 # create the daemon group and user
1130 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1131 if [ -z "$HAVE_BACULA" ]; then
1132         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1133         echo "The group %{daemon_group} has been added to %{group_file}."
1134         echo "See the manual chapter \"Running Bacula\" for details."
1135 fi
1136 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1137 if [ -z "$HAVE_BACULA" ]; then
1138         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -n -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1139         echo "The user %{file_daemon_user} has been added to %{user_file}."
1140         echo "See the manual chapter \"Running Bacula\" for details."
1141 fi
1142
1143 %post client
1144 # add our link
1145 if [ "$1" -ge 1 ] ; then
1146 /sbin/chkconfig --add bacula-fd
1147 fi
1148
1149 # generate passwords if needed
1150 if [ -d /etc/bacula ]; then
1151         cd /etc/bacula
1152         for file in *.conf; do
1153                 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
1154                         need_password=`grep $string $file 2>/dev/null`
1155                         if [ -n "$need_password" ]; then
1156                                 pass=`openssl rand -base64 33`
1157                                 sed "s-$string-$pass-g" $file > $file.new
1158                                 cp -f $file.new $file; rm -f $file.new
1159                         fi
1160                 done
1161         done
1162 fi
1163
1164 %preun client
1165 # delete our link
1166 if [ $1 = 0 ]; then
1167 /sbin/chkconfig --del bacula-fd
1168 fi
1169
1170 %files updatedb
1171 %defattr(-,root,%{daemon_group})
1172 /etc/bacula/updatedb/*
1173
1174 %pre updatedb
1175 # create the daemon group
1176 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1177 if [ -z "$HAVE_BACULA" ]; then
1178         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1179         echo "The group %{daemon_group} has been added to %{group_file}."
1180         echo "See the manual chapter \"Running Bacula\" for details."
1181 fi
1182
1183 %post updatedb
1184 echo "The database update scripts were installed to /etc/bacula/updatedb"
1185
1186 %if %{gconsole}
1187 %files gconsole
1188 %defattr(-,root,root)
1189 /usr/sbin/gnome-console
1190 %attr(-, root, %{daemon_group}) %dir /etc/bacula
1191 %attr(-, root, %{daemon_group}) /etc/bacula/gconsole
1192 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
1193 /usr/share/pixmaps/bacula.png
1194 %endif
1195
1196 %if %{gconsole}
1197 /usr/share/applications/bacula.desktop
1198 %endif
1199
1200 %if %{gconsole} && ! %{rh8}
1201 /usr/sbin/bacula-tray-monitor
1202 %config(noreplace) /etc/bacula/tray-monitor.conf
1203 /usr/share/pixmaps/bacula-tray-monitor.xpm
1204 /usr/share/applications/bacula-tray-monitor.desktop
1205 %endif
1206
1207 %if %{gconsole} && ! %{su9} && ! %{su10}
1208 # add the console helper files
1209 %config(noreplace,missingok) /etc/pam.d/gnome-console
1210 %config(noreplace,missingok) /etc/security/console.apps/gnome-console
1211 /usr/bin/gnome-console
1212 %endif
1213
1214 %if %{gconsole}
1215 %pre gconsole
1216 # create the daemon group
1217 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1218 if [ -z "$HAVE_BACULA" ]; then
1219         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1220         echo "The group %{daemon_group} has been added to %{group_file}."
1221         echo "See the manual chapter \"Running Bacula\" for details."
1222 fi
1223
1224 %post gconsole
1225 # generate passwords if needed
1226 if [ -d /etc/bacula ]; then
1227         cd /etc/bacula
1228         for file in *.conf; do
1229                 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
1230                         need_password=`grep $string $file 2>/dev/null`
1231                         if [ -n "$need_password" ]; then
1232                                 pass=`openssl rand -base64 33`
1233                                 sed "s-$string-$pass-g" $file > $file.new
1234                                 cp -f $file.new $file; rm -f $file.new
1235                         fi
1236                 done
1237         done
1238 fi
1239 %endif
1240
1241 %changelog
1242 * Sun Jan 29 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
1243 - add centos3 build tag
1244 - fix link error of static-fd on Mandrake with --disable-nls
1245 * Fri Jan 27 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
1246 - add fc4 dependencies
1247 * Mon Jan 23 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
1248 - add SuSE 10.0 build
1249 - remove specific permission in attrib macros
1250 * Sat Jan 21 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
1251 - 1.38.5 release
1252 - fix usermode required on suse, suse doesn't have usermode (xsu instead)
1253 - refix compat for _dist on SLES9 which seems to have been removed
1254 - added note regarding Aleksandar's use of specific permissions in attrib macros
1255 - need to review and add specific fc4 build currently using fc3 Requires
1256 * Wed Dec 14 2005 Aleksandar Milivojevic <alex@milivojevic.org>
1257 - 1.38.2 release
1258 - Reorganize files and pre/post sections to remove repetitions
1259 - Always build separate mtx package
1260 - Fix file ownerships for /etc/bacula and Bacula's working dir
1261 * Wed Nov 23 2005 Aleksandar Milivojevic <alex@milivojevic.org>
1262 - Disable GNOME on RH7
1263 * Fri Nov 18 2005 Aleksandar Milivojevic <alex@milivojevic.org>
1264 - Red Hat and look alikes have mtx RPM, do not build/package our version
1265 * Sun Nov 13 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1266 - minor edit to _dist for SLES9 compatibility
1267 * Sat Nov 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1268 - 1.38.0 release
1269 - kern changed location of pdf files and html manual in docs package
1270 * Sun Oct 30 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1271 - 1.38.0 release
1272 - add docs (from prebuilt tarball) and rescue packages back in
1273 - remove dvd-freespace and dvd-writepart files, add dvd-handler
1274 - remove 3 of 4 sqlite script patches as not needed
1275 * Sun Jul 24 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1276 - changes for 1.38
1277 - remove docs and rescue sections (remove static fd)
1278 - add dvd-freespace and dvd-writepart files
1279 - update depkgs to 22Jun05
1280 - change database update to 8 to 9
1281 * Sun Jul 24 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1282 - minor cleanups before 1.38 changes
1283 - add popt and popt-devel build dependencies
1284 - add tetex and tetex-dvips dependencies for doc build
1285 - replace deprecated Copyright tag with License
1286 * Sat May 07 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1287 - move sqlite installation bindir to /usr/lib/bacula/sqlite and remove
1288 - conflict with sqlite packages. remove readline dependency.
1289 * Sun Apr 17 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1290 - release 1.36.3 update docs
1291 * Tue Apr 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1292 - add centos4 build tag
1293 - add x86_64 build tag
1294 * Sun Apr 03 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1295 - add rhel4 build tag
1296 - clean up for mysql4 which is now mdk-10.1, suse-9.2 and rhel4
1297 * Sun Mar 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1298 - add rhel3 build tag
1299 * Tue Mar 01 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1300 - fix tray-monitor.conf for noreplace
1301 * Mon Feb 28 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1302 - fix distribution check for Fedora and Whitebox
1303 * Sun Feb 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1304 - add logwatch script
1305 - add dvd scripts
1306 * Sat Jan 15 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1307 - add build for Fedora Core 3 (linc now included in ORDit2)
1308 - add mysql4 define for Mandrake 10.1
1309 * Fri Jan 14 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1310 - fix {group_file} variable in post scripts
1311 * Thu Dec 30 2004 D. Scott Barninger <barninger@fairfieldcomputers.com>
1312 - add distribution checking and custom Distribution tag
1313 * Thu Dec 09 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1314 - ASSIGNMENT OF COPYRIGHT
1315 - FOR VALUE RECEIVED, D. Scott Barninger hereby sells, transfers and 
1316 - assigns unto Kern Sibbald, his successors, assigns and personal representatives, 
1317 - all right, title and interest in and to the copyright in this software RPM
1318 - spec file. D. Scott Barninger warrants good title to said copyright, that it is 
1319 - free of all liens, encumbrances or any known claims against said copyright.
1320 * Sat Dec 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1321 - bug 183 fixes
1322 - thanks to Daniel Widyono
1323 - update description for rescue package to describe cdrom creation
1324 * Thu Nov 18 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1325 - update depkgs to 29Oct04
1326 * Fri Nov 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1327 - add cdrom rescue to bacula-rescue package
1328 * Sun Oct 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1329 - misc fixes from 1.36.0 suse feedback
1330 - fix situation where sqlite database exists but sqlite has been removed.
1331 * Fri Oct 22 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1332 - remove tray-monitor from RH8 build
1333 - fix permissions on tray-monitor files
1334 * Wed Oct 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1335 - add Mandrake support and tray-monitor, misc changes for 1.35.8/1.36.0,
1336 - change database update to 7 to 8 upgrade,
1337 - revert depkgs to 08Mar04 as there seems to be a bug in the sqlite
1338 - build in 30Jul04, add freetype dependancy to gnome package.
1339 * Sun Sep 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1340 - add documentation to console for groupadd
1341 * Sat Sep 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1342 - add support for running daemons as root.bacula
1343 - correct for change in location of floppy rescue files in 1.35.2
1344 - removed /etc/bacula/fd script from all packages as it has disappeared from 1.35.2
1345 - updated depgkgs to 30Jul04
1346 * Thu Jun 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1347 - really, really fix symlink creation for gconsole
1348 * Thu Jun 17 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1349 - fix symlink creation in gconsole post install
1350 * Sat Jun 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1351 - fixed error in gconsole post script
1352 * Fri Apr 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1353 - add check for gconsole symlink before trying to create it
1354 * Sun Apr 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1355 - fix some minor permissions issues on doc files that CVS won't let us fix
1356 * Sun Apr 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1357 - add pkgconfig to BuildRequires
1358 - clean up gnome1/2 menu entries for appropriate packages
1359 * Fri Apr 02 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1360 - tightened up doc distribution
1361 * Tue Mar 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1362 - added usermode (Redhat) and xsu (SuSE) support for gnome-console;
1363 - rpm's horrible bug that prevents nested conditional macros prevents me
1364 - from implementing these 2 separate approaches within the conditionals which
1365 - create the separate server packages.
1366 - the solution adopted is to remove the gnome-console files from the server packages
1367 - so bacula-gconsole is now an add on for both client and server packages.
1368 - this also now allows the server packages to be install on machines without
1369 - an X-server and we can still maintain a single spec file.
1370 - added tests to make sure we have defined platform and database macros.
1371 * Sat Mar 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1372 - corrected mysql prerequisites for suse
1373 * Mon Mar 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1374 - replaced all cp commands with cp -p
1375 - removed addition of a+x permissions on gnome-console
1376 - corrected permissions on init scripts
1377 * Sat Feb 28 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1378 - corrected creation of sqlite_bindir in install from !mysql to sqlite
1379 -
1380 - various cleanup patches from Michael K. Johnson:
1381 - corrected post install routines for nicer chkconfig
1382 - removed chmod changes in post routines and moved to install section
1383 - removed interactive nature of post routine for rescue package
1384 - added description of building rescue disks to the description of rescue package
1385 - added clean of build root to beginning of install
1386 - removed specifying attr in all file lists
1387 * Fri Feb 20 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1388 - added bconsole to client package
1389 - added gconsole package as add-on to client
1390 - removed spurious dependancies on updatedb package (!cut/paste)
1391 * Thu Feb 19 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1392 - added updatedb package
1393 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1394 - added postgresql package
1395 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1396 - corrected the if else logic in the dependancy sections
1397 - changes for 1.34 release
1398 - /etc/bacula/console is now /etc/bacula/bconsole
1399 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
1400 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
1401 - /usr/sbin/smtp is now /usr/sbin/bsmtp
1402 - added new /etc/bacula/drop_mysql_database
1403 - added new /etc/bacula/drop_sqlite_database
1404 - added new /etc/bacula/grant_sqlite_privileges
1405 - added new generic bacula database scripts in /etc/bacula
1406 - added pre-install sections to check for database versions older than 6
1407 - added check for /etc/bacula/console.conf and copy to bconsole.conf
1408 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1409 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
1410 - added testing for existing databases before executing any of the database creation scripts
1411 - added defines working_dir and sqlite_bindir in place of hard coded paths
1412 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1413 - added build configuration for SuSE.
1414 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
1415 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1416 - added patch for create_sqlite_database to fix the installed bindir
1417 - added execute of create_sqlite_database to post of sqlite package
1418 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1419 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
1420 - added bacula-fd as Requires for rescue package
1421 - added build tag for Fedora Core 1
1422 - cleaned up dependancies for all builds
1423 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1424 - removed rh_version from package names
1425 - added platform build configuration section to beginning of file
1426 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1427 - removed make_static_bacula script from rescue package install
1428 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1429 - Added define at top of file for depkgs version
1430 - Added rescue sub-package
1431 - Moved requires statements into proper sub-package locations
1432 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1433 - Corrected Requires for Gnome 1.4/2.0 builds
1434 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1435 - Added separate source declaration for depkgs
1436 - added patch for make_catalog_backup script
1437 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1438 - Misc changes to mysql/sqlite build and rh7/8 menu differences
1439 - Added rh_version to sub-package names
1440 - Added installed but missing file /etc/bacula/gconsole
1441 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
1442 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
1443 - Update spec for version 1.31 and combine client
1444 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1445 - Initial spec file