5 # Platform Build Configuration
7 # basic defines for every build
8 %define _release @RELEASE@
9 %define _version @VERSION@
10 %define product bacula
11 %define _packager Kern Sibbald <kern@sibbald.com>
12 %define depkgs_version @DEPKGS_VERSION@
14 # Don't strip binaries
15 %define __os_install_post %{nil}
16 %define __debug_install_post %{nil}
17 %define debug_package %{nil}
19 %define postgres_version 8
21 %{?build_rhel5:%define pgre84 1}
22 %{?build_el5:%define pgre84 1}
24 %define postgres_package postgresql84
25 %define postgres_server_package postgresql84-server
26 %define postgres_devel_package postgresql84-devel
28 %define postgres_package postgresql
29 %define postgres_server_package postgresql-server
30 %define postgres_devel_package postgresql-devel
34 %{?single_dir_install:%define single_dir 1}
36 # Installation Directory locations
37 %define _prefix /opt/bacula
38 %define _sbindir /opt/bacula/bin
39 %define _bindir /opt/bacula/bin
40 %define _subsysdir /opt/bacula/working
41 %define sqlite_bindir /opt/bacula/sqlite
42 %define _mandir /usr/share/man
43 %define docs_dir /opt/bacula/docs
44 %define archive_dir /opt/bacula/archive
45 %define sysconf_dir /opt/bacula/etc
46 %define script_dir /opt/bacula/scripts
47 %define working_dir /opt/bacula/working
48 %define pid_dir /opt/bacula/working
49 %define plugin_dir /opt/bacula/plugins
50 %define lib_dir /opt/bacula/lib
51 %define log_dir /opt/bacula/log
52 %define systemd_dir /lib/systemd/system
54 # Daemon user:group Don't change them unless you know what you are doing
55 %define director_daemon_user bacula
56 %define storage_daemon_user bacula
57 %define file_daemon_user root
58 %define daemon_group bacula
59 # group that has write access to tape devices, usually disk on Linux
60 %define storage_daemon_group disk
62 %define depkgs ../depkgs
64 # problems with mandriva build:
65 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
67 #--------------------------------------------------------------------------
68 # it should not be necessary to change anything below here for a release
69 # except for patch macros in the setup section
70 #--------------------------------------------------------------------------
72 %define base_package_name %{product}
74 %{?contrib_packager:%define _packager %{contrib_packager}}
76 Summary: Bacula - The Network Backup Solution
77 Name: %{base_package_name}
80 Group: System Environment/Daemons
82 BuildRoot: %{_tmppath}/%{name}-root
83 URL: http://www.bacula.org/
84 Vendor: The Bacula Team
85 Packager: %{_packager}
88 # opensuse build service changes the release itself
89 # what happens if the release is not 1? DSB
90 Source0: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
91 Source1: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
92 Source2: Release_Notes-%{version}-%{release}.tar.gz
94 # define the basic package description
95 %define blurb Bacula - The Leading Open Source Backup Solution.
96 %define blurb2 Bacula is a set of computer programs that permit you (or the system
97 %define blurb3 administrator) to manage backup, recovery, and verification of computer
98 %define blurb4 data across a network of computers of different kinds. In technical terms,
99 %define blurb5 it is a network client/server based backup program. Bacula is relatively
100 %define blurb6 easy to use and efficient, while offering many advanced storage management
101 %define blurb7 features that make it easy to find and recover lost or damaged files.
102 %define blurb8 Bacula source code has been released under the AGPL version 3 license.
104 %define user_file /etc/passwd
105 %define group_file /etc/group
108 %define useradd /usr/sbin/useradd
109 %define groupadd /usr/sbin/groupadd
110 %define usermod /usr/sbin/usermod
112 # platform defines - set one below or define the build_xxx on the command line
115 %{?build_rh7:%define rh7 1}
117 %{?build_rh8:%define rh8 1}
119 %{?build_rh9:%define rh9 1}
122 %{?build_fc16:%define fc16 1}
124 %{?build_fc17:%define fc17 1}
126 %{?build_fc18:%define fc18 1}
128 %{?build_fc22:%define fc22 1}
129 # Whitebox Enterprise build
131 %{?build_wb3:%define wb3 1}
132 # RedHat Enterprise builds
134 %{?build_rhel3:%define rhel3 1}
135 %{?build_rhel3:%define wb3 1}
137 %{?build_rhel4:%define rhel4 1}
138 %{?build_rhel4:%define fc3 1}
139 %{?build_el4:%define rhel4 1}
140 %{?build_el4:%define fc3 1}
142 %{?build_rhel5:%define rhel5 1}
143 %{?build_rhel5:%define fc6 1}
144 %{?build_el5:%define rhel5 1}
145 %{?build_el5:%define fc6 1}
147 %{?build_rhel6:%define rhel6 1}
148 %{?build_el6:%define rhel6 1}
150 %{?build_rhel7:%define rhel7 1}
151 %{?build_el7:%define rhel7 1}
154 %{?build_centos3:%define centos3 1}
155 %{?build_centos3:%define wb3 1}
157 %{?build_centos4:%define centos4 1}
158 %{?build_centos4:%define fc3 1}
160 %{?build_centos5:%define centos5 1}
161 %{?build_centos5:%define fc6 1}
163 %{?build_centos6:%define centos6 1}
165 %{?build_centos7:%define centos7 1}
168 %{?build_sl3:%define sl3 1}
169 %{?build_sl3:%define wb3 1}
171 %{?build_sl4:%define sl4 1}
172 %{?build_sl4:%define fc3 1}
174 %{?build_sl5:%define sl5 1}
175 %{?build_sl5:%define fc6 1}
178 %{?build_su9:%define su9 1}
180 %{?build_su10:%define su10 1}
182 %{?build_su102:%define su102 1}
184 %{?build_su103:%define su103 1}
186 %{?build_su110:%define su110 1}
188 %{?build_su111:%define su111 1}
190 %{?build_su112:%define su112 1}
192 %{?build_su113:%define su113 1}
194 %{?build_su120:%define su120 1}
196 %{?build_su131:%define su131 1}
199 %{?build_mdk:%define mdk 1}
201 %{?build_mdv:%define mdv 1}
202 %{?build_mdv:%define mdk 1}
205 %define client_only 0
206 %{?build_client_only:%define client_only 1}
208 # if the platform is using systemd
211 %if %{rhel7} || %{fc22}
215 # depending if we use systemd or not, we use chkconfig or systemctl
217 %define service_enable systemctl enable
218 %define service_disable systemctl disable
220 %define service_enable /sbin/chkconfig --add
221 %define service_disable /sbin/chkconfig --del
224 # Setup some short cuts
226 %if %{rh7} || %{rh8} || %{rh9}
230 %if %{fc16} || %{fc17} || %{fc18} || %{fc22}
234 %if %{su9} || %{su10} || %{su102} || %{su103} || %{su110} || %{su111} || %{su112} || %{su120} || %{su131}
238 %if %{rhel3} || %{rhel4} || %{rhel5} || %{rhel6} || %{rhel7} || %{centos3} || %{centos4} || %{centos5} || %{centos6} || %{centos7}
242 %if %{sl3} || %{sl4} || %{sl5}
247 # test for a platform definition
248 %if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk} && !%{scil}
249 %{error: You must specify a platform. Please examine the spec file.}
253 # distribution-specific directory for logwatch
254 %if %{wb3} || %{rh7} || %{rh8} || %{rh9}
255 %define logwatch_dir /etc/log.d
257 %define logwatch_dir /etc/logwatch
261 # set for database support desired or define the build_xxx on the command line
263 %{?build_mysql:%define mysql 1}
265 %{?build_sqlite:%define sqlite 1}
267 %{?build_postgresql:%define postgresql 1}
269 # test for a database definition
270 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
271 %{error: You must specify database support, by passing one of the following to rpmbuild:}
272 %{error: --define build_postgresql=1}
273 %{error: --define build_sqlite=1}
274 %{error: --define build_mysql=1}
279 %define db_backend mysql
282 %define db_backend sqlite3
285 %define db_backend postgresql
290 %{?build_x86_64:%define x86_64 1}
292 # check what distribution we are
293 %if %{fc16} || %{fc17} || %{fc18} || %{fc22}
294 %define _dist %(grep Fedora /etc/redhat-release)
296 %if %{centos7} || %{centos6}
297 %define _dist %(grep CentOS /etc/redhat-release)
299 %if %{centos5} || %{centos4} || %{centos3}
300 %define _dist %(grep CentOS /etc/redhat-release)
302 %if %{sl5} ||%{sl4} || %{sl3}
303 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
305 %if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
306 %define _dist %(grep White /etc/whitebox-release)
309 %define _dist %(grep -i SuSE /etc/SuSE-release)
312 %define _dist %(grep Mand /etc/mandrake-release)
317 # should we turn on python support
319 %{?build_python:%define python 0}
321 # should we enable tcp wrappers support
322 %define tcpwrappers 1
323 %{?build_tcpwrappers:%define tcpwrappers 1}
325 # do we need to patch for old postgresql version?
327 %{?build_old_pgsql:%define old_pgsql 1}
329 # Mandriva somehow forces the manpage file extension to bz2 rather than gz
331 %define manpage_ext bz2
333 %define manpage_ext gz
336 # for client only build
343 BuildRequires: gcc, gcc-c++, make, autoconf
344 BuildRequires: glibc, glibc-devel
345 BuildRequires: ncurses-devel, readline-devel
346 BuildRequires: libstdc++-devel, zlib-devel
347 BuildRequires: openssl-devel
348 BuildRequires: libacl-devel
349 BuildRequires: pkgconfig
350 BuildRequires: bzip2-devel
352 BuildRequires: libxml2-devel
355 BuildRequires: python, python-devel
356 %{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
360 BuildRequires: libxml-devel
363 BuildRequires: libstdc++-static-devel
364 BuildRequires: glibc-static-devel
367 %if %{mysql} && ! %{suse}
368 BuildRequires: mysql-devel
371 %if %{postgresql} && %{wb3}
372 BuildRequires: rh-postgresql-devel >= %{postgres_version}
375 %if %{postgresql} && ! %{wb3}
376 BuildRequires: %{postgres_devel_package} >= %{postgres_version}
400 Summary: Bacula - The Network Backup Solution
401 Group: System Environment/Daemons
402 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
403 Conflicts: bacula-client
405 Requires: ncurses, libstdc++, zlib, openssl
406 Requires: glibc, readline, %{name}-libs
416 %if %{postgresql} && %{wb3}
417 Requires: rh-postgresql >= 7
419 %if %{postgresql} && ! %{wb3}
420 Requires: postgresql >= 7
430 %description postgresql
434 Requires: python >= %{pyver}
448 This build requires MySQL to be installed separately as the catalog database.
451 This build requires PostgreSQL to be installed separately as the catalog database.
454 This build incorporates sqlite3 as the catalog database, statically compiled.
457 This build includes python scripting support.
460 This build includes tcp-wrappers support.
464 Summary: Bacula - The Network Backup Solution
465 Group: System Environment/Daemons
467 Conflicts: bacula-mysql
468 Conflicts: bacula-sqlite
469 Conflicts: bacula-postgresql
473 Provides: %{product}-libs
476 Requires: libstdc++, zlib, openssl, bzip2-libs
477 Requires: glibc, readline, %{name}-libs
480 Requires: python >= %{pyver}
494 This is the File daemon (Client) only package. It includes the command line
497 This build includes python scripting support.
500 This build includes tcp-wrappers support.
506 Summary: Bacula - The Network Backup Solution
507 Group: System Environment/Daemons
509 %description updatedb
520 This package installs scripts for updating older versions of the bacula
526 Summary: Bacula - The Network Backup Solution
527 Group: System Environment/Daemons
540 This package installs the shared libraries used by many bacula programs.
542 # Must explicitly enable debug pkg on SuSE
543 # but not in opensuse_bs
544 #%if %{suse} && ! 0%{?opensuse_bs}
549 %setup -T -b 0 -n depkgs
550 %setup -T -b 1 -n %{product}-%{version}
551 %setup -T -D -b 2 -n %{product}-%{version}
558 #export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
561 # You can use a cache for depkgs
562 # tar xfz depkgs*gz -C ~/
564 # touch %{depkgs_version} # depkgs version
566 if [ -f $HOME/depkgs/%{depkgs_version} ]; then
568 ln -s $HOME/depkgs %{depkgs}
580 export LDFLAGS="${LDFLAGS} -L${PWD}/lzo/lib"
581 export CPPFLAGS="${CPPFLAGS} -I${PWD}/lzo/include"
584 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
585 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
588 # patches for the bundled sqlite scripts
589 sed -i s:.SQLITE_BINDIR.:/opt/bacula/sqlite: src/cats/*_sqlite3_*.in
591 # patch the bacula-dir init script to remove sqlite service
593 sed -i 's/network .DB_TYPE./network/' platforms/suse/bacula-dir.in
597 # 64 bit lib location hacks
598 # as of 1.39.18 it should not be necessary to enable x86_64 as configure is
599 # reported to be fixed to properly detect lib locations.
601 export LDFLAGS="${LDFLAGS} -L/usr/lib64"
603 %if %{mysql} && %{x86_64}
604 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
606 %if %{python} && %{x86_64}
607 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
610 export BACULA="Bacula"
612 # Main Bacula configuration
614 --prefix=%{_prefix} \
615 --sbindir=%{_sbindir} \
616 --sysconfdir=%{sysconf_dir} \
617 --mandir=%{_mandir} \
618 --with-scriptdir=%{script_dir} \
619 --with-working-dir=%{working_dir} \
620 --with-plugindir=%{plugin_dir} \
621 --with-logdir=%{log_dir} \
622 --with-pid-dir=%{pid_dir} \
623 --with-subsys-dir=%{_subsysdir} \
624 --enable-smartalloc \
631 --with-sqlite3=${cwd}/%{depkgs}/sqlite3 \
641 --enable-client-only \
643 %if %{rh7} || %{rh8} || %{rh9}
644 --disable-batch-insert \
647 --with-systemd=%{systemd_dir} \
649 --with-tcp-wrappers \
650 --with-dir-user=%{director_daemon_user} \
651 --with-dir-group=%{daemon_group} \
652 --with-sd-user=%{storage_daemon_user} \
653 --with-sd-group=%{storage_daemon_group} \
654 --with-fd-user=%{file_daemon_user} \
655 --with-fd-group=%{daemon_group} \
656 --with-basename="XXX_HOSTNAME_XXX" \
657 --with-hostname="XXX_HOSTNAME_XXX" \
658 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
659 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
660 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
661 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
662 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
663 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
671 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
672 mkdir -p $RPM_BUILD_ROOT/etc/init.d
673 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
674 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles
675 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/conf/services
676 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services
677 mkdir -p $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared
678 mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
680 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
681 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
684 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
687 make DESTDIR=$RPM_BUILD_ROOT install
690 make DESTDIR=$RPM_BUILD_ROOT -C ../bacula-%{_version}/src/tools/ install-bsnapshot
693 make DESTDIR=$RPM_BUILD_ROOT -C platforms/systemd install-dir install-service
696 # Remove docs for programs that are depreciated
697 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
698 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
699 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
700 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
702 # Remove docs for programs we do not distribute
703 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bpluginfo.8.%{manpage_ext}
705 # Storage-ctl packaged in shstore rpm
706 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
707 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
709 # fixme - make installs the mysql scripts for sqlite build
711 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
712 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
713 rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
716 # fixme - make installs the mysql scripts for postgresql build
718 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
719 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
722 # install the init scripts
725 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
726 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
727 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
730 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
731 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
732 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
734 %if ! %{suse} && ! %{mdk}
735 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
736 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
737 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
738 %endif # !suse && !mdk
739 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
740 %endif # ! usesystemd
743 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
744 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
745 rm -f $RPM_BUILD_ROOT%{script_dir}/breload
746 rm -f $RPM_BUILD_ROOT%{script_dir}/manual_prune.pl
747 rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-dir.service
748 rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-sd.service
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
767 # install special upgrade script, except for sqlite3
772 # install the sample-query.sql file
773 cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
775 # install the logwatch scripts
776 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
777 cp -p scripts/logwatch/applybaculadate $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
778 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
779 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
780 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
781 chmod 755 $RPM_BUILD_ROOT%{logwatch_dir}/scripts/shared/applybaculadate
782 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/logfiles/bacula.conf
783 chmod 644 $RPM_BUILD_ROOT%{logwatch_dir}/conf/services/bacula.conf
786 # now clean up permissions that are left broken by the install
787 chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
789 # fix me - building enable-client-only installs files not included in bacula-client package
791 # Program docs not installed on client
792 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-dir.8.%{manpage_ext}
793 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-sd.8.%{manpage_ext}
794 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bcopy.8.%{manpage_ext}
795 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bextract.8.%{manpage_ext}
796 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
797 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
798 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
799 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
800 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bregex.8.%{manpage_ext}
801 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bwild.8.%{manpage_ext}
802 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
803 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
804 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
805 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
806 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
807 rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
808 rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
809 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
810 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
811 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
812 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
813 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
814 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
815 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
820 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
821 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*
840 %defattr(-,root,root)
841 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
842 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
843 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
844 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
845 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
846 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
847 %{sqlite_bindir}/libsqlite3.a
848 %{sqlite_bindir}/sqlite3.h
849 %{sqlite_bindir}/sqlite3
850 %{_libdir}/libbaccats*
851 %{_libdir}/libbacsql*
858 %defattr(-,root,root)
859 %attr(755, root, %{daemon_group}) %{script_dir}/create_postgresql_database
860 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
861 %attr(755, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
862 %attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
863 %attr(755, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
864 %attr(755, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
865 %{_libdir}/libbaccats*
866 %{_libdir}/libbacsql*
869 # The rest is DB backend independent
872 %attr(-, root, %{daemon_group}) %dir %{script_dir}
873 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
874 #%attr(-, %{director_daemon_user}, %{daemon_group}) %dir %{log_dir}
875 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
876 %attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
877 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
878 %attr(755, root, %{daemon_group}) %{script_dir}/create_bacula_database
879 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_database
880 %attr(755, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
881 %attr(755, root, %{daemon_group}) %{script_dir}/make_bacula_tables
882 %attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
883 %attr(755, root, %{daemon_group}) %{script_dir}/update_bacula_tables
884 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
885 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup.pl
886 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
887 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
888 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
889 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
890 %attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
891 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
892 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
893 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
894 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
895 #%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
896 #%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
897 %attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
898 %attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
899 #%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
900 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
901 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{script_dir}/mtx-changer.conf
904 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-dir.service
905 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-fd.service
906 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-sd.service
908 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
909 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
910 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
913 /etc/logrotate.d/bacula
914 %{logwatch_dir}/scripts/services/bacula
915 %{logwatch_dir}/scripts/shared/applybaculadate
916 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
917 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
918 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
919 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
920 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
921 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
922 %attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
924 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
926 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-dir
927 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-sd
928 %attr(-, root, %{daemon_group}) %{_sbindir}/btraceback
929 %attr(-, root, %{daemon_group}) %{_sbindir}/bconsole
930 %attr(-, root, %{daemon_group}) %{_sbindir}/bsmtp
931 %attr(-, root, %{daemon_group}) %{_sbindir}/bscan
932 %attr(-, root, %{daemon_group}) %{_sbindir}/btape
934 %attr(755, root, root) %{_sbindir}/bsnapshot
936 %{_sbindir}/bacula-fd
943 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
944 %{_mandir}/man8/bacula-dir.8.%{manpage_ext}
945 %{_mandir}/man8/bacula-sd.8.%{manpage_ext}
946 %{_mandir}/man8/bacula.8.%{manpage_ext}
947 %{_mandir}/man8/bconsole.8.%{manpage_ext}
948 %{_mandir}/man8/bcopy.8.%{manpage_ext}
949 %{_mandir}/man8/bextract.8.%{manpage_ext}
950 %{_mandir}/man8/bls.8.%{manpage_ext}
951 %{_mandir}/man8/bscan.8.%{manpage_ext}
952 %{_mandir}/man8/btape.8.%{manpage_ext}
953 %{_mandir}/man8/btraceback.8.%{manpage_ext}
954 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
955 %{_mandir}/man8/bregex.8.%{manpage_ext}
956 %{_mandir}/man8/bwild.8.%{manpage_ext}
957 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
958 %{_mandir}/man1/bat.1.%{manpage_ext}
962 %doc ../Release_Notes-%{version}-%{release}.txt
966 # test for bacula database older than version 13
967 # note: this ASSUMES no password has been set for bacula database
968 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
973 # are we upgrading from sqlite to sqlite3?
974 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
975 echo "This version of bacula-sqlite involves an upgrade to sqlite3."
976 echo "Your catalog database file is not compatible with sqlite3, thus"
977 echo "you will need to dump the data, delete the old file, and re-run"
978 echo "this rpm upgrade."
980 echo "Backing up your current database..."
981 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db > %{working_dir}/bacula_backup.sql
982 mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
983 echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
984 echo "catalog file has been renamed %{working_dir}/bacula.db.old."
986 echo "Please re-run this rpm package upgrade."
987 echo "After the upgrade is complete, restore your catalog"
988 echo "with the following commands:"
989 echo "%{script_dir}/drop_sqlite3_tables"
990 echo "cd %{working_dir}"
991 echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
992 echo "chown bacula.bacula bacula.db"
995 # test for bacula database older than version 12 and sqlite3
996 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
997 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1002 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1005 %if ! %{client_only}
1006 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "12" ]; then
1007 echo "This bacula upgrade will update a bacula database from version 12 to 1014."
1008 echo "You appear to be running database version $DB_VER. You must first update"
1009 echo "your database to version 12 and then install this upgrade. The alternative"
1010 echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
1011 echo "catalog information, then do the upgrade. Information on updating a"
1012 echo "database older than version 12 can be found in the release notes."
1021 %if ! %{client_only}
1022 # check for and copy %{sysconf_dir}/console.conf to bconsole.conf
1023 if [ -s %{sysconf_dir}/console.conf ];then
1024 cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
1027 # create the daemon users and groups
1028 # first create the groups if they don't exist
1029 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1030 if [ -z "$HAVE_BACULA" ]; then
1031 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1032 echo "The group %{daemon_group} has been added to %{group_file}."
1033 echo "See the manual chapter \"Running Bacula\" for details."
1035 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
1036 if [ -z "$HAVE_BACULA" ]; then
1037 %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
1038 echo "The group %{storage_daemon_group} has been added to %{group_file}."
1039 echo "See the manual chapter \"Running Bacula\" for details."
1041 # now create the users if they do not exist
1042 # we do not use the -g option allowing the primary group to be set to system default
1043 # this will be a unique group on redhat type systems or the group users on some systems
1044 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
1045 if [ -z "$HAVE_BACULA" ]; then
1046 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
1047 echo "The user %{storage_daemon_user} has been added to %{user_file}."
1048 echo "See the manual chapter \"Running Bacula\" for details."
1050 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
1051 if [ -z "$HAVE_BACULA" ]; then
1052 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
1053 echo "The user %{director_daemon_user} has been added to %{user_file}."
1054 echo "See the manual chapter \"Running Bacula\" for details."
1056 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1057 if [ -z "$HAVE_BACULA" ]; then
1058 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1059 echo "The user %{file_daemon_user} has been added to %{user_file}."
1060 echo "See the manual chapter \"Running Bacula\" for details."
1062 # now we add the supplementary groups, this is ok to call even if the users already exist
1063 # we only do this if the user is NOT root
1064 IS_ROOT=%{director_daemon_user}
1065 if [ "$IS_ROOT" != "root" ]; then
1066 %{usermod} -G %{daemon_group} %{director_daemon_user}
1068 IS_ROOT=%{storage_daemon_user}
1069 if [ "$IS_ROOT" != "root" ]; then
1070 %{usermod} -G %{daemon_group},%{storage_daemon_group} %{storage_daemon_user}
1072 IS_ROOT=%{file_daemon_user}
1073 if [ "$IS_ROOT" != "root" ]; then
1074 %{usermod} -G %{daemon_group} %{file_daemon_user}
1087 %if ! %{client_only}
1089 if [ "$1" -ge 1 ] ; then
1090 %if %{suse} && %{mysql}
1091 %{service_enable} mysql
1093 %if %{suse} && %{postgresql}
1094 %{service_enable} postgresql
1096 %{service_enable} bacula-dir
1097 %{service_enable} bacula-fd
1098 %{service_enable} bacula-sd
1102 if [ -d %{sysconf_dir} ]; then
1104 if [ ! -f .rpm.sed ]; then
1106 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1107 echo "# match between configuration files" >> .rpm.sed
1109 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
1110 pass=`openssl rand -base64 33`
1111 echo "s@${string}@${pass}@g" >> .rpm.sed
1115 if [ "$host" = "" ]; then
1118 for file in *.conf; do
1119 sed -f .rpm.sed $file > $file.new
1120 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1128 #check, if mysql can be called successfully at all
1129 if mysql 2>/dev/null bacula -e 'select * from Version;' ; then
1131 # test for an existing database
1132 # note: this ASSUMES no password has been set for bacula database
1133 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1135 # grant privileges and create tables if they do not exist
1136 if [ -z "$DB_VER" ]; then
1137 echo "Hmm, it doesn't look like you have an existing database."
1138 echo "Granting privileges for MySQL user bacula..."
1139 %{script_dir}/grant_mysql_privileges
1140 echo "Creating MySQL bacula database..."
1141 %{script_dir}/create_mysql_database
1142 echo "Creating bacula tables..."
1143 %{script_dir}/make_mysql_tables
1145 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1146 echo "This release requires an upgrade to your bacula database."
1147 echo "Backing up your current database..."
1148 mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1149 echo "Upgrading bacula database ..."
1150 %{script_dir}/update_mysql_tables
1151 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1158 # test for an existing database
1159 if [ -s %{working_dir}/bacula.db ]; then
1160 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1161 # check to see if we need to upgrade a 3.x database
1162 if [ "$DB_VER" -le "13" ] && [ "$DB_VER" -ge "12" ]; then
1163 echo "This release requires an upgrade to your bacula database."
1164 echo "Backing up your current database..."
1165 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1166 echo "Upgrading bacula database ..."
1167 %{script_dir}/update_sqlite3_tables
1168 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1171 # create the database and tables
1172 echo "Hmm, doesn't look like you have an existing database."
1173 echo "Creating SQLite database..."
1174 %{script_dir}/create_sqlite3_database
1175 echo "Creating the SQLite tables..."
1176 %{script_dir}/make_sqlite3_tables
1177 chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
1182 # check if psql can be called successfully at all
1183 if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; then
1185 # test for an existing database
1186 # note: this ASSUMES no password has been set for bacula database
1187 DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
1189 # grant privileges and create tables if they do not exist
1190 if [ -z "$DB_VER" ]; then
1191 echo "Hmm, doesn't look like you have an existing database."
1192 echo "Creating PostgreSQL bacula database..."
1193 su - postgres -c %{script_dir}/create_postgresql_database
1194 echo "Creating bacula tables..."
1195 su - postgres -c %{script_dir}/make_postgresql_tables
1196 echo "Granting privileges for PostgreSQL user bacula..."
1197 su - postgres -c %{script_dir}/grant_postgresql_privileges
1199 elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
1200 echo "This release requires an upgrade to your bacula database."
1201 echo "Backing up your current database..."
1202 su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1203 echo "Upgrading bacula database ..."
1204 su - postgres -c %{script_dir}/update_postgresql_tables
1205 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1206 echo "Granting privileges for PostgreSQL user bacula..."
1207 su - postgres -c %{script_dir}/grant_postgresql_privileges
1213 %if ! %{client_only}
1214 if [ -d %{sysconf_dir} ]; then
1216 if [ ! -f .rpm.sed ]; then
1218 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1219 echo "# match between configuration files" >> .rpm.sed
1221 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
1222 pass=`openssl rand -base64 33`
1223 echo "s@${string}@${pass}@g" >> .rpm.sed
1227 if [ "$host" = "" ]; then
1230 for file in *.conf; do
1231 sed -f .rpm.sed $file > $file.new
1232 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1249 %if ! %{client_only}
1252 %{service_disable} bacula-dir
1253 %{service_disable} bacula-fd
1254 %{service_disable} bacula-sd
1259 %defattr(-,root,root)
1260 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1261 %attr(-, root, %{daemon_group}) %dir %{plugin_dir}
1262 #%attr(-, root, %{daemon_group}) %dir %{log_dir}
1263 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
1265 # SD/DIR might write here
1266 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{log_dir}
1267 #%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
1270 %attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-fd.service
1272 %{script_dir}/bacula-ctl-fd
1273 /etc/init.d/bacula-fd
1276 /etc/logrotate.d/bacula
1278 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1279 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1280 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1282 %{_sbindir}/bacula-fd
1283 %{_sbindir}/btraceback
1284 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1285 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1286 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
1287 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
1288 %{_sbindir}/bconsole
1289 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1290 %{_mandir}/man8/bacula.8.%{manpage_ext}
1291 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1292 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1293 %{_mandir}/man1/bat.1.%{manpage_ext}
1294 %_prefix/share/doc/*
1297 # create the daemon group and user
1298 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1299 if [ -z "$HAVE_BACULA" ]; then
1300 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1301 echo "The group %{daemon_group} has been added to %{group_file}."
1302 echo "See the manual chapter \"Running Bacula\" for details."
1304 # we do not use the -g option allowing the primary group to be set to system default
1305 # this will be a unique group on redhat type systems or the group users on some systems
1306 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1307 if [ -z "$HAVE_BACULA" ]; then
1308 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1309 echo "The user %{file_daemon_user} has been added to %{user_file}."
1310 echo "See the manual chapter \"Running Bacula\" for details."
1312 # now we add the supplementary group, this is ok to call even if the user already exists
1313 # we only do this if the user is NOT root
1314 IS_ROOT=%{file_daemon_user}
1315 if [ "$IS_ROOT" != "root" ]; then
1316 %{usermod} -G %{daemon_group} %{file_daemon_user}
1321 if [ "$1" -ge 1 ] ; then
1322 %{service_enable} bacula-fd
1325 if [ -d %{sysconf_dir} ]; then
1327 if [ ! -f .rpm.sed ]; then
1329 echo "# This file is used to ensure that all passwords will" > .rpm.sed
1330 echo "# match between configuration files" >> .rpm.sed
1332 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
1333 pass=`openssl rand -base64 33`
1334 echo "s@${string}@${pass}@g" >> .rpm.sed
1338 if [ "$host" = "" ]; then
1341 for file in *.conf; do
1342 sed -f .rpm.sed $file > $file.new
1343 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
1351 %{service_disable} bacula-fd
1355 %defattr(-,root,root)
1358 %{_libdir}/libbaccfg*
1359 %{_libdir}/libbacfind*
1369 %if ! %{client_only}
1371 %defattr(-,root,%{daemon_group})
1372 %{script_dir}/updatedb/*
1373 #oensuse_bs: directories not owned by any package
1374 #%{script_dir}/updatedb
1377 # create the daemon group
1378 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1379 if [ -z "$HAVE_BACULA" ]; then
1380 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1381 echo "The group %{daemon_group} has been added to %{group_file}."
1382 echo "See the manual chapter \"Running Bacula\" for details."
1386 echo "The database update scripts were installed to %{script_dir}/updatedb"