#!/bin/bash : ${UTIL_VSERVER_VARS:=/usr/share/util-vserver/netns/util-vserver-vars} 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" . "$_LIB_VSERVER_FUNCTIONS" ARGS=( "$@" ) while : do case "$1" in -i|--index|-e|--enter) VSERVER_DIR="$($_VSERVER_INFO "$2" ID)" getFileValue VSERVER_NAME "${VSERVER_DIR}/name" break ;; --mask) shift shift ;; --) break ;; *) shift ;; esac done if [[ -n "$VSERVER_NAME" && -d "${VSERVER_DIR}/spline-netns/" ]]; then exec $_IP netns exec "$VSERVER_NAME" /usr/sbin/vnamespace "${ARGS[@]}" fi exec /usr/sbin/vnamespace "${ARGS[@]}"