Create run.sh
diff --git a/tools/build_ramdisk.sh b/tools/build_ramdisk.sh
index 63d37a9..b9f4afd 100755
--- a/tools/build_ramdisk.sh
+++ b/tools/build_ramdisk.sh
@@ -18,6 +18,9 @@
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:-}
+
# Option to use the version of devstack on which we are currently working
USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
@@ -112,6 +115,29 @@
iface eth0 inet dhcp
EOF
+# Configure the runner
+RUN_SH=$CHROOTCACHE/natty-stack/$DEST/run.sh
+cat > $RUN_SH <<EOF
+#!/usr/bin/env bash
+
+# Pre-empt download of natty image
+tar czf $DEST/devstack/files/natty.tgz /etc/hosts
+touch $DEST/devstack/files/images/natty-server-cloudimg-amd64-vmlinuz-virtual
+touch $DEST/devstack/files/images/natty-server-cloudimg-amd64.img
+
+# Kill any existing screens
+killall screen
+
+# Run stack.sh
+cd $DEST/devstack && \$STACKSH_PARAMS ./stack.sh > $DEST/run.sh.log
+echo >> $DEST/run.sh.log
+echo >> $DEST/run.sh.log
+echo "All done! Time to start clicking." >> $DEST/run.sh.log
+EOF
+
+# Make the run.sh executable
+chmod 755 $RUN_SH
+
# build a new image
BASE=$CHROOTCACHE/build.$$
IMG=$BASE.img