This commit was manufactured by cvs2svn to create branch
authorPlanet-Lab Support <support@planet-lab.org>
Wed, 7 Feb 2007 23:46:30 +0000 (23:46 +0000)
committerPlanet-Lab Support <support@planet-lab.org>
Wed, 7 Feb 2007 23:46:30 +0000 (23:46 +0000)
'planetlab-4_0-branch'.

make.sh [new file with mode: 0755]

diff --git a/make.sh b/make.sh
new file mode 100755 (executable)
index 0000000..05e9aff
--- /dev/null
+++ b/make.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+BASE=$(cd "$(dirname $0)" && pwd -P)
+
+# Delete .rpmmacros and parseSpec files in case we are restarting
+rm -f $BASE/.rpmmacros $BASE/parseSpec
+
+# Build development environment first
+make -C $BASE myplc-devel
+
+# Build everything else inside the development environment
+export PLC_ROOT=$(echo $BASE/BUILD/myplc-devel-*/myplc/devel/root)
+export PLC_DATA=$(echo $BASE/BUILD/myplc-devel-*/myplc/devel/data)
+
+cleanup() {
+    sudo umount $PLC_ROOT/data/fedora
+    sudo umount $PLC_ROOT/data/build
+    sudo $BASE/BUILD/myplc-devel-*/myplc/host.init stop
+    sudo chown -h -R $USER $PLC_DATA
+}
+
+trap "cleanup" ERR INT
+
+# Start development environment
+sudo $BASE/BUILD/myplc-devel-*/myplc/host.init start
+
+# Cross mount the current build directory to the build user home directory
+sudo mount -o bind,rw $BASE $PLC_ROOT/data/build
+
+# Also cross mount /data/fedora if it exists
+if [ -d /data/fedora ] ; then
+    sudo mkdir -p $PLC_ROOT/data/fedora
+    sudo mount -o bind,ro /data/fedora $PLC_ROOT/data/fedora
+fi
+
+# Delete .rpmmacros and parseSpec files so that they get regenerated
+# appropriately in the development environment.
+rm -f $BASE/.rpmmacros $BASE/parseSpec
+
+# Enable networking
+sudo cp -f /etc/hosts /etc/resolv.conf $PLC_ROOT/etc/
+
+# Run the rest of the build
+sudo chroot $PLC_ROOT su - build -c "make $@"
+rc=$?
+
+# Clean up
+cleanup
+trap - ERR INT
+
+exit $rc