add support for -containers keyword

This commit is contained in:
William Hubbs 2015-12-03 14:09:38 -06:00
parent f5cf1136e7
commit 627e925463
4 changed files with 48 additions and 2 deletions

View File

@ -227,6 +227,9 @@ Same as -jail, but for Xen DOM0 systems.
Same as -jail, but for Xen DOMU systems. Same as -jail, but for Xen DOMU systems.
.It Dv -docker .It Dv -docker
Same as -jail, but for docker systems. 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
.El .El
.Pp .Pp

View File

@ -29,7 +29,18 @@ provide() {
[ -n "$*" ] && echo "$RC_SVCNAME iprovide $*" >&3 [ -n "$*" ] && echo "$RC_SVCNAME iprovide $*" >&3
} }
keyword() { 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() { depend() {
: :

View File

@ -79,7 +79,18 @@ provide() {
[ -n "$*" ] && echo "provide $*" [ -n "$*" ] && echo "provide $*"
} }
keyword() { 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 # Describe the init script to the user

View File

@ -86,6 +86,27 @@ get_bootparam()
} }
# Called from openrc-run.sh or gendepends.sh # 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() {
depend depend
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends= local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends=