Support init.d-using services in os-svc-enable

os-svc-enable-upstart currently only works for Upstart scripts,
and will print a warning that the job doesn't exist, and then
create an .enable file anyway. If the action is enable, and the
Upstart config file doesn't exist, but the initscript does, run
update-rc.d.

Change-Id: Ib1e3d4e2963dd2ce4d96078781a929205c25d886
This commit is contained in:
Steve Kowalik 2014-07-21 14:53:27 -04:00
parent 72b6546307
commit 2171b584a2
1 changed files with 8 additions and 2 deletions

View File

@ -47,8 +47,14 @@ if [ "$action" != "enabled" ] ; then
fi
fi
if ! [ -e "/etc/init/${job_name}.conf" ] ; then
echo "WARNING: $job_name does not exist!"
if [ ! -e "/etc/init/${job_name}.conf" ] ; then
# Perhaps it's an init.d script.
if [ "$action" = "enable" -a -e "/etc/init.d/$job_name" ]; then
update-rc.d $job_name defaults 2>/dev/null
exit 0
else
echo "WARNING: $job_name does not exist!"
fi
fi
enable_file="${OS_UPSTART_STATE_DIR}/${job_name}.enable"