[edac-utils] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Wed Mar 14 17:45:56 UTC 2012
commit 349eb8ed77dda387a4a2eb17475bdeaf2acb1832
Author: Jon Ciesla <limburgher at gmail.com>
Date: Wed Mar 14 12:45:47 2012 -0500
Migrate to systemd.
edac-utils.spec | 51 +++++++++++++++++++++++++++++++++++++++++++--------
edac.service | 11 +++++++++++
2 files changed, 54 insertions(+), 8 deletions(-)
---
diff --git a/edac-utils.spec b/edac-utils.spec
index 9e3e399..4879131 100644
--- a/edac-utils.spec
+++ b/edac-utils.spec
@@ -1,12 +1,13 @@
Name: edac-utils
Version: 0.9
-Release: 13%{?dist}
+Release: 14%{?dist}
Summary: Userspace helper for kernel EDAC drivers
Group: System Environment/Base
License: GPLv2+
URL: http://sourceforge.net/projects/edac-utils/
Source0: http://dl.sourceforge.net/sourceforge/edac-utils/%{name}-%{version}.tar.bz2
+Source1: edac.service
Patch0: edac_ctl-remove_driver_loading.patch
Patch1: edac_init-fix_messages.patch
Patch2: edac_ctl-fix_model_parsing.patch
@@ -15,6 +16,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Requires: hwdata, dmidecode, sysfsutils
BuildRequires: libsysfs-devel
ExclusiveArch: %{ix86} x86_64
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
EDAC is the current set of drivers in the Linux kernel that handle
@@ -49,22 +53,50 @@ make install-exec install-data DESTDIR="$RPM_BUILD_ROOT"
# Remove libtool archive
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la
+install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/edac.service
+rm -f $RPM_BUILD_ROOT%{_sysconfdir}/init.d/edac
+
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
-if [ $1 = 1 ]; then
- /sbin/chkconfig --add edac
+#if [ $1 = 1 ]; then
+# /sbin/chkconfig --add edac
+#fi
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
-if [ $1 = 0 ]; then
- /sbin/service edac stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del edac
+#if [ $1 = 0 ]; then
+# /sbin/service edac stop >/dev/null 2>&1 || :
+# /sbin/chkconfig --del edac
+#fi
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable edac.service > /dev/null 2>&1 || :
+ /bin/systemctl stop edac.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/sbin/ldconfig
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart edac.service >/dev/null 2>&1 || :
fi
-%postun -p /sbin/ldconfig
+%triggerun -- edac-utils < 0.9-14
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply edac
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save edac >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del edac >/dev/null 2>&1 || :
+/bin/systemctl try-restart edac.service >/dev/null 2>&1 || :
%files
%defattr(-,root,root,-)
@@ -75,7 +107,7 @@ fi
%{_mandir}/*/*
%dir %attr(0755,root,root) %{_sysconfdir}/edac
%config(noreplace) %{_sysconfdir}/edac/*
-%{_sysconfdir}/init.d/edac
+%{_unitdir}/edac.service
%files devel
%defattr(-,root,root,-)
@@ -83,6 +115,9 @@ fi
%{_includedir}/edac.h
%changelog
+* Wed Mar 14 2012 Jon Ciesla <limburgher at gmail.com> - 0.9-14
+- Migrate to systemd, BZ 767784.
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.9-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
diff --git a/edac.service b/edac.service
new file mode 100644
index 0000000..b94a4b6
--- /dev/null
+++ b/edac.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Initialize EDAC Drivers For Machine Hardware
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/edac-ctl --register-labels
+ExecStop=/usr/sbin/edac-ctl --unload
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
More information about the scm-commits
mailing list