* [gentoo-commits] proj/openrc:master commit in: sh/, man/
@ 2014-10-20 20:59 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2014-10-20 20:59 UTC (permalink / raw
To: gentoo-commits
commit: 8c7ea4e9e8da500877a514402bbe90aababda2d6
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Oct 20 00:36:57 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 20:44:19 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8c7ea4e9
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"
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/, man/
@ 2015-12-03 23:45 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2015-12-03 23:45 UTC (permalink / raw
To: gentoo-commits
commit: 627e925463068e754ffd869f99a43634d6d9631e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Dec 3 20:09:38 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Dec 3 22:52:15 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=627e9254
add support for -containers keyword
man/openrc-run.8 | 3 +++
sh/gendepends.sh.in | 13 ++++++++++++-
sh/openrc-run.sh.in | 13 ++++++++++++-
sh/rc-functions.sh.in | 21 +++++++++++++++++++++
4 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 6aab067..5d18fe5 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -227,6 +227,9 @@ Same as -jail, but for Xen DOM0 systems.
Same as -jail, but for Xen DOMU systems.
.It Dv -docker
Same as -jail, but for docker systems.
+.It Dv -containers
+Same as -jail, but for all relevant container types on the operating
+system.
.El
.El
.Pp
diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in
index 36caeb7..2ab798d 100644
--- a/sh/gendepends.sh.in
+++ b/sh/gendepends.sh.in
@@ -29,7 +29,18 @@ provide() {
[ -n "$*" ] && echo "$RC_SVCNAME iprovide $*" >&3
}
keyword() {
- [ -n "$*" ] && echo "$RC_SVCNAME keyword $*" >&3
+ local c x
+ set -- $*
+ while [ -n "$*" ]; do
+ case "$1" in
+ -containers) x="$(_get_containers)" ;;
+ !-containers) x="$(_get_containers_remove)" ;;
+ *) x=$1 ;;
+ esac
+ c="${c}${x} "
+ shift
+ done
+ [ -n "$c" ] && echo "$RC_SVCNAME keyword $c" >&3
}
depend() {
:
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index c169204..5018cee 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -79,7 +79,18 @@ provide() {
[ -n "$*" ] && echo "provide $*"
}
keyword() {
- [ -n "$*" ] && echo "keyword $*"
+ local c x
+ set -- $*
+ while [ -n "$*" ]; do
+ case "$1" in
+ -containers) x="$(_get_containers)" ;;
+ !-containers) x="$(_get_containers_remove)" ;;
+ *) x=$1 ;;
+ esac
+ c="${c}${x} "
+ shift
+ done
+ [ -n "$c" ] && echo "keyword $c"
}
# Describe the init script to the user
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index c854876..12eb4e2 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -86,6 +86,27 @@ get_bootparam()
}
# Called from openrc-run.sh or gendepends.sh
+_get_containers() {
+ local c
+ case "${RC_UNAME}" in
+ FreeBSD)
+ c="-jail"
+ ;;
+ Linux)
+ c="-docker -lxc -openvz -rkt -systemd-nspawn -uml -vserver"
+ ;;
+ esac
+ echo $c
+}
+
+_get_containers_remove() {
+ local c
+ for x in $(_get_containers); do
+ c="${c}!${x} "
+ done
+ echo $c
+}
+
_depend() {
depend
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends=
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/, man/
@ 2017-11-29 21:12 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2017-11-29 21:12 UTC (permalink / raw
To: gentoo-commits
commit: ddbdb696582e9fd61995f15d6a3a53055a151e41
Author: Julien Reichardt <mi <AT> jrei <DOT> ch>
AuthorDate: Mon Nov 20 22:45:51 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 21:06:06 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ddbdb696
add more variables for start-stop-daemon and supervise-daemon options
Add the following variables to expose more arguments that can be passed
to start-stop-daemon or supervise-daemon:
- directory will be passed to --chdir
- error_log will be passed to --stderr
- output_log will be passed to --stdout
- umask will be passed to umask
This is for #184.
man/openrc-run.8 | 20 ++++++++++++++++++++
sh/start-stop-daemon.sh | 4 ++++
sh/supervise-daemon.sh | 4 ++++
3 files changed, 28 insertions(+)
diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3f4f7e81..e1db58bd 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -157,6 +157,24 @@ use this to change the user id before
or
.Xr supervise-daemon 8
launches the daemon
+.It Ar output_log
+This is the path to a file or named pipe where the standard output from
+the service will be redirected. If you are starting this service with
+.Xr start-stop-daemon 8 ,
+, you must set
+.Pa command_background
+to true. Keep in mind that this path will be inside the chroot if the
+.Pa chroot
+variable is set.
+.It Ar error_log
+The same thing as
+.Pa output_log
+but for the standard error output.
+.It Ar directory
+.Xr start-stop-daemon 8
+and
+.Xr supervise-daemon 8
+will chdir to this directory before starting the daemon.
.It Ar chroot
.Xr start-stop-daemon 8
and
@@ -201,6 +219,8 @@ 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.
+.It Ar umask
+Set the umask of the daemon.
.Pp
Keep in mind that eval is used to process chroot, command, command_args_*,
command_user, pidfile and procname. This may affect how they are
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 0793b19a..35c642c0 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -44,9 +44,13 @@ ssd_start()
eval start-stop-daemon --start \
--exec $command \
${chroot:+--chroot} $chroot \
+ ${directory:+--chdir} $directory \
+ ${output_log+--stdout} $output_log \
+ ${error_log+--stderr} $error_log \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
+ ${umask+--umask} $umask \
$_background $start_stop_daemon_args \
-- $command_args $command_args_background
if eend $? "Failed to start ${name:-$RC_SVCNAME}"; then
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index f6e599d5..b600b9c6 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -24,12 +24,16 @@ supervise_start()
# to work properly.
eval supervise-daemon "${RC_SVCNAME}" --start \
${retry:+--retry} $retry \
+ ${directory:+--chdir} $directory \
${chroot:+--chroot} $chroot \
+ ${output_log+--stdout} ${output_log} \
+ ${error_log+--stderr} $error_log \
${pidfile:+--pidfile} $pidfile \
${respawn_delay:+--respawn-delay} $respawn_delay \
${respawn_max:+--respawn-max} $respawn_max \
${respawn_period:+--respawn-period} $respawn_period \
${command_user+--user} $command_user \
+ ${umask+--umask} $umask \
$supervise_daemon_args \
$command \
-- $command_args $command_args_foreground
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/, man/
@ 2018-05-31 21:54 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2018-05-31 21:54 UTC (permalink / raw
To: gentoo-commits
commit: 6edf516a1fe0ad4f4e8738f9fdd1bf0bc7718361
Author: Austin English <austinenglish <AT> gmail <DOT> com>
AuthorDate: Wed May 30 16:11:10 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed May 30 16:11:10 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6edf516a
sh/supervise-daemon.sh: use start_stop_daemon_args if supervise_daemon_args is undefined
man/openrc-run.8 | 3 +++
sh/supervise-daemon.sh | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/man/openrc-run.8 b/man/openrc-run.8
index f9109ef3..f0750406 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -119,6 +119,9 @@ The amount of time, in milliseconds, s6-svc should wait for the service
to go down when stopping the service. The default is 60000.
.It Ar start_stop_daemon_args
List of arguments passed to start-stop-daemon when starting the daemon.
+.It Ar supervise_daemon_args
+List of arguments passed to supervise-daemon when starting the daemon.
+If undefined, start_stop_daemon_args is used as a fallback.
.It Ar command
Daemon to start or stop via
.Nm start-stop-daemon
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index b600b9c6..80e0260c 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -34,7 +34,7 @@ supervise_start()
${respawn_period:+--respawn-period} $respawn_period \
${command_user+--user} $command_user \
${umask+--umask} $umask \
- $supervise_daemon_args \
+ ${supervise_daemon_args:-${start_stop_daemon_args}} \
$command \
-- $command_args $command_args_foreground
rc=$?
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-31 21:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-31 21:54 [gentoo-commits] proj/openrc:master commit in: sh/, man/ William Hubbs
-- strict thread matches above, loose matches on Subject: below --
2017-11-29 21:12 William Hubbs
2015-12-03 23:45 William Hubbs
2014-10-20 20:59 William Hubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox