implement stackrc for variable configuration (esp repos)
diff --git a/build_lxc.sh b/build_lxc.sh
index e8612e6..15af51d 100755
--- a/build_lxc.sh
+++ b/build_lxc.sh
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
+# Source params
+source ./stackrc
+
# Configurable params
BRIDGE=${BRIDGE:-br0}
CONTAINER=${CONTAINER:-STACK}
@@ -51,10 +54,23 @@
cgdelete -r cpu,net_cls:$CONTAINER
fi
+# git clone only if directory doesn't exist already. Since ``DEST`` might not
+# be owned by the installation user, we create the directory and change the
+# ownership to the proper user.
+function git_clone {
+ if [ ! -d $2 ]; then
+ sudo mkdir $2
+ sudo chown `whoami` $2
+ git clone $1 $2
+ cd $2
+ # This checkout syntax works for both branches and tags
+ git checkout $3
+ fi
+}
# Warm the base image on first install
CACHEDIR=/var/cache/lxc/natty/rootfs-amd64
-if [ ! -d $CACHEDIR ]; then
+if [ ! -d $CACHEDIR/opt/nova ]; then
# by deleting the container, we force lxc-create to re-bootstrap (lxc is
# lazy and doesn't do anything if a container already exists)
lxc-destroy -n $CONTAINER
@@ -63,15 +79,16 @@
chroot $CACHEDIR apt-get update
chroot $CACHEDIR apt-get install -y --force-yes `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
chroot $CACHEDIR pip install `cat files/pips/*`
- # FIXME (anthony) - provide ability to vary source locations
- #git clone https://github.com/cloudbuilders/nova.git $CACHEDIR/opt/nova
- bzr clone lp:~hudson-openstack/nova/milestone-proposed/ $CACHEDIR/opt/nova
- git clone https://github.com/cloudbuilders/openstackx.git $CACHEDIR/opt/openstackx
- git clone https://github.com/cloudbuilders/noVNC.git $CACHEDIR/opt/noVNC
- git clone https://github.com/cloudbuilders/openstack-dashboard.git $CACHEDIR/opt/dash
- git clone https://github.com/cloudbuilders/python-novaclient.git $CACHEDIR/opt/python-novaclient
- git clone https://github.com/cloudbuilders/keystone.git $CACHEDIR/opt/keystone
- git clone https://github.com/cloudbuilders/glance.git $CACHEDIR/opt/glance
+
+ git_clone $NOVA_REPO $CACHEDIR/opt/nova $NOVA_BRANCH
+ git_clone $GLANCE_REPO $CACHEDIR/opt/glance $GLANCE_BRANCH
+ git_clone $KEYSTONE_REPO $CACHEDIR/opt/keystone $KEYSTONE_BRANCH
+ git_clone $NOVNC_REPO $CACHEDIR/opt/novnc $NOVNC_BRANCH
+ git_clone $DASH_REPO $CACHEDIR/opt/dash $DASH_BRANCH $DASH_TAG
+ git_clone $NIXON_REPO $CACHEDIR/opt/nixon $NIXON_BRANCH
+ git_clone $NOVACLIENT_REPO $CACHEDIR/opt/python-novaclient $NOVACLIENT_BRANCH
+ git_clone $OPENSTACKX_REPO $CACHEDIR/opt/openstackx $OPENSTACKX_BRANCH
+ git_clone $MUNIN_REPO $CACHEDIR/opt/openstack-munin $MUNIN_BRANCH
fi
# Destroy the old container