X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=776e487d269bbc0443655f61a1ba3cc287e0345c;hb=5ee5e9157572fe9047a12be75af60fa32f0a60a8;hp=78d37e8faee08ce2bc1fbe90572a621bfb0082ef;hpb=1dd534f9534eeda713ba543170ba954e56a95c07;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index 78d37e8..776e487 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -611,7 +611,8 @@ function _generateTagOptions local vdir="$1" local tag - getFileValue tag "$vdir/tag" "$vdir/context" || return 0 + getFileValue tag "$vdir/tag" "$vdir/context" + test -n "$tag" || return 0 OPTS_VTAG_CREATE=( --tag "$tag" ) OPTS_VTAG_ENTER=( --tag "$tag" ) @@ -892,6 +893,22 @@ function umountVserver test -n "$is_ok" } +function fsckAllFS +{ + local cfgdir=$1 + local fstab="$cfgdir"/fstab + local FSTAB_FILE + local fsck_exitcode + + test -e "$fstab" || return 0 + + export FSTAB_FILE="$fstab" + $_FSCK -s -n -A -T + fsck_exitcode=$? + test "$fsck_exitcode" -eq 0 -o \ + "$fsck_exitcode" -eq 1 || return $fsck_exitcode +} + ## Usage: waitForSync function initSync { @@ -1215,17 +1232,22 @@ function _namespaceCleanup local root=$($_VSERVER_INFO "$1" VDIR 1) local -a list local -a skip - local tmp + local i + local j getFileArray skip "$vdir"/namespace-cleanup-skip \ "$__CONFDIR"/.defaults/namespace-cleanup-skip || : # these are things that have to be accessible post-cleanup - for tmp in "$root" "$__SBINDIR" "$__PKGLIBDIR" "$vdir" \ + for i in "$root" "$__SBINDIR" "$__PKGLIBDIR" "$vdir" \ "$__PKGSTATEDIR" "$__LOCKDIR" /usr/local /tmp "${skip[@]}"; do - while test -n "$tmp"; do - list=( "${list[@]}" "$tmp" ) - tmp="${tmp%/*}" + local real=`readlink -f "$i"` + test "$i" != "$real" || real= + for j in "$i" "$real"; do + while test -n "$j"; do + list=( "${list[@]}" "$j" ) + j="${j%/*}" + done done done @@ -1269,6 +1291,6 @@ function loadDeviceMap vdevmap_opts=( "${vdevmap_opts[@]}" ${flags:+--flags "$flags"} \ ${device:+--device "$device"} ${target:+--target "$target"} ) - $_VDEVMAP --xid "$xid" "${vdevmap_opts[@]}" || return $? + $_VDEVMAP --xid "$xid" --set "${vdevmap_opts[@]}" || return $? done }