aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2015-12-03 14:09:38 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2015-12-03 16:52:15 -0600
commit627e925463068e754ffd869f99a43634d6d9631e (patch)
tree7b8f1504c8d21ff500547976643deb066fbccb71
parentf5cf1136e70502ee530f20f0434f312611b12b51 (diff)
add support for -containers keyword
-rw-r--r--man/openrc-run.83
-rw-r--r--sh/gendepends.sh.in13
-rw-r--r--sh/openrc-run.sh.in13
-rw-r--r--sh/rc-functions.sh.in21
4 files changed, 48 insertions, 2 deletions
diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 6aab067c..5d18fe59 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 36caeb7d..2ab798d9 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 c1692048..5018cee6 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 c854876e..12eb4e2a 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=