aboutsummaryrefslogtreecommitdiffstats
path: root/del-service
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-30 14:41:47 +0000
committerColin Guthrie <colin@mageia.org>2011-10-30 14:41:47 +0000
commit232fc6e1f66745d1c063924bb5f5a78732cac96f (patch)
treeb7b8a32cf1be0081732ecab0602a8c07aef6686a /del-service
parent12fe844fdc0d963ac9b0b3fd4d5e039898306c68 (diff)
downloadrpm-helper-232fc6e1f66745d1c063924bb5f5a78732cac96f.tar
rpm-helper-232fc6e1f66745d1c063924bb5f5a78732cac96f.tar.gz
rpm-helper-232fc6e1f66745d1c063924bb5f5a78732cac96f.tar.bz2
rpm-helper-232fc6e1f66745d1c063924bb5f5a78732cac96f.tar.xz
rpm-helper-232fc6e1f66745d1c063924bb5f5a78732cac96f.zip
Ensure systemd units are handled automagically from the service name.
The Mandriva code required that all packages were updated to deal with systemd units whenever they are provided. While packages generally need updated to include new units, it's also something that requires a lot of work and thus in the short term we should deal with it with minimal changes. By always seting the units variable, some checks become redundant so skip them or replace with a suitable alternative
Diffstat (limited to 'del-service')
-rwxr-xr-xdel-service12
1 files changed, 9 insertions, 3 deletions
diff --git a/del-service b/del-service
index c19b1f2..753fcc3 100755
--- a/del-service
+++ b/del-service
@@ -18,7 +18,7 @@ else
fi
if [ $# -lt 3 ]; then
- echo "usage: $0 [--no-sysv] <pkg name> <number installed> [<service name>] <unit name> ..." 1>&2
+ echo "usage: $0 [--no-sysv] <pkg name> <number installed> [<service name>] [<unit name> ...]" 1>&2
exit 1
fi
@@ -34,6 +34,12 @@ fi
units="$*" # systemd units
units_to_remove=
+# If only a sysvinit service is given, then deal with a systemd unit of the same
+# name. Specific specs can enable specific unit names as needed but this should
+# catch the most common usage.
+if [ -z "$units" ]; then
+ units="$srv.service"
+fi
if [ $num = 0 ]; then
@@ -47,14 +53,14 @@ if [ $num = 0 ]; then
fi
fi
- [ -n "$units" ] && /bin/systemctl --no-reload --quiet disable $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" ] && \
+ if [ -n "$srv" -a -f /etc/rc.d/init.d/$srv ] && \
/bin/mountpoint -q /sys/fs/cgroup/systemd; then
/bin/rm -f /etc/rc.d/init.d/$srv
/bin/systemctl daemon-reload