aboutsummaryrefslogtreecommitdiffstats
path: root/del-service
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2011-10-27 22:47:46 +0000
committerDexter Morgan <dmorgan@mageia.org>2011-10-27 22:47:46 +0000
commitc64fa938609c6bee9dd02adc1a37df89a9ebd116 (patch)
tree20da84dbd8cc32fb518e4bf777359664dba63a88 /del-service
parentb1c56622b1c4a3e390de269e8c28af133f2472c9 (diff)
downloadrpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar
rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.gz
rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.bz2
rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.xz
rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.zip
Add systemd support ( mdv )
Diffstat (limited to 'del-service')
-rwxr-xr-xdel-service49
1 files changed, 42 insertions, 7 deletions
diff --git a/del-service b/del-service
index 34c2328..8e7ddb7 100755
--- a/del-service
+++ b/del-service
@@ -3,27 +3,62 @@
# Project : Mandriva Linux
# Module : rpm-helper
# File : del-service
-# Version : $Id: del-service 263135 2009-10-30 16:58:08Z blino $
-# Author : Frederic Lepied
+# Version : $Id: del-service 272144 2011-03-20 18:42:29Z bor $
+# Authors : Frederic Lepied, Andrey Borzenkov
# Created On : Tue Jul 9 08:11:26 2002
# Purpose : helper script for rpm scriptlets to remove a
# service.
#---------------------------------------------------------------
-if [ $# != 3 ]; then
- echo "usage: $0 <pkg name> <number installed> <service name>" 1>&2
+if [ x$1 = x--no-sysv ]; then
+ do_sysv=no
+ shift
+else
+ do_sysv=yes
+fi
+
+if [ $# -lt 3 ]; then
+ echo "usage: $0 [--no-sysv] <pkg name> <number installed> [<service name>] <unit name> ..." 1>&2
exit 1
fi
pkg=$1 # name of the package
num=$2 # number of packages installed
-srv=$3 # name of the service
+if [ $do_sysv = yes ]; then
+ srv=$3 # name of the SysV script
+ shift 3
+else
+ srv=
+ shift 2
+fi
+units="$*" # systemd units
+units_to_remove=
+
if [ $num = 0 ]; then
+
if [ -z "$DURING_INSTALL" ]; then
- /sbin/service $srv stop > /dev/null || :
+ if [ -n "$units" ]; then
+ if /bin/mountpoint -q /sys/fs/cgroup/systemd; then
+ /bin/systemctl stop $units
+ fi
+ elif [ -n "srv" ]; then
+ /sbin/service $srv stop > /dev/null || :
+ fi
+ fi
+
+ [ -n "$units" ] && /bin/systemctl --no-reload --quiet disable $units
+ [ -n "$srv" ] && /sbin/chkconfig --del $srv
+
+ # 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 -z "$units" ] && \
+ /bin/mountpoint -q /sys/fs/cgroup/systemd; then
+ /bin/rm -f /etc/rc.d/init.d/$srv
+ /bin/systemctl daemon-reload
fi
- /sbin/chkconfig --del $srv
fi
# del-service ends here