X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver;h=c9f9f24edce8f7d6a22113463aa021d25da62cab;hb=9ffed2d8110339da84f676fc52161f4423c969d8;hp=a34993fbd25f324fb60aca36bd7852359f1d4586;hpb=b1fc457a777a0c3206aed69d4ef178d495848b4e;p=util-vserver.git diff --git a/scripts/vserver b/scripts/vserver index a34993f..c9f9f24 100755 --- a/scripts/vserver +++ b/scripts/vserver @@ -165,25 +165,28 @@ test "$cmd" != build || { shift 2; exec $_VNAMESPACE --new -- \ allow_legacy= +vserver="${vserver%%/}" case "$vserver" in - (./*) VSERVER_DIR=`pwd`/$vserver;; - (/*) VSERVER_DIR=$vserver;; - (*) VSERVER_DIR=$__CONFDIR/$vserver - allow_legacy=1 - ;; + (./*) VSERVER_DIR="`pwd`/$vserver";; + (/*) VSERVER_DIR="$vserver";; + (*) # Check if this is a context id + context=$(vuname --get --xid "$vserver" 2>/dev/null) + if test -d "$context"; then + VSERVER_DIR="$context" + else + VSERVER_DIR="$__CONFDIR/$vserver" + do_legacy= + test ! -e "$VSERVER_DIR/legacy" || do_legacy=1 + test -d "$VSERVER_DIR" -o ! -e "$__CONFDIR/$vserver.conf" || do_legacy=1 + + test -z "$do_legacy" || { + echo $"WARNING: can not find configuration, assuming legacy method" >&2 + exec "$_VSERVER_LEGACY" "$@" + } + fi + ;; esac -if test -n "$allow_legacy"; then - do_legacy= - test ! -e "$VSERVER_DIR/legacy" || do_legacy=1 - test -d "$VSERVER_DIR" -o ! -e "$__CONFDIR/$vserver.conf" || do_legacy=1 - - test -z "$do_legacy" || { - echo $"WARNING: can not find configuration, assuming legacy method" >&2 - exec "$_VSERVER_LEGACY" "$@" - } -fi - test -d "$VSERVER_DIR" || { echo $"\ Can not find a vserver-setup at '$VSERVER_DIR/'.