Browse code

fix apt-get update, add crude caching

Anthony Young authored on 2011/09/13 15:25:37
Showing 1 changed files
... ...
@@ -13,6 +13,16 @@ COPYENV=${COPYENV:-1}
13 13
 lxc-stop -n $CONTAINER
14 14
 lxc-destroy -n $CONTAINER
15 15
 
16
+FSTAB=/tmp/fstab
17
+cat > $FSTAB <<EOF
18
+none /var/lib/lxc/$CONTAINER/dev/pts devpts defaults 0 0
19
+none /var/lib/lxc/$CONTAINER/proc proc defaults 0 0
20
+none /var/lib/lxc/$CONTAINER/sys sysfs defaults 0 0
21
+none /var/lib/lxc/$CONTAINER/var/lock tmpfs defaults 0 0
22
+none /var/lib/lxc/$CONTAINER/var/run tmpfs defaults 0 0
23
+/var/cache/apt/ $APTCACHEDIR none bind 0 0
24
+EOF
25
+
16 26
 # Create network configuration
17 27
 NET_CONF=/tmp/net.conf
18 28
 cat > $NET_CONF <<EOF
... ...
@@ -20,6 +30,7 @@ lxc.network.type = veth
20 20
 lxc.network.link = $BRIDGE
21 21
 lxc.network.flags = up
22 22
 lxc.network.ipv4 = $CONTAINER_CIDR
23
+lxc.mount = $FSTAB
23 24
 EOF
24 25
 
25 26
 # Configure the network
... ...
@@ -55,7 +66,8 @@ cat > $INSTALL_SH <<EOF
55 55
 #!/bin/bash
56 56
 echo "nameserver $NAMESERVER" | resolvconf -a eth0
57 57
 sleep 1
58
-apt-get -y --force-yes install git-core vim-nox
58
+apt-get update
59
+apt-get -y --force-yes install git-core vim-nox sudo
59 60
 git clone git://github.com/cloudbuilders/nfs-stack.git /root/nfs-stack
60 61
 EOF
61 62
 
... ...
@@ -68,6 +80,13 @@ cat > $RC_LOCAL <<EOF
68 68
 /root/install.sh
69 69
 EOF
70 70
 
71
+# Setup apt cache
72
+# FIXME - use proper fstab mount
73
+CWD=`pwd`
74
+APTCACHEDIR=$CWD/cache/apt
75
+mkdir -p $APTCACHEDIR
76
+cp -pr $APTCACHEDIR/* $ROOTFS/var/cache/apt/
77
+
71 78
 # Configure cgroup directory
72 79
 mkdir -p /cgroup
73 80
 mount none -t cgroup /cgroup