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