| ... | ... |
@@ -6,10 +6,8 @@ if [ "$EUID" -ne "0" ]; then |
| 6 | 6 |
exit 1 |
| 7 | 7 |
fi |
| 8 | 8 |
|
| 9 |
-# Warn users who aren't on natty |
|
| 10 |
-if ! grep -q natty /etc/lsb-release; then |
|
| 11 |
- echo "WARNING: this script has only been tested on natty" |
|
| 12 |
-fi |
|
| 9 |
+# Keep track of ubuntu version |
|
| 10 |
+UBUNTU_VERSION=`cat /etc/lsb-release | grep CODENAME | sed 's/.*=//g'` |
|
| 13 | 11 |
|
| 14 | 12 |
# Move to top devstack dir |
| 15 | 13 |
cd .. |
| ... | ... |
@@ -92,8 +90,21 @@ function git_clone {
|
| 92 | 92 |
fi |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
+# Helper to create the container |
|
| 96 |
+function create_lxc {
|
|
| 97 |
+ if [ "natty" = "$UBUNTU_VERSION" ]; then |
|
| 98 |
+ lxc-create -n $CONTAINER -t natty -f $LXC_CONF |
|
| 99 |
+ else |
|
| 100 |
+ lxc-create -n $CONTAINER -t ubuntu -f $LXC_CONF |
|
| 101 |
+ fi |
|
| 102 |
+} |
|
| 103 |
+ |
|
| 95 | 104 |
# Location of the base image directory |
| 96 |
-CACHEDIR=/var/cache/lxc/natty/rootfs-amd64 |
|
| 105 |
+if [ "natty" = "$UBUNTU_VERSION" ]; then |
|
| 106 |
+ CACHEDIR=/var/cache/lxc/natty/rootfs-amd64 |
|
| 107 |
+else |
|
| 108 |
+ CACHEDIR=/var/cache/lxc/oneiric/rootfs-amd64 |
|
| 109 |
+fi |
|
| 97 | 110 |
|
| 98 | 111 |
# Provide option to do totally clean install |
| 99 | 112 |
if [ "$CLEAR_LXC_CACHE" = "1" ]; then |
| ... | ... |
@@ -106,7 +117,7 @@ if [ ! -f $CACHEDIR/bootstrapped ]; then |
| 106 | 106 |
# lazy and doesn't do anything if a container already exists) |
| 107 | 107 |
lxc-destroy -n $CONTAINER |
| 108 | 108 |
# trigger the initial debootstrap |
| 109 |
- lxc-create -n $CONTAINER -t natty -f $LXC_CONF |
|
| 109 |
+ create_lxc |
|
| 110 | 110 |
chroot $CACHEDIR apt-get update |
| 111 | 111 |
chroot $CACHEDIR apt-get install -y --force-yes `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` |
| 112 | 112 |
chroot $CACHEDIR pip install `cat files/pips/*` |
| ... | ... |
@@ -143,7 +154,7 @@ if [ "$TERMINATE" = "1" ]; then |
| 143 | 143 |
fi |
| 144 | 144 |
|
| 145 | 145 |
# Create the container |
| 146 |
-lxc-create -n $CONTAINER -t natty -f $LXC_CONF |
|
| 146 |
+create_lxc |
|
| 147 | 147 |
|
| 148 | 148 |
# Specify where our container rootfs lives |
| 149 | 149 |
ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/ |
| ... | ... |
@@ -207,6 +218,10 @@ cat > $RUN_SH <<EOF |
| 207 | 207 |
#!/usr/bin/env bash |
| 208 | 208 |
# Make sure dns is set up |
| 209 | 209 |
echo "nameserver $NAMESERVER" | sudo resolvconf -a eth0 |
| 210 |
+# Make there is a default route - needed for natty |
|
| 211 |
+if ! route | grep -q default; then |
|
| 212 |
+ sudo ip route add default via $CONTAINER_GATEWAY |
|
| 213 |
+fi |
|
| 210 | 214 |
sleep 1 |
| 211 | 215 |
|
| 212 | 216 |
# Kill any existing screens |
| ... | ... |
@@ -218,7 +233,7 @@ sudo apt-get -y --force-yes install git-core vim-nox sudo |
| 218 | 218 |
if [ ! -d "$DEST/devstack" ]; then |
| 219 | 219 |
git clone git://github.com/cloudbuilders/devstack.git $DEST/devstack |
| 220 | 220 |
fi |
| 221 |
-cd $DEST/devstack && $STACKSH_PARAMS ./stack.sh > /$DEST/run.sh.log |
|
| 221 |
+cd $DEST/devstack && $STACKSH_PARAMS FORCE=yes ./stack.sh > /$DEST/run.sh.log |
|
| 222 | 222 |
echo >> /$DEST/run.sh.log |
| 223 | 223 |
echo >> /$DEST/run.sh.log |
| 224 | 224 |
echo "All done! Time to start clicking." >> /$DEST/run.sh.log |
| ... | ... |
@@ -228,11 +243,13 @@ EOF |
| 228 | 228 |
chmod 755 $RUN_SH |
| 229 | 229 |
|
| 230 | 230 |
# Make runner launch on boot |
| 231 |
-RC_LOCAL=$ROOTFS/etc/rc.local |
|
| 231 |
+RC_LOCAL=$ROOTFS/etc/init.d/local |
|
| 232 | 232 |
cat > $RC_LOCAL <<EOF |
| 233 | 233 |
#!/bin/sh -e |
| 234 | 234 |
su -c "$DEST/run.sh" stack |
| 235 | 235 |
EOF |
| 236 |
+chmod +x $RC_LOCAL |
|
| 237 |
+chroot $ROOTFS sudo update-rc.d local defaults 80 |
|
| 236 | 238 |
|
| 237 | 239 |
# Configure cgroup directory |
| 238 | 240 |
if ! mount | grep -q cgroup; then |