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