diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-09-28 18:33:26 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-09-28 18:33:26 +0200 |
commit | 0d52009f7ea77e739fca105988c01337dfeb04d5 (patch) | |
tree | d0bb7a08c2adb941c03e0e976f43912a5a8cdfc3 /vnamespace.netns | |
download | util-vserver-netns-0d52009f7ea77e739fca105988c01337dfeb04d5.tar.gz util-vserver-netns-0d52009f7ea77e739fca105988c01337dfeb04d5.tar.bz2 util-vserver-netns-0d52009f7ea77e739fca105988c01337dfeb04d5.zip |
initial commit
Diffstat (limited to 'vnamespace.netns')
-rwxr-xr-x | vnamespace.netns | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vnamespace.netns b/vnamespace.netns new file mode 100755 index 0000000..51c6325 --- /dev/null +++ b/vnamespace.netns @@ -0,0 +1,48 @@ +#!/bin/bash + +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars.netns} +test -e "$UTIL_VSERVER_VARS" || { + echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 + exit 1 +} +. "$UTIL_VSERVER_VARS" +. "$_LIB_FUNCTIONS" +. $__PKGLIBDIR/vserver.functions + +ARGS=( "$@" ) + +while : +do + case "$1" in + -i|--index) + VSERVER_DIR="$($_VSERVER_INFO "$2" ID)" + getFileValue VSERVER_NAME "${VSERVER_DIR}/name" + break + ;; + + -e|--enter) + VSERVER_NAME="$2" + _setVserverDir "$VSERVER_NAME" + break + ;; + + --mask) + shift + shift + ;; + + --) + break + ;; + + *) + shift + ;; + esac +done + +if [[ -n "$VSERVER_NAME" && -d "${VSERVER_DIR}/netns/" ]]; then + exec $_IP netns exec "$VSERVER_NAME" /usr/sbin/vnamespace "${ARGS[@]}" +fi + +exec /usr/sbin/vnamespace "${ARGS[@]}" |