allow role configuration for multi-host lxc
diff --git a/build_lxc.sh b/build_lxc.sh
index e3765db..97dd594 100755
--- a/build_lxc.sh
+++ b/build_lxc.sh
@@ -9,6 +9,9 @@
NAMESERVER=${NAMESERVER:-192.168.1.1}
COPYENV=${COPYENV:-1}
+# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
+STACKSH_PARAMS=${STACKSH_PARAMS:-}
+
# Create lxc configuration
LXC_CONF=/tmp/$CONTAINER.conf
cat > $LXC_CONF <<EOF
@@ -82,12 +85,10 @@
gateway $CONTAINER_GATEWAY
EOF
-# Configure the first run installer
+# Configure the runner
INSTALL_SH=$ROOTFS/root/install.sh
cat > $INSTALL_SH <<EOF
#!/bin/bash
-# Disable startup script
-echo \#\!/bin/sh -e > /etc/rc.local
# Make sure dns is set up
echo "nameserver $NAMESERVER" | resolvconf -a eth0
sleep 1
@@ -95,8 +96,10 @@
# Install and run stack.sh
apt-get update
apt-get -y --force-yes install git-core vim-nox sudo
-su -c "git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack" stack
-su -c "cd ~/nfs-stack && ./stack.sh" stack
+if [ ! -d "~/nfs-stack" ]
+ su -c "git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack" stack
+fi
+su -c "cd ~/nfs-stack && $STACKSH_PARAMS ./stack.sh" stack
EOF
# Make the install.sh executable
diff --git a/stack.sh b/stack.sh
index 64c97da..0f6ea96 100755
--- a/stack.sh
+++ b/stack.sh
@@ -60,8 +60,8 @@
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
# Mysql connection info
-MYSQL_PASS=${MYSQL_PASS:-nova}
MYSQL_USER=${MYSQL_USER:-root}
+MYSQL_PASS=${MYSQL_PASS:-nova}
MYSQL_HOST=${MYSQL_HOST:-localhost}
# don't specify /db in this string, so we can use it for multiple services
BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASS@$MYSQL_HOST}