4 # Copyright (C) 2000-2015 Kern Sibbald
5 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Platform Build Configuration
10 # basic defines for every build
11 %define _release @RELEASE@
12 %define _version @VERSION@
13 %define product bacula
14 %define _packager Kern Sibbald <kern@sibbald.com>
15 %define depkgs_version @DEPKGS_VERSION@
17 # Don't strip binaries
18 %define __os_install_post %{nil}
19 %define __debug_install_post %{nil}
20 %define debug_package %{nil}
22 %define postgres_version 8
24 %{?build_rhel5:%define pgre84 1}
25 %{?build_el5:%define pgre84 1}
27 %define postgres_package postgresql84
28 %define postgres_server_package postgresql84-server
29 %define postgres_devel_package postgresql84-devel
31 %define postgres_package postgresql
32 %define postgres_server_package postgresql-server
33 %define postgres_devel_package postgresql-devel
37 %{?single_dir_install:%define single_dir 1}
39 # Installation Directory locations
41 %define _prefix /opt/bacula
42 %define _sbindir /opt/bacula/bin
43 %define _bindir /opt/bacula/bin
44 %define _subsysdir /opt/bacula/working
45 %define sqlite_bindir /opt/bacula/sqlite
46 %define _mandir /usr/share/man
47 %define docs_dir /opt/bacula/docs
48 %define archive_dir /opt/bacula/archive
49 %define sysconf_dir /opt/bacula/etc
50 %define script_dir /opt/bacula/scripts
51 %define working_dir /opt/bacula/working
52 %define pid_dir /opt/bacula/working
53 %define plugin_dir /opt/bacula/plugins
54 %define lib_dir /opt/bacula/lib
55 %define log_dir /opt/bacula/log
58 %define _sbindir %_prefix/sbin
59 %define _bindir %_prefix/bin
60 %define _subsysdir /var/lock/subsys
61 %define sqlite_bindir %_libdir/bacula/sqlite
62 %define _mandir %_prefix/share/man
63 %define sysconf_dir /etc/bacula
64 %define script_dir %_libdir/bacula
65 %define working_dir /var/lib/bacula
66 %define pid_dir /var/run
67 %define plugin_dir %_libdir/bacula/plugins
68 %define lib_dir %_libdir/bacula/lib
69 %define log_dir %_libdir/bacula/log
72 # Daemon user:group Don't change them unless you know what you are doing
73 %define director_daemon_user bacula
74 %define storage_daemon_user bacula
75 %define file_daemon_user root
76 %define daemon_group bacula
77 # group that has write access to tape devices, usually disk on Linux
78 %define storage_daemon_group disk
80 %define depkgs ../depkgs
82 # probems with mandriva build:
83 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
85 #--------------------------------------------------------------------------
86 # it should not be necessary to change anything below here for a release
87 # except for patch macros in the setup section
88 #--------------------------------------------------------------------------
90 %define base_package_name %{product}
92 %{?contrib_packager:%define _packager %{contrib_packager}}
94 Summary: Bacula - The Network Backup Solution
95 Name: %{base_package_name}
98 Group: System Environment/Daemons
100 BuildRoot: %{_tmppath}/%{name}-root
101 URL: http://www.bacula.org/
102 Vendor: The Bacula Team
103 Packager: %{_packager}
106 # opensuse build service changes the release itself
107 # what happens if the release is not 1? DSB
108 Source0: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
109 Source1: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
111 Source2: Release_Notes-%{version}-1.tar.gz
113 Source2: Release_Notes-%{version}-%{release}.tar.gz
116 # define the basic package description
117 %define blurb Bacula - The Leading Open Source Backup Solution.
118 %define blurb2 Bacula is a set of computer programs that permit you (or the system
119 %define blurb3 administrator) to manage backup, recovery, and verification of computer
120 %define blurb4 data across a network of computers of different kinds. In technical terms,
121 %define blurb5 it is a network client/server based backup program. Bacula is relatively
122 %define blurb6 easy to use and efficient, while offering many advanced storage management
123 %define blurb7 features that make it easy to find and recover lost or damaged files.
124 %define blurb8 Bacula source code has been released under the AGPL version 3 license.
126 %define user_file /etc/passwd
127 %define group_file /etc/group
130 %define useradd /usr/sbin/useradd
131 %define groupadd /usr/sbin/groupadd
132 %define usermod /usr/sbin/usermod
134 # platform defines - set one below or define the build_xxx on the command line
137 %{?build_rh7:%define rh7 1}
139 %{?build_rh8:%define rh8 1}
141 %{?build_rh9:%define rh9 1}
144 %{?build_fc16:%define fc16 1}
146 %{?build_fc17:%define fc17 1}
148 %{?build_fc18:%define fc18 1}
149 # Whitebox Enterprise build
151 %{?build_wb3:%define wb3 1}
152 # RedHat Enterprise builds
154 %{?build_rhel3:%define rhel3 1}
155 %{?build_rhel3:%define wb3 1}
157 %{?build_rhel4:%define rhel4 1}
158 %{?build_rhel4:%define fc3 1}
159 %{?build_el4:%define rhel4 1}
160 %{?build_el4:%define fc3 1}
162 %{?build_rhel5:%define rhel5 1}
163 %{?build_rhel5:%define fc6 1}
164 %{?build_el5:%define rhel5 1}
165 %{?build_el5:%define fc6 1}
167 %{?build_rhel6:%define rhel6 1}
168 %{?build_el6:%define rhel6 1}
171 %{?build_centos3:%define centos3 1}
172 %{?build_centos3:%define wb3 1}
174 %{?build_centos4:%define centos4 1}
175 %{?build_centos4:%define fc3 1}
177 %{?build_centos5:%define centos5 1}
178 %{?build_centos5:%define fc6 1}
180 %{?build_centos6:%define centos6 1}
183 %{?build_sl3:%define sl3 1}
184 %{?build_sl3:%define wb3 1}
186 %{?build_sl4:%define sl4 1}
187 %{?build_sl4:%define fc3 1}
189 %{?build_sl5:%define sl5 1}
190 %{?build_sl5:%define fc6 1}
193 %{?build_su9:%define su9 1}
195 %{?build_su10:%define su10 1}
197 %{?build_su102:%define su102 1}
199 %{?build_su103:%define su103 1}
201 %{?build_su110:%define su110 1}
203 %{?build_su111:%define su111 1}
205 %{?build_su112:%define su112 1}
207 %{?build_su121:%define su121 1}
210 %{?build_mdk:%define mdk 1}
212 %{?build_mdv:%define mdv 1}
213 %{?build_mdv:%define mdk 1}
216 %define client_only 0
217 %{?build_client_only:%define client_only 1}
219 # Setup some short cuts
221 %if %{rh7} || %{rh8} || %{rh9}
225 %if %{fc16} || %{fc17} || %{fc18}
229 %if %{su9} || %{su10} || %{su102} || %{su103} || %{su110} || %{su111} || %{su112} || %{su121}
233 %if %{rhel3} || %{rhel4} || %{rhel5} || %{rhel6} || %{centos3} || %{centos4} || %{centos5} || %{centos6}
237 %if %{sl3} || %{sl4} || %{sl5}
242 # test for a platform definition
243 %if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk} && !%{scil}
244 %{error: You must specify a platform. Please examine the spec file.}
248 # distribution-specific directory for logwatch
249 %if %{wb3} || %{rh7} || %{rh8} || %{rh9}
250 %define logwatch_dir /etc/log.d
252 %define logwatch_dir /etc/logwatch
256 # set for database support desired or define the build_xxx on the command line
258 %{?build_mysql:%define mysql 1}
260 %{?build_sqlite:%define sqlite 1}
262 %{?build_postgresql:%define postgresql 1}
264 # test for a database definition
265 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
266 %{error: You must specify database support, by passing one of the following to rpmbuild:}
267 %{error: --define build_postgresql=1}
268 %{error: --define build_sqlite=1}
269 %{error: --define build_mysql=1}
274 %define db_backend mysql
277 %define db_backend sqlite3
280 %define db_backend postgresql
285 %{?build_x86_64:%define x86_64 1}
287 # check what distribution we are
288 %if %{fc16} || %{fc17} || %{fc18}
289 %define _dist %(grep Fedora /etc/redhat-release)
291 %if %{centos5} || %{centos4} || %{centos3}
292 %define _dist %(grep CentOS /etc/redhat-release)
294 %if %{sl5} ||%{sl4} || %{sl3}
295 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
297 %if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
298 %define _dist %(grep White /etc/whitebox-release)
301 %define _dist %(grep -i SuSE /etc/SuSE-release)
304 %define _dist %(grep Mand /etc/mandrake-release)
306 %if %{rhat} || %{rhel}
307 %define _dist %(grep Red /etc/redhat-release)
309 %{?DISTNAME:%define _dist %{DISTNAME}}
311 # only set Disribution if not in opensuse build service, as it sets it itself
312 %if ! 0%{?opensuse_bs}
313 Distribution: %{_dist}
316 %if 0%{?opensuse_bs} && %{mysql} && %{suse}
317 # needed in opensuse_bs, as rpm is installed during build process
318 BuildRequires: libmysqlclient-devel
319 BuildRequires: mysql-client
322 %if 0%{?opensuse_bs} && %{suse} && %{postgresql}
323 BuildRequires: %{postgres_package}
324 BuildRequires: %{postgres_server_package}
326 BuildRequires: openssl
328 %if 0%{?opensuse_bs} && %{suse}
329 BuildRequires: pwdutils
330 BuildRequires: sysconfig
333 # should we turn on python support
335 %{?build_python:%define python 1}
337 # should we enable tcp wrappers support
338 %define tcpwrappers 1
339 %{?build_tcpwrappers:%define tcpwrappers 1}
341 # do we need to patch for old postgresql version?
343 %{?build_old_pgsql:%define old_pgsql 1}
345 # Mandriva somehow forces the manpage file extension to bz2 rather than gz
347 %define manpage_ext bz2
349 %define manpage_ext gz
352 # for client only build
359 BuildRequires: gcc, gcc-c++, make, autoconf
360 BuildRequires: glibc, glibc-devel
361 BuildRequires: ncurses-devel, readline-devel
362 BuildRequires: libstdc++-devel, zlib-devel
363 BuildRequires: openssl-devel
364 BuildRequires: libacl-devel
365 BuildRequires: pkgconfig
367 BuildRequires: libxml2-devel
370 BuildRequires: python, python-devel
371 %{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
375 BuildRequires: libxml-devel
378 BuildRequires: libstdc++-static-devel
379 BuildRequires: glibc-static-devel
382 %if %{mysql} && ! %{suse}
383 BuildRequires: mysql-devel
386 %if %{postgresql} && %{wb3}
387 BuildRequires: rh-postgresql-devel >= %{postgres_version}
390 %if %{postgresql} && ! %{wb3}
391 BuildRequires: %{postgres_devel_package} >= %{postgres_version}
415 Summary: Bacula - The Network Backup Solution
416 Group: System Environment/Daemons
417 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
418 Conflicts: bacula-client
420 Requires: ncurses, libstdc++, zlib, openssl
421 Requires: glibc, readline, %{name}-libs
431 %if %{postgresql} && %{wb3}
432 Requires: rh-postgresql >= 7
434 %if %{postgresql} && ! %{wb3}
435 Requires: postgresql >= 7
445 %description postgresql
449 Requires: python >= %{pyver}
463 This build requires MySQL to be installed separately as the catalog database.
466 This build requires PostgreSQL to be installed separately as the catalog database.
469 This build incorporates sqlite3 as the catalog database, statically compiled.
472 This build includes python scripting support.
475 This build includes tcp-wrappers support.
479 Summary: Bacula - The Network Backup Solution
480 Group: System Environment/Daemons
482 Conflicts: bacula-mysql
483 Conflicts: bacula-sqlite
484 Conflicts: bacula-postgresql
488 Provides: %{product}-libs
491 Requires: libstdc++, zlib, openssl
492 Requires: glibc, readline, %{name}-libs
495 Requires: python >= %{pyver}
509 This is the File daemon (Client) only package. It includes the command line
512 This build includes python scripting support.
515 This build includes tcp-wrappers support.
521 Summary: Bacula - The Network Backup Solution
522 Group: System Environment/Daemons
524 %description updatedb
535 This package installs scripts for updating older versions of the bacula
541 Summary: Bacula - The Network Backup Solution
542 Group: System Environment/Daemons
555 This package installs the shared libraries used by many bacula programs.
557 # Must explicitly enable debug pkg on SuSE
558 # but not in opensuse_bs
559 #%if %{suse} && ! 0%{?opensuse_bs}
564 %setup -T -b 0 -n depkgs
565 %setup -T -b 1 -n %{product}-%{version}
566 %setup -T -D -b 2 -n %{product}-%{version}
573 #export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
576 # You can use a cache for depkgs
577 # tar xfz depkgs*gz -C ~/
579 # touch %{depkgs_version} # depkgs version
581 if [ -f $HOME/depkgs/%{depkgs_version} ]; then
583 ln -s $HOME/depkgs %{depkgs}
595 export LDFLAGS="${LDFLAGS} -L${PWD}/lzo/lib"
596 export CPPFLAGS="${CPPFLAGS} -I${PWD}/lzo/include"
599 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
600 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
603 # patches for the bundled sqlite scripts
604 sed -i s:.SQLITE_BINDIR.:/opt/bacula/sqlite: src/cats/*_sqlite3_*.in
606 # patch the bacula-dir init script to remove sqlite service
608 sed -i 's/network .DB_TYPE./network/' platforms/suse/bacula-dir.in
612 # 64 bit lib location hacks
613 # as of 1.39.18 it should not be necessary to enable x86_64 as configure is
614 # reported to be fixed to properly detect lib locations.
616 export LDFLAGS="${LDFLAGS} -L/usr/lib64"
618 %if %{mysql} && %{x86_64}
619 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
621 %if %{python} && %{x86_64}
622 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
625 export BACULA="Bacula"
627 # Main Bacula configuration
629 --prefix=%{_prefix} \
630 --sbindir=%{_sbindir} \
631 --sysconfdir=%{sysconf_dir} \
632 --mandir=%{_mandir} \
633 --with-scriptdir=%{script_dir} \
634 --with-working-dir=%{working_dir} \
635 --with-plugindir=%{plugin_dir} \
636 --with-logdir=%{log_dir} \
637 --with-pid-dir=%{pid_dir} \
638 --with-subsys-dir=%{_subsysdir} \
639 --enable-smartalloc \
640 --disable-bwx-console \
641 --disable-tray-monitor \
648 --with-sqlite3=${cwd}/%{depkgs}/sqlite3 \
658 --enable-client-only \
660 %if %{rh7} || %{rh8} || %{rh9}
661 --disable-batch-insert \
663 --with-tcp-wrappers \
664 --with-dir-user=%{director_daemon_user} \
665 --with-dir-group=%{daemon_group} \
666 --with-sd-user=%{storage_daemon_user} \
667 --with-sd-group=%{storage_daemon_group} \
668 --with-fd-user=%{file_daemon_user} \
669 --with-fd-group=%{daemon_group} \
670 --with-basename="XXX_HOSTNAME_XXX" \
671 --with-hostname="XXX_HOSTNAME_XXX" \
672 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
673 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
674 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
675 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
676 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
677 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
685 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
686 mkdir -p $RPM_BUILD_ROOT/etc/init.d
687 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
688 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles
689 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/services
690 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services
691 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared
692 mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
694 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
695 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
698 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
701 make DESTDIR=$RPM_BUILD_ROOT install
703 # Remove docs for programs that are depreciated
704 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
705 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
706 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
707 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
709 # Storage-ctl packaged in shstore rpm
710 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
711 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
713 # Remove libtool unneeded file
714 rm -f $RPM_BUILD_ROOT%{_libdir}/libbacsd.la
716 # fixme - make installs the mysql scripts for sqlite build
718 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
719 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
720 rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
723 # fixme - make installs the mysql scripts for postgresql build
725 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
726 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
729 # install the init scripts
731 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
732 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
733 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
736 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
737 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
738 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
740 %if ! %{suse} && ! %{mdk}
741 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
742 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
743 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
745 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
747 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
748 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
753 cp -p %{depkgs}/sqlite3/sqlite3 $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3
754 cp -p %{depkgs}/sqlite3/sqlite3.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3.h
755 cp -p %{depkgs}/sqlite3/libsqlite3.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite3.a
759 # install the logrotate file
760 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
762 # install the updatedb scripts
763 cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
765 # install specific scripts
768 # install the sample-query.sql file
769 cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
771 # install the logwatch scripts
772 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
773 cp -p scripts/logwatch/applybaculadate $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
774 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
775 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
776 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
777 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
778 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
779 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
782 # now clean up permissions that are left broken by the install
783 chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
785 # fix me - building enable-client-only installs files not included in bacula-client package
787 # Program docs not installed on client
788 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-dir.8.%{manpage_ext}
789 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-sd.8.%{manpage_ext}
790 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bcopy.8.%{manpage_ext}
791 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bextract.8.%{manpage_ext}
792 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
793 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
794 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
795 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
796 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bregex.8.%{manpage_ext}
797 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bwild.8.%{manpage_ext}
798 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
800 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
801 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
802 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
803 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
804 rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
805 rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
806 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
807 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
808 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
809 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
810 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
811 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
812 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
816 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
818 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-1.txt
820 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
825 # MySQL specific files
827 %defattr(-, root, root)
828 %attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
829 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
830 %attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
831 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
832 %attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
833 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
834 %{_libdir}/libbaccats*
835 %{_libdir}/libbacsql*
836 %{_libdir}/libbacsd*.so
841 %defattr(-,root,root)
842 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
843 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
844 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
845 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
846 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
847 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
848 %{sqlite_bindir}/libsqlite3.a
849 %{sqlite_bindir}/sqlite3.h
850 %{sqlite_bindir}/sqlite3
851 %{_libdir}/libbaccats*
852 %{_libdir}/libbacsql*
853 %{_libdir}/libbacsd*.so
860 %defattr(-,root,root)
861 %attr(755, root, %{daemon_group}) %{script_dir}/create_postgresql_database
862 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
863 %attr(755, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
864 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
865 %attr(755, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
866 %attr(755, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
867 %{_libdir}/libbaccats*
868 %{_libdir}/libbacsql*
869 %{_libdir}/libbacsd*.so
872 # The rest is DB backend independent
875 %attr(-, root, %{daemon_group}) %dir %{script_dir}
876 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
877 #%attr(-, %{director_daemon_user}, %{daemon_group}) %dir %{log_dir}
878 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
879 %attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
880 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
881 %attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
882 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_database
883 %attr(755, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
884 %attr(755, root, %{daemon_group}) %{script_dir}/make_bacula_tables
885 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
886 %attr(755, root, %{daemon_group}) %{script_dir}/update_bacula_tables
887 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
888 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup.pl
889 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
890 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
891 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
892 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
893 %attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
894 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
895 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
896 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
897 %attr(-, root, %{daemon_group}) %{script_dir}/tapealert
898 %attr(-, root, %{daemon_group}) %{script_dir}/baculabackupreport
899 %attr(-, root, %{daemon_group}) %{script_dir}/query.sql
901 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
903 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
904 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
906 %attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
907 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
908 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
909 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{script_dir}/mtx-changer.conf
911 /etc/logrotate.d/bacula
912 %{logwatch_dir}/scripts/services/bacula
913 %{logwatch_dir}/scripts/shared/applybaculadate
914 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
915 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
916 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
917 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
918 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
919 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
920 %attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
922 # Bacula tray-monitor shortcut
923 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-tray-monitor.desktop
925 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
927 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-dir
928 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-sd
929 %attr(-, root, %{daemon_group}) %{_sbindir}/btraceback
930 %attr(-, root, %{daemon_group}) %{_sbindir}/bconsole
931 %attr(-, root, %{daemon_group}) %{_sbindir}/bsmtp
932 %attr(-, root, %{daemon_group}) %{_sbindir}/bscan
933 %attr(-, root, %{daemon_group}) %{_sbindir}/btape
934 %attr(-, root, %{daemon_group}) %{_sbindir}/bbconsjson
935 %attr(-, root, %{daemon_group}) %{_sbindir}/bdirjson
936 %attr(-, root, %{daemon_group}) %{_sbindir}/bsdjson
938 %attr(755, root, %{daemon_group}) %{_sbindir}/bfdjson
940 %{_sbindir}/bacula-fd
947 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
948 %{_mandir}/man8/bacula-dir.8.%{manpage_ext}
949 %{_mandir}/man8/bacula-sd.8.%{manpage_ext}
950 %{_mandir}/man8/bacula.8.%{manpage_ext}
951 %{_mandir}/man8/bconsole.8.%{manpage_ext}
952 %{_mandir}/man8/bcopy.8.%{manpage_ext}
953 %{_mandir}/man8/bextract.8.%{manpage_ext}
954 %{_mandir}/man8/bls.8.%{manpage_ext}
955 %{_mandir}/man8/bscan.8.%{manpage_ext}
956 %{_mandir}/man8/btape.8.%{manpage_ext}
957 %{_mandir}/man8/btraceback.8.%{manpage_ext}
958 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
959 %{_mandir}/man8/bregex.8.%{manpage_ext}
960 %{_mandir}/man8/bwild.8.%{manpage_ext}
961 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
962 %{_mandir}/man1/bat.1.%{manpage_ext}
965 # opensuse build service changes the release itself
967 %doc ../Release_Notes-%{version}-1.txt
969 %doc ../Release_Notes-%{version}-%{release}.txt
975 # test for bacula database older than version 13
976 # note: this ASSUMES no password has been set for bacula database
977 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
982 # are we upgrading from sqlite to sqlite3?
983 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
984 echo "This version of bacula-sqlite involves an upgrade to sqlite3."
985 echo "Your catalog database file is not compatible with sqlite3, thus"
986 echo "you will need to dump the data, delete the old file, and re-run"
987 echo "this rpm upgrade."
989 echo "Backing up your current database..."
990 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db > %{working_dir}/bacula_backup.sql
991 mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
992 echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
993 echo "catalog file has been renamed %{working_dir}/bacula.db.old."
995 echo "Please re-run this rpm package upgrade."
996 echo "After the upgrade is complete, restore your catalog"
997 echo "with the following commands:"
998 echo "%{script_dir}/drop_sqlite3_tables"
999 echo "cd %{working_dir}"
1000 echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
1001 echo "chown bacula.bacula bacula.db"
1004 # test for bacula database older than version 12 and sqlite3
1005 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
1006 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1011 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1014 %if ! %{client_only}
1015 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "12" ]; then
1016 echo "This bacula upgrade will update a bacula database from version 12 to 1014."
1017 echo "You appear to be running database version $DB_VER. You must first update"
1018 echo "your database to version 12 and then install this upgrade. The alternative"
1019 echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
1020 echo "catalog information, then do the upgrade. Information on updating a"
1021 echo "database older than version 12 can be found in the release notes."
1030 %if ! %{client_only}
1031 # check for and copy %{sysconf_dir}/console.conf to bconsole.conf
1032 if [ -s %{sysconf_dir}/console.conf ];then
1033 cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
1036 # create the daemon users and groups
1037 # first create the groups if they don't exist
1038 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1039 if [ -z "$HAVE_BACULA" ]; then
1040 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1041 echo "The group %{daemon_group} has been added to %{group_file}."
1042 echo "See the manual chapter \"Running Bacula\" for details."
1044 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
1045 if [ -z "$HAVE_BACULA" ]; then
1046 %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
1047 echo "The group %{storage_daemon_group} has been added to %{group_file}."
1048 echo "See the manual chapter \"Running Bacula\" for details."
1050 # now create the users if they do not exist
1051 # we do not use the -g option allowing the primary group to be set to system default
1052 # this will be a unique group on redhat type systems or the group users on some systems
1053 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
1054 if [ -z "$HAVE_BACULA" ]; then
1055 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
1056 echo "The user %{storage_daemon_user} has been added to %{user_file}."
1057 echo "See the manual chapter \"Running Bacula\" for details."
1059 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
1060 if [ -z "$HAVE_BACULA" ]; then
1061 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
1062 echo "The user %{director_daemon_user} has been added to %{user_file}."
1063 echo "See the manual chapter \"Running Bacula\" for details."
1065 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1066 if [ -z "$HAVE_BACULA" ]; then
1067 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1068 echo "The user %{file_daemon_user} has been added to %{user_file}."
1069 echo "See the manual chapter \"Running Bacula\" for details."
1071 # now we add the supplementary groups, this is ok to call even if the users already exist
1072 # we only do this if the user is NOT root
1073 IS_ROOT=%{director_daemon_user}
1074 if [ "$IS_ROOT" != "root" ]; then
1075 %{usermod} -G %{daemon_group} %{director_daemon_user}
1077 IS_ROOT=%{storage_daemon_user}
1078 if [ "$IS_ROOT" != "root" ]; then
1079 %{usermod} -G %{daemon_group},%{storage_daemon_group} %{storage_daemon_user}
1081 IS_ROOT=%{file_daemon_user}
1082 if [ "$IS_ROOT" != "root" ]; then
1083 %{usermod} -G %{daemon_group} %{file_daemon_user}
1096 %if ! %{client_only}
1098 if [ "$1" -ge 1 ] ; then
1099 %if %{suse} && %{mysql}
1100 /sbin/chkconfig --add mysql
1102 %if %{suse} && %{postgresql}
1103 /sbin/chkconfig --add postgresql
1105 /sbin/chkconfig --add bacula-dir
1106 /sbin/chkconfig --add bacula-fd
1107 /sbin/chkconfig --add bacula-sd
1111 if [ -d %{sysconf_dir} ]; then
1113 if [ ! -f .rpm.sed ]; then
1115 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1116 echo "# match between configuration files" >> .rpm.sed
1118 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
1119 pass=`openssl rand -base64 33`
1120 echo "s@${string}@${pass}@g" >> .rpm.sed
1124 for file in *.conf; do
1125 sed -f .rpm.sed $file > $file.new
1126 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1134 #check, if mysql can be called successfully at all
1135 if mysql 2>/dev/null bacula -e 'select * from Version;' ; then
1137 # test for an existing database
1138 # note: this ASSUMES no password has been set for bacula database
1139 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1141 # grant privileges and create tables if they do not exist
1142 if [ -z "$DB_VER" ]; then
1143 echo "Hmm, it doesn't look like you have an existing database."
1144 echo "Granting privileges for MySQL user bacula..."
1145 %{script_dir}/grant_mysql_privileges
1146 echo "Creating MySQL bacula database..."
1147 %{script_dir}/create_mysql_database
1148 echo "Creating bacula tables..."
1149 %{script_dir}/make_mysql_tables
1151 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1152 echo "This release requires an upgrade to your bacula database."
1153 echo "Backing up your current database..."
1154 mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1155 echo "Upgrading bacula database ..."
1156 %{script_dir}/update_mysql_tables
1157 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1164 # test for an existing database
1165 if [ -s %{working_dir}/bacula.db ]; then
1166 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1167 # check to see if we need to upgrade a 3.x database
1168 if [ "$DB_VER" -le "13" ] && [ "$DB_VER" -ge "12" ]; then
1169 echo "This release requires an upgrade to your bacula database."
1170 echo "Backing up your current database..."
1171 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1172 echo "Upgrading bacula database ..."
1173 %{script_dir}/update_sqlite3_tables
1174 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1177 # create the database and tables
1178 echo "Hmm, doesn't look like you have an existing database."
1179 echo "Creating SQLite database..."
1180 %{script_dir}/create_sqlite3_database
1181 echo "Creating the SQLite tables..."
1182 %{script_dir}/make_sqlite3_tables
1183 chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
1188 # check if psql can be called successfully at all
1189 if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; then
1191 # test for an existing database
1192 # note: this ASSUMES no password has been set for bacula database
1193 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1195 # grant privileges and create tables if they do not exist
1196 if [ -z "$DB_VER" ]; then
1197 echo "Hmm, doesn't look like you have an existing database."
1198 echo "Creating PostgreSQL bacula database..."
1199 su - postgres -c %{script_dir}/create_postgresql_database
1200 echo "Creating bacula tables..."
1201 su - postgres -c %{script_dir}/make_postgresql_tables
1202 echo "Granting privileges for PostgreSQL user bacula..."
1203 su - postgres -c %{script_dir}/grant_postgresql_privileges
1205 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1206 echo "This release requires an upgrade to your bacula database."
1207 echo "Backing up your current database..."
1208 su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1209 echo "Upgrading bacula database ..."
1210 su - postgres -c %{script_dir}/update_postgresql_tables
1211 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1212 echo "Granting privileges for PostgreSQL user bacula..."
1213 su - postgres -c %{script_dir}/grant_postgresql_privileges
1219 %if ! %{client_only}
1220 if [ -d %{sysconf_dir} ]; then
1222 if [ ! -f .rpm.sed ]; then
1224 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1225 echo "# match between configuration files" >> .rpm.sed
1227 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
1228 pass=`openssl rand -base64 33`
1229 echo "s@${string}@${pass}@g" >> .rpm.sed
1233 for file in *.conf; do
1234 sed -f .rpm.sed $file > $file.new
1235 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1252 %if ! %{client_only}
1255 /sbin/chkconfig --del bacula-dir
1256 /sbin/chkconfig --del bacula-fd
1257 /sbin/chkconfig --del bacula-sd
1262 %defattr(-,root,root)
1263 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1264 %attr(-, root, %{daemon_group}) %dir %{plugin_dir}
1265 #%attr(-, root, %{daemon_group}) %dir %{log_dir}
1266 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
1267 %{script_dir}/bacula-ctl-fd
1268 /etc/init.d/bacula-fd
1270 /etc/logrotate.d/bacula
1272 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1273 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1274 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1276 %{_sbindir}/bacula-fd
1277 %{_sbindir}/btraceback
1278 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1279 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1280 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
1281 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
1282 %{_sbindir}/bconsole
1283 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1284 %{_mandir}/man8/bacula.8.%{manpage_ext}
1285 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1286 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1287 %{_mandir}/man1/bat.1.%{manpage_ext}
1288 %_prefix/share/doc/*
1291 # create the daemon group and user
1292 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1293 if [ -z "$HAVE_BACULA" ]; then
1294 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1295 echo "The group %{daemon_group} has been added to %{group_file}."
1296 echo "See the manual chapter \"Running Bacula\" for details."
1298 # we do not use the -g option allowing the primary group to be set to system default
1299 # this will be a unique group on redhat type systems or the group users on some systems
1300 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1301 if [ -z "$HAVE_BACULA" ]; then
1302 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1303 echo "The user %{file_daemon_user} has been added to %{user_file}."
1304 echo "See the manual chapter \"Running Bacula\" for details."
1306 # now we add the supplementary group, this is ok to call even if the user already exists
1307 # we only do this if the user is NOT root
1308 IS_ROOT=%{file_daemon_user}
1309 if [ "$IS_ROOT" != "root" ]; then
1310 %{usermod} -G %{daemon_group} %{file_daemon_user}
1315 if [ "$1" -ge 1 ] ; then
1316 /sbin/chkconfig --add bacula-fd
1319 if [ -d %{sysconf_dir} ]; then
1321 if [ ! -f .rpm.sed ]; then
1323 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1324 echo "# match between configuration files" >> .rpm.sed
1326 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
1327 pass=`openssl rand -base64 33`
1328 echo "s@${string}@${pass}@g" >> .rpm.sed
1332 for file in *.conf; do
1333 sed -f .rpm.sed $file > $file.new
1334 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1342 /sbin/chkconfig --del bacula-fd
1346 %defattr(-,root,root)
1349 %{_libdir}/libbaccfg*
1350 %{_libdir}/libbacfind*
1360 %if ! %{client_only}
1362 %defattr(-,root,%{daemon_group})
1363 %{script_dir}/updatedb/*
1364 #oensuse_bs: directories not owned by any package
1365 #%{script_dir}/updatedb
1368 # create the daemon group
1369 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1370 if [ -z "$HAVE_BACULA" ]; then
1371 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1372 echo "The group %{daemon_group} has been added to %{group_file}."
1373 echo "See the manual chapter \"Running Bacula\" for details."
1377 echo "The database update scripts were installed to %{script_dir}/updatedb"
1381 * Thu Mar 27 2014 Kern Sibbald <kern@sibbald.com> 7.0.0-1
1382 - New rpm spec file for Suse