3 # make(1) wrapper to build PlanetLab RPMS inside a myplc-devel
4 # development environment.
6 # 1. $BASE is the build/ directory containing this script.
7 # 2. Builds myplc-devel using host tools.
8 # 3. Mounts $BASE onto the home directory of the build user inside
10 # 4. Executes "make" on the specified targets.
12 # Can be used to manally restart a build also, e.g.,
14 # cd build/nightly/2007.02.07/
17 # Mark Huang <mlhuang@cs.princeton.edu>
18 # Copyright (C) 2007 The Trustees of Princeton University
20 # $Id: make.sh,v 1.2 2007/02/07 23:49:42 mlhuang Exp $
23 PATH=/sbin:/bin:/usr/sbin:/usr/bin
25 BASE=$(cd "$(dirname $0)" && pwd -P)
27 # Delete .rpmmacros and parseSpec files in case we are restarting
28 rm -f $BASE/.rpmmacros $BASE/parseSpec
30 # Build development environment first
31 make -C $BASE myplc-devel
33 # Build everything else inside the development environment
34 export PLC_ROOT=$(echo $BASE/BUILD/myplc-devel-*/myplc/devel/root)
35 export PLC_DATA=$(echo $BASE/BUILD/myplc-devel-*/myplc/devel/data)
38 sudo umount $PLC_ROOT/data/fedora
39 sudo umount $PLC_ROOT/data/build
40 sudo $BASE/BUILD/myplc-devel-*/myplc/host.init stop
41 sudo chown -h -R $USER $PLC_DATA
44 trap "cleanup" ERR INT
46 # Start development environment
47 sudo $BASE/BUILD/myplc-devel-*/myplc/host.init start
49 # Cross mount the current build directory to the build user home directory
50 sudo mount -o bind,rw $BASE $PLC_ROOT/data/build
52 # Also cross mount /data/fedora if it exists
53 if [ -d /data/fedora ] ; then
54 sudo mkdir -p $PLC_ROOT/data/fedora
55 sudo mount -o bind,ro /data/fedora $PLC_ROOT/data/fedora
58 # Delete .rpmmacros and parseSpec files so that they get regenerated
59 # appropriately in the development environment.
60 rm -f $BASE/.rpmmacros $BASE/parseSpec
63 sudo cp -f /etc/hosts /etc/resolv.conf $PLC_ROOT/etc/
65 # Run the rest of the build
66 sudo chroot $PLC_ROOT su - build -c "make $@"