Hopefully this will make it bullet-proof.
[util-vserver.git] / scripts / vmount
index 0afe144..f0a63d5 100755 (executable)
@@ -30,7 +30,7 @@ function showHelp()
     echo \
 $"Usage: $0 <vserver-name> -- [-o options] [--bind|--rbind]
          [-t <type>] [-a] [-n] [--move]
-         <source> <destination>
+         [<source> [<destination>]]
 
 <source>       ...  what to mount, this is relative to the host's root
 <destination>  ...  where to mount it, this is relative to the guest's root
@@ -86,15 +86,15 @@ while true; do
     shift
 done
 
-case "$1" in
-    (/*)       ;;
+case "x$1" in
+    (x/*|x)    ;;
     (*)                panic $"vmount: the source must be an absolute path";;
 esac
 
 rc=0
 for guest in "${guests[@]}"; do
     pushd "$guest/vdir" &> /dev/null
-    $_VNAMESPACE -e "$guest" -- \
+    callInNamespace "$guest" \
        $_SECURE_MOUNT --chroot --fstab "$guest/fstab" "${options[@]}" "$@"
     test "$?" -eq 0 || rc=$?
     popd &> /dev/null