Use the host's /etc/resolv.conf by default.
[util-vserver.git] / scripts / vserver
index 044835b..8b7e8cb 100755 (executable)
@@ -166,12 +166,13 @@ test "$cmd" != build || { shift 2; exec $_VNAMESPACE --new -- \
 allow_legacy=
 
 case "$vserver" in
-    (./*) VSERVER_DIR=`pwd`/$vserver;;
-    (/*)  VSERVER_DIR=$vserver;;
-    (*)          VSERVER_DIR=$__CONFDIR/$vserver
+    (./*) VSERVER_DIR="`pwd`/$vserver";;
+    (/*)  VSERVER_DIR="$vserver";;
+    (*)          VSERVER_DIR="$__CONFDIR/$vserver"
          allow_legacy=1
          ;;
 esac
+VSERVER_DIR="${VSERVER_DIR%%/}"
 
 if test -n "$allow_legacy"; then
     do_legacy=
@@ -199,11 +200,11 @@ Possible solutions:
 _setVserverName
 
 # Create a new namespace when starting the guest
-test "$2" != start -o -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \
+test "$cmd" != start -o -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \
     exec $_VNAMESPACE --new -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}"
 
 # Enter the namespace early so we can test for files inside the guest
-test "$2" != enter -a "$2" != stop || \
+test "$cmd" != enter -a "$cmd" != stop || \
     test -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \
     ! isVserverRunning "$VSERVER_DIR" || \
     exec $_VNAMESPACE --enter "$VSERVER_DIR" -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}"