start-stop-daemon.sh: fix regression in chroot support

The support for the chroot variable was broken in 0.16, this fixes that
breakage.
This commit is contained in:
William Hubbs 2016-05-19 17:58:14 -05:00
parent 9a372812c7
commit a8214af2fe

View File

@ -40,6 +40,7 @@ ssd_start()
fi fi
eval start-stop-daemon --start \ eval start-stop-daemon --start \
--exec $command \ --exec $command \
${chroot:+--chroot} $chroot \
${procname:+--name} $procname \ ${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \ ${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \ ${command_user+--user} $command_user \
@ -47,6 +48,7 @@ ssd_start()
-- $command_args $command_args_background -- $command_args $command_args_background
if eend $? "Failed to start $RC_SVCNAME"; then if eend $? "Failed to start $RC_SVCNAME"; then
service_set_value "command" "${command}" service_set_value "command" "${command}"
[ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}" [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
[ -n "${procname}" ] && service_set_value "procname" "${procname}" [ -n "${procname}" ] && service_set_value "procname" "${procname}"
return 0 return 0
@ -62,9 +64,11 @@ ssd_start()
ssd_stop() ssd_stop()
{ {
local startcommand="$(service_get_value "command")" local startcommand="$(service_get_value "command")"
local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")" local startpidfile="$(service_get_value "pidfile")"
local startprocname="$(service_get_value "procname")" local startprocname="$(service_get_value "procname")"
command="${startcommand:-$command}" command="${startcommand:-$command}"
chroot="${startchroot:-$chroot}"
pidfile="${startpidfile:-$pidfile}" pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}" procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0 [ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
@ -73,7 +77,7 @@ ssd_stop()
${retry:+--retry} $retry \ ${retry:+--retry} $retry \
${command:+--exec} $command \ ${command:+--exec} $command \
${procname:+--name} $procname \ ${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \ ${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig ${stopsig:+--signal} $stopsig
eend $? "Failed to stop $RC_SVCNAME" eend $? "Failed to stop $RC_SVCNAME"