[gentoo-commits] proj/openrc:openrc-0.13.x commit in: man/, sh/

2014-10-20 Thread William Hubbs
commit: 0d3fdd3769be9801b800f89ee8ce9d1b816434db
Author: William Hubbs w.d.hubbs AT gmail DOT com
AuthorDate: Mon Oct 20 00:36:57 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Mon Oct 20 21:03:27 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=0d3fdd37

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

---
 man/openrc-run.8   | 3 +++
 sh/runscript.sh.in | 6 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index c8bf24d..3308f24 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -120,6 +120,9 @@ Set this to true, yes or 1 (case-insensitive) to 
force the daemon into
 the background. This implies the --make-pidfile and --pidfile option of
 .Xr start-stop-daemon 8
 so the pidfile variable must be set.
+.It Ar chroot
+.Xr start-stop-daemon 8
+will chroot into this path before writing the pid file or starting the daemon.
 .It Ar pidfile
 Pidfile to use for the above defined command.
 .It Ar name

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index b89c460..06d51d0 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
 }



[gentoo-commits] proj/openrc:openrc-0.13.x commit in: man/

2014-10-16 Thread William Hubbs
commit: b964de828731b5989fb1117822016cacbfe1ad8a
Author: William Hubbs w.d.hubbs AT gmail DOT com
AuthorDate: Fri Sep 19 22:23:55 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Thu Oct 16 16:42:38 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b964de82

man: Document start_inactive and in_background_fake

---
 man/openrc-run.8 | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3890f76..c8bf24d 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -131,6 +131,12 @@ timeout in seconds or multiple signal/timeout pairs (like 
SIGTERM/5).
 A list of directories which must exist for the service to start.
 .It Ar required_files
 A list of files which must exist for the service to start.
+.It Ar start_inactive
+Set to yes to have the service marked inactive when it starts. This is
+used along with in_background_fake to support re-entrant services.
+.It Ar in_background_fake
+Space separated list of commands which should always succeed when
+in_background is yes.
 .El
 .Sh DEPENDENCIES
 You should define a