[yum-updatesd] convert to systemd file

Tom Callaway spot at fedoraproject.org
Thu Sep 8 14:38:47 UTC 2011


commit 952099ba1a529b26079f3191d35b59b8ef9ed5f5
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Thu Sep 8 10:38:35 2011 -0400

    convert to systemd file

 yum-updatesd.service |   11 +++++++++++
 yum-updatesd.spec    |   42 +++++++++++++++++++++---------------------
 2 files changed, 32 insertions(+), 21 deletions(-)
---
diff --git a/yum-updatesd.service b/yum-updatesd.service
new file mode 100644
index 0000000..c59d151
--- /dev/null
+++ b/yum-updatesd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=YUM Package	Update Service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=edu.duke.linux.yum
+ExecStart=/usr/sbin/yum-updatesd -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/yum-updatesd.spec b/yum-updatesd.spec
index 30d80ec..739c430 100644
--- a/yum-updatesd.spec
+++ b/yum-updatesd.spec
@@ -2,23 +2,21 @@ Summary: Update notification daemon
 Name: yum-updatesd
 Epoch: 1
 Version: 0.9
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv2
 Group: System Environment/Base
 Source0: %{name}-%{version}.tar.bz2
+Source1: %{name}.service
 URL: http://linux.duke.edu/yum/
 BuildArch: noarch
 BuildRequires: python
+BuildRequires: systemd-units
 Requires: python >= 2.4
 Requires: yum >= 3.2.0
 Requires: dbus-python
 Requires: pygobject2
 Requires: gamin-python
-Requires(preun): /sbin/chkconfig
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/service
-Requires(post): /sbin/service
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires(post): systemd-units
 
 %description
 yum-updatesd provides a daemon which checks for available updates and 
@@ -31,28 +29,27 @@ can notify you when they are available via email, syslog or dbus.
 make
 
 %install
-rm -rf $RPM_BUILD_ROOT
 make DESTDIR=$RPM_BUILD_ROOT install
 
-%clean
-rm -rf $RPM_BUILD_ROOT
+# Don't need the old sysv initscript anymore
+rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
 
-%post
-/sbin/chkconfig --add yum-updatesd
-/sbin/service yum-updatesd condrestart >/dev/null 2>&1
-exit 0
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
 
-%preun
-if [ $1 = 0 ]; then
- /sbin/chkconfig --del yum-updatesd
- /sbin/service yum-updatesd stop >/dev/null 2>&1
-fi
-exit 0
+%triggerun -- yum-updatesd < 0.9-5
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply yum-updatesd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save httpd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del httpd >/dev/null 2>&1 || :
+/bin/systemctl try-restart apache-httpd.service >/dev/null 2>&1 || :
 
 %files
-%defattr(-,root,root,-)
 %doc COPYING
-%{_sysconfdir}/rc.d/init.d/yum-updatesd
+%{_unitdir}/%{name}.service
 %config(noreplace) %{_sysconfdir}/yum/yum-updatesd.conf
 %config %{_sysconfdir}/dbus-1/system.d/yum-updatesd.conf
 %{_sbindir}/yum-updatesd
@@ -61,6 +58,9 @@ exit 0
 
 
 %changelog
+* Thu Sep 08 2011 Tom Callaway <spot at fedoraproject.org> - 1:0.9-5
+- update to systemd service
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:0.9-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list