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/
%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