From 6053496ebc8471890c26cc2845dad0c98d2f9832 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 13 Sep 2011 10:40:04 -0700 Subject: [PATCH] simplify pre-cache procedure --- build_lxc.sh | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/build_lxc.sh b/build_lxc.sh index 4faa2e7..ba26f4f 100755 --- a/build_lxc.sh +++ b/build_lxc.sh @@ -8,30 +8,9 @@ CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0} CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1} NAMESERVER=${NAMESERVER:-192.168.1.1} COPYENV=${COPYENV:-1} -WARMCACHE=${WARMCACHE:-0} -# Shutdown any existing container -lxc-stop -n $CONTAINER - -# This prevents zombie containers -cgdelete -r cpu,net_cls:$CONTAINER - -# Destroy the old container -lxc-destroy -n $CONTAINER - -# Warm the base image on first run or when WARMCACHE=1 -CACHEDIR=/var/cache/lxc/natty/rootfs-amd64 -if [ "$WARMCACHE" = "1" ] || [ ! -d $CACHEDIR ]; then - if [ -d $CACHEDIR ]; then - # Pre-cache files - chroot $CACHEDIR apt-get update - chroot $CACHEDIR apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` - chroot $CACHEDIR pip install `cat pips/*` - fi -fi - -# Create network configuration -LXC_CONF=/tmp/net.conf +# Create lxc configuration +LXC_CONF=/tmp/$CONTAINER.conf cat > $LXC_CONF <