aboutsummaryrefslogtreecommitdiffstats
path: root/del-service
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-30 15:08:02 +0000
committerColin Guthrie <colin@mageia.org>2011-10-30 15:08:02 +0000
commite11609c43474d840d51004ab88fb274dbd9ddeb8 (patch)
treee42ccad268f36890005bc469578ad6e871deff2b /del-service
parent751f55f6a09a18bcb6ffab577256d93824ee29cc (diff)
downloadrpm-helper-e11609c43474d840d51004ab88fb274dbd9ddeb8.tar
rpm-helper-e11609c43474d840d51004ab88fb274dbd9ddeb8.tar.gz
rpm-helper-e11609c43474d840d51004ab88fb274dbd9ddeb8.tar.bz2
rpm-helper-e11609c43474d840d51004ab88fb274dbd9ddeb8.tar.xz
rpm-helper-e11609c43474d840d51004ab88fb274dbd9ddeb8.zip
Change how services are handled in systemd.v0.24.20.24.2
This ensures that services are started/stopped in the most appropriate way depending on what init system is being used. Also when upgrading a service, ensure it is properly restarted even when using systemd (assuming it is currently running). Testing these scripts without actually installing/uninstalling package may result in the sysvinit scripts being deleted so be careful.
Diffstat (limited to 'del-service')
-rwxr-xr-xdel-service17
1 files changed, 10 insertions, 7 deletions
diff --git a/del-service b/del-service
index 753fcc3..f519065 100755
--- a/del-service
+++ b/del-service
@@ -22,6 +22,13 @@ if [ $# -lt 3 ]; then
exit 1
fi
+# What init system are we currently using?
+if /bin/mountpoint -q /sys/fs/cgroup/systemd; then
+ init=systemd
+else
+ init=sysvinit
+fi
+
pkg=$1 # name of the package
num=$2 # number of packages installed
if [ $do_sysv = yes ]; then
@@ -44,10 +51,8 @@ fi
if [ $num = 0 ]; then
if [ -z "$DURING_INSTALL" ]; then
- if [ -n "$units" ]; then
- if /bin/mountpoint -q /sys/fs/cgroup/systemd; then
- /bin/systemctl stop $units
- fi
+ if [ x$init = xsystemd ]; then
+ /bin/systemctl stop $units
elif [ -n "srv" ]; then
/sbin/service $srv stop > /dev/null || :
fi
@@ -59,9 +64,7 @@ if [ $num = 0 ]; then
# Yes - this is very ugly workaround. chkconfig --del does daemon-reload,
# but initscript is still there, so it remains loaded. Remove file and
# reload again. Systemd units are supposed to provide postun script
-
- if [ -n "$srv" -a -f /etc/rc.d/init.d/$srv ] && \
- /bin/mountpoint -q /sys/fs/cgroup/systemd; then
+ if [ -n "$srv" -a -f /etc/rc.d/init.d/$srv -a x$init = xsystemd ]; then
/bin/rm -f /etc/rc.d/init.d/$srv
/bin/systemctl daemon-reload
fi