pass CVS tag through to internal myplc build
[myplc.git] / build_devel.sh
1 #!/bin/bash
2 #
3 # Build a complete MyPLC development environment. Requires PlanetLab
4 # source code to be exported into directories at the same level as we
5 # are (i.e., ..).
6 #
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 #
14 # Mark Huang <mlhuang@cs.princeton.edu>
15 # Copyright (C) 2006 The Trustees of Princeton University
16 #
17 # $Id: build_devel.sh,v 1.1 2006/07/17 21:31:31 mlhuang Exp $
18 #
19
20 . build.functions
21
22 echo "* myplc-devel: Installing base filesystem"
23 mkdir -p devel/root
24 make_chroot devel/root plc_devel_config.xml
25
26 # Import everything (including ourself) into a private CVS tree
27 echo "* myplc-devel: Building CVS repository"
28 cvsroot=$PWD/devel/data/cvs
29 mkdir -p $cvsroot
30 cvs -d $cvsroot init
31
32 myplc=$(basename $PWD)
33 pushd ..
34 for dir in * ; do
35     if [ ! -d $cvsroot/$dir ] ; then
36         pushd $dir
37         if [ "$dir" = "$myplc" ] ; then
38             # Ignore generated files
39             ignore="-I ! -I devel -I root -I root.img -I data" 
40         else
41             ignore="-I !"
42         fi
43         cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab $TAG
44         popd
45     fi
46 done
47 popd
48
49 # Install configuration file
50 echo "* myplc-devel: Installing configuration file"
51 install -D -m 444 plc_devel_config.xml devel/data/etc/planetlab/default_config.xml
52 install -D -m 444 plc_config.dtd devel/data/etc/planetlab/plc_config.dtd
53
54 # Install configuration scripts
55 echo "* myplc-devel: Installing configuration scripts"
56 install -D -m 755 plc_config.py devel/root/tmp/plc_config.py
57 chroot devel/root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
58 install -D -m 755 plc-config devel/root/usr/bin/plc-config
59
60 # Install initscripts
61 echo "* myplc-devel: Installing initscripts"
62 find plc.d/functions | cpio -p -d -u devel/root/etc/
63 install -D -m 755 guest.init devel/root/etc/init.d/plc
64 chroot devel/root sh -c 'chkconfig --add plc; chkconfig plc on'
65
66 # Move "data" directories out of the installation
67 echo "* myplc-devel: Moving data directories out of the installation"
68 move_datadirs devel/root devel/data \
69     /etc/planetlab /build /cvs
70
71 # Make image out of directory
72 echo "* myplc-devel: Building loopback image"
73 make_image devel/root devel/root.img
74
75 exit 0