[func] Restoring systemd-related fixes
ssalevan
ssalevan at fedoraproject.org
Mon Oct 15 22:53:11 UTC 2012
commit f82e75a02335a3bb27946d90730c838480fae7ca
Author: Steve Salevan <steve at tumblr.com>
Date: Mon Oct 15 18:52:57 2012 -0400
Restoring systemd-related fixes
func.spec | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/func.spec b/func.spec
index 21d5d06..387c0f6 100644
--- a/func.spec
+++ b/func.spec
@@ -27,6 +27,13 @@ BuildRequires: python-setuptools
%endif
%endif
%endif
+%if 0%{?fedora} >= 16
+BuildRequires: systemd-units
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
Url: https://fedorahosted.org/func/
@@ -46,6 +53,12 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
touch $RPM_BUILD_ROOT/var/log/func/func.log
touch $RPM_BUILD_ROOT/var/log/func/audit.log
+%if 0%{?fedora} >= 16
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/funcd.service
+rm -rf $RPM_BUILD_ROOT/etc/init.d
+%endif
+
%clean
rm -fr $RPM_BUILD_ROOT
@@ -129,6 +142,12 @@ rm -fr $RPM_BUILD_ROOT
%{_mandir}/man1/func-create-module.1.gz
%post
+# systemd
+if [ -x /bin/systemctl ]; then
+ if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ fi
# for suse
if [ -x /usr/lib/lsb/install_initd ]; then
/usr/lib/lsb/install_initd /etc/init.d/funcd
@@ -155,7 +174,11 @@ exit 0
%preun
if [ "$1" = 0 ] ; then
/etc/init.d/funcd stop > /dev/null 2>&1
- if [ -x /usr/lib/lsb/remove_initd ]; then
+ if [ -x /bin/systemctl ]; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable funcd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop funcd.service > /dev/null 2>&1 || :
+ elif [ -x /usr/lib/lsb/remove_initd ]; then
/usr/lib/lsb/remove_initd /etc/init.d/funcd
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del funcd
@@ -164,6 +187,26 @@ if [ "$1" = 0 ] ; then
fi
fi
+%postun
+if [ -x /bin/systemctl ]; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart funcd.service >/dev/null 2>&1 || :
+ fi
+fi
+
+%if 0%{?fedora} >= 16
+%triggerun -- func < 0.28-2
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply funcd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save funcd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del funcd >/dev/null 2>&1 || :
+/bin/systemctl try-restart funcd.service >/dev/null 2>&1 || :
+%endif
%changelog
More information about the scm-commits
mailing list