]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/rpms/redhat/bacula.spec.in
rpm: Update bacula.spec for Fedora 27
[bacula/bacula] / bacula / platforms / rpms / redhat / bacula.spec.in
index 8f59a8f4135daf016cc07001a027e6584dddc92f..e11daab4b66ed9705b351fd7b19c8b317612a212 100644 (file)
@@ -1,3 +1,4 @@
+#
 # Bacula RPM spec file
 #
 
@@ -33,7 +34,6 @@
 %{?single_dir_install:%define single_dir 1}
 
 # Installation Directory locations
-%if %{single_dir}
 %define _prefix        /opt/bacula
 %define _sbindir       /opt/bacula/bin
 %define _bindir        /opt/bacula/bin
 %define plugin_dir     /opt/bacula/plugins
 %define lib_dir        /opt/bacula/lib
 %define log_dir        /opt/bacula/log
-%else
-%define _prefix        /usr
-%define _sbindir       %_prefix/sbin
-%define _bindir        %_prefix/bin
-%define _subsysdir     /var/lock/subsys
-%define sqlite_bindir %_libdir/bacula/sqlite
-%define _mandir        %_prefix/share/man
-%define sysconf_dir    /etc/bacula
-%define script_dir     %_libdir/bacula
-%define working_dir    /var/lib/bacula
-%define pid_dir        /var/run
-%define plugin_dir     %_libdir/bacula/plugins
-%define lib_dir        %_libdir/bacula/lib
-%define log_dir        %_libdir/bacula/log
-%endif
+%define systemd_dir    /lib/systemd/system
 
 # Daemon user:group Don't change them unless you know what you are doing
 %define director_daemon_user    bacula
@@ -75,7 +61,7 @@
 
 %define depkgs ../depkgs
 
-# probems with mandriva build:
+# problems with mandriva build:
 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
 
 #--------------------------------------------------------------------------
@@ -103,11 +89,7 @@ Prefix: %{_prefix}
 # what happens if the release is not 1? DSB
 Source0: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
 Source1: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
-%if 0%{?opensuse_bs}
-Source2: Release_Notes-%{version}-1.tar.gz
-%else
 Source2: Release_Notes-%{version}-%{release}.tar.gz
-%endif
 
 # define the basic package description
 %define blurb Bacula - The Leading Open Source Backup Solution.
@@ -142,13 +124,17 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %{?build_fc17:%define fc17 1}
 %define fc18 0
 %{?build_fc18:%define fc18 1}
-# Whitebox Enterprise build
-%define wb3 0
-%{?build_wb3:%define wb3 1}
+%define fc22 0
+%{?build_fc22:%define fc22 1}
+%define fc25 0
+%{?build_fc25:%define fc25 1}
+%define fc26 0
+%{?build_fc26:%define fc26 1}
+%define fc27 0
+%{?build_fc27:%define fc27 1}
 # RedHat Enterprise builds
 %define rhel3 0
 %{?build_rhel3:%define rhel3 1}
-%{?build_rhel3:%define wb3 1}
 %define rhel4 0
 %{?build_rhel4:%define rhel4 1}
 %{?build_rhel4:%define fc3 1}
@@ -162,10 +148,12 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %define rhel6 0
 %{?build_rhel6:%define rhel6 1}
 %{?build_el6:%define rhel6 1}
+%define rhel7 0
+%{?build_rhel7:%define rhel7 1}
+%{?build_el7:%define rhel7 1}
 # CentOS build
 %define centos3 0
 %{?build_centos3:%define centos3 1}
-%{?build_centos3:%define wb3 1}
 %define centos4 0
 %{?build_centos4:%define centos4 1}
 %{?build_centos4:%define fc3 1}
@@ -174,10 +162,11 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %{?build_centos5:%define fc6 1}
 %define centos6 0
 %{?build_centos6:%define centos6 1}
+%define centos7 0
+%{?build_centos7:%define centos7 1}
 # SL build
 %define sl3 0
 %{?build_sl3:%define sl3 1}
-%{?build_sl3:%define wb3 1}
 %define sl4 0
 %{?build_sl4:%define sl4 1}
 %{?build_sl4:%define fc3 1}
@@ -199,6 +188,8 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %{?build_su111:%define su111 1}
 %define su112 0
 %{?build_su112:%define su112 1}
+%define su113 0
+%{?build_su113:%define su113 1}
 %define su120 0
 %{?build_su120:%define su120 1}
 %define su131 0
@@ -214,13 +205,29 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %define client_only 0
 %{?build_client_only:%define client_only 1}
 
+# if the platform is using systemd
+%define usesystemd 0
+
+%if %{rhel7} || %{fc22}|| %{fc25} || %{fc26} || %{fc27} || %{centos7}
+%define usesystemd 1
+%endif
+
+# depending if we use systemd or not, we use chkconfig or systemctl
+%if %{usesystemd}
+%define service_enable    systemctl enable
+%define service_disable   systemctl disable
+%else
+%define service_enable    /sbin/chkconfig --add
+%define service_disable   /sbin/chkconfig --del
+%endif
+
 # Setup some short cuts
 %define rhat 0
 %if %{rh7} || %{rh8} || %{rh9}
 %define rhat 1
 %endif
 %define fed 0
-%if %{fc16} || %{fc17} || %{fc18}
+%if %{fc16} || %{fc17} || %{fc18} || %{fc22} || %{fc25} || %{fc26} || %{fc27}
 %define fed 1
 %endif
 %define suse 0
@@ -228,7 +235,7 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 %define suse 1
 %endif
 %define rhel 0
-%if %{rhel3} || %{rhel4} || %{rhel5} || %{rhel6} || %{centos3} || %{centos4} || %{centos5} || %{centos6}
+%if %{rhel3} || %{rhel4} || %{rhel5} || %{rhel6} || %{rhel7} || %{centos3} || %{centos4} || %{centos5} || %{centos6} || %{centos7}
 %define rhel 1
 %endif
 %define scil 0
@@ -238,13 +245,13 @@ Source2: Release_Notes-%{version}-%{release}.tar.gz
 
 
 # test for a platform definition
-%if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk} && !%{scil}
+%if !%{rhat} && !%{rhel} && !%{fed} && !%{suse} && !%{mdk} && !%{scil}
 %{error: You must specify a platform. Please examine the spec file.}
 exit 1
 %endif
 
 # distribution-specific directory for logwatch
-%if %{wb3} || %{rh7} || %{rh8} || %{rh9}
+%if %{rh7} || %{rh8} || %{rh9}
 %define logwatch_dir /etc/log.d
 %else
 %define logwatch_dir /etc/logwatch
@@ -283,54 +290,23 @@ exit 1
 %{?build_x86_64:%define x86_64 1}
 
 # check what distribution we are
-%if %{fc16} || %{fc17} || %{fc18}
+%if %{fc16} || %{fc17} || %{fc18} || %{fc22} || %{fc25} || %{fc26} || %{fc27}
 %define _dist %(grep Fedora /etc/redhat-release)
 %endif
+%if %{centos7} || %{centos6}
+%define _dist %(grep CentOS /etc/redhat-release)
+%endif
 %if %{centos5} || %{centos4} || %{centos3}
 %define _dist %(grep CentOS /etc/redhat-release)
 %endif
 %if %{sl5} ||%{sl4} || %{sl3}
 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
 %endif
-%if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
-%define _dist %(grep White /etc/whitebox-release)
-%endif
 %if %{suse}
 %define _dist %(grep -i SuSE /etc/SuSE-release)
 %endif
-%if %{mdk}
-%define _dist %(grep Mand /etc/mandrake-release)
-%endif
-%if %{rhat} || %{rhel}
-%define _dist %(grep Red /etc/redhat-release)
-%endif
-%{?DISTNAME:%define _dist %{DISTNAME}}
-
-# only set Disribution if not in opensuse build service, as it sets it itself
-%if ! 0%{?opensuse_bs}
-Distribution: %{_dist}
-%endif
-
-%if 0%{?opensuse_bs} &&  %{mysql} && %{suse}
-# needed in opensuse_bs, as rpm is installed during build process
-BuildRequires: libmysqlclient-devel
-BuildRequires: mysql-client
-BuildRequires: mysql
-%endif
-%if 0%{?opensuse_bs} &&  %{suse} && %{postgresql}
-BuildRequires: %{postgres_package}
-BuildRequires: %{postgres_server_package}
-%endif
-BuildRequires: openssl
-
-%if 0%{?opensuse_bs} && %{suse}
-BuildRequires: pwdutils
-BuildRequires: sysconfig
-%endif
 
-# should we turn on python support
-%define python 0
-%{?build_python:%define python 0}
+Distribution: %_dist
 
 # should we enable tcp wrappers support
 %define tcpwrappers 1
@@ -361,13 +337,10 @@ BuildRequires: libstdc++-devel, zlib-devel
 BuildRequires: openssl-devel
 BuildRequires: libacl-devel
 BuildRequires: pkgconfig
+BuildRequires: bzip2-devel
 %if ! %{rh7}
 BuildRequires: libxml2-devel
 %endif
-%if %{python}
-BuildRequires: python, python-devel
-%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
-%endif
 
 %if %{rh7}
 BuildRequires: libxml-devel
@@ -381,11 +354,7 @@ BuildRequires: glibc-static-devel
 BuildRequires: mysql-devel
 %endif
 
-%if %{postgresql} && %{wb3}
-BuildRequires: rh-postgresql-devel >= %{postgres_version}
-%endif
-
-%if %{postgresql} && ! %{wb3}
+%if %{postgresql}
 BuildRequires: %{postgres_devel_package} >= %{postgres_version}
 %endif
 
@@ -400,11 +369,20 @@ BuildRequires: %{postgres_devel_package} >= %{postgres_version}
 %{blurb7}
 %{blurb8}
 
+#
+# ===========================================================
+# Generate mysql, sqlite, or postgresql rpm
+# ===========================================================
+#
 %if %{mysql}
 %package mysql
-%endif
-%if %{sqlite}
-%package sqlite
+Provides: libbaccats-%{version}.so()(64bit)
+#
+# The following provides is to work around an 
+#  auto generated requires from src/scripts/logwatch/applybaculadate
+#  this is a gross kludge to keep it from being a requirement
+#
+Provides: perl(Logwatch)
 %endif
 %if %{postgresql}
 %package postgresql
@@ -426,10 +404,7 @@ Conflicts: bacula
 Requires: mysql
 %endif
 
-%if %{postgresql} && %{wb3}
-Requires: rh-postgresql >= 7
-%endif
-%if %{postgresql} && ! %{wb3}
+%if %{postgresql}
 Requires: postgresql >= 7
 %endif
 
@@ -443,10 +418,6 @@ Requires: postgresql >= 7
 %description postgresql
 %endif
 
-%if %{python}
-Requires: python >= %{pyver}
-%endif
-
 %{blurb}
 
 %{blurb2}
@@ -466,13 +437,17 @@ This build requires PostgreSQL to be installed separately as the catalog databas
 %if %{sqlite}
 This build incorporates sqlite3 as the catalog database, statically compiled.
 %endif
-%if %{python}
-This build includes python scripting support.
-%endif
 %if %{tcpwrappers}
 This build includes tcp-wrappers support.
 %endif
 
+
+
+#
+# ===========================================================
+# Client -- bacula-fd rpm
+# ===========================================================
+#
 %package client
 Summary: Bacula - The Network Backup Solution
 Group: System Environment/Daemons
@@ -486,13 +461,9 @@ Provides: %{product}
 Provides: %{product}-libs
 %endif
 
-Requires: libstdc++, zlib, openssl
+Requires: libstdc++, zlib, openssl, bzip2-libs
 Requires: glibc, readline, %{name}-libs
 
-%if %{python}
-Requires: python >= %{pyver}
-%endif
-
 %description client
 %{blurb}
 
@@ -506,13 +477,15 @@ Requires: python >= %{pyver}
 
 This is the File daemon (Client) only package. It includes the command line
 console program.
-%if %{python}
-This build includes python scripting support.
-%endif
 %if %{tcpwrappers}
 This build includes tcp-wrappers support.
 %endif
 
+#
+# ===========================================================
+# Generate updatedb rpm
+# ===========================================================
+#
 %if ! %{client_only}
 %package updatedb
 
@@ -534,6 +507,11 @@ This package installs scripts for updating older versions of the bacula
 database.
 %endif
 
+#
+# ===========================================================
+# Generate libs rpm
+# ===========================================================
+#
 %package libs
 
 Summary: Bacula - The Network Backup Solution
@@ -616,9 +594,6 @@ export LDFLAGS="${LDFLAGS} -L/usr/lib64"
 %if %{mysql} && %{x86_64}
 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
 %endif
-%if %{python} && %{x86_64}
-export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
-%endif
 
 export BACULA="Bacula"
 
@@ -640,21 +615,18 @@ export BACULA="Bacula"
 %if %{mysql}
         --with-mysql \
 %endif
-%if %{sqlite}
-        --with-sqlite3=${cwd}/%{depkgs}/sqlite3 \
-%endif
 %if %{postgresql}
         --with-postgresql \
 %endif
         --disable-bat \
-%if %{python}
-        --with-python \
-%endif
 %if %{client_only}
         --enable-client-only \
 %endif
 %if %{rh7} || %{rh8} || %{rh9}
         --disable-batch-insert \
+%endif
+%if %{usesystemd}
+        --with-systemd=%{systemd_dir} \
 %endif
         --with-tcp-wrappers  \
         --with-dir-user=%{director_daemon_user} \
@@ -696,11 +668,23 @@ mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
 
 make DESTDIR=$RPM_BUILD_ROOT install
 
+# bsnapshot
+make DESTDIR=$RPM_BUILD_ROOT -C ../bacula-%{_version}/src/tools/ install-bsnapshot
+
+%if %{usesystemd}
+make DESTDIR=$RPM_BUILD_ROOT -C platforms/systemd install-dir install-service
+%endif
+
 # Remove docs for programs that are depreciated
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
-# Storage-ctl packaged in shstore rpm
+
+# Remove docs for programs we do not distribute
+rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bpluginfo.8.%{manpage_ext}
+
+# Remove storage-ctl packaged in shstore rpm
 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
 rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
 
@@ -717,26 +701,38 @@ rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
 %endif
 
+# Remove symlinks
+#rm -f $RPM_BUILD_ROOT%{_libdir}/libbaccats.so
+#rm -f $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
+rm -f $RPM_BUILD_ROOT%{_libdir}/libbacsd.la
+
 # install the init scripts
+%if !%{usesystemd}
 %if %{suse}
 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
-%endif
+%endif                           # suse
 %if %{mdk}
 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
-%endif
+%endif                           # mdk
 %if ! %{suse} && ! %{mdk}
 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
-%endif
+%endif                           # !suse && !mdk
 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
+%endif                           # ! usesystemd
+
 %if %{client_only}
 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
+rm -f $RPM_BUILD_ROOT%{script_dir}/breload
+rm -f $RPM_BUILD_ROOT%{script_dir}/manual_prune.pl
+rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-dir.service
+rm -f $RPM_BUILD_ROOT%{systemd_dir}/bacula-sd.service
 %endif
 
 # install sqlite
@@ -755,8 +751,6 @@ cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
 
 # install specific scripts
 
-# install special upgrade script, except for sqlite3
-
 %if ! %{client_only}
 # install the sample-query.sql file
 cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
@@ -789,7 +783,6 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bregex.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bwild.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bpluginfo.8.gz
 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
@@ -803,17 +796,12 @@ rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
-rm -f $RPM_BUILD_ROOT%{_sbindir}/bpluginfo
 
 %endif
 
 %clean
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
-%if 0%{?opensuse_bs}
-rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-1.txt
-%else
 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
-%endif
 
 
 %if %{mysql}
@@ -828,26 +816,10 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
 %{_libdir}/libbaccats*
 %{_libdir}/libbacsql*
-%endif
-
-%if %{sqlite}
-%files sqlite
-%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
-%attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
-%attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
-%{sqlite_bindir}/libsqlite3.a
-%{sqlite_bindir}/sqlite3.h
-%{sqlite_bindir}/sqlite3
-%{_libdir}/libbaccats*
-%{_libdir}/libbacsql*
+%{_libdir}/libbacsd*.so
 %endif
 
 
-
 %if %{postgresql}
 %files postgresql
 %defattr(-,root,root)
@@ -859,6 +831,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(755, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
 %{_libdir}/libbaccats*
 %{_libdir}/libbacsql*
+%{_libdir}/libbacsd*.so
 %endif
 
 # The rest is DB backend independent
@@ -866,7 +839,6 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %if ! %{client_only}
 %attr(-, root, %{daemon_group}) %dir %{script_dir}
 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
-#%attr(-, %{director_daemon_user}, %{daemon_group}) %dir %{log_dir}
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
@@ -886,16 +858,24 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
+%attr(-, root, %{daemon_group}) %{script_dir}/tapealert
+%attr(-, root, %{daemon_group}) %{script_dir}/baculabackupreport
+
 %attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
-%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
-%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
 %attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
-%attr(-, root, %{daemon_group}) %{_sbindir}/bpluginfo
-%attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
-%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{script_dir}/mtx-changer.conf
 
+%if %{usesystemd}
+%attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-dir.service
+%attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-fd.service
+%attr(-, root, %{daemon_group}) %{systemd_dir}/bacula-sd.service
+%else
+%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
+%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
+%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
+%endif
+
 /etc/logrotate.d/bacula
 %{logwatch_dir}/scripts/services/bacula
 %{logwatch_dir}/scripts/shared/applybaculadate
@@ -906,6 +886,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
 %attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
+%attr(-, root, %{daemon_group}) %{script_dir}/query.sql
 
 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
 
@@ -913,9 +894,15 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{_sbindir}/bacula-sd
 %attr(-, root, %{daemon_group}) %{_sbindir}/btraceback
 %attr(-, root, %{daemon_group}) %{_sbindir}/bconsole
+%attr(-, root, %{daemon_group}) %{_sbindir}/bbconsjson
 %attr(-, root, %{daemon_group}) %{_sbindir}/bsmtp
 %attr(-, root, %{daemon_group}) %{_sbindir}/bscan
 %attr(-, root, %{daemon_group}) %{_sbindir}/btape
+%attr(-, root, %{daemon_group}) %{_sbindir}/bdirjson
+%attr(-, root, %{daemon_group}) %{_sbindir}/bsdjson
+
+%attr(755, root, root) %{_sbindir}/bsnapshot
+%attr(755, root, root) %{_sbindir}/bfdjson
 
 %{_sbindir}/bacula-fd
 %{_sbindir}/bacula
@@ -940,16 +927,12 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %{_mandir}/man8/bwild.8.%{manpage_ext}
 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
 %{_mandir}/man1/bat.1.%{manpage_ext}
-%{_mandir}/man8/bpluginfo.8.gz
-
 %_prefix/share/doc/*
 
-# opensuse build service changes the release itself
-%if 0%{?opensuse_bs}
-%doc ../Release_Notes-%{version}-1.txt
-%else
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-tray-monitor.desktop
+
 %doc ../Release_Notes-%{version}-%{release}.txt
-%endif
+
 %endif
 
 %if %{mysql}
@@ -1079,14 +1062,14 @@ fi
 # add our links
 if [ "$1" -ge 1 ] ; then
 %if %{suse} && %{mysql}
-  /sbin/chkconfig --add mysql
+  %{service_enable} mysql
 %endif
 %if %{suse} && %{postgresql}
-  /sbin/chkconfig --add postgresql
+  %{service_enable} postgresql
 %endif
-  /sbin/chkconfig --add bacula-dir
-  /sbin/chkconfig --add bacula-fd
-  /sbin/chkconfig --add bacula-sd
+  %{service_enable} bacula-dir
+  %{service_enable} bacula-fd
+  %{service_enable} bacula-sd
 fi
 %endif
 
@@ -1103,6 +1086,9 @@ if [ -d %{sysconf_dir} ]; then
        done
    fi
    host=`hostname -s`
+   if [ "$host" = "" ]; then
+       host=localhost
+   fi
    for file in *.conf; do
       sed -f .rpm.sed $file > $file.new
       sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
@@ -1212,6 +1198,9 @@ if [ -d %{sysconf_dir} ]; then
        done
    fi
    host=`hostname -s`
+   if [ "$host" = "" ]; then
+       host=localhost
+   fi
    for file in *.conf; do
       sed -f .rpm.sed $file > $file.new
       sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
@@ -1234,9 +1223,9 @@ fi
 %if ! %{client_only}
 # delete our links
 if [ $1 = 0 ]; then
-  /sbin/chkconfig --del bacula-dir
-  /sbin/chkconfig --del bacula-fd
-  /sbin/chkconfig --del bacula-sd
+  %{service_disable} bacula-dir
+  %{service_disable} bacula-fd
+  %{service_disable} bacula-sd
 fi
 %endif
 
@@ -1244,10 +1233,17 @@ fi
 %defattr(-,root,root)
 %attr(-, root, %{daemon_group}) %dir %{script_dir}
 %attr(-, root, %{daemon_group}) %dir %{plugin_dir}
-#%attr(-, root, %{daemon_group}) %dir %{log_dir}
 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+
+# SD/DIR might write here
+%attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{log_dir}
+
+%if %{usesystemd}
+%attr(-, root, %{daemon_group})  %{systemd_dir}/bacula-fd.service
+%else
 %{script_dir}/bacula-ctl-fd
 /etc/init.d/bacula-fd
+%endif
 
 /etc/logrotate.d/bacula
 
@@ -1295,7 +1291,7 @@ fi
 %post client
 # add our link
 if [ "$1" -ge 1 ] ; then
-   /sbin/chkconfig --add bacula-fd
+   %{service_enable} bacula-fd
 fi
 
 if [ -d %{sysconf_dir} ]; then
@@ -1311,6 +1307,9 @@ if [ -d %{sysconf_dir} ]; then
        done
    fi
    host=`hostname -s`
+   if [ "$host" = "" ]; then
+       host=localhost
+   fi
    for file in *.conf; do
       sed -f .rpm.sed $file > $file.new
       sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
@@ -1321,7 +1320,7 @@ fi
 %preun client
 # delete our link
 if [ $1 = 0 ]; then
-   /sbin/chkconfig --del bacula-fd
+   %{service_disable} bacula-fd
 fi
 
 %files libs
@@ -1343,8 +1342,6 @@ exit 0
 %files updatedb
 %defattr(-,root,%{daemon_group})
 %{script_dir}/updatedb/*
-#oensuse_bs: directories not owned by any package
-#%{script_dir}/updatedb
 
 %pre updatedb
 # create the daemon group