[kexec-tools/f16] fix systemd scriptlets

Tom Callaway spot at fedoraproject.org
Fri Sep 9 19:03:10 UTC 2011


commit 80571bbe097b33ae079892e04702c0b0df6fcbe8
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Fri Sep 9 15:02:57 2011 -0400

    fix systemd scriptlets

 kexec-tools.spec |   50 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/kexec-tools.spec b/kexec-tools.spec
index fab9eb1..6e855e7 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -1,6 +1,6 @@
 Name: kexec-tools
 Version: 2.0.2
-Release: 28%{?dist}
+Release: 29%{?dist}
 License: GPLv2
 Group: Applications/System
 Summary: The kexec/kdump userspace component.
@@ -29,12 +29,15 @@ Source17: mkdumpramfs
 #######################################
 Source100: dracut-files.tbz2
 
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Requires(pre): coreutils chkconfig sed zlib 
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(pre): coreutils sed zlib 
 Requires: busybox >= 1.2.0, dracut
 BuildRequires: dash 
 BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel 
 BuildRequires: pkgconfig intltool gettext 
+BuildRequires: systemd-units
 %ifarch %{ix86} x86_64 ppc64 ia64 ppc
 Obsoletes: diskdumputils netdump
 %endif
@@ -130,7 +133,6 @@ make -C makedumpfile-1.3.5
 make -C kexec-tools-po
 
 %install
-rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
 mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
 mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
@@ -157,7 +159,7 @@ install -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/kdump/firstboot_kdump.py
 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
 install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/98-kexec.rules
 install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
-install -m 644 %{SOURCE16} $RPM_BUILD_ROOT/lib/systemd/system/kdump.service
+install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
 
 %ifarch %{ix86} x86_64 ia64 ppc64
 install -m 755 makedumpfile-1.3.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
@@ -177,10 +179,11 @@ chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/kd
 mkdir -p $RPM_BUILD_ROOT/usr/share/dracut/modules.d/
 mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/usr/share/dracut/modules.d/
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %post
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 touch /etc/kdump.conf
 /sbin/chkconfig --add kdump
 # This portion of the script is temporary.  Its only here
@@ -207,16 +210,29 @@ fi
 
 
 %postun
-
-if [ "$1" -ge 1 ]; then
-	systemctl try-restart kdump.service &> /dev/null || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart kdump.service >/dev/null 2>&1 || :
 fi
 
 %preun
-if [ "$1" = 0 ]; then
-	systemctl disable kdump.service &> /dev/null || :
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable kdump.service > /dev/null 2>&1 || :
+    /bin/systemctl stop kdump.service > /dev/null 2>&1 || :
 fi
-exit 0
+
+%triggerun -- kexec-tools < 2.0.2-3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply kdump
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save kdump >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del kdump >/dev/null 2>&1 || :
+/bin/systemctl try-restart kdump.service >/dev/null 2>&1 || :
+
 
 %triggerin -- firstboot
 # we enable kdump everywhere except for paravirtualized xen domains; check here
@@ -263,7 +279,6 @@ do
 done
 
 %files -f %{name}.lang
-%defattr(-,root,root,-)
 /sbin/*
 %{_bindir}/*
 %{_datadir}/kdump
@@ -274,7 +289,7 @@ done
 %dir %{_localstatedir}/crash
 %{_mandir}/man8/*
 %{_mandir}/man5/*
-/lib/systemd/system/*
+%{_unitdir}/kdump.service
 %doc News
 %doc COPYING
 %doc TODO
@@ -282,6 +297,9 @@ done
 
 
 %changelog
+* Fri Sep 9 2011 Tom Callaway <spot at fedoraproject.org> - 2.0.2-29
+- fix systemd scriptlets
+
 * Wed Sep 7 2011 Cong Wang <xiyou.wangcong at gmail.com> - 2.0.2-28
 - Rename mkdumprd2 to mkdumpramfs.
 


More information about the scm-commits mailing list