aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-30 20:20:46 +0000
committerColin Guthrie <colin@mageia.org>2011-10-30 20:20:46 +0000
commitaf4af7aa58704add139718564d1e6df80662554b (patch)
treedcb9da8a90e9888bfe33d68f76f653320f9fdebd
parente11609c43474d840d51004ab88fb274dbd9ddeb8 (diff)
downloadrpm-helper-af4af7aa58704add139718564d1e6df80662554b.tar
rpm-helper-af4af7aa58704add139718564d1e6df80662554b.tar.gz
rpm-helper-af4af7aa58704add139718564d1e6df80662554b.tar.bz2
rpm-helper-af4af7aa58704add139718564d1e6df80662554b.tar.xz
rpm-helper-af4af7aa58704add139718564d1e6df80662554b.zip
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.
-rwxr-xr-xadd-service4
1 files 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: $*"