Stop enabling services in %post

Since we enable cloud-init services in the cloud product kickstart
enabling the service in %post is no longer necessary.  This also makes
now a convenient time to switch to systemd's rpm script macros as well.

https://bugzilla.redhat.com/show_bug.cgi?id=850058
This commit is contained in:
Garrett Holmstrom 2015-02-19 18:10:33 -08:00
parent c33ce8c1e0
commit 469555be6b

View File

@ -123,28 +123,15 @@ rm -rf $RPM_BUILD_ROOT
%post
if [ $1 -eq 1 ] ; then
# Initial installation
# Enabled by default per "runs once then goes away" exception
/bin/systemctl enable cloud-config.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-final.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-init.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
fi
# These services are now enabled by the cloud image's kickstart.
# They should probably be done with a preset instead.
%systemd_post cloud-config.service cloud-final.service cloud-init.service cloud-init-local.service
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
# One-shot services -> no need to stop
fi
%systemd_preun cloud-config.service cloud-final.service cloud-init.service cloud-init-local.service
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
# One-shot services -> no need to restart
%systemd_postun
%files
@ -180,6 +167,7 @@ fi
- Fixed handling of user group lists that contain spaces [RH:1126365 LP:1354694]
- Changed network.target systemd deps to network-online.target [RH:1110731 RH:1112817 RH:1147613]
- Fixed race condition between cloud-init.service and the login prompt
- Stopped enabling services in %%post (now done by kickstart) [RH:850058]
* Fri Nov 14 2014 Colin Walters <walters@redhat.com> - 0.7.6-2
- New upstream version [RH:974327]