Various tweaks for myplc-native (not thoroughly tested yet) :
[myplc.git] / build-native.sh
1 #!/bin/bash
2 #
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 environment with the appropriate development packages
7 # installed).
8 #
9 # Marc E. Fiuczynski <mef@cs.princeton.edu>
10 # Copyright (C) 2007 The Trustees of Princeton University
11 #
12 # $Id$
13 #
14
15 . build.functions
16
17 # XXX .spec file needs to have the appropriate set of requires statements
18
19 # Install configuration scripts
20 echo "* myplc-native: Installing configuration scripts"
21 pldistro=$1; shift
22 tmpdir=$1 ; shift
23 rm -rf ${tmpdir}
24 mkdir -p ${tmpdir}
25 echo "* myplc-native: installing plc_config.py in /usr/share/myplc"
26 install -D -m 755 plc_config.py ${tmpdir}/usr/share/myplc/plc_config.py
27 install -D -m 755 plc-config ${tmpdir}/usr/bin/plc-config
28 install -D -m 755 plc-config-tty ${tmpdir}/usr/bin/plc-config-tty
29 install -D -m 755 db-config ${tmpdir}/usr/bin/db-config
30 install -D -m 755 dns-config ${tmpdir}/usr/bin/dns-config
31 install -D -m 755 plc-map.py ${tmpdir}/usr/bin/plc-map.py
32 install -D -m 755 clean-empty-dirs.py ${tmpdir}/usr/bin/clean-empty-dirs.py
33 install -D -m 755 mtail.py ${tmpdir}/usr/bin/mtail.py
34 install -D -m 755 check-ssl-peering.py ${tmpdir}/usr/bin/check-ssl-peering.py
35 # Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
36 mkdir -p ${tmpdir}/etc/support-scripts
37 cp support-scripts/* ${tmpdir}/etc/support-scripts
38 # copy initscripts to etc/plc_sliceinitscripts
39 mkdir -p ${tmpdir}/etc/plc_sliceinitscripts
40 cp plc_sliceinitscripts/* ${tmpdir}/etc/plc_sliceinitscripts
41
42 # Install initscripts
43 echo "* myplc-native: Installing initscripts"
44 find plc.d | cpio -p -d -u ${tmpdir}/etc/
45 install -D -m 755 guest.init ${tmpdir}/etc/init.d/plc
46
47 # fetch the release stamp from the build if any
48 if [ -f ../../../myplc-release ] ; then
49   cp ../../../myplc-release myplc-release
50 else
51   echo "Cannot find release information." > myplc-release
52   date >> myplc-release
53   echo "$HeadURL$" >> myplc-release
54 fi
55 # install it in /etc/myplc-release 
56 install -m 444 myplc-release ${tmpdir}/etc/myplc-release
57
58 # Install configuration file
59 echo "* myplc: Installing configuration file"
60 install -D -m 444 default_config.xml ${tmpdir}/etc/planetlab/default_config.xml
61 install -D -m 444 plc_config.dtd ${tmpdir}/etc/planetlab/plc_config.dtd
62
63 # Initialize node RPMs directory. The PlanetLab-Bootstrap.tar.bz2
64 # tarball already contains all of the node RPMs pre-installed. Only
65 # updates or optional packages should be placed in this directory.
66 nodefamily=${pldistro}-${pl_DISTRO_ARCH}
67 install -D -m 644 $pl_DISTRO_YUMGROUPS \
68     ${tmpdir}/var/www/html/install-rpms/$nodefamily/yumgroups.xml
69 # temporary - so that node update still work until yum.conf.php gets fixed
70 ( cd ${tmpdir}/var/www/html/install-rpms ; ln -s $nodefamily planetlab)
71
72 # building myplc doc
73 # beware that making the pdf file somehow overwrites the html
74 make -C doc myplc.pdf 
75 rm -f doc/myplc.html
76 make -C doc myplc.html 
77
78 # install doc
79 for doc in myplc.html myplc.pdf ; do
80     install -D -m 644 doc/$doc ${tmpdir}/var/www/html/planetlab/doc/$doc
81 done
82
83 # create drupal pages
84 # at this stage we dont have access to the PLCAPI html
85 # so, let's just package build.common and do the job in the post-install script
86 install -m 644 ./docbook2drupal.sh ${tmpdir}/usr/share/myplc/docbook2drupal.sh
87
88 exit 0