commit: 3351c8b4c3027f09003f8ba33e43f46762f5c453
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 19 22:59:40 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 19 22:59:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3351c8b4
supervise-daemon.sh: add support for chroot variable
sh/supervise-daemon.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 34e3ef7..2d889a6 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -20,24 +20,30 @@ supervise_start()
ebegin "Starting ${name:-$RC_SVCNAME}"
eval supervise-daemon --start \
+ ${chroot:+--chroot} $chroot \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
$supervise_daemon_args \
$command \
-- $command_args $command_args_foreground
rc=$?
- [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ if [ $rc = 0 ]; then
+ [ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
+ [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ fi
eend $rc "failed to start $RC_SVCNAME"
}
supervise_stop()
{
+ local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
+ chroot="${startchroot:-$chroot}"
pidfile="${startpidfile:-$pidfile}"
[ -n "$pidfile" ] || return 0
ebegin "Stopping ${name:-$RC_SVCNAME}"
supervise-daemon --stop \
- ${pidfile:+--pidfile} $pidfile \
+ ${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
eend $? "Failed to stop $RC_SVCNAME"