X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver.functions;fp=util-vserver%2Fscripts%2Fvserver.functions;h=a2a56a718945ef5138f7fe8a5cebf6b255aa4785;hb=98fd27aafc3e20c42c3eed3d061edd3c0dc92c1e;hp=5d1372dc8722d67866ec50033c476a12a7cb19ac;hpb=073ddcdc4f4b32c1474244f87ffb7c36d33f0653;p=util-vserver.git diff --git a/util-vserver/scripts/vserver.functions b/util-vserver/scripts/vserver.functions index 5d1372d..a2a56a7 100644 --- a/util-vserver/scripts/vserver.functions +++ b/util-vserver/scripts/vserver.functions @@ -670,11 +670,17 @@ function generateOptions function _mountVserverInternal { local fstab="$1" + local xflag= + test -e "$fstab" || return 0 shift pushd "$vdir" >/dev/null - "$@" $_SECURE_MOUNT -a --chroot --fstab "$fstab" --rootfs no + # check whether / is mounted readonly or whether there is special + # magic regarding the mtab file; when etc/mtab can not be touched, + # add the '-n' flag to mount + test -w etc -o -w etc/mtab || xflag=-n + "$@" $_SECURE_MOUNT -a $xflag --chroot --fstab "$fstab" --rootfs no popd >/dev/null } @@ -683,10 +689,15 @@ function mountRootFS local cfgdir=$1 local vdir=$1/vdir local fstab="$cfgdir"/fstab + local xflag= test -e "$fstab" || return 0 pushd "$vdir" >/dev/null - $_SECURE_MOUNT -a --chroot --fstab "$fstab" --rootfs only -n + # check whether / is mounted readonly or whether there is special + # magic regarding the mtab file; when etc/mtab can not be touched, + # add the '-n' flag to mount + test -w etc -o -w etc/mtab || xflag=-n + $_SECURE_MOUNT -a $xflag --chroot --fstab "$fstab" --rootfs only -n popd >/dev/null }