]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec
Fix logwatch install in bacula.spec. Patch from bug #1454
[bacula/bacula] / bacula / platforms / redhat / bacula.spec
1 # Bacula RPM spec file
2 #
3 # Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
4
5 # Platform Build Configuration
6
7 # basic defines for every build
8 %define _release           1
9 %define _version           3.0.3
10 %define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
11
12 %define single_dir 0
13 %{?single_dir_install:%define single_dir 1}
14
15 # Installation Directory locations
16 %if %{single_dir}
17 %define _prefix        /opt/bacula
18 %define _sbindir       /opt/bacula/bin
19 %define _bindir        /opt/bacula/bin
20 %define _subsysdir     /opt/bacula/working
21 %define _mandir        /usr/share/man
22 %define sysconf_dir    /opt/bacula/etc
23 %define script_dir     /opt/bacula/scripts
24 %define working_dir    /opt/bacula/working
25 %define pid_dir        /opt/bacula/working
26 %define plugin_dir     /opt/bacula/plugins
27 %define lib_dir        /opt/bacula/lib
28 %else
29 %define _prefix        /usr
30 %define _sbindir       %_prefix/sbin
31 %define _bindir        %_prefix/bin
32 %define _subsysdir     /var/lock/subsys
33 %define _mandir        %_prefix/share/man
34 %define sysconf_dir    /etc/bacula
35 %define script_dir     %_libdir/bacula
36 %define working_dir    /var/lib/bacula
37 %define pid_dir        /var/run
38 %define plugin_dir     %_libdir/bacula/plugins
39 %define lib_dir        %_libdir/bacula/lib
40 %endif
41
42 # Daemon user:group Don't change them unless you know what you are doing
43 %define director_daemon_user    bacula
44 %define storage_daemon_user     bacula
45 %define file_daemon_user        root
46 %define daemon_group            bacula
47 # group that has write access to tape devices, usually disk on Linux
48 %define storage_daemon_group    disk
49
50
51 # probems with mandriva build: 
52 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
53
54 # set Macros by opensuse_bs, see http://en.opensuse.org/Build_Service/cross_distribution_package_how_to
55 #openSUSE 11.1          %if 0%{?suse_version} == 1110  
56 #openSUSE 11.0          %if 0%{?suse_version} == 1100   
57 #openSUSE 10.3          %if 0%{?suse_version} == 1030   
58 #openSUSE 10.2          %if 0%{?suse_version} == 1020   
59 #SUSE Linux 10.1        %if 0%{?suse_version} == 1010   
60 #SUSE Linux 10.0        %if 0%{?suse_version} == 1000   
61 #SUSE Linux 9.3         %if 0%{?suse_version} == 930    
62 #SLES 9                 %if 0%{?sles_version} == 9      also set: %if 0%{?suse_version} == 910
63 #SLE 10                 %if 0%{?sles_version} == 10     also set: %if 0%{?suse_version} == 1010
64 #SLE 11                 %if 0%{?sles_version} == 11     also set: %if 0%{?suse_version} == 1110
65 #CentOS 5               %if 0%{?centos_version} == 501  
66 #RHEL 4                 %if 0%{?rhel_version} == 406    
67 #RHEL 5                 %if 0%{?rhel_version} == 501    
68 #Fedora 6 with Extras   %if 0%{?fedora_version} == 6    
69 #Fedora 7 with Extras   %if 0%{?fedora_version} == 7    
70 #Fedora 8 with Extras   %if 0%{?fedora_version} == 8    
71 #Fedora 9 with Extras   %if 0%{?fedora_version} == 9    
72 #Fedora 10 with Extras  %if 0%{?fedora_version} == 10   
73 #Mandriva 2006          %if 0%{?mandriva_version} == 2006       
74 #Mandriva 2007          %if 0%{?mandriva_version} == 2007       
75 #Mandriva 2008          %if 0%{?mandriva_version} == 2008       
76
77
78 %if 0%{?opensuse_bs}
79 # am I running in opensuse build service?
80 # TODO: seems to make problems
81
82 # choose database backend here
83 # postgres, mysql, sqlite
84 %define build_mysql 1
85
86 # Build Service: Determine Distribution
87
88 %ifarch x86_64
89  %define build_x86_64 1
90 %endif
91
92
93 %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
94 BuildRequires: GConf2-devel
95 BuildRequires: freetype-devel
96 BuildRequires: libtermcap-devel
97 BuildRequires: shadow-utils
98 %endif
99
100
101 %if 0%{?mandriva_version} == 2007
102 %define build_mdv 1
103 %define _dist "Mandriva 2007"
104 %endif
105
106 %if 0%{?fedora_version} == 8
107 %define build_fc8 1
108 %define _dist "Fedora Core 8"
109 BuildRequires: redhat-release
110 %endif
111
112 %if 0%{?fedora_version} == 9
113 %define build_fc9 1
114 %define _dist "Fedora Core 9"
115 BuildRequires: redhat-release
116 %endif
117
118
119 %if 0%{?fedora_version} == 10
120 %define build_fc9 1
121 %define _dist "Fedora Core 10"
122 BuildRequires: PolicyKit-gnome
123 BuildRequires: fedora-release
124 %endif
125
126 %if 0%{?fedora_version} == 11
127 %define build_fc9 1
128 %define _dist "Fedora Core 11"
129 BuildRequires: PolicyKit-gnome
130 BuildRequires: fedora-release
131 %endif
132
133 %if 0%{?rhel_version} == 501
134 %define build_rhel5 1
135 %define _dist "Red Hat Enterprise Linux Server release 5"
136 BuildRequires: redhat-release
137 %endif
138
139 %if 0%{?rhel_version} == 406
140 %define build_rhel4 1
141 %define _dist "Red Hat Enterprise Linux Server release 4"
142 BuildRequires: redhat-release
143 %endif
144
145
146 %if 0%{?centos_version} == 501
147 %define build_centos5 1
148 %define _dist "CentOS 5"
149 BuildRequires: redhat-release
150 %endif
151
152
153 %if 0%{?suse_version} == 1020
154 %define build_su102 1
155 %define _dist "OpenSUSE 10.2"
156 BuildRequires: suse-release
157 %endif
158
159
160 %if 0%{?suse_version} == 1030
161 %define build_su103 1
162 %define _dist "OpenSUSE 10.3"
163 BuildRequires: suse-release
164 %endif
165
166 %if 0%{?suse_version} == 1100
167 %define build_su110 1
168 %define _dist "SUSE 11"
169 BuildRequires: suse-release
170 %endif
171
172
173 %if 0%{?suse_version} == 1110
174 %define build_su111 1
175 %define _dist "SUSE 11"
176 %endif
177
178
179 %if 0%{?sles_version} == 9
180 %define build_su9 1
181 %define _dist "SLES 9"
182 %endif
183
184
185 %if 0%{?sles_version} == 10
186 %define build_su10 1
187 %define _dist "SLE 10"
188 %endif
189
190
191 %if 0%{?sles_version} == 11
192 %define build_su111 1
193 %define _dist "SLES 11"
194 %endif
195
196 %endif 
197 # opensuse-bs?
198
199
200 # any patches for this release
201 # be sure to check the setup section for patch macros
202
203 #--------------------------------------------------------------------------
204 # it should not be necessary to change anything below here for a release
205 # except for patch macros in the setup section
206 #--------------------------------------------------------------------------
207
208 %{?contrib_packager:%define _packager %{contrib_packager}}
209
210 Summary: Bacula - The Network Backup Solution
211 Name: bacula
212 Version: %{_version}
213 Release: %{_release}
214 Group: System Environment/Daemons
215 License: GPL v2
216 BuildRoot: %{_tmppath}/%{name}-root
217 URL: http://www.bacula.org/
218 Vendor: The Bacula Team
219 Packager: %{_packager}
220 Prefix: %{_prefix}
221
222 Source0: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
223 # opensuse build service changes the release itself
224 %if 0%{?opensuse_bs}
225 Source1: Release_Notes-%{version}-1.tar.gz
226 %else
227 Source1: Release_Notes-%{version}-%{release}.tar.gz
228 %endif
229 Source2: bacula-2.2.7-postgresql.patch
230
231 # define the basic package description
232 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
233 %define blurb2 Bacula is a set of computer programs that permit you (or the system
234 %define blurb3 administrator) to manage backup, recovery, and verification of computer
235 %define blurb4 data across a network of computers of different kinds. In technical terms,
236 %define blurb5 it is a network client/server based backup program. Bacula is relatively
237 %define blurb6 easy to use and efficient, while offering many advanced storage management
238 %define blurb7 features that make it easy to find and recover lost or damaged files.
239 %define blurb8 Bacula source code has been released under the GPL version 2 license.
240
241 %define user_file  /etc/passwd
242 %define group_file /etc/group
243
244 # program locations
245 %define useradd  /usr/sbin/useradd
246 %define groupadd /usr/sbin/groupadd
247 %define usermod  /usr/sbin/usermod
248
249 # platform defines - set one below or define the build_xxx on the command line
250 # RedHat builds
251 %define rh7 0
252 %{?build_rh7:%define rh7 1}
253 %define rh8 0
254 %{?build_rh8:%define rh8 1}
255 %define rh9 0
256 %{?build_rh9:%define rh9 1}
257 # Fedora Core build
258 %define fc1 0
259 %{?build_fc1:%define fc1 1}
260 %define fc3 0
261 %{?build_fc3:%define fc3 1}
262 %define fc4 0
263 %{?build_fc4:%define fc4 1}
264 %define fc5 0
265 %{?build_fc5:%define fc5 1}
266 %define fc6 0
267 %{?build_fc6:%define fc6 1}
268 %define fc7 0
269 %{?build_fc7:%define fc7 1}
270 %define fc8 0
271 %{?build_fc8:%define fc8 1}
272 %define fc9 0
273 %{?build_fc9:%define fc9 1}
274 # Whitebox Enterprise build
275 %define wb3 0
276 %{?build_wb3:%define wb3 1}
277 # RedHat Enterprise builds
278 %define rhel3 0
279 %{?build_rhel3:%define rhel3 1}
280 %{?build_rhel3:%define wb3 1}
281 %define rhel4 0
282 %{?build_rhel4:%define rhel4 1}
283 %{?build_rhel4:%define fc3 1}
284 %define rhel5 0
285 %{?build_rhel5:%define rhel5 1}
286 %{?build_rhel5:%define fc6 1}
287 # CentOS build
288 %define centos3 0
289 %{?build_centos3:%define centos3 1}
290 %{?build_centos3:%define wb3 1}
291 %define centos4 0
292 %{?build_centos4:%define centos4 1}
293 %{?build_centos4:%define fc3 1}
294 %define centos5 0
295 %{?build_centos5:%define centos5 1}
296 %{?build_centos5:%define fc6 1}
297 # SL build
298 %define sl3 0
299 %{?build_sl3:%define sl3 1}
300 %{?build_sl3:%define wb3 1}
301 %define sl4 0
302 %{?build_sl4:%define sl4 1}
303 %{?build_sl4:%define fc3 1}
304 %define sl5 0
305 %{?build_sl5:%define sl5 1}
306 %{?build_sl5:%define fc6 1}
307 # SuSE build
308 %define su9 0
309 %{?build_su9:%define su9 1}
310 %define su10 0
311 %{?build_su10:%define su10 1}
312 %define su102 0
313 %{?build_su102:%define su102 1}
314 %define su103 0
315 %{?build_su103:%define su103 1}
316 %define su110 0
317 %{?build_su110:%define su110 1}
318 %define su111 0
319 %{?build_su111:%define su111 1}
320 # Mandrake builds
321 %define mdk 0
322 %{?build_mdk:%define mdk 1}
323 %define mdv 0
324 %{?build_mdv:%define mdv 1}
325 %{?build_mdv:%define mdk 1}
326
327 # client only build
328 %define client_only 0
329 %{?build_client_only:%define client_only 1}
330
331 # Setup some short cuts
332 %define rhat 0
333 %if %{rh7} || %{rh8} || %{rh9}
334 %define rhat 1
335 %endif
336 %define fed 0
337 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9}
338 %define fed 1
339 %endif
340 %define suse 0
341 %if %{su9} || %{su10} || %{su102} || %{su103} || %{su110} || %{su111}
342 %define suse 1
343 %endif
344 %define rhel 0
345 %if %{rhel3} || %{rhel4} || %{rhel5} || %{centos3} || %{centos4} || %{centos5}
346 %define rhel 1
347 %endif
348 %define scil 0
349 %if %{sl3} || %{sl4} || %{sl5}
350 %define scil 1
351 %endif
352
353
354 # test for a platform definition
355 %if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk}
356 %{error: You must specify a platform. Please examine the spec file.}
357 exit 1
358 %endif
359
360 # database defines
361 # set for database support desired or define the build_xxx on the command line
362 %define mysql 0
363 %{?build_mysql:%define mysql 1}
364 # if using mysql 4.x define this and mysql above
365 # currently: Mandrake 10.1, SuSE 9.x & 10.0, RHEL4 and Fedora Core 4
366 %define mysql4 0
367 %{?build_mysql4:%define mysql4 1}
368 %{?build_mysql4:%define mysql 1}
369 # if using mysql 5.x define this and mysql above
370 # currently: SuSE 10.1 and Fedora Core 5
371 %define mysql5 0
372 %{?build_mysql5:%define mysql5 1}
373 %{?build_mysql5:%define mysql 1}
374 %define sqlite 0
375 %{?build_sqlite:%define sqlite 1}
376 %define postgresql 0
377 %{?build_postgresql:%define postgresql 1}
378
379 # test for a database definition
380 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
381 %{error: You must specify database support. Please examine the spec file.}
382 exit 1
383 %endif
384
385 %if %{mysql}
386 %define db_backend mysql
387 %endif
388 %if %{sqlite}
389 %define db_backend sqlite3
390 %endif
391 %if %{postgresql}
392 %define db_backend postgresql
393 %endif
394
395 # 64 bit support
396 %define x86_64 0
397 %{?build_x86_64:%define x86_64 1}
398
399 # check what distribution we are
400 %if %{rhat} || %{rhel}
401 %define _dist %(grep Red /etc/redhat-release)
402 %endif
403 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9}
404 %define _dist %(grep Fedora /etc/redhat-release)
405 %endif
406 %if %{centos5} || %{centos4} || %{centos3}
407 %define _dist %(grep CentOS /etc/redhat-release)
408 %endif
409 %if %{sl5} ||%{sl4} || %{sl3}
410 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
411 %endif
412 %if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
413 %define _dist %(grep White /etc/whitebox-release)
414 %endif
415 %if %{suse}
416 %define _dist %(grep -i SuSE /etc/SuSE-release)
417 %endif
418 %if %{mdk}
419 %define _dist %(grep Mand /etc/mandrake-release)
420 %endif
421 %{?DISTNAME:%define _dist %{DISTNAME}}
422
423 # only set Disribution if not in opensuse build service, as it sets it itself
424 %if ! 0%{?opensuse_bs}
425 %{?DISTNAME:%define _dist %{DISTNAME}}
426 Distribution: %{_dist}
427 %endif
428
429 %if 0%{?opensuse_bs} &&  %{mysql} && %{suse}
430 # needed in opensuse_bs, as rpm is installed during build process
431 BuildRequires: libmysqlclient-devel
432 BuildRequires: mysql-client
433 BuildRequires: mysql
434 %endif
435 %if 0%{?opensuse_bs} &&  %{suse} && %{postgresql}
436 BuildRequires: postgresql
437 BuildRequires: postgresql-server
438 %endif
439 BuildRequires: openssl
440
441 %if 0%{?opensuse_bs} && %{suse}
442 BuildRequires: pwdutils
443 BuildRequires: sysconfig
444 %endif
445
446 # should we turn on python support
447 %define python 0
448 %{?build_python:%define python 1}
449
450 # specifically disallow build of mtx package if desired
451 %define mtx 0
452 %{?nobuild_mtx:%define mtx 0}
453
454 # do we need to patch for old postgresql version?
455 %define old_pgsql 0
456 %{?build_old_pgsql:%define old_pgsql 1}
457
458 # Mandriva somehow forces the manpage file extension to bz2 rather than gz
459 %if %{mdk}
460 %define manpage_ext bz2
461 %else
462 %define manpage_ext gz
463 %endif
464
465 # for client only build
466 %if %{client_only}
467 %define mysql 0
468 %define mysql4 0
469 %define mysql5 0
470 %define postgresql 0
471 %define sqlite 0
472 %endif
473
474 BuildRequires: gcc, gcc-c++, make, autoconf
475 BuildRequires: glibc, glibc-devel
476 BuildRequires: ncurses-devel, perl
477 BuildRequires: libstdc++-devel, zlib-devel
478 BuildRequires: openssl-devel
479 BuildRequires: libacl-devel
480 BuildRequires: pkgconfig
481 %if ! %{rh7}
482 BuildRequires: libxml2-devel
483 %endif
484 %if %{python}
485 BuildRequires: python, python-devel
486 %{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
487 %endif
488
489 %if %{rh7}
490 BuildRequires: libtermcap-devel
491 BuildRequires: libxml-devel
492 %endif
493 %if %{suse}
494 BuildRequires: termcap
495 %endif
496 %if %{mdk}
497 BuildRequires: libtermcap-devel
498 BuildRequires: libstdc++-static-devel
499 BuildRequires: glibc-static-devel
500 %endif
501 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9}
502 BuildRequires: libtermcap-devel
503 %endif
504 %if !%{rh7} && !%{su9} && !%{su10} && !%{su102} && !%{su103} && !%{su110} && !%{su111} && !%{mdk} && !%{fc3} && !%{fc4} && !%{fc5} && !%{fc6} && !%{fc7} && !%{fc8} && !%{fc9}
505 #BuildRequires: libtermcap-devel
506 %endif
507
508 %if %{sqlite} && %{su10}
509 BuildRequires: sqlite2-devel
510 %endif
511 %if %{sqlite} && ! %{su10}
512 BuildRequires: sqlite-devel
513 %endif
514
515 %if %{mysql}
516 BuildRequires: mysql-devel
517 %endif
518
519 %if %{postgresql} && %{wb3}
520 BuildRequires: rh-postgresql-devel >= 7
521 %endif
522
523 %if %{postgresql} && ! %{wb3}
524 BuildRequires: postgresql-devel >= 7
525 %endif
526
527 %description
528 %{blurb}
529
530 %{blurb2}
531 %{blurb3}
532 %{blurb4}
533 %{blurb5}
534 %{blurb6}
535 %{blurb7}
536 %{blurb8}
537
538 %if %{mysql}
539 %package mysql
540 %endif
541 %if %{sqlite}
542 %package sqlite
543 %endif
544 %if %{postgresql}
545 %package postgresql
546 %endif
547
548 Summary: Bacula - The Network Backup Solution
549 Group: System Environment/Daemons
550 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
551 Conflicts: bacula-client
552
553 Requires: ncurses, libstdc++, zlib, openssl
554 Requires: glibc
555
556 %if %{rhel} || %{rhat} || %{fed}
557 Requires: libtermcap
558 %endif
559 %if %{suse}
560 Conflicts: bacula
561 Requires: termcap
562 %endif
563
564 %if %{mysql}
565 Requires: mysql
566
567 %if %{suse} || %{mdk}
568 Requires: mysql-client
569 %else
570 Requires: mysql-server
571 %endif
572 %endif
573
574 %if %{postgresql} && %{wb3}
575 Requires: rh-postgresql >= 7
576 Requires: rh-postgresql-server >= 7
577 %endif
578 %if %{postgresql} && ! %{wb3}
579 Requires: postgresql >= 7
580 Requires: postgresql-server >= 7
581 %endif
582 %if %{sqlite}
583 Requires: sqlite
584 %endif
585
586 %if %{mysql}
587 %description mysql
588 %endif
589 %if %{sqlite}
590 %description sqlite
591 %endif
592 %if %{postgresql}
593 %description postgresql
594 %endif
595
596 %if %{python}
597 Requires: python >= %{pyver}
598 %endif
599
600 %{blurb}
601
602 %{blurb2}
603 %{blurb3}
604 %{blurb4}
605 %{blurb5}
606 %{blurb6}
607 %{blurb7}
608 %{blurb8}
609
610 %if %{mysql}
611 This build requires MySQL to be installed separately as the catalog database.
612 %endif
613 %if %{postgresql}
614 This build requires PostgreSQL to be installed separately as the catalog database.
615 %endif
616 %if %{sqlite}
617 This build incorporates sqlite3 as the catalog database, statically compiled.
618 %endif
619 %if %{python}
620 This build includes python scripting support.
621 %endif
622
623 %package client
624 Summary: Bacula - The Network Backup Solution
625 Group: System Environment/Daemons
626 Provides: bacula-fd
627 Conflicts: bacula-mysql
628 Conflicts: bacula-sqlite
629 Conflicts: bacula-postgresql
630
631 %if %{suse}
632 Provides: bacula
633 %endif
634
635 Requires: libstdc++, zlib, openssl
636 Requires: glibc
637
638 %if %{suse}
639 Requires: termcap
640 %else
641 Requires: libtermcap
642 %endif
643
644 %if %{python}
645 Requires: python >= %{pyver}
646 %endif
647
648 %description client
649 %{blurb}
650
651 %{blurb2}
652 %{blurb3}
653 %{blurb4}
654 %{blurb5}
655 %{blurb6}
656 %{blurb7}
657 %{blurb8}
658
659 This is the File daemon (Client) only package. It includes the command line 
660 console program.
661 %if %{python}
662 This build includes python scripting support.
663 %endif
664
665 %if ! %{client_only}
666 %package updatedb
667
668 Summary: Bacula - The Network Backup Solution
669 Group: System Environment/Daemons
670
671 %description updatedb
672 %{blurb}
673
674 %{blurb2}
675 %{blurb3}
676 %{blurb4}
677 %{blurb5}
678 %{blurb6}
679 %{blurb7}
680 %{blurb8}
681
682 This package installs scripts for updating older versions of the bacula
683 database.
684 %endif
685
686 %package docs
687
688 Summary: Bacula - The Network Backup Solution
689 Group: System Environment/Daemons
690
691 %description docs
692 %{blurb}
693
694 %{blurb2}
695 %{blurb3}
696 %{blurb4}
697 %{blurb5}
698 %{blurb6}
699 %{blurb7}
700 %{blurb8}
701
702 This package installs the Bacula pdf and html documentation.
703
704 # Must explicitly enable debug pkg on SuSE
705 # but not in opensuse_bs
706 %if ! 0%{?opensuse_bs}
707 %if %{suse}
708 %debug_package
709 export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap"
710 %endif
711 %endif
712
713 %prep
714 %setup
715 %setup -T -D -b 1
716 #%setup -T -D -b 2
717
718 %build
719
720 %if %{wb3} || %{old_pgsql}
721 patch -p3 src/cats/postgresql.c < %SOURCE5
722 %endif
723
724 # patches for the bundled sqlite scripts
725
726 # patch the make_sqlite_tables script for installation bindir
727 #patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
728 #patch src/cats/make_sqlite3_tables.in src/cats/make_sqlite3_tables.in.patch
729
730 # patch the create_sqlite_database script for installation bindir
731 #patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
732 #patch src/cats/create_sqlite3_database.in src/cats/create_sqlite3_database.in.patch
733
734 # patch the make_catalog_backup script for installation bindir
735 #patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
736
737 # patch the update_sqlite_tables script for installation bindir
738 #patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
739 #patch src/cats/update_sqlite3_tables.in src/cats/update_sqlite3_tables.in.patch
740
741 # patch the bacula-dir init script to remove sqlite service
742 %if %{sqlite} && %{su9}
743 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
744 %endif
745 %if %{sqlite} && %{su10}
746 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
747 %endif
748 %if %{sqlite} && %{su102}
749 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
750 %endif
751 %if %{sqlite} && %{su103}
752 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
753 %endif
754 %if %{sqlite} && %{su110}
755 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
756 %endif
757 %if %{sqlite} && %{su111}
758 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
759 %endif
760
761 # 64 bit lib location hacks
762 # as of 1.39.18 it should not be necessary to enable x86_64 as configure is
763 # reported to be fixed to properly detect lib locations.
764 %if %{x86_64}
765 export LDFLAGS="${LDFLAGS} -L/usr/lib64"
766 %endif
767 %if %{mysql} && %{x86_64}
768 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
769 %endif
770 %if %{python} && %{x86_64}
771 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
772 %endif
773
774 # Red Hat's 64 bit installation of QT4 appears to be broken so:
775 %define qt_path 0
776 %if %{rhel5} || %{centos5} || %{sl5}
777 %define qt_path 1
778 %endif
779
780 # Main Bacula configuration
781 %configure \
782         --prefix=%{_prefix} \
783         --sbindir=%{_sbindir} \
784         --sysconfdir=%{sysconf_dir} \
785         --mandir=%{_mandir} \
786         --with-scriptdir=%{script_dir} \
787         --with-working-dir=%{working_dir} \
788         --with-plugindir=%{script_dir} \
789         --with-pid-dir=%{pid_dir} \
790         --with-subsys-dir=%{_subsysdir} \
791         --enable-smartalloc \
792         --disable-gome \
793         --disable-bwx-console \
794         --disable-tray-monitor \
795 %if %{mysql}
796         --with-mysql \
797 %endif
798 %if %{sqlite}
799 %if %{su9} || %{su10}
800         --with-sqlite \
801 %else
802         --with-sqlite3 \
803 %endif
804 %endif # sqlite?
805 %if %{postgresql}
806         --with-postgresql \
807 %endif
808         --disable-bat \
809         --without-qwt \
810 %if %{python}
811         --with-python \
812 %endif
813 %if %{client_only}
814         --enable-client-only \
815 %endif
816 %if %{rh7} || %{rh8} || %{rh9} || %{fc1} || %{fc3} || %{wb3} 
817         --disable-batch-insert \
818 %endif
819         --with-dir-user=%{director_daemon_user} \
820         --with-dir-group=%{daemon_group} \
821         --with-sd-user=%{storage_daemon_user} \
822         --with-sd-group=%{storage_daemon_group} \
823         --with-fd-user=%{file_daemon_user} \
824         --with-fd-group=%{daemon_group} \
825         --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
826         --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
827         --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
828         --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
829         --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
830         --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
831         --with-openssl
832
833 make -j3
834
835 %install
836  
837 cwd=${PWD}
838 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
839 mkdir -p $RPM_BUILD_ROOT/etc/init.d
840 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
841 mkdir -p $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles
842 mkdir -p $RPM_BUILD_ROOT/etc/logwatch/conf/services
843 mkdir -p $RPM_BUILD_ROOT/etc/logwatch/scripts/services
844 mkdir -p $RPM_BUILD_ROOT/etc/logwatch/scripts/shared
845 mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
846
847 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
848 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
849 #mkdir -p $RPM_BUILD_ROOT%{_bindir}
850
851 make DESTDIR=$RPM_BUILD_ROOT install
852
853 %if %{client_only}
854 # Program docs not installed on client
855 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-dir.8.%{manpage_ext}
856 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-sd.8.%{manpage_ext}
857 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bcopy.8.%{manpage_ext}
858 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bextract.8.%{manpage_ext}
859 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
860 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
861 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
862 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
863 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
864 %endif
865 # Docs for programs that are depreciated
866 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
867 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
868 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
869 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
870
871 # fixme - make installs the mysql scripts for sqlite build
872 %if %{sqlite}
873 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
874 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
875 rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
876 %endif
877
878 # fixme - make installs the mysql scripts for postgresql build
879 %if %{postgresql}
880 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
881 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
882 %endif
883
884 # install the init scripts
885 %if %{suse}
886 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
887 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
888 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
889 %endif
890 %if %{mdk}
891 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
892 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
893 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
894 %endif
895 %if ! %{suse} && ! %{mdk}
896 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
897 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
898 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
899 %endif
900 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
901 %if %{client_only}
902 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
903 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
904 %endif
905
906 # install the logrotate file
907 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
908
909 # install the updatedb scripts
910 cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
911
912 # install the logwatch scripts
913 %if ! %{client_only}
914 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT/etc/logwatch/scripts/services/bacula
915 cp -p scripts/logwatch/applybacula $RPM_BUILD_ROOT/etc/logwatch/scripts/shared/applybacula
916 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/bacula.conf
917 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/bacula.conf
918 chmod 755 $RPM_BUILD_ROOT/etc/logwatch/scripts/services/bacula
919 chmod 755 $RPM_BUILD_ROOT/etc/logwatch/scripts/shared/applybacula
920 chmod 644 $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/bacula.conf
921 chmod 644 $RPM_BUILD_ROOT/etc/logwatch/conf/services/bacula.conf
922 %endif
923
924 # now clean up permissions that are left broken by the install
925 chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
926
927 # fix me - building enable-client-only installs files not included in bacula-client package
928 %if %{client_only}
929 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
930 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
931 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
932 rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
933 rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
934 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
935 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
936 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
937 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
938 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
939 rm -f $RPM_BUILD_ROOT%{script_dir}/bpipe-fd.so
940 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
941 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
942 %endif
943
944 %clean
945 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
946 %if 0%{?opensuse_bs}
947 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-1.txt
948 %else
949 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
950 %endif
951
952
953 %if %{mysql}
954 # MySQL specific files
955 %files mysql
956 %defattr(-, root, root)
957 %attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
958 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
959 %attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
960 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
961 %attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
962 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
963 %attr(-, root, %{daemon_group}) %{script_dir}/startmysql
964 %attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
965 %endif
966
967 %if %{sqlite}
968 %if  %{su9} ||  %{su10}
969 # use sqlite2 on SLE_10 and SLES9
970 %files sqlite
971 %defattr(-,root,root)
972 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite_database
973 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_database
974 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite_privileges
975 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite_tables
976 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_tables
977 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite_tables
978 %else
979 %files sqlite
980 %defattr(-,root,root)
981 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
982 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
983 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
984 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
985 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
986 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
987 %endif # sqlite?
988 %endif
989
990
991
992 %if %{postgresql}
993 %files postgresql
994 %defattr(-,root,root)
995 %attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
996 %attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
997 %attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
998 %attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
999 %attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
1000 %attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
1001 # The rest is DB backend independent
1002 %endif
1003 # opensuse_bs: directories not owned by any package
1004 /etc/bacula
1005
1006 %if ! %{client_only}
1007 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1008 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
1009 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
1010 %attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
1011 %attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
1012 %attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
1013 %attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
1014 %attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
1015 %attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
1016 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
1017 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
1018 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1019 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1020 %attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
1021 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
1022 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
1023 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
1024 %attr(-, root, %{daemon_group}) %{script_dir}/bpipe-fd.so
1025 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
1026 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
1027 %attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
1028 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
1029 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
1030 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer.conf
1031
1032 /etc/logrotate.d/bacula
1033 /etc/logwatch/scripts/services/bacula
1034 /etc/logwatch/scripts/shared/applybacula
1035 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
1036 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1037 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
1038 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1039 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/logwatch/conf/logfiles/bacula.conf
1040 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/logwatch/conf/services/bacula.conf
1041 %attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
1042
1043 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
1044
1045 %{_sbindir}/bacula-dir
1046 %{_sbindir}/bacula-fd
1047 %{_sbindir}/bacula-sd
1048 %{_sbindir}/bacula
1049 %{_sbindir}/bcopy
1050 %{_sbindir}/bextract
1051 %{_sbindir}/bls
1052 %{_sbindir}/bscan
1053 %{_sbindir}/btape
1054 %{_sbindir}/btraceback
1055 %{_sbindir}/bconsole
1056 %{_sbindir}/dbcheck
1057 %{_sbindir}/bsmtp
1058 %{_sbindir}/bregex
1059 %{_sbindir}/bwild
1060 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1061 %{_mandir}/man8/bacula-dir.8.%{manpage_ext}
1062 %{_mandir}/man8/bacula-sd.8.%{manpage_ext}
1063 %{_mandir}/man8/bacula.8.%{manpage_ext}
1064 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1065 %{_mandir}/man8/bcopy.8.%{manpage_ext}
1066 %{_mandir}/man8/bextract.8.%{manpage_ext}
1067 %{_mandir}/man8/bls.8.%{manpage_ext}
1068 %{_mandir}/man8/bscan.8.%{manpage_ext}
1069 %{_mandir}/man8/btape.8.%{manpage_ext}
1070 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1071 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
1072 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
1073 %{_mandir}/man1/bat.1.%{manpage_ext}
1074 %{_libdir}/libbac*
1075 /usr/share/doc/*
1076 %endif
1077
1078 %if %{mysql}
1079 %pre mysql
1080 # test for bacula database older than version 10
1081 # note: this ASSUMES no password has been set for bacula database
1082 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1083 %endif
1084
1085 %if %{sqlite}
1086 %pre sqlite
1087 # test for bacula database older than version 10 and sqlite3
1088 if [ -s %{working_dir}/bacula.db ]; then
1089         DB_VER=`echo "select * from Version;" | sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1090 fi
1091 %endif
1092
1093 %if %{postgresql}
1094 %pre postgresql
1095 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1096 %endif
1097
1098 %if ! %{client_only}
1099 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "10" ]; then
1100     echo "This bacula upgrade will update a bacula database from version 10 to 11."
1101     echo "You appear to be running database version $DB_VER. You must first update"
1102     echo "your database to version 10 and then install this upgrade. The alternative"
1103     echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
1104     echo "catalog information, then do the upgrade. Information on updating a"
1105     echo "database older than version 10 can be found in the release notes."
1106     exit 1
1107 fi
1108 %endif
1109
1110
1111 %if ! %{client_only}
1112 # check for and copy %{sysconf_dir}/console.conf to bconsole.conf
1113 if [ -s %{sysconf_dir}/console.conf ];then
1114     cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
1115 fi
1116
1117 # create the daemon users and groups
1118 # first create the groups if they don't exist
1119 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1120 if [ -z "$HAVE_BACULA" ]; then
1121         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1122         echo "The group %{daemon_group} has been added to %{group_file}."
1123         echo "See the manual chapter \"Running Bacula\" for details."
1124 fi
1125 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
1126 if [ -z "$HAVE_BACULA" ]; then
1127         %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
1128         echo "The group %{storage_daemon_group} has been added to %{group_file}."
1129         echo "See the manual chapter \"Running Bacula\" for details."
1130 fi
1131 # now create the users if they do not exist
1132 # we do not use the -g option allowing the primary group to be set to system default
1133 # this will be a unique group on redhat type systems or the group users on some systems
1134 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
1135 if [ -z "$HAVE_BACULA" ]; then
1136         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
1137         echo "The user %{storage_daemon_user} has been added to %{user_file}."
1138         echo "See the manual chapter \"Running Bacula\" for details."
1139 fi
1140 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
1141 if [ -z "$HAVE_BACULA" ]; then
1142         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
1143         echo "The user %{director_daemon_user} has been added to %{user_file}."
1144         echo "See the manual chapter \"Running Bacula\" for details."
1145 fi
1146 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1147 if [ -z "$HAVE_BACULA" ]; then
1148         %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1149         echo "The user %{file_daemon_user} has been added to %{user_file}."
1150         echo "See the manual chapter \"Running Bacula\" for details."
1151 fi
1152 # now we add the supplementary groups, this is ok to call even if the users already exist
1153 # we only do this if the user is NOT root
1154 IS_ROOT=%{director_daemon_user}
1155 if [ "$IS_ROOT" != "root" ]; then
1156 %{usermod} -G %{daemon_group} %{director_daemon_user}
1157 fi
1158 IS_ROOT=%{storage_daemon_user}
1159 if [ "$IS_ROOT" != "root" ]; then
1160 %{usermod} -G %{daemon_group},%{storage_daemon_group} %{storage_daemon_user}
1161 fi
1162 IS_ROOT=%{file_daemon_user}
1163 if [ "$IS_ROOT" != "root" ]; then
1164 %{usermod} -G %{daemon_group} %{file_daemon_user}
1165 fi
1166 %endif
1167
1168 %if %{mysql}
1169 %post mysql
1170 %endif
1171 %if %{sqlite}
1172 %post sqlite
1173 %endif
1174 %if %{postgresql}
1175 %post postgresql
1176 %endif
1177 %if ! %{client_only}
1178 # add our links
1179 if [ "$1" -ge 1 ] ; then
1180 %if %{suse} && %{mysql}
1181   /sbin/chkconfig --add mysql
1182 %endif
1183 %if %{suse} && %{postgresql}
1184   /sbin/chkconfig --add postgresql
1185 %endif
1186   /sbin/chkconfig --add bacula-dir
1187   /sbin/chkconfig --add bacula-fd
1188   /sbin/chkconfig --add bacula-sd
1189 fi
1190 %endif
1191
1192 %if %{mysql}
1193
1194 #check, if mysql can be called successfully at all
1195 if mysql 2>/dev/null bacula -e 'select * from Version;' ; then
1196
1197 # test for an existing database
1198 # note: this ASSUMES no password has been set for bacula database
1199 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1200
1201 # grant privileges and create tables if they do not exist
1202 if [ -z "$DB_VER" ]; then
1203     echo "Hmm, it doesn't look like you have an existing database."
1204     echo "Granting privileges for MySQL user bacula..."
1205     %{script_dir}/grant_mysql_privileges
1206     echo "Creating MySQL bacula database..."
1207     %{script_dir}/create_mysql_database
1208     echo "Creating bacula tables..."
1209     %{script_dir}/make_mysql_tables
1210
1211 # check to see if we need to upgrade a 2.x database
1212 elif [ "$DB_VER" -lt "11" ]; then
1213     echo "This release requires an upgrade to your bacula database."
1214     echo "Backing up your current database..."
1215     mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1216     echo "Upgrading bacula database ..."
1217     %{script_dir}/update_mysql_tables
1218     echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1219
1220 fi
1221 fi
1222 %endif
1223
1224 %if %{sqlite}
1225 # test for an existing database
1226 if [ -s %{working_dir}/bacula.db ]; then
1227     DB_VER=`echo "select * from Version;" | sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1228     # check to see if we need to upgrade a 2.x database
1229     if [ "$DB_VER" -lt "11" ] && [ "$DB_VER" -ge "10" ]; then
1230         echo "This release requires an upgrade to your bacula database."
1231         echo "Backing up your current database..."
1232         echo ".dump" | sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1233         echo "Upgrading bacula database ..."
1234         %{script_dir}/update_sqlite3_tables
1235         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1236     fi
1237 else
1238     # create the database and tables
1239     echo "Hmm, it doesn't look like you have an existing database."
1240     echo "Creating SQLite database..."
1241     %{script_dir}/create_sqlite3_database
1242     echo "Creating the SQLite tables..."
1243     %{script_dir}/make_sqlite3_tables
1244     chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
1245 fi
1246 %endif
1247
1248 %if %{postgresql}
1249 # check if psql can be called successfully at all
1250 if echo 'select * from Version;' | psql bacula 2>/dev/null; then
1251
1252 # test for an existing database
1253 # note: this ASSUMES no password has been set for bacula database
1254 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1255
1256 # grant privileges and create tables if they do not exist
1257 if [ -z "$DB_VER" ]; then
1258     echo "Hmm, doesn't look like you have an existing database."
1259     echo "Creating PostgreSQL bacula database..."
1260     %{script_dir}/create_postgresql_database
1261     echo "Creating bacula tables..."
1262     %{script_dir}/make_postgresql_tables
1263     echo "Granting privileges for PostgreSQL user bacula..."
1264     %{script_dir}/grant_postgresql_privileges
1265
1266 # check to see if we need to upgrade a 2.x database
1267 elif [ "$DB_VER" -lt "11" ]; then
1268     echo "This release requires an upgrade to your bacula database."
1269     echo "Backing up your current database..."
1270     pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1271     echo "Upgrading bacula database ..."
1272     %{script_dir}/update_postgresql_tables
1273     echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1274         
1275 fi
1276 fi
1277 %endif
1278
1279 %if ! %{client_only}
1280 if [ -d %{sysconf_dir} ]; then
1281    cd %{sysconf_dir}
1282    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
1283       pass=`openssl rand -base64 33`
1284       for file in *.conf; do
1285          sed "s@${string}@${pass}@g" $file > $file.new
1286          cp -f $file.new $file; rm -f $file.new
1287       done
1288    done
1289 # put actual hostname in conf file
1290    host=`hostname`
1291    string="XXX_HOSTNAME_XXX"
1292    for file in *.conf; do
1293       sed "s@${string}@${host}@g" $file >$file.new
1294       cp -f $file.new $file; rm -f $file.new
1295    done
1296 fi
1297 %endif
1298 /sbin/ldconfig
1299 exit 0 # always exit successfull, as otherwise opensuse build service complains
1300
1301 %if %{mysql}
1302 %preun mysql
1303 %endif
1304 %if %{sqlite}
1305 %preun sqlite
1306 %endif
1307 %if %{postgresql}
1308 %preun postgresql
1309 %endif
1310
1311 %if ! %{client_only}
1312 # delete our links
1313 if [ $1 = 0 ]; then
1314   /sbin/chkconfig --del bacula-dir
1315   /sbin/chkconfig --del bacula-fd
1316   /sbin/chkconfig --del bacula-sd
1317 fi
1318 /sbin/ldconfig
1319 %endif
1320
1321 # added: run ldconfig in postun
1322 %if %{mysql}
1323 %postun mysql
1324 %endif
1325 %if %{sqlite}
1326 %postun sqlite
1327 %endif
1328 %if %{postgresql}
1329 %postun postgresql
1330 %endif
1331 /sbin/ldconfig
1332
1333 %files client
1334 %defattr(-,root,root)
1335 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1336 %{script_dir}/bacula-ctl-fd
1337 /etc/init.d/bacula-fd
1338
1339 /etc/logrotate.d/bacula
1340
1341 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1342 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1343 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1344
1345 %{_sbindir}/bacula-fd
1346 %{_sbindir}/btraceback
1347 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1348 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1349 %{_sbindir}/bconsole
1350 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1351 %{_mandir}/man8/bacula.8.%{manpage_ext}
1352 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1353 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1354 %{_mandir}/man1/bat.1.%{manpage_ext}
1355 %{_libdir}/libbac.*
1356 %{_libdir}/libbaccfg.*
1357 %{_libdir}/libbacfind.*
1358 %{_libdir}/libbacpy.*
1359 /usr/share/doc/*
1360 #opensuse_bs: directories not owned by any package
1361 /etc/bacula
1362
1363 %pre client
1364 # create the daemon group and user
1365 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1366 if [ -z "$HAVE_BACULA" ]; then
1367     %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1368     echo "The group %{daemon_group} has been added to %{group_file}."
1369     echo "See the manual chapter \"Running Bacula\" for details."
1370 fi
1371 # we do not use the -g option allowing the primary group to be set to system default
1372 # this will be a unique group on redhat type systems or the group users on some systems
1373 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1374 if [ -z "$HAVE_BACULA" ]; then
1375     %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1376     echo "The user %{file_daemon_user} has been added to %{user_file}."
1377     echo "See the manual chapter \"Running Bacula\" for details."
1378 fi
1379 # now we add the supplementary group, this is ok to call even if the user already exists
1380 # we only do this if the user is NOT root
1381 IS_ROOT=%{file_daemon_user}
1382 if [ "$IS_ROOT" != "root" ]; then
1383 %{usermod} -G %{daemon_group} %{file_daemon_user}
1384 fi
1385
1386 %post client
1387 # add our link
1388 if [ "$1" -ge 1 ] ; then
1389    /sbin/chkconfig --add bacula-fd
1390 fi
1391
1392 if [ -d %{sysconf_dir} ]; then
1393    cd %{sysconf_dir}
1394    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
1395       pass=`openssl rand -base64 33`
1396       for file in *.conf; do
1397          sed "s@${string}@${pass}@g" $file > $file.new
1398          cp -f $file.new $file; rm -f $file.new
1399       done
1400    done
1401 # put actual hostname in conf file
1402    host=`hostname`
1403    string="XXX_HOSTNAME_XXX"
1404    for file in *.conf; do
1405       sed "s@${string}@${host}@g" $file >$file.new
1406       cp -f $file.new $file; rm -f $file.new
1407    done
1408 fi
1409
1410 /sbin/ldconfig
1411 exit 0
1412 %preun client
1413 # delete our link
1414 if [ $1 = 0 ]; then
1415    /sbin/chkconfig --del bacula-fd
1416 fi
1417
1418 %postun client
1419 /sbin/ldconfig
1420
1421 %if ! %{client_only}
1422 %files updatedb
1423 %defattr(-,root,%{daemon_group})
1424 %{script_dir}/updatedb/*
1425 #oensuse_bs: directories not owned by any package
1426 %{script_dir}/updatedb
1427
1428 %pre updatedb
1429 # create the daemon group
1430 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1431 if [ -z "$HAVE_BACULA" ]; then
1432     %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1433     echo "The group %{daemon_group} has been added to %{group_file}."
1434     echo "See the manual chapter \"Running Bacula\" for details."
1435 fi
1436
1437 %post updatedb
1438 echo "The database update scripts were installed to %{script_dir}/updatedb"
1439 %endif
1440
1441 %changelog
1442 * Mon Aug 10 2009 Philipp Storz <philipp.storz@dass-it.de>
1443 - changes to work with opensuse build service
1444 * Sat Jun 20 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1445 - Fix bat install which is now handled by make and uses shared libs
1446 * Sat May 16 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1447 - fix libxml dependency for rh7 per Pasi Kärkkäinen <pasik@iki.fi>
1448 * Mon May 04 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1449 - Fix post ldconfig problem in client only build
1450 * Sun May 03 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1451 - remove more files installed by client-only build not needed by client package
1452 - remove libbacsql files from client package
1453 * Sat May 02 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1454 - 3.0.1
1455 - update for new docs configuration
1456 * Sat Apr 25 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1457 - add switch to pass Distribution tag
1458 * Sun Apr 5 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1459 - 3.0.0 release
1460 - database update version 10 to 11
1461 - make now installs docs so we rm from buildroot
1462 - add shared libs in %_libdir and other misc new files
1463 * Wed Dec 31 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1464 - add su111 target
1465 * Sat Nov 08 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1466 - set paths for QT using pkgconfig
1467 * Sat Oct 11 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1468 - release 2.4.3 update depkgs to 11Sep08 remove file nmshack from mtx package
1469 * Sun Sep 07 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1470 - adjust /opt/bacula install
1471 - add build switch to supress rescue package
1472 * Sun Aug 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1473 - add support for install to /opt/bacula
1474 * Sun Aug 17 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1475 - remove libtermcap dependancy for FC9
1476 * Mon Aug 04 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1477 - fix bat dependencies
1478 * Sat Jun 28 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1479 - add su110 target
1480 * Sat May 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1481 - add fc9 target
1482 * Sun Mar 30 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1483 - FHS compatibility changes
1484 * Sat Feb 16 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1485 - remove fix for false buffer overflow detection with glibc >= 2.7
1486 * Sat Feb 09 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1487 - fix for false buffer overflow detection with glibc >= 2.7