From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A8BB71388C1 for ; Thu, 3 Dec 2015 23:46:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 80D8721C07A; Thu, 3 Dec 2015 23:46:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CE28721C07A for ; Thu, 3 Dec 2015 23:46:04 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6717C340923 for ; Thu, 3 Dec 2015 23:46:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A37ACA95 for ; Thu, 3 Dec 2015 23:45:58 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1449183135.627e925463068e754ffd869f99a43634d6d9631e.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/, man/ X-VCS-Repository: proj/openrc X-VCS-Files: man/openrc-run.8 sh/gendepends.sh.in sh/openrc-run.sh.in sh/rc-functions.sh.in X-VCS-Directories: man/ sh/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 627e925463068e754ffd869f99a43634d6d9631e X-VCS-Branch: master Date: Thu, 3 Dec 2015 23:45:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d0915fc9-a3a0-4d67-a057-521e81458b6d X-Archives-Hash: 8761204305ca4e606d5d28f668b540b2 commit: 627e925463068e754ffd869f99a43634d6d9631e Author: William Hubbs gmail com> AuthorDate: Thu Dec 3 20:09:38 2015 +0000 Commit: William Hubbs gentoo 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=