use build/build.common to use common build operations
[bootmanager.git] / support-files / buildnode.sh
1 #!/bin/bash
2 #
3 # Build PlanetLab-Bootstrap.tar.bz2, the reference image for PlanetLab
4 # nodes.
5 #
6 # Mark Huang <mlhuang@cs.princeton.edu>
7 # Copyright (C) 2005-2006 The Trustees of Princeton University
8 #
9 # $Id: buildnode.sh,v 1.13 2007/08/30 20:08:25 mef Exp $
10 #
11
12 PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14 # In both a normal CVS environment and a PlanetLab RPM
15 # build environment, all of our dependencies are checked out into
16 # directories at the same level as us.
17 if [ -d ../../build ] ; then
18     PATH=$PATH:../../build
19     srcdir=../..
20 else
21     echo "Error: Could not find $(cd ../.. && pwd -P)/build/"
22     exit 1
23 fi
24
25 export PATH
26
27 . build.common
28
29 pl_process_fedora_options $@
30 shiftcount=$?
31 shift $shiftcount
32
33 # Do not tolerate errors
34 set -e
35
36 VROOT=$PWD/PlanetLab-Bootstrap
37 install -d -m 755 $VROOT
38
39 # Some of the PlanetLab RPMs attempt to (re)start themselves in %post,
40 # unless the installation is running inside the BootCD environment. We
41 # would like to pretend that we are.
42 export PL_BOOTCD=1
43
44 # Install the "PlanetLab" group. This requires that the PlanetLab
45 # build system install the appropriate yumgroups.xml file (currently
46 # build/groups/v3_yumgroups.xml) in $RPM_BUILD_DIR/../RPMS/ and that
47 # mkfedora runs either yum-arch or createrepo on that directory. dev
48 # is specified explicitly because of a stupid bug in its %post script
49 # that causes its installation to fail; see the mkfedora script for a
50 # full explanation. coreutils and python are specified explicitly
51 # because groupinstall does not honor Requires(pre) dependencies
52 # properly, most %pre scripts require coreutils to be installed first,
53 # and some of our %post scripts require python.
54
55 packagelist=(
56 udev
57 coreutils
58 python
59 )
60 # vserver-reference packages used for reference image
61 for package in "${packagelist[@]}" ; do
62     packages="$packages -p $package"
63 done
64
65 # Populate VROOT with the files for the PlanetLab-Bootstrap content
66 pl_setup_chroot $VROOT -k $packages -g PlanetLab
67
68 # Disable additional unnecessary services
69 echo "* Disabling unnecessary services"
70 for service in netfs rawdevices cpuspeed smartd ; do
71     if [ -x $VROOT/etc/init.d/$service ] ; then
72         /usr/sbin/chroot $VROOT /sbin/chkconfig $service off
73     fi
74 done
75
76 # Build tarball
77 echo "* Building bootstrap tarball"
78 tar -cpjf PlanetLab-Bootstrap.tar.bz2 -C $VROOT .
79
80 exit 0