4 # Platform Build Configuration
6 # basic defines for every build
7 %define _release @RELEASE@
8 %define _version @VERSION@
10 %define _packager Kern Sibbald <kern@sibbald.com>
11 %define depkgs_version @DEPKGS_VERSION@
13 # Don't strip binaries
14 %define __os_install_post %{nil}
15 %define __debug_install_post %{nil}
16 %define debug_package %{nil}
18 %define postgres_version 8
20 %{?build_rhel5:%define pgre84 1}
21 %{?build_el5:%define pgre84 1}
23 %define postgres_package postgresql84
24 %define postgres_server_package postgresql84-server
25 %define postgres_devel_package postgresql84-devel
27 %define postgres_package postgresql
28 %define postgres_server_package postgresql-server
29 %define postgres_devel_package postgresql-devel
33 %{?single_dir_install:%define single_dir 1}
35 # Installation Directory locations
36 %define _prefix /opt/bacula
37 %define _sbindir /opt/bacula/bin
38 %define _bindir /opt/bacula/bin
39 %define _subsysdir /opt/bacula/working
40 %define sqlite_bindir /opt/bacula/sqlite
41 %define _mandir /usr/share/man
42 %define docs_dir /opt/bacula/docs
43 %define archive_dir /opt/bacula/archive
44 %define sysconf_dir /opt/bacula/etc
45 %define script_dir /opt/bacula/scripts
46 %define working_dir /opt/bacula/working
47 %define pid_dir /opt/bacula/working
48 %define plugin_dir /opt/bacula/plugins
49 %define lib_dir /opt/bacula/lib
50 %define log_dir /opt/bacula/log
51 %define systemd_dir /lib/systemd/system
53 # Daemon user:group Don't change them unless you know what you are doing
54 %define director_daemon_user bacula
55 %define storage_daemon_user bacula
56 %define file_daemon_user root
57 %define daemon_group bacula
58 # group that has write access to tape devices, usually disk on Linux
59 %define storage_daemon_group disk
61 %define depkgs ../depkgs
63 # problems with mandriva build:
64 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
66 #--------------------------------------------------------------------------
67 # it should not be necessary to change anything below here for a release
68 # except for patch macros in the setup section
69 #--------------------------------------------------------------------------
71 %define base_package_name %{product}
73 %{?contrib_packager:%define _packager %{contrib_packager}}
75 Summary: Bacula - The Network Backup Solution
76 Name: %{base_package_name}
79 Group: System Environment/Daemons
81 BuildRoot: %{_tmppath}/%{name}-root
82 URL: http://www.bacula.org/
83 Vendor: The Bacula Team
84 Packager: %{_packager}
87 # opensuse build service changes the release itself
88 # what happens if the release is not 1? DSB
89 Source0: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
90 Source1: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
92 Source2: Release_Notes-%{version}-1.tar.gz
94 Source2: Release_Notes-%{version}-%{release}.tar.gz
97 # define the basic package description
98 %define blurb Bacula - The Leading Open Source Backup Solution.
99 %define blurb2 Bacula is a set of computer programs that permit you (or the system
100 %define blurb3 administrator) to manage backup, recovery, and verification of computer
101 %define blurb4 data across a network of computers of different kinds. In technical terms,
102 %define blurb5 it is a network client/server based backup program. Bacula is relatively
103 %define blurb6 easy to use and efficient, while offering many advanced storage management
104 %define blurb7 features that make it easy to find and recover lost or damaged files.
105 %define blurb8 Bacula source code has been released under the AGPL version 3 license.
107 %define user_file /etc/passwd
108 %define group_file /etc/group
111 %define useradd /usr/sbin/useradd
112 %define groupadd /usr/sbin/groupadd
113 %define usermod /usr/sbin/usermod
115 # platform defines - set one below or define the build_xxx on the command line
118 %{?build_rh7:%define rh7 1}
120 %{?build_rh8:%define rh8 1}
122 %{?build_rh9:%define rh9 1}
125 %{?build_fc16:%define fc16 1}
127 %{?build_fc17:%define fc17 1}
129 %{?build_fc18:%define fc18 1}
131 %{?build_fc22:%define fc22 1}
132 # Whitebox Enterprise build
134 %{?build_wb3:%define wb3 1}
135 # RedHat Enterprise builds
137 %{?build_rhel3:%define rhel3 1}
138 %{?build_rhel3:%define wb3 1}
140 %{?build_rhel4:%define rhel4 1}
141 %{?build_rhel4:%define fc3 1}
142 %{?build_el4:%define rhel4 1}
143 %{?build_el4:%define fc3 1}
145 %{?build_rhel5:%define rhel5 1}
146 %{?build_rhel5:%define fc6 1}
147 %{?build_el5:%define rhel5 1}
148 %{?build_el5:%define fc6 1}
150 %{?build_rhel6:%define rhel6 1}
151 %{?build_el6:%define rhel6 1}
153 %{?build_rhel7:%define rhel7 1}
154 %{?build_el7:%define rhel7 1}
157 %{?build_centos3:%define centos3 1}
158 %{?build_centos3:%define wb3 1}
160 %{?build_centos4:%define centos4 1}
161 %{?build_centos4:%define fc3 1}
163 %{?build_centos5:%define centos5 1}
164 %{?build_centos5:%define fc6 1}
166 %{?build_centos6:%define centos6 1}
168 %{?build_centos7:%define centos7 1}
171 %{?build_sl3:%define sl3 1}
172 %{?build_sl3:%define wb3 1}
174 %{?build_sl4:%define sl4 1}
175 %{?build_sl4:%define fc3 1}
177 %{?build_sl5:%define sl5 1}
178 %{?build_sl5:%define fc6 1}
181 %{?build_su9:%define su9 1}
183 %{?build_su10:%define su10 1}
185 %{?build_su102:%define su102 1}
187 %{?build_su103:%define su103 1}
189 %{?build_su110:%define su110 1}
191 %{?build_su111:%define su111 1}
193 %{?build_su112:%define su112 1}
195 %{?build_su113:%define su113 1}
197 %{?build_su120:%define su120 1}
199 %{?build_su131:%define su131 1}
202 %{?build_mdk:%define mdk 1}
204 %{?build_mdv:%define mdv 1}
205 %{?build_mdv:%define mdk 1}
208 %define client_only 0
209 %{?build_client_only:%define client_only 1}
211 # if the platform is using systemd
214 %if %{rhel7} || %{fc22}
218 # depending if we use systemd or not, we use chkconfig or systemctl
220 %define service_enable systemctl enable
221 %define service_disable systemctl disable
223 %define service_enable /sbin/chkconfig --add
224 %define service_disable /sbin/chkconfig --del
227 # Setup some short cuts
229 %if %{rh7} || %{rh8} || %{rh9}
233 %if %{fc16} || %{fc17} || %{fc18} || %{fc22}
237 %if %{su9} || %{su10} || %{su102} || %{su103} || %{su110} || %{su111} || %{su112} || %{su120} || %{su131}
241 %if %{rhel3} || %{rhel4} || %{rhel5} || %{rhel6} || %{rhel7} || %{centos3} || %{centos4} || %{centos5} || %{centos6} || %{centos7}
245 %if %{sl3} || %{sl4} || %{sl5}
250 # test for a platform definition
251 %if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk} && !%{scil}
252 %{error: You must specify a platform. Please examine the spec file.}
256 # distribution-specific directory for logwatch
257 %if %{wb3} || %{rh7} || %{rh8} || %{rh9}
258 %define logwatch_dir /etc/log.d
260 %define logwatch_dir /etc/logwatch
264 # set for database support desired or define the build_xxx on the command line
266 %{?build_mysql:%define mysql 1}
268 %{?build_sqlite:%define sqlite 1}
270 %{?build_postgresql:%define postgresql 1}
272 # test for a database definition
273 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
274 %{error: You must specify database support, by passing one of the following to rpmbuild:}
275 %{error: --define build_postgresql=1}
276 %{error: --define build_sqlite=1}
277 %{error: --define build_mysql=1}
282 %define db_backend mysql
285 %define db_backend sqlite3
288 %define db_backend postgresql
293 %{?build_x86_64:%define x86_64 1}
295 # check what distribution we are
296 %if %{fc16} || %{fc17} || %{fc18} || %{fc22}
297 %define _dist %(grep Fedora /etc/redhat-release)
299 %if %{centos7} || %{centos6}
300 %define _dist %(grep CentOS /etc/redhat-release)
302 %if %{centos5} || %{centos4} || %{centos3}
303 %define _dist %(grep CentOS /etc/redhat-release)
305 %if %{sl5} ||%{sl4} || %{sl3}
306 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
308 %if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
309 %define _dist %(grep White /etc/whitebox-release)
312 %define _dist %(grep -i SuSE /etc/SuSE-release)
315 %define _dist %(grep Mand /etc/mandrake-release)
320 %if 0%{?opensuse_bs} && %{mysql} && %{suse}
321 # needed in opensuse_bs, as rpm is installed during build process
322 BuildRequires: libmysqlclient-devel
323 BuildRequires: mysql-client
326 %if 0%{?opensuse_bs} && %{suse} && %{postgresql}
327 BuildRequires: %{postgres_package}
328 BuildRequires: %{postgres_server_package}
330 BuildRequires: openssl
332 %if 0%{?opensuse_bs} && %{suse}
333 BuildRequires: pwdutils
334 BuildRequires: sysconfig
337 # should we turn on python support
339 %{?build_python:%define python 0}
341 # should we enable tcp wrappers support
342 %define tcpwrappers 1
343 %{?build_tcpwrappers:%define tcpwrappers 1}
345 # do we need to patch for old postgresql version?
347 %{?build_old_pgsql:%define old_pgsql 1}
349 # Mandriva somehow forces the manpage file extension to bz2 rather than gz
351 %define manpage_ext bz2
353 %define manpage_ext gz
356 # for client only build
363 BuildRequires: gcc, gcc-c++, make, autoconf
364 BuildRequires: glibc, glibc-devel
365 BuildRequires: ncurses-devel, readline-devel
366 BuildRequires: libstdc++-devel, zlib-devel
367 BuildRequires: openssl-devel
368 BuildRequires: libacl-devel
369 BuildRequires: pkgconfig
370 BuildRequires: bzip2-devel
372 BuildRequires: libxml2-devel
375 BuildRequires: python, python-devel
376 %{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
380 BuildRequires: libxml-devel
383 BuildRequires: libstdc++-static-devel
384 BuildRequires: glibc-static-devel
387 %if %{mysql} && ! %{suse}
388 BuildRequires: mysql-devel
391 %if %{postgresql} && %{wb3}
392 BuildRequires: rh-postgresql-devel >= %{postgres_version}
395 %if %{postgresql} && ! %{wb3}
396 BuildRequires: %{postgres_devel_package} >= %{postgres_version}
420 Summary: Bacula - The Network Backup Solution
421 Group: System Environment/Daemons
422 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
423 Conflicts: bacula-client
425 Requires: ncurses, libstdc++, zlib, openssl
426 Requires: glibc, readline, %{name}-libs
436 %if %{postgresql} && %{wb3}
437 Requires: rh-postgresql >= 7
439 %if %{postgresql} && ! %{wb3}
440 Requires: postgresql >= 7
450 %description postgresql
454 Requires: python >= %{pyver}
468 This build requires MySQL to be installed separately as the catalog database.
471 This build requires PostgreSQL to be installed separately as the catalog database.
474 This build incorporates sqlite3 as the catalog database, statically compiled.
477 This build includes python scripting support.
480 This build includes tcp-wrappers support.
484 Summary: Bacula - The Network Backup Solution
485 Group: System Environment/Daemons
487 Conflicts: bacula-mysql
488 Conflicts: bacula-sqlite
489 Conflicts: bacula-postgresql
493 Provides: %{product}-libs
496 Requires: libstdc++, zlib, openssl, bzip2-libs
497 Requires: glibc, readline, %{name}-libs
500 Requires: python >= %{pyver}
514 This is the File daemon (Client) only package. It includes the command line
517 This build includes python scripting support.
520 This build includes tcp-wrappers support.
526 Summary: Bacula - The Network Backup Solution
527 Group: System Environment/Daemons
529 %description updatedb
540 This package installs scripts for updating older versions of the bacula
546 Summary: Bacula - The Network Backup Solution
547 Group: System Environment/Daemons
560 This package installs the shared libraries used by many bacula programs.
562 # Must explicitly enable debug pkg on SuSE
563 # but not in opensuse_bs
564 #%if %{suse} && ! 0%{?opensuse_bs}
569 %setup -T -b 0 -n depkgs
570 %setup -T -b 1 -n %{product}-%{version}
571 %setup -T -D -b 2 -n %{product}-%{version}
578 #export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
581 # You can use a cache for depkgs
582 # tar xfz depkgs*gz -C ~/
584 # touch %{depkgs_version} # depkgs version
586 if [ -f $HOME/depkgs/%{depkgs_version} ]; then
588 ln -s $HOME/depkgs %{depkgs}
600 export LDFLAGS="${LDFLAGS} -L${PWD}/lzo/lib"
601 export CPPFLAGS="${CPPFLAGS} -I${PWD}/lzo/include"
604 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
605 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
608 # patches for the bundled sqlite scripts
609 sed -i s:.SQLITE_BINDIR.:/opt/bacula/sqlite: src/cats/*_sqlite3_*.in
611 # patch the bacula-dir init script to remove sqlite service
613 sed -i 's/network .DB_TYPE./network/' platforms/suse/bacula-dir.in
617 # 64 bit lib location hacks
618 # as of 1.39.18 it should not be necessary to enable x86_64 as configure is
619 # reported to be fixed to properly detect lib locations.
621 export LDFLAGS="${LDFLAGS} -L/usr/lib64"
623 %if %{mysql} && %{x86_64}
624 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
626 %if %{python} && %{x86_64}
627 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
630 export BACULA="Bacula"
632 # Main Bacula configuration
634 --prefix=%{_prefix} \
635 --sbindir=%{_sbindir} \
636 --sysconfdir=%{sysconf_dir} \
637 --mandir=%{_mandir} \
638 --with-scriptdir=%{script_dir} \
639 --with-working-dir=%{working_dir} \
640 --with-plugindir=%{plugin_dir} \
641 --with-logdir=%{log_dir} \
642 --with-pid-dir=%{pid_dir} \
643 --with-subsys-dir=%{_subsysdir} \
644 --enable-smartalloc \
651 --with-sqlite3=${cwd}/%{depkgs}/sqlite3 \
661 --enable-client-only \
663 %if %{rh7} || %{rh8} || %{rh9}
664 --disable-batch-insert \
667 --with-systemd=%{systemd_dir} \
669 --with-tcp-wrappers \
670 --with-dir-user=%{director_daemon_user} \
671 --with-dir-group=%{daemon_group} \
672 --with-sd-user=%{storage_daemon_user} \
673 --with-sd-group=%{storage_daemon_group} \
674 --with-fd-user=%{file_daemon_user} \
675 --with-fd-group=%{daemon_group} \
676 --with-basename="XXX_HOSTNAME_XXX" \
677 --with-hostname="XXX_HOSTNAME_XXX" \
678 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
679 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
680 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
681 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
682 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
683 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
691 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
692 mkdir -p $RPM_BUILD_ROOT/etc/init.d
693 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
694 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles
695 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/services
696 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services
697 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared
698 mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
700 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
701 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
704 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
707 make DESTDIR=$RPM_BUILD_ROOT install
710 make DESTDIR=$RPM_BUILD_ROOT -C ../bacula-%{_version}/src/tools/ install-bsnapshot
713 make DESTDIR=$RPM_BUILD_ROOT -C platforms/systemd install-dir install-service
716 # Remove docs for programs that are depreciated
717 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
718 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
719 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
720 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
722 # Remove docs for programs only included in bee
723 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bpluginfo.8.%{manpage_ext}
725 # Storage-ctl packaged in shstore rpm
726 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
727 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
729 # fixme - make installs the mysql scripts for sqlite build
731 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
732 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
733 rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
736 # fixme - make installs the mysql scripts for postgresql build
738 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
739 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
742 # install the init scripts
745 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
746 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
747 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
750 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
751 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
752 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
754 %if ! %{suse} && ! %{mdk}
755 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
756 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
757 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
758 %endif # !suse && !mdk
759 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
760 %endif # ! usesystemd
763 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
764 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
765 rm -f $RPM_BUILD_ROOT%{script_dir}/breload
766 rm -f $RPM_BUILD_ROOT%{script_dir}/manual_prune.pl
767 rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-dir.service
768 rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-sd.service
773 cp -p %{depkgs}/sqlite3/sqlite3 $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3
774 cp -p %{depkgs}/sqlite3/sqlite3.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3.h
775 cp -p %{depkgs}/sqlite3/libsqlite3.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite3.a
779 # install the logrotate file
780 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
782 # install the updatedb scripts
783 cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
785 # install specific scripts
787 # install special upgrade script, except for sqlite3
792 # install the sample-query.sql file
793 cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
795 # install the logwatch scripts
796 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
797 cp -p scripts/logwatch/applybaculadate $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
798 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
799 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
800 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
801 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
802 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
803 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
806 # now clean up permissions that are left broken by the install
807 chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
809 # fix me - building enable-client-only installs files not included in bacula-client package
811 # Program docs not installed on client
812 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-dir.8.%{manpage_ext}
813 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-sd.8.%{manpage_ext}
814 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bcopy.8.%{manpage_ext}
815 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bextract.8.%{manpage_ext}
816 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
817 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
818 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
819 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
820 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bregex.8.%{manpage_ext}
821 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bwild.8.%{manpage_ext}
822 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
823 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
824 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
825 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
826 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
827 rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
828 rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
829 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
830 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
831 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
832 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
833 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
834 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
835 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
840 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
842 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-1.txt
844 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
849 # MySQL specific files
851 %defattr(-, root, root)
852 %attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
853 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
854 %attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
855 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
856 %attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
857 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
858 %{_libdir}/libbaccats*
859 %{_libdir}/libbacsql*
864 %defattr(-,root,root)
865 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
866 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
867 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
868 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
869 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
870 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
871 %{sqlite_bindir}/libsqlite3.a
872 %{sqlite_bindir}/sqlite3.h
873 %{sqlite_bindir}/sqlite3
874 %{_libdir}/libbaccats*
875 %{_libdir}/libbacsql*
882 %defattr(-,root,root)
883 %attr(755, root, %{daemon_group}) %{script_dir}/create_postgresql_database
884 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
885 %attr(755, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
886 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
887 %attr(755, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
888 %attr(755, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
889 %{_libdir}/libbaccats*
890 %{_libdir}/libbacsql*
893 # The rest is DB backend independent
896 %attr(-, root, %{daemon_group}) %dir %{script_dir}
897 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
898 #%attr(-, %{director_daemon_user}, %{daemon_group}) %dir %{log_dir}
899 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
900 %attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
901 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
902 %attr(755, root, %{daemon_group}) %{script_dir}/create_bacula_database
903 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_database
904 %attr(755, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
905 %attr(755, root, %{daemon_group}) %{script_dir}/make_bacula_tables
906 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
907 %attr(755, root, %{daemon_group}) %{script_dir}/update_bacula_tables
908 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
909 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup.pl
910 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
911 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
912 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
913 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
914 %attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
915 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
916 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
917 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
918 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
919 #%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
920 #%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
921 %attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
922 %attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
923 #%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
924 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
925 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{script_dir}/mtx-changer.conf
928 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-dir.service
929 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-fd.service
930 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-sd.service
932 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
933 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
934 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
937 /etc/logrotate.d/bacula
938 %{logwatch_dir}/scripts/services/bacula
939 %{logwatch_dir}/scripts/shared/applybaculadate
940 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
941 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
942 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
943 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
944 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
945 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
946 %attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
948 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
950 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-dir
951 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-sd
952 %attr(-, root, %{daemon_group}) %{_sbindir}/btraceback
953 %attr(-, root, %{daemon_group}) %{_sbindir}/bconsole
954 %attr(-, root, %{daemon_group}) %{_sbindir}/bsmtp
955 %attr(-, root, %{daemon_group}) %{_sbindir}/bscan
956 %attr(-, root, %{daemon_group}) %{_sbindir}/btape
958 %attr(755, root, root) %{_sbindir}/bsnapshot
960 %{_sbindir}/bacula-fd
967 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
968 %{_mandir}/man8/bacula-dir.8.%{manpage_ext}
969 %{_mandir}/man8/bacula-sd.8.%{manpage_ext}
970 %{_mandir}/man8/bacula.8.%{manpage_ext}
971 %{_mandir}/man8/bconsole.8.%{manpage_ext}
972 %{_mandir}/man8/bcopy.8.%{manpage_ext}
973 %{_mandir}/man8/bextract.8.%{manpage_ext}
974 %{_mandir}/man8/bls.8.%{manpage_ext}
975 %{_mandir}/man8/bscan.8.%{manpage_ext}
976 %{_mandir}/man8/btape.8.%{manpage_ext}
977 %{_mandir}/man8/btraceback.8.%{manpage_ext}
978 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
979 %{_mandir}/man8/bregex.8.%{manpage_ext}
980 %{_mandir}/man8/bwild.8.%{manpage_ext}
981 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
982 %{_mandir}/man1/bat.1.%{manpage_ext}
986 # opensuse build service changes the release itself
988 %doc ../Release_Notes-%{version}-1.txt
990 %doc ../Release_Notes-%{version}-%{release}.txt
996 # test for bacula database older than version 13
997 # note: this ASSUMES no password has been set for bacula database
998 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1003 # are we upgrading from sqlite to sqlite3?
1004 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
1005 echo "This version of bacula-sqlite involves an upgrade to sqlite3."
1006 echo "Your catalog database file is not compatible with sqlite3, thus"
1007 echo "you will need to dump the data, delete the old file, and re-run"
1008 echo "this rpm upgrade."
1010 echo "Backing up your current database..."
1011 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db > %{working_dir}/bacula_backup.sql
1012 mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
1013 echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
1014 echo "catalog file has been renamed %{working_dir}/bacula.db.old."
1016 echo "Please re-run this rpm package upgrade."
1017 echo "After the upgrade is complete, restore your catalog"
1018 echo "with the following commands:"
1019 echo "%{script_dir}/drop_sqlite3_tables"
1020 echo "cd %{working_dir}"
1021 echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
1022 echo "chown bacula.bacula bacula.db"
1025 # test for bacula database older than version 12 and sqlite3
1026 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
1027 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1032 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1035 %if ! %{client_only}
1036 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "12" ]; then
1037 echo "This bacula upgrade will update a bacula database from version 12 to 1014."
1038 echo "You appear to be running database version $DB_VER. You must first update"
1039 echo "your database to version 12 and then install this upgrade. The alternative"
1040 echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
1041 echo "catalog information, then do the upgrade. Information on updating a"
1042 echo "database older than version 12 can be found in the release notes."
1051 %if ! %{client_only}
1052 # check for and copy %{sysconf_dir}/console.conf to bconsole.conf
1053 if [ -s %{sysconf_dir}/console.conf ];then
1054 cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
1057 # create the daemon users and groups
1058 # first create the groups if they don't exist
1059 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1060 if [ -z "$HAVE_BACULA" ]; then
1061 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1062 echo "The group %{daemon_group} has been added to %{group_file}."
1063 echo "See the manual chapter \"Running Bacula\" for details."
1065 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
1066 if [ -z "$HAVE_BACULA" ]; then
1067 %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
1068 echo "The group %{storage_daemon_group} has been added to %{group_file}."
1069 echo "See the manual chapter \"Running Bacula\" for details."
1071 # now create the users if they do not exist
1072 # we do not use the -g option allowing the primary group to be set to system default
1073 # this will be a unique group on redhat type systems or the group users on some systems
1074 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
1075 if [ -z "$HAVE_BACULA" ]; then
1076 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
1077 echo "The user %{storage_daemon_user} has been added to %{user_file}."
1078 echo "See the manual chapter \"Running Bacula\" for details."
1080 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
1081 if [ -z "$HAVE_BACULA" ]; then
1082 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
1083 echo "The user %{director_daemon_user} has been added to %{user_file}."
1084 echo "See the manual chapter \"Running Bacula\" for details."
1086 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1087 if [ -z "$HAVE_BACULA" ]; then
1088 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1089 echo "The user %{file_daemon_user} has been added to %{user_file}."
1090 echo "See the manual chapter \"Running Bacula\" for details."
1092 # now we add the supplementary groups, this is ok to call even if the users already exist
1093 # we only do this if the user is NOT root
1094 IS_ROOT=%{director_daemon_user}
1095 if [ "$IS_ROOT" != "root" ]; then
1096 %{usermod} -G %{daemon_group} %{director_daemon_user}
1098 IS_ROOT=%{storage_daemon_user}
1099 if [ "$IS_ROOT" != "root" ]; then
1100 %{usermod} -G %{daemon_group},%{storage_daemon_group} %{storage_daemon_user}
1102 IS_ROOT=%{file_daemon_user}
1103 if [ "$IS_ROOT" != "root" ]; then
1104 %{usermod} -G %{daemon_group} %{file_daemon_user}
1117 %if ! %{client_only}
1119 if [ "$1" -ge 1 ] ; then
1120 %if %{suse} && %{mysql}
1121 %{service_enable} mysql
1123 %if %{suse} && %{postgresql}
1124 %{service_enable} postgresql
1126 %{service_enable} bacula-dir
1127 %{service_enable} bacula-fd
1128 %{service_enable} bacula-sd
1132 if [ -d %{sysconf_dir} ]; then
1134 if [ ! -f .rpm.sed ]; then
1136 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1137 echo "# match between configuration files" >> .rpm.sed
1139 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
1140 pass=`openssl rand -base64 33`
1141 echo "s@${string}@${pass}@g" >> .rpm.sed
1145 if [ "$host" = "" ]; then
1148 for file in *.conf; do
1149 sed -f .rpm.sed $file > $file.new
1150 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1158 #check, if mysql can be called successfully at all
1159 if mysql 2>/dev/null bacula -e 'select * from Version;' ; then
1161 # test for an existing database
1162 # note: this ASSUMES no password has been set for bacula database
1163 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1165 # grant privileges and create tables if they do not exist
1166 if [ -z "$DB_VER" ]; then
1167 echo "Hmm, it doesn't look like you have an existing database."
1168 echo "Granting privileges for MySQL user bacula..."
1169 %{script_dir}/grant_mysql_privileges
1170 echo "Creating MySQL bacula database..."
1171 %{script_dir}/create_mysql_database
1172 echo "Creating bacula tables..."
1173 %{script_dir}/make_mysql_tables
1175 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1176 echo "This release requires an upgrade to your bacula database."
1177 echo "Backing up your current database..."
1178 mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1179 echo "Upgrading bacula database ..."
1180 %{script_dir}/update_mysql_tables
1181 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1188 # test for an existing database
1189 if [ -s %{working_dir}/bacula.db ]; then
1190 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1191 # check to see if we need to upgrade a 3.x database
1192 if [ "$DB_VER" -le "13" ] && [ "$DB_VER" -ge "12" ]; then
1193 echo "This release requires an upgrade to your bacula database."
1194 echo "Backing up your current database..."
1195 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1196 echo "Upgrading bacula database ..."
1197 %{script_dir}/update_sqlite3_tables
1198 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1201 # create the database and tables
1202 echo "Hmm, doesn't look like you have an existing database."
1203 echo "Creating SQLite database..."
1204 %{script_dir}/create_sqlite3_database
1205 echo "Creating the SQLite tables..."
1206 %{script_dir}/make_sqlite3_tables
1207 chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
1212 # check if psql can be called successfully at all
1213 if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; then
1215 # test for an existing database
1216 # note: this ASSUMES no password has been set for bacula database
1217 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1219 # grant privileges and create tables if they do not exist
1220 if [ -z "$DB_VER" ]; then
1221 echo "Hmm, doesn't look like you have an existing database."
1222 echo "Creating PostgreSQL bacula database..."
1223 su - postgres -c %{script_dir}/create_postgresql_database
1224 echo "Creating bacula tables..."
1225 su - postgres -c %{script_dir}/make_postgresql_tables
1226 echo "Granting privileges for PostgreSQL user bacula..."
1227 su - postgres -c %{script_dir}/grant_postgresql_privileges
1229 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1230 echo "This release requires an upgrade to your bacula database."
1231 echo "Backing up your current database..."
1232 su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1233 echo "Upgrading bacula database ..."
1234 su - postgres -c %{script_dir}/update_postgresql_tables
1235 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1236 echo "Granting privileges for PostgreSQL user bacula..."
1237 su - postgres -c %{script_dir}/grant_postgresql_privileges
1243 %if ! %{client_only}
1244 if [ -d %{sysconf_dir} ]; then
1246 if [ ! -f .rpm.sed ]; then
1248 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1249 echo "# match between configuration files" >> .rpm.sed
1251 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
1252 pass=`openssl rand -base64 33`
1253 echo "s@${string}@${pass}@g" >> .rpm.sed
1257 if [ "$host" = "" ]; then
1260 for file in *.conf; do
1261 sed -f .rpm.sed $file > $file.new
1262 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1279 %if ! %{client_only}
1282 %{service_disable} bacula-dir
1283 %{service_disable} bacula-fd
1284 %{service_disable} bacula-sd
1289 %defattr(-,root,root)
1290 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1291 %attr(-, root, %{daemon_group}) %dir %{plugin_dir}
1292 #%attr(-, root, %{daemon_group}) %dir %{log_dir}
1293 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
1295 # SD/DIR might write here
1296 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{log_dir}
1297 #%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
1300 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-fd.service
1302 %{script_dir}/bacula-ctl-fd
1303 /etc/init.d/bacula-fd
1306 /etc/logrotate.d/bacula
1308 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1309 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1310 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1312 %{_sbindir}/bacula-fd
1313 %{_sbindir}/btraceback
1314 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1315 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1316 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
1317 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
1318 %{_sbindir}/bconsole
1319 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1320 %{_mandir}/man8/bacula.8.%{manpage_ext}
1321 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1322 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1323 %{_mandir}/man1/bat.1.%{manpage_ext}
1324 %_prefix/share/doc/*
1327 # create the daemon group and user
1328 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1329 if [ -z "$HAVE_BACULA" ]; then
1330 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1331 echo "The group %{daemon_group} has been added to %{group_file}."
1332 echo "See the manual chapter \"Running Bacula\" for details."
1334 # we do not use the -g option allowing the primary group to be set to system default
1335 # this will be a unique group on redhat type systems or the group users on some systems
1336 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1337 if [ -z "$HAVE_BACULA" ]; then
1338 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1339 echo "The user %{file_daemon_user} has been added to %{user_file}."
1340 echo "See the manual chapter \"Running Bacula\" for details."
1342 # now we add the supplementary group, this is ok to call even if the user already exists
1343 # we only do this if the user is NOT root
1344 IS_ROOT=%{file_daemon_user}
1345 if [ "$IS_ROOT" != "root" ]; then
1346 %{usermod} -G %{daemon_group} %{file_daemon_user}
1351 if [ "$1" -ge 1 ] ; then
1352 %{service_enable} bacula-fd
1355 if [ -d %{sysconf_dir} ]; then
1357 if [ ! -f .rpm.sed ]; then
1359 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1360 echo "# match between configuration files" >> .rpm.sed
1362 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
1363 pass=`openssl rand -base64 33`
1364 echo "s@${string}@${pass}@g" >> .rpm.sed
1368 if [ "$host" = "" ]; then
1371 for file in *.conf; do
1372 sed -f .rpm.sed $file > $file.new
1373 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1381 %{service_disable} bacula-fd
1385 %defattr(-,root,root)
1388 %{_libdir}/libbaccfg*
1389 %{_libdir}/libbacfind*
1399 %if ! %{client_only}
1401 %defattr(-,root,%{daemon_group})
1402 %{script_dir}/updatedb/*
1403 #oensuse_bs: directories not owned by any package
1404 #%{script_dir}/updatedb
1407 # create the daemon group
1408 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1409 if [ -z "$HAVE_BACULA" ]; then
1410 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1411 echo "The group %{daemon_group} has been added to %{group_file}."
1412 echo "See the manual chapter \"Running Bacula\" for details."
1416 echo "The database update scripts were installed to %{script_dir}/updatedb"