X-Git-Url: http://git.onelab.eu/?p=build.git;a=blobdiff_plain;f=lbuild-initvm.sh;h=636fdc4f305c36d481bd510ba6460e3fe87e5098;hp=ce220133ca6201bd18d9d05febae0a700df3bf35;hb=77cf7bccd1980c4fb1208a730e4ad53382c16274;hpb=5916f9d9632018d6e3cbc233f335459bee592e4d diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index ce220133..636fdc4f 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -868,6 +868,8 @@ function main () { local lxc_root=$(lxcroot $lxc) # rainchecks + # when using with the -i option, checking that $lxc_root is void + # is a little too much stress.. almost_empty $lxc_root || \ { echo "container $lxc already exists in $lxc_root - exiting" ; exit 1 ; } virsh -c lxc:/// domuuid $lxc >& /dev/null && \ @@ -876,9 +878,13 @@ function main () { # if IMAGE, copy the provided rootfs to lxc_root if [ -n "$IMAGE" ] ; then - [ ! -d "$IMAGE" ] && \ - { echo "$IMAGE rootfs folder does not exist - exiting" ; exit 1 ; } - rsync -a $IMAGE/ $lxc_root/ + if [ ! -d "$IMAGE" ]; then + echo "$IMAGE rootfs folder does not exist - exiting" + exit 1 + else + echo "Copying $IMAGE into $lxc_root with rsync --archive --delete" + rsync --archive --delete $IMAGE/ $lxc_root/ + fi fi # check we've exhausted the arguments