From 232fc6e1f66745d1c063924bb5f5a78732cac96f Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 30 Oct 2011 14:41:47 +0000 Subject: 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 --- add-service | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'add-service') diff --git a/add-service b/add-service index 09e549d..23b0094 100755 --- a/add-service +++ b/add-service @@ -18,7 +18,7 @@ else fi if [ $# -lt 3 ]; then - echo "usage: $0 [--no-sysv] [] ..." 1>&2 + echo "usage: $0 [--no-sysv] [] [ ...]" 1>&2 exit 1 fi @@ -34,6 +34,13 @@ fi units="$*" # systemd units units_to_enable= # units enabled by msec +# 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 + add_chkconfig_service() { if [ -n "$units_to_enable" ]; then /bin/systemctl --quiet enable $units_to_enable @@ -125,7 +132,7 @@ else /sbin/chkconfig --add $srv fi - if [ -z "$units" ] || ! /bin/mountpoint -q /sys/fs/cgroup/systemd; then + if ! /bin/mountpoint -q /sys/fs/cgroup/systemd; then # restart the service if already running if [ -f /var/lock/subsys/$srv ]; then /sbin/service $srv restart > /dev/null || : -- cgit v1.2.1