[ipmitool] convert to systemd

Tom Callaway spot at fedoraproject.org
Mon Sep 12 13:19:47 UTC 2011


commit 3938dcea8f81a8574ff7788acd87a3a35a6b54cc
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Mon Sep 12 09:19:34 2011 -0400

    convert to systemd

 ipmievd.service |   10 ++++++++++
 ipmitool.spec   |   51 ++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 44 insertions(+), 17 deletions(-)
---
diff --git a/ipmievd.service b/ipmievd.service
new file mode 100644
index 0000000..82855c2
--- /dev/null
+++ b/ipmievd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Ipmievd Daemon 
+After=syslog.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/ipmievd
+ExecStart=/usr/sbin/ipmievd $IPMIEVD_OPTIONS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ipmitool.spec b/ipmitool.spec
index 030aad6..fd4a1e5 100644
--- a/ipmitool.spec
+++ b/ipmitool.spec
@@ -1,16 +1,19 @@
 Name:         ipmitool
 Summary:      Utility for IPMI control
 Version:      1.8.11
-Release:      6%{?dist}
+Release:      7%{?dist}
 License:      BSD
 Group:        System Environment/Base
 URL:          http://ipmitool.sourceforge.net/
 Source0:      http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
 Source1:      openipmi-ipmievd.sysconf
-Buildroot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Source2:      ipmievd.service
 BuildRequires: openssl-devel readline-devel ncurses-devel
-Requires(post): chkconfig
-Requires(preun): chkconfig
+BuildRequires: systemd-units
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 Obsoletes: OpenIPMI-tools < 2.0.14-3
 Provides: OpenIPMI-tools = 2.0.14-3
 
@@ -52,33 +55,44 @@ done
 make %{?_smp_mflags}
 
 %install
-rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
 
-install -Dpm 755 contrib/ipmievd.init.redhat %{buildroot}%{_initrddir}/ipmievd
+install -Dpm 644 ipmievd.service %{buildroot}%{_unitdir}/ipmievd.service
 install -Dpm 644 %SOURCE1 %{buildroot}%{_sysconfdir}/sysconfig/ipmievd
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %post
-/sbin/chkconfig --add ipmievd
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 = 0 ]; then
-   service ipmievd stop >/dev/null 2>&1
-   /sbin/chkconfig --del ipmievd
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable ipmievd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop ipmievd.service > /dev/null 2>&1 || :
 fi
 
 %postun
-if [ "$1" -ge "1" ]; then
-    service ipmievd condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart ipmievd.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- ipmievd < 1.8.11-7
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply ipmievd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save ipmievd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del ipmievd >/dev/null 2>&1 || :
+/bin/systemctl try-restart ipmievd.service >/dev/null 2>&1 || :
+
 %files
-%defattr(-,root,root)
 %config(noreplace) %{_sysconfdir}/sysconfig/ipmievd
-%{_initrddir}/ipmievd
+%{_unitdir}/ipmievd.service
 %{_bindir}/*
 %{_sbindir}/*
 %{_mandir}/man*/*
@@ -87,6 +101,9 @@ fi
 
 
 %changelog
+* Mon Sep 12 2011 Tom Callaway <spot at fedoraproject.org> - 1.8.11-7
+- convert to systemd
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.11-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list