From af4af7aa58704add139718564d1e6df80662554b Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 30 Oct 2011 20:20:46 +0000 Subject: Do not assume that the sysvinit script exists. It is possible that we call this helper when only a systemd unit exists and thus it makes sense to protect against calling chkconfig and friends when this is the case. --- add-service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add-service b/add-service index 307f0a4..1b5ac54 100755 --- a/add-service +++ b/add-service @@ -91,7 +91,7 @@ add_service() { if [ -n "$units_to_enable" ]; then /bin/systemctl --quiet enable $units_to_enable fi - if [ -n "$srv" ]; then + if [ -n "$srv" -a -f /etc/rc.d/init.d/$srv ]; then /sbin/chkconfig --add $srv if [ -r /etc/sysconfig/system ]; then @@ -117,7 +117,7 @@ else # Upgrade mode. if [ x$init = xsystemd ]; then /bin/systemctl --quiet try-restart $units - else + elif [ -f /etc/rc.d/init.d/$srv ]; then set -- /etc/rc3.d/S??$srv if [ $# -gt 1 ]; then echo 1>&2 "add-service: Error: $srv appears multiple times: $*" -- cgit v1.2.1