[and/f15/master] Rework for systemd

Jochen Schmitt s4504kr at fedoraproject.org
Thu Mar 31 20:03:44 UTC 2011


commit 3b3bfa08c9af7817d6aa082086a1c2966f09e6e2
Author: Jochen Schmitt <Jochen at herr-schmitt.de>
Date:   Thu Mar 31 22:02:09 2011 +0200

    Rework for systemd

 and.spec |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/and.spec b/and.spec
index ccd7bbf..93c6a53 100644
--- a/and.spec
+++ b/and.spec
@@ -1,6 +1,6 @@
 Name:      and
 Version:   1.2.2
-Release:   11%{?dist}
+Release:   12%{?dist}
 Summary:   Auto nice daemon
 
 License:   GPLv2
@@ -20,6 +20,21 @@ Provides:  and-sysvinit = %{version}-%{release}
 Obsoletes:  and-units < %{version}-%{release}
 Provides:   and-units = %{version}-%{release}
 
+BuildRequires:	systemd-units
+
+Requires(post):	systemd-units
+Requires(preun):	systemd-units
+Requires(postun):	systemd-units
+
+provides:	and-sysvinit = %{version}-%{release}
+Obsoletes:	and-sysvinit < 1.2.2-11
+
+provides:	and-units = %{version}-%{release}
+Obsoletes:	and-units < 1.2.2-11
+
+
+Buildroot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
+
 %description
 The auto nice daemon renices and even kills jobs according to their CPU time,
 owner, and command name. This is especially useful on production machines with
@@ -52,18 +67,26 @@ make PREFIX=%{buildroot}%{_prefix} \
 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
 install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/and
 
-mkdir -p %{buildroot}/lib/systemd/system
-install -p -m 0644 %{SOURCE2} %{buildroot}/lib/systemd/system
+mkdir -p %{buildroot}%{_unitdir}
+install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}
 
 %clean
 rm -rf %{buildroot}
 
 %post
-/usr/bin/systemd-install --realize=minimal enable amd.service >/dev/null 2>&1 || :
+if [ $1 -eq 1 ]; then
+   /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [$1 -eq ß ]; then
-   /usr/bin/system-install --realize disable amd.service </dev/null 2>&1 || :
+if [ $1 -eq 1 ]; then
+   /bin/systemctl --no-reload disable and.service >/dev/null 2>&1 || :
+   /bin/systemctl stop and.service >/dev/null 2>&1 || :
+fi
+
+%postun
+if [ $0 -en 0 ]; then
+   /bin/systemctl try-restart and.service >/dev/null 2>&1 || :
 fi
 
 %files
@@ -74,16 +97,19 @@ fi
 %{_sbindir}/*
 %{_mandir}/man5/*.gz
 %{_mandir}/man8/*.gz
-/lib/systemd/system/and.service
+%{_unitdir}/and.service
 
 %changelog
+* Thu Mar 31 2011 Jochen Schmitt <Jochen herr-schmitt de> 1.2.2-12
+- Rework for systemd
+
 * Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.2-11
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
-* Sun Nov 28 2010 Jochen Schmitt <Jochen herr-schmitt de> - 1.2.2-10
+* Sun Nov 28 2010 Jochen Schmitt <Jochen herr-schmitt de> 1.2.2-10
 - Remove SysVInit support
 
-* Sun Jul 18 2010 Jochen Schmitt <Jochen herr-schmitt de> - 1.2.2-9
+* Sun Jul 18 2010 Jochen Schmitt <Jochen herr-schmitt de> 1.2.2-9
 - Try to add systemd support
 
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.2-8


More information about the scm-commits mailing list