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