From: Thierry Parmentelat Date: Mon, 19 Sep 2011 09:13:14 +0000 (+0200) Subject: tweak for the new test framework X-Git-Tag: 5.0-rc24~24 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=70206fb506c1ad08bf2071c4ccd3ac1f50852ce8;p=build.git tweak for the new test framework --- diff --git a/vbuild-init-vserver.sh b/vbuild-init-vserver.sh index 4a649718..22a71dff 100755 --- a/vbuild-init-vserver.sh +++ b/vbuild-init-vserver.sh @@ -102,6 +102,15 @@ function canonical_arch () { esac } +# the new test framework creates /timestamp in /vservers/ *before* populating it +function almost_empty () { + dir="$1"; shift ; + # non existing is fine + [ ! -d $dir ] && return 0; + # need to have at most one file + count=$(cd $dir; ls | wc -l); [ $count -le 1 ]; +} + function setup_vserver () { set -x @@ -112,10 +121,11 @@ function setup_vserver () { fcdistro=$1; shift personality=$1; shift - if [ -d /vservers/$vserver ] ; then + # check that this is a new one - see above + almost_empty /vservers/$vserver || { echo "$COMMAND : vserver $vserver seems to exist - bailing out" exit 1 - fi + } pkg_method=$(package_method $fcdistro) case $pkg_method in