From bdb3042f07c559b57a095afe9a3bdc37140a58f5 Mon Sep 17 00:00:00 2001 From: Baoquan He Date: Tue, 25 Jun 2013 13:30:59 +0800 Subject: [PATCH] kexec-tools.spec: replaces scriptlets with new systemd macros Fedora 18 changes the way how to work with services in spec files. It introduces new macros - %systemd_post, %systemd_preun and %systemd_postun. These macros are functionally equivalent to the manual scriptlets used in older versions of Fedora. By using the new unified RPM macros the .spec file code is simplified a lot. Signed-off-by: Baoquan He Acked-by: WANG Chao --- kexec-tools.spec | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index 8334055..8e92e5e 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -200,10 +200,9 @@ mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ %post -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl enable kdump.service >/dev/null 2>&1 || : -fi +# Initial installation +%systemd_post kdump.service + touch /etc/kdump.conf # This portion of the script is temporary. Its only here # to fix up broken boxes that require special settings @@ -229,18 +228,11 @@ fi %postun -/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 +%systemd_postun_with_restart kdump.service %preun -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 +# Package removal, not upgrade +%systemd_preun kdump.service %triggerun -- kexec-tools < 2.0.2-3 # Save the current service runlevel info