3 # Builds MyPLC, either inside the MyPLC development environment in
4 # devel/root (if PLC_DEVEL_BOOTSTRAP is true), or in the current host
5 # environment (may be itself a MyPLC development environment or a
6 # Fedora Core 4 environment with the appropriate development packages
9 # root.img (loopback image)
11 # data/ (various data files)
12 # data/etc/planetlab/ (configuration files)
13 # data/root (root's homedir)
15 # Mark Huang <mlhuang@cs.princeton.edu>
16 # Copyright (C) 2006 The Trustees of Princeton University
18 # $Id: build.sh,v 1.38 2007/01/20 04:06:02 mlhuang Exp $
23 # These directories are allowed to grow to unspecified size, so they
24 # are stored as symlinks to the /data partition. mkfedora and yum
25 # expect some of them to be real directories, however.
30 /var/www/html/alpina-logs
32 /var/www/html/download
34 /var/www/html/generated
35 /var/www/html/install-rpms
42 for datadir in "${datadirs[@]}" ; do
43 # If we are being re-run, it may be a symlink
44 if [ -h root/$datadir ] ; then
46 mkdir -p root/$datadir
50 echo "* myplc: Installing base filesystem"
52 make_chroot root plc_config.xml
54 # Install configuration scripts
55 echo "* myplc: Installing configuration scripts"
56 install -D -m 755 plc_config.py root/tmp/plc_config.py
57 chroot root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
58 install -D -m 755 plc-config root/usr/bin/plc-config
59 install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
60 install -D -m 755 db-config root/usr/bin/db-config
61 install -D -m 755 dns-config root/usr/bin/dns-config
64 echo "* myplc: Installing initscripts"
65 find plc.d | cpio -p -d -u root/etc/
66 install -D -m 755 guest.init root/etc/init.d/plc
67 chroot root sh -c 'chkconfig --add plc; chkconfig plc on'
70 echo "* myplc: Installing web scripts"
73 $srcdir/plc/scripts/gen-sites-xml.py \
74 $srcdir/plc/scripts/gen-slices-xml-05.py \
75 $srcdir/plc/scripts/gen-static-content.py \
79 echo "* myplc: Installing web pages"
80 mkdir -p root/var/www/html
81 rsync -a $srcdir/new_plc_www/ root/var/www/html/
83 # Install Drupal rewrite rules
84 install -D -m 644 $srcdir/new_plc_www/drupal.conf root/etc/httpd/conf.d/drupal.conf
86 # Install configuration file
87 echo "* myplc: Installing configuration file"
88 install -D -m 444 $config data/etc/planetlab/default_config.xml
89 install -D -m 444 plc_config.dtd data/etc/planetlab/plc_config.dtd
91 # handle root's homedir and tweak root prompt
92 echo "* myplc: root's homedir and prompt"
95 cat << EOF > $roothome/.profile
96 export PS1="<plc> \$PS1"
98 chmod 644 $roothome/.profile
100 # Move "data" directories out of the installation
101 echo "* myplc: Moving data directories out of the installation"
102 move_datadirs root data "${datadirs[@]}"
104 # Fix permissions on tmp directories
105 chmod 1777 data/tmp data/usr/tmp data/var/tmp
107 # Remove generated bootmanager script
108 rm -f data/var/www/html/boot/bootmanager.sh
110 # Initialize node RPMs directory. The PlanetLab-Bootstrap.tar.bz2
111 # tarball already contains all of the node RPMs pre-installed. Only
112 # updates or optional packages should be placed in this directory.
113 install -D -m 644 ../build/groups/v3_yumgroups.xml \
114 data/var/www/html/install-rpms/planetlab/yumgroups.xml
116 # Make image out of directory
117 echo "* myplc: Building loopback image"
118 make_image root root.img