3 # Common functions for MyPLC build scripts (build_devel.sh and
6 # Mark Huang <mlhuang@cs.princeton.edu>
7 # Copyright (C) 2006 The Trustees of Princeton University
12 PATH=/sbin:/bin:/usr/sbin:/usr/bin
14 # In both a normal CVS environment and a PlanetLab RPM
15 # build environment, all of our dependencies are checked out into
16 # directories at the same level as us.
17 if [ -d ../build ] ; then
21 echo "Error: Could not find $(cd .. && pwd -P)/build/"
29 pl_process_fedora_options $@
33 # XXX Backwards compatibility with old myplc-devel environment
34 # We may be running inside a myplc-devel environment, which can
35 # override these defaults.
36 if [ -f /etc/planetlab/plc_config ] ; then
37 . /etc/planetlab/plc_config
38 [ ! -z "$PLC_DEVEL_FEDORA_RELEASE" ] && pl_FEDORA_RELEASE=$PLC_DEVEL_FEDORA_RELEASE
39 [ ! -z "$PLC_DEVEL_FEDORA_ARCH" ] && pl_FEDORA_ARCH=$PLC_DEVEL_FEDORA_ARCH
40 [ ! -z "$PLC_DEVEL_FEDORA_URL" ] && pl_FEDORA_URL=$PLC_DEVEL_FEDORA_URL
43 # Do not tolerate errors
49 # Make a basic chroot at the specified location given the specified
51 make_chroot_from_lst() {
56 packages=$(pl_getPackagesOptions2 $fcdistro $lst)
57 groups=$(pl_getGroupsOptions2 $fcdistro $lst)
59 pl_setup_chroot $root $packages $groups
62 # Move specified directories out of the chroot and into a "data"
63 # directory that will be bind mounted on /data inside the chroot.
68 # pl_move_dirs $root $data /data "$@"
71 # Make loopback filesystem from specified location
75 # pl_make_image $root $image 100000000
78 function yum_conf_to_build_host () {
79 BUILD_HOST=$(hostname)
82 cachedir=/var/cache/yum
84 logfile=/var/log/yum.log
86 distroverpkg=redhat-release
92 # Prevent yum-2.4 from loading additional repository definitions
93 # (e.g., from /etc/yum.repos.d/)
97 name=Fedora Core 4 - i386 - base
98 baseurl=http://${BUILD_HOST}/fedora/linux/core/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/os/
102 name=Fedora Core 4 - i386 - updates
103 baseurl=http://${BUILD_HOST}/fedora/linux/core/updates/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/
105 $(if [ "${pl_DISTRO_RELEASE}" -le 6 ] ; then cat << EXTRAS
107 name=Fedora Core 4 - i386 - extras
108 baseurl=http://${BUILD_HOST}/fedora/linux/extras/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/
115 function sudoers_bootcustom_apache () {
117 User_Alias WWW = %apache,%root
118 Cmnd_Alias BOOTCUSTOM = /usr/share/bootcd/bootcustom.sh
119 WWW ALL = NOPASSWD: BOOTCUSTOM
123 # quick and dirty - might break anytime if docbook html output changes
124 function docbook_html_to_drupal () {
129 mkdir -p $(dirname $php)
130 if [ ! -f $html ] ; then
131 cat << __header_no_doc__ > $php
133 require_once 'plc_drupal.php';
134 drupal_set_title("$title - unavailable");
136 <p class='plc-warning'> Build-time error - could not locate documentation $html</p>
139 # insert header, makes sure we have a trailing eol
140 (cat << __header_doc__ ; cat $html ) > $php
142 require_once 'plc_drupal.php';
143 drupal_set_title("$title");
146 # ignore ed return status
148 # cuts off around the <body> </body>
149 # preserves the 4 first lines that we just added as a header
150 ed -s $php << __ed_script__