use /opt/stack instead of /opt
diff --git a/build_lxc.sh b/build_lxc.sh
index b97f8db..1f85b33 100755
--- a/build_lxc.sh
+++ b/build_lxc.sh
@@ -22,6 +22,7 @@
CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY}
COPYENV=${COPYENV:-1}
+DEST=${DEST:-/opt/stack}
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
STACKSH_PARAMS=${STACKSH_PARAMS:-}
@@ -94,21 +95,27 @@
chroot $CACHEDIR pip install `cat files/pips/*`
fi
+# Clean out code repos if directed to do so
+if [ "$CLEAN" = "1" ]; then
+ rm -rf $NOVA_REPO $CACHEDIR/$DEST
+fi
+
# Cache openstack code
-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
+mkdir -p $CACHEDIR/$DEST
+git_clone $NOVA_REPO $CACHEDIR/$DEST/nova $NOVA_BRANCH
+git_clone $GLANCE_REPO $CACHEDIR/$DEST/glance $GLANCE_BRANCH
+git_clone $KEYSTONE_REPO $CACHEDIR/$DESTkeystone $KEYSTONE_BRANCH
+git_clone $NOVNC_REPO $CACHEDIR/$DEST/novnc $NOVNC_BRANCH
+git_clone $DASH_REPO $CACHEDIR/$DEST/dash $DASH_BRANCH $DASH_TAG
+git_clone $NIXON_REPO $CACHEDIR/$DEST/nixon $NIXON_BRANCH
+git_clone $NOVACLIENT_REPO $CACHEDIR/$DEST/python-novaclient $NOVACLIENT_BRANCH
+git_clone $OPENSTACKX_REPO $CACHEDIR/$DEST/openstackx $OPENSTACKX_BRANCH
+git_clone $MUNIN_REPO $CACHEDIR/$DEST/openstack-munin $MUNIN_BRANCH
# Use this version of devstack?
if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
- rm -rf $CACHEDIR/opt/devstack
- cp -pr $CWD $CACHEDIR/opt/devstack
+ rm -rf $CACHEDIR/$DEST/devstack
+ cp -pr $CWD $CACHEDIR/$DEST/devstack
fi
# Destroy the old container
@@ -128,7 +135,7 @@
# Create a stack user that is a member of the libvirtd group so that stack
# is able to interact with libvirt.
chroot $ROOTFS groupadd libvirtd
-chroot $ROOTFS useradd stack -s /bin/bash -d /opt -G libvirtd
+chroot $ROOTFS useradd stack -s /bin/bash -d $DEST -G libvirtd
# a simple password - pass
echo stack:pass | chroot $ROOTFS chpasswd
@@ -151,19 +158,19 @@
# Copy over your ssh keys and env if desired
if [ "$COPYENV" = "1" ]; then
- cp_it ~/.ssh $ROOTFS/opt/.ssh
- cp_it ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys
- cp_it ~/.gitconfig $ROOTFS/opt/.gitconfig
- cp_it ~/.vimrc $ROOTFS/opt/.vimrc
- cp_it ~/.bashrc $ROOTFS/opt/.bashrc
+ cp_it ~/.ssh $ROOTFS/$DEST/.ssh
+ cp_it ~/.ssh/id_rsa.pub $ROOTFS/$DEST/.ssh/authorized_keys
+ cp_it ~/.gitconfig $ROOTFS/$DEST/.gitconfig
+ cp_it ~/.vimrc $ROOTFS/$DEST/.vimrc
+ cp_it ~/.bashrc $ROOTFS/$DEST/.bashrc
fi
# Make our ip address hostnames look nice at the command prompt
-echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/opt/.bashrc
+echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/etc/profile
-# Give stack ownership over /opt so it may do the work needed
-chroot $ROOTFS chown -R stack /opt
+# Give stack ownership over /$DEST so it may do the work needed
+chroot $ROOTFS chown -R stack /$DEST
# Configure instance network
INTERFACES=$ROOTFS/etc/network/interfaces
@@ -179,7 +186,7 @@
EOF
# Configure the runner
-RUN_SH=$ROOTFS/opt/run.sh
+RUN_SH=$ROOTFS/$DEST/run.sh
cat > $RUN_SH <<EOF
#!/usr/bin/env bash
# Make sure dns is set up
@@ -192,10 +199,10 @@
# Install and run stack.sh
sudo apt-get update
sudo apt-get -y --force-yes install git-core vim-nox sudo
-if [ ! -d "/opt/devstack" ]; then
- git clone git://github.com/cloudbuilders/devstack.git /opt/devstack
+if [ ! -d "/$DEST/devstack" ]; then
+ git clone git://github.com/cloudbuilders/devstack.git /$DEST/devstack
fi
-cd /opt/devstack && $STACKSH_PARAMS ./stack.sh > /opt/run.sh.log
+cd /$DEST/devstack && $STACKSH_PARAMS ./stack.sh > /$DEST/run.sh.log
EOF
# Make the run.sh executable
@@ -205,7 +212,7 @@
RC_LOCAL=$ROOTFS/etc/rc.local
cat > $RC_LOCAL <<EOF
#!/bin/sh -e
-su -c "/opt/run.sh" stack
+su -c "/$DEST/run.sh" stack
EOF
# Configure cgroup directory