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