summaryrefslogtreecommitdiffstats
path: root/lib/container/create
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-12 06:32:19 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-31 14:30:16 +0000
commit39fd32080205aebe8a59936b9b6a76ae04b6f047 (patch)
tree5edd37d3ff17f577f58f7b1eb5aacc0393f45ce6 /lib/container/create
parentAdding container limit command. (diff)
downloadcompute-tools-39fd32080205aebe8a59936b9b6a76ae04b6f047.tar.xz
compute-tools-39fd32080205aebe8a59936b9b6a76ae04b6f047.zip
Adding capability and drop-capability config option.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'lib/container/create')
-rwxr-xr-xlib/container/create16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/container/create b/lib/container/create
index cfee91a..3411832 100755
--- a/lib/container/create
+++ b/lib/container/create
@@ -25,7 +25,7 @@ MACHINES="/var/lib/machines"
Parameters ()
{
- LONG_OPTIONS="name:,cnt.autostart:,bind:,script:"
+ LONG_OPTIONS="name:,cnt.autostart:,bind:,capability:,drop-capability:script:"
OPTIONS="n:,b:,c:,d:,s:"
PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})"
@@ -56,6 +56,16 @@ Parameters ()
shift 2
;;
+ -c|--capability)
+ CAPABILITY="${2}"
+ shift 2
+ ;;
+
+ -d|--drop-capability)
+ DROP_CAPABILITY="${2}"
+ shift 2
+ ;;
+
-s|--script)
SCRIPT="${2}"
shift 2
@@ -76,7 +86,7 @@ Parameters ()
Usage ()
{
- echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.autostart=true|false|FQDN] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2
+ echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.autostart=true|false|FQDN] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-c|--capability CAPABILITY[,CAPABILITY]] [-d|--drop-capability DROP_CAPABILITY[,DROP_CAPABILITY]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2
exit 1
}
@@ -121,7 +131,9 @@ sed -e "s|@CNT_AUTOSTART@|${CNT_AUTOSTART}|g" \
-e "s|@NAME@|${NAME}|g" \
-e "s|@BIND@|${BIND}|g" \
-e "s|@BOOT@|yes|g" \
+ -e "s|@CAPABILITY@|${CAPABILITY}|g" \
-e "s|@DIRECTORY@|${MACHINES}/${NAME}|g" \
+ -e "s|@DROP_CAPABILITY@|${DROP_CAPABILITY}|g" \
-e "s|@MACHINE@|${NAME}|g" \
-e "s|@NETWORK_VETH@|yes|g" \
-e "s|@NETWORK_BRIDGE@|br0|g" \