#!/bin/bash
+#
+# make(1) wrapper to build PlanetLab RPMS inside a myplc-devel
+# development environment.
+#
+# 1. $BASE is the build/ directory containing this script.
+# 2. Builds myplc-devel using host tools.
+# 3. Mounts $BASE onto the home directory of the build user inside
+# myplc-devel.
+# 4. Executes "make" on the specified targets.
+#
+# Can be used to manally restart a build also, e.g.,
+#
+# cd build/nightly/2007.02.07/
+# ./make.sh kernel
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2007 The Trustees of Princeton University
+#
+# $Id: make.sh,v 1.2 2007/02/07 23:49:42 mlhuang Exp $
+#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
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)
+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 $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
+sudo $BASE/BUILD/myplc-devel-*/MyPLC/host.init start
+
+# Make sure "build" user has proper sudoers setup
+if [ $(sudo grep "build.*ALL=(ALL).*NOPASSWD:.*ALL" $PLC_ROOT/etc/sudoers | wc -l) -eq 0 ] ; then
+ sudo echo "build ALL=(ALL) NOPASSWD: ALL" >> $PLC_ROOT/etc/sudoers
+fi
# Cross mount the current build directory to the build user home directory
sudo mount -o bind,rw $BASE $PLC_ROOT/data/build