commit:     a8214af2fe3aa91930e3270af99cf1d9b7ef5b0a
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 19 22:58:14 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 19 22:58:14 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a8214af2

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

The support for the chroot variable was broken in 0.16, this fixes that
breakage.

 sh/start-stop-daemon.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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

Reply via email to