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