3 # Build a complete MyPLC development environment. Requires PlanetLab
4 # source code to be exported into directories at the same level as we
7 # devel/root.img (loopback image)
8 # devel/root/ (mount point)
9 # devel/data/ (various data files)
10 # devel/data/cvs/ (local CVS repository)
11 # devel/data/build/ (build area)
12 # devel/data/etc/planetlab/ (configuration)
13 # devel/data/root (root's home dir)
15 # Mark Huang <mlhuang@cs.princeton.edu>
16 # Copyright (C) 2006 The Trustees of Princeton University
18 # $Id: build_devel.sh,v 1.4 2006/08/11 18:34:59 thierry Exp $
23 echo "* myplc-devel: Installing base filesystem"
25 make_chroot devel/root plc_devel_config.xml
27 # Import everything (including ourself) into a private CVS tree
28 echo "* myplc-devel: Building CVS repository"
29 cvsroot=$PWD/devel/data/cvs
33 myplc=$(basename $PWD)
36 if [ ! -d $cvsroot/$dir ] ; then
38 if [ "$dir" = "$myplc" ] ; then
39 # Ignore generated files
40 ignore="-I ! -I devel -I root -I root.img -I data"
44 cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab $IMPORT_TAG
50 # Install configuration file
51 echo "* myplc-devel: Installing configuration file"
52 install -D -m 444 plc_devel_config.xml devel/data/etc/planetlab/default_config.xml
53 install -D -m 444 plc_config.dtd devel/data/etc/planetlab/plc_config.dtd
55 # Install configuration scripts
56 echo "* myplc-devel: Installing configuration scripts"
57 install -D -m 755 plc_config.py devel/root/tmp/plc_config.py
58 chroot devel/root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
59 install -D -m 755 plc-config devel/root/usr/bin/plc-config
60 install -D -m 755 plc-config-tty devel/root/usr/bin/plc-config-tty
63 echo "* myplc-devel: Installing initscripts"
64 find plc.d/functions | cpio -p -d -u devel/root/etc/
65 install -D -m 755 guest.init devel/root/etc/init.d/plc
66 chroot devel/root sh -c 'chkconfig --add plc; chkconfig plc on'
68 # handle root's homedir and tweak root prompt
69 echo "* myplc-devel: root's homedir and prompt"
70 roothome=devel/data/root
72 cat << EOF > $roothome/.profile
73 export PS1="<plc-devel> \$PS1"
75 chmod 644 $roothome/.profile
77 # Move "data" directories out of the installation
78 echo "* myplc-devel: Moving data directories out of the installation"
79 move_datadirs devel/root devel/data \
80 /etc/planetlab /build /cvs /root
82 # Make image out of directory
83 echo "* myplc-devel: Building loopback image"
84 make_image devel/root devel/root.img