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
23 # pldistro expected as $1 - defaults to planetlab
25 [ -n "$@" ] && pldistro=$1
27 # These directories are allowed to grow to unspecified size, so they
28 # are stored as symlinks to the /data partition. mkfedora and yum
29 # expect some of them to be real directories, however.
34 /var/www/html/alpina-logs
36 /var/www/html/download
39 /var/www/html/generated
40 /var/www/html/install-rpms
48 pl_fixdirs root "${datadirs[@]}"
50 echo "* myplc: Installing base filesystem"
53 pkgsfile=$(pl_locateDistroFile ../build/ ${pldistro} myplc.pkgs)
54 pl_root_setup_chroot root -f $pkgsfile
56 # Install configuration scripts
57 echo "* myplc: Installing configuration scripts"
58 install -D -m 755 plc_config.py root/tmp/plc_config.py
59 chroot root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
60 install -D -m 755 plc-config root/usr/bin/plc-config
61 install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
62 install -D -m 755 db-config root/usr/bin/db-config
63 install -D -m 755 dns-config root/usr/bin/dns-config
64 install -D -m 755 plc-map.py root/usr/bin/plc-map.py
65 install -D -m 755 clean-empty-dirs.py root/usr/bin/clean-empty-dirs.py
66 install -D -m 755 mtail.py root/usr/bin/mtail.py
67 install -D -m 755 check-ssl-peering.py root/usr/bin/check-ssl-peering.py
70 echo "* myplc: Installing initscripts"
71 find plc.d | cpio -p -d -u root/etc/
72 install -D -m 755 guest.init root/etc/init.d/plc
73 chroot root sh -c 'chkconfig --add plc; chkconfig plc on'
75 # fetch the release stamp from the build if any
76 # I could not come up with any more sensitive scheme
77 if [ -f ../../../myplc-release ] ; then
78 cp ../../../myplc-release myplc-release
80 echo "No build release information found" > myplc-release
82 # install it in /etc/myplc-release
83 install -m 444 myplc-release root/etc/myplc-release
85 ### Thierry Parmentelat - april 16 2007
86 # fix the yum.conf as produced by mkfedora
87 # so we can use the build's fc4 mirror for various installs/upgrades
88 # within the chroot jail
89 # yum_conf_to_build_host is defined in build.functions
90 yum_conf_to_build_host > root/etc/yum.conf
92 ### Thierry Parmentelat - july 20 2007
93 # we now build the myplc doc
94 # beware that making the pdf file somehow overwrites the html
97 make -C doc myplc.html
99 # install at the same place as plcapi - better ideas ?
100 for doc in myplc.html myplc.pdf ; do
101 install -m 644 doc/$doc root/usr/share/plc_api/doc/$doc
104 # we now build the plcapi doc
105 # this generates a drupal php file from a docbook-generated html
107 docbook_html_to_drupal "${pldistro} PLCAPI Documentation" \
108 root/usr/share/plc_api/doc/PLCAPI.html \
109 root/var/www/html/planetlab/doc/plcapi.php
110 # pdf just get copied
111 install -m 644 root/usr/share/plc_api/doc/PLCAPI.pdf root/var/www/html/planetlab/doc/plcapi.pdf
113 docbook_html_to_drupal "Myplc User Guide" \
114 root/usr/share/plc_api/doc/myplc.html \
115 root/var/www/html/planetlab/doc/myplc.php
116 # pdf just get copied
117 install -m 644 root/usr/share/plc_api/doc/myplc.pdf root/var/www/html/planetlab/doc/myplc.pdf
119 # Install configuration file
120 echo "* myplc: Installing configuration file"
121 install -D -m 444 default_config.xml data/etc/planetlab/default_config.xml
122 install -D -m 444 plc_config.dtd data/etc/planetlab/plc_config.dtd
124 # handle root's homedir and tweak root prompt
125 echo "* myplc: root's homedir and prompt"
128 cat << EOF > $roothome/.profile
129 export PS1="<plc> \$PS1"
131 chmod 644 $roothome/.profile
133 # Move "data" directories out of the installation
134 echo "* myplc: Moving data directories out of the installation"
135 pl_move_dirs root data /data "${datadirs[@]}"
137 # Fix permissions on tmp directories
138 pl_fixtmp_permissions data
140 # Remove generated bootmanager script
141 rm -f data/var/www/html/boot/bootmanager.sh
143 # Initialize node RPMs directory. The PlanetLab-Bootstrap.tar.bz2
144 # tarball already contains all of the node RPMs pre-installed. Only
145 # updates or optional packages should be placed in this directory.
146 install -D -m 644 $pl_DISTRO_YUMGROUPS \
147 data/var/www/html/install-rpms/planetlab/yumgroups.xml
149 # Make image out of directory
150 echo "* myplc: Building loopback image"
151 pl_make_image root root.img 100000000