Browse code

destroy the container before creating to force re-bootstrap

Jesse Andrews authored on 2011/09/20 06:23:42
Showing 1 changed files
... ...
@@ -1,4 +1,5 @@
1 1
 #!/usr/bin/env bash
2
+
2 3
 # Configurable params
3 4
 BRIDGE=${BRIDGE:-br0}
4 5
 CONTAINER=${CONTAINER:-STACK}
... ...
@@ -49,9 +50,13 @@ if [ -d /cgroup/$CONTAINER ]; then
49 49
     cgdelete -r cpu,net_cls:$CONTAINER
50 50
 fi
51 51
 
52
+
52 53
 # Warm the base image on first install
53 54
 CACHEDIR=/var/cache/lxc/natty/rootfs-amd64
54 55
 if [ ! -d $CACHEDIR ]; then
56
+    # by deleting the container, we force lxc-create to re-bootstrap (lxc is
57
+    # lazy and doesn't do anything if a container already exists)
58
+    lxc-destroy -n $CONTAINER
55 59
     # trigger the initial debootstrap
56 60
     lxc-create -n $CONTAINER -t natty -f $LXC_CONF
57 61
     chroot $CACHEDIR apt-get update