[bacula/f17] Add F18 systemd macros and refresh distro checks
Simone Caronni
slaanesh at fedoraproject.org
Tue Sep 11 08:07:44 UTC 2012
commit 2529f6ce9dcaae8ceee3eceea2a58cbb741dad88
Author: Simone Caronni <negativo17 at gmail.com>
Date: Tue Sep 11 10:04:59 2012 +0200
Add F18 systemd macros and refresh distro checks
bacula.spec | 90 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 72 insertions(+), 18 deletions(-)
---
diff --git a/bacula.spec b/bacula.spec
index 57e7887..31b385e 100644
--- a/bacula.spec
+++ b/bacula.spec
@@ -3,7 +3,7 @@
Name: bacula
Version: 5.2.10
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Cross platform network backup for Linux, Unix, Mac and Windows
# See LICENSE for details
License: AGPLv3 with exceptions
@@ -54,17 +54,17 @@ BuildRequires: readline-devel
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
BuildRequires: qt4-devel >= 4.6.2
%endif
-%if 0%{?fedora} >= 7 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
BuildRequires: tcp_wrappers-devel
%else
BuildRequires: tcp_wrappers
%endif
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires: systemd-units
%endif
@@ -141,7 +141,7 @@ Provides: bacula-director-sqlite = %{version}-%{release}
Obsoletes: bacula-director-sqlite < 5.2.3-5
Provides: bacula-director-postgresql = %{version}-%{release}
Obsoletes: bacula-director-postgresql < 5.2.3-5
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
@@ -174,7 +174,7 @@ Provides: bacula-storage-sqlite = %{version}-%{release}
Obsoletes: bacula-storage-sqlite < 5.2.0
Provides: bacula-storage-postgresql = %{version}-%{release}
Obsoletes: bacula-storage-postgresql < 5.2.0
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
@@ -200,7 +200,7 @@ devices.
Summary: Bacula backup client
Group: System Environment/Daemons
Requires: bacula-common%{?_isa} = %{version}-%{release}
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
@@ -237,7 +237,7 @@ This package contains the command-line management console for the bacula backup
system.
-%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
%package console-bat
Summary: Bacula bat console
Group: System Environment/Daemons
@@ -337,7 +337,7 @@ export CPPFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/ncurses"
$*
}
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
export QMAKE=/usr/bin/qmake-qt4
build --enable-bat --htmldir=%{_datadir}/doc/bacula-console-bat-%{version}
%else
@@ -354,7 +354,7 @@ pushd examples/nagios/check_bacula
CFLAGS="%{optflags}" make LIBS="-lpthread -ldl -lssl -lcrypto -lz"
popd
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
pushd src/qt-console/tray-monitor
/usr/bin/qmake-qt4
make %{?_smp_mflags}
@@ -377,7 +377,7 @@ rm -f %{buildroot}%{_libdir}/libbaccats-%{version}.so
# Sample query file
mv %{buildroot}%{_libexecdir}/bacula/query.sql %{buildroot}%{_sysconfdir}/bacula/query.sql
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
# Bat
install -p -m 644 -D src/qt-console/images/bat_icon.png %{buildroot}%{_datadir}/pixmaps/bat.png
desktop-file-install --vendor="fedora" --dir=%{buildroot}%{_datadir}/applications %{SOURCE13}
@@ -403,7 +403,7 @@ install -p -m 644 -D scripts/logwatch/logfile.bacula.conf %{buildroot}%{_sysconf
install -p -m 644 -D scripts/logwatch/services.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/services/bacula.conf
install -p -m 755 -D %{SOURCE19} %{buildroot}%{_sbindir}/bacula-checkconf
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
# Systemd unit files
mkdir -p %{buildroot}%{_unitdir}
install -p -m 755 -D %{SOURCE10} %{buildroot}%{_unitdir}/bacula-fd.service
@@ -507,7 +507,9 @@ test "$1" != 0 || userdel %username &>/dev/null || :
test "$1" != 0 || groupdel %username &>/dev/null || :
exit 0
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+# Until this is fixed upstream in fedpkg, leave it like this
+# http://permalink.gmane.org/gmane.linux.redhat.fedora.devel/168291
+%if (0%{?fedora} == 16 || 0%{?fedora} == 17) && !0%{?rhel}
%post client
if [ $1 -eq 1 ] ; then
@@ -610,7 +612,55 @@ fi
/sbin/chkconfig --del bacula-sd >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
-%else
+%endif
+
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+
+%post client
+%systemd_post %{name}-fd.service
+
+%preun client
+%systemd_preun %{name}-fd.service
+
+%postun client
+%systemd_postun_with_restart %{name}-fd.service
+
+%triggerun client -- bacula-client < 5.0.3-10
+/usr/bin/systemd-sysv-convert --save bacula-fd >/dev/null 2>&1 ||:
+/sbin/chkconfig --del bacula-fd >/dev/null 2>&1 || :
+/bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
+
+%post director
+%systemd_post %{name}-dir.service
+
+%preun director
+%systemd_preun %{name}-dir.service
+
+%postun director
+%systemd_postun_with_restart %{name}-dir.service
+
+%triggerun director -- bacula-director-common < 5.0.3-10
+/usr/bin/systemd-sysv-convert --save bacula-dir >/dev/null 2>&1 ||:
+/sbin/chkconfig --del bacula-dir >/dev/null 2>&1 || :
+/bin/systemctl try-restart bacula-dir.service >/dev/null 2>&1 || :
+
+%post storage
+%systemd_post %{name}-sd.service
+
+%preun storage
+%systemd_preun %{name}-sd.service
+
+%postun storage
+%systemd_postun_with_restart %{name}-sd.service
+
+%triggerun storage -- bacula-storage-common < 5.0.3-10
+/usr/bin/systemd-sysv-convert --save bacula-sd >/dev/null 2>&1 ||:
+/sbin/chkconfig --del bacula-sd >/dev/null 2>&1 || :
+/bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
+
+%endif
+
+%if 0%{?rhel} == 6
%post client
/sbin/chkconfig --add bacula-fd
@@ -713,7 +763,7 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/bacula-dir
%{_sysconfdir}/logwatch/scripts/services/bacula
%{_sysconfdir}/logwatch/scripts/shared/applybaculadate
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
%{_unitdir}/bacula-dir.service
%else
%{_initrddir}/bacula-dir
@@ -765,7 +815,7 @@ fi
%{_sbindir}/btape
%attr(640,root,root) %config(noreplace) %{_sysconfdir}/bacula/bacula-sd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/bacula-sd
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
%{_unitdir}/bacula-sd.service
%else
%{_initrddir}/bacula-sd
@@ -784,7 +834,7 @@ fi
%files client
%defattr(-,root,root,-)
%{_sbindir}/bacula-fd
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
%{_unitdir}/bacula-fd.service
%else
%{_initrddir}/bacula-fd
@@ -800,7 +850,7 @@ fi
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/bacula/bconsole.conf
%{_mandir}/man8/bconsole.8.*
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
%files console-bat
%defattr(-,root,root,-)
%doc %{_datadir}/doc/bacula-console-bat-%{version}/*
@@ -837,6 +887,10 @@ fi
%changelog
+* Tue Sep 11 2012 Simone Caronni <negativo17 at gmail.com> - 5.2.10-7
+- Add Fedora 18 systemd macros.
+- Remove old distribution checks.
+
* Wed Aug 29 2012 Simone Caronni <negativo17 at gmail.com> - 5.2.10-6
- Remove user definition during prep so they are not used during the install
phase (rhbz#852732).
More information about the scm-commits
mailing list