diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2014-10-19 19:36:57 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2014-10-20 15:44:19 -0500 |
commit | 8c7ea4e9e8da500877a514402bbe90aababda2d6 (patch) | |
tree | 75b4a3bf7ef085f5847ccbe6831f24d21533fd00 /sh | |
parent | 5f1439f1aac14618592789042e05daaf80f55a15 (diff) |
runscript.sh: add chroot support
This adds support for a chroot variable which will be passed to the
start-stop-daemon --chroot switch to runscript.sh when starting a
daemon. This also needs to be saved so it can be used in locating the
pid file when stopping the daemon.
X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
Diffstat (limited to 'sh')
-rw-r--r-- | sh/runscript.sh.in | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index b89c4607..06d51d07 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -142,12 +142,14 @@ start() fi eval start-stop-daemon --start \ --exec $command \ + ${chroot:+--chroot} $chroot \ ${procname:+--name} $procname \ ${pidfile:+--pidfile} $pidfile \ $_background $start_stop_daemon_args \ -- $command_args 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 @@ -163,9 +165,11 @@ start() 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 @@ -174,7 +178,7 @@ 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" } |