lxc root fs might be created already but almost empty, with the timestamp in it only
[build.git] / lbuild-initvm.sh
index bb2e540..82793ed 100755 (executable)
@@ -23,17 +23,6 @@ COMMAND_LBUILD="lbuild-initvm.sh"
 COMMAND_LTEST="ltest-initvm.sh"
 
 ##########
-# when creating build boxes we use private NAT'ed addresses for the VMs
-# as per virbr0 that is taken care of by libvirt at startup
-PRIVATE_BRIDGE="virbr0"
-PRIVATE_PREFIX="192.168.122."
-PRIVATE_GATEWAY="192.168.122.1"
-# beware that changing this would break the logic of random_private_byte...
-PRIVATE_MASKLEN=24
-
-# we just try randomly in that range until a free IP address shows up
-PRIVATE_ATTEMPTS=20
-
 # constant
 PUBLIC_BRIDGE=br0
 
@@ -932,8 +921,6 @@ function main () {
            usage ;;
     esac
 
-    echo 'build mode=' $BUILD_MODE 'test mode=' $TEST_MODE
-
     # the set of preinstalled packages - depends on vbuild or vtest
     if [ -n "$BUILD_MODE" ] ; then
        PREINSTALLED=devel.pkgs
@@ -960,8 +947,8 @@ function main () {
     lxc=$1 ; shift
     lxc_root=/vservers/$lxc
     # rainchecks
-    [ -d $lxc_root ] && \
-       { echo "container $lxc already exists in filesystem - exiting" ; exit 1 ; }
+    almost_empty $lxc_root || \
+       { echo "container $lxc already exists in $lxc_root - exiting" ; exit 1 ; }
     virsh -c lxc:/// domuuid $lxc >& /dev/null && \
        { echo "container $lxc already exists in libvirt - exiting" ; exit 1 ; }
     mkdir -p $lxc_root