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 <bhe@redhat.com>
Acked-by: WANG Chao <chaowang@redhat.com>
This commit is contained in:
Baoquan He 2013-06-25 13:30:59 +08:00
parent 67667bdd66
commit bdb3042f07

View File

@ -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/ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
%post %post
if [ $1 -eq 1 ] ; then # Initial installation
# Initial installation %systemd_post kdump.service
/bin/systemctl enable kdump.service >/dev/null 2>&1 || :
fi
touch /etc/kdump.conf touch /etc/kdump.conf
# This portion of the script is temporary. Its only here # This portion of the script is temporary. Its only here
# to fix up broken boxes that require special settings # to fix up broken boxes that require special settings
@ -229,18 +228,11 @@ fi
%postun %postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || : %systemd_postun_with_restart kdump.service
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart kdump.service >/dev/null 2>&1 || :
fi
%preun %preun
if [ $1 -eq 0 ] ; then # Package removal, not upgrade
# Package removal, not upgrade %systemd_preun kdump.service
/bin/systemctl --no-reload disable kdump.service > /dev/null 2>&1 || :
/bin/systemctl stop kdump.service > /dev/null 2>&1 || :
fi
%triggerun -- kexec-tools < 2.0.2-3 %triggerun -- kexec-tools < 2.0.2-3
# Save the current service runlevel info # Save the current service runlevel info