# $Id$
#
-BINARIES = plc-config plc-config-tty db-config dns-config refresh-peer.py plc-map.py clean-empty-dirs.py mtail.py renew_reminder.py
+BINARIES = plc-config plc-config-tty db-config dns-config plc-map.py clean-empty-dirs.py mtail.py \
+ support-scripts/renew_reminder.py support-scripts/gen_aliases.py
INIT_SCRIPTS = api bootcd bootmanager crond db dns functions gpg httpd mail network packages postgresql ssh ssl syslog
INITS=$(addprefix plc.d/,$(INIT_SCRIPTS))
########## make sync PLCHOST=hostname
ifdef PLCHOST
-PLCSSH:=root@$(PLCHOST)
+ifdef VSERVER
+PLCSSH:=root@$(PLCHOST):/vservers/$(VSERVER)
+endif
endif
LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
sync:
ifeq (,$(PLCSSH))
- echo "sync: You must define target host as PLCHOST on the command line"
- echo " e.g. make sync PLCHOST=private.one-lab.org" ; exit 1
+ echo "sync: You must define PLCHOST and VSERVER on the command line"
+ echo " e.g. make sync PLCHOST=private.one-lab.org VSERVER=myplc01" ; exit 1
else
- +$(RSYNC) host.init $(PLCSSH):/etc/init.d/plc
- +$(RSYNC) guest.init $(PLCSSH):/plc/root/etc/init.d/plc
- +$(RSYNC) $(BINARIES) $(PLCSSH):/plc/root/usr/bin
- +$(RSYNC) $(INITS) $(PLCSSH):/plc/root/etc/plc.d
- +$(RSYNC) plc_config.py $(PLCSSH):/plc/root/usr/lib/python2.5/site-packages/plc_config.py
- +$(RSYNC) default_config.xml $(PLCSSH):/plc/data/etc/planetlab/default_config.xml
+ +$(RSYNC) guest.init $(PLCSSH)/etc/init.d/plc
+ +$(RSYNC) $(BINARIES) $(PLCSSH)/usr/bin
+ +$(RSYNC) $(INITS) $(PLCSSH)/etc/plc.d
+ +$(RSYNC) plc_config.py $(PLCSSH)/usr/lib/python2.5/site-packages/plc_config.py
+ +$(RSYNC) default_config.xml $(PLCSSH)/etc/planetlab/default_config.xml
@echo XXXXXXXX You might consider running the following command
- @echo ssh $(PLCSSH) chroot /plc/root service plc start
+ @echo ssh $(PLCHOST) service plc start
endif
install -D -m 755 guest.init ${tmpdir}/etc/init.d/plc
# fetch the release stamp from the build if any
-# I could not come up with any more sensitive scheme
if [ -f ../../../myplc-release ] ; then
cp ../../../myplc-release myplc-release
else
# temporary - so that node update still work until yum.conf.php gets fixed
( cd ${tmpdir}/var/www/html/install-rpms ; ln -s $nodefamily planetlab)
+# building myplc doc
+# beware that making the pdf file somehow overwrites the html
+make -C doc myplc.pdf
+rm -f doc/myplc.html
+make -C doc myplc.html
+
+# install doc
+for doc in myplc.html myplc.pdf ; do
+ install -D -m 644 doc/$doc ${tmpdir}/var/www/html/planetlab/doc/$doc
+done
+
+# create drupal pages
+# at this stage we dont have access to the PLCAPI html
+# so, let's just package build.common and do the job in the post-install script
+install -m 644 ./docbook2drupal.sh ${tmpdir}/usr/share/myplc/docbook2drupal.sh
+
exit 0
fi
}
-# quick and dirty - might break anytime if docbook html output changes
-function docbook_html_to_drupal () {
- title=$1; shift
- html=$1; shift
- php=$1; shift
-
- mkdir -p $(dirname $php)
- if [ ! -f $html ] ; then
- cat << __header_no_doc__ > $php
-<?php
-require_once 'plc_drupal.php';
-drupal_set_title("$title - unavailable");
-?>
-<p class='plc-warning'> Build-time error - could not locate documentation $html</p>
-__header_no_doc__
- else
- # insert header, makes sure we have a trailing eol
- (cat << __header_doc__ ; cat $html ) > $php
-<?php
-require_once 'plc_drupal.php';
-drupal_set_title("$title");
-?>
-__header_doc__
- # ignore ed return status
- set +e
- # cuts off around the <body> </body>
- # preserves the 4 first lines that we just added as a header
- ed -s $php << __ed_script__
-/BODY/
-/>/
-s,><,<,
-5,-d
-$
-?/BODY?
-s,><.*,>,
-+
-;d
-w
-q
-__ed_script__
- set -e
- fi
-}
# we now build the plcapi doc
# this generates a drupal php file from a docbook-generated html
# quick & dirty
-docbook_html_to_drupal "${pldistro} PLCAPI Documentation" \
+./docbook2drupal.sh "${pldistro} PLCAPI Documentation" \
root/usr/share/plc_api/doc/PLCAPI.html \
root/var/www/html/planetlab/doc/plcapi.php
# pdf just get copied
install -m 644 root/usr/share/plc_api/doc/PLCAPI.pdf root/var/www/html/planetlab/doc/plcapi.pdf
-docbook_html_to_drupal "Myplc User Guide" \
+./docbook2drupal.sh "Myplc User Guide" \
root/usr/share/plc_api/doc/myplc.html \
root/var/www/html/planetlab/doc/myplc.php
# pdf just get copied
<variable id="ip" type="ip">
<name>IP Address</name>
- <value>127.0.0.1</value>
+ <value/>
<description>The IP address of the database server, if not
- resolvable by the configured DNS servers.</description>
+ resolvable.</description>
</variable>
<variable id="port" type="int">
<variable id="ip" type="ip">
<name>IP Address</name>
- <value>127.0.0.1</value>
+ <value/>
<description>The IP address of the API server, if not
- resolvable by the configured DNS servers.</description>
+ resolvable.</description>
</variable>
<variable id="ipod_subnet" type="ip">
<variable id="ip" type="ip">
<name>IP Address</name>
- <value>127.0.0.1</value>
+ <value/>
<description>The IP address of the web server, if not
- resolvable by the configured DNS servers.</description>
+ resolvable.</description>
</variable>
<variable id="port" type="int">
<variable id="ip" type="ip">
<name>IP Address</name>
- <value>127.0.0.1</value>
+ <value/>
<description>The IP address of the boot server, if not
- resolvable by the configured DNS servers.</description>
+ resolvable.</description>
</variable>
<variable id="port" type="int">
--- /dev/null
+#!/bin/bash
+
+# quick and dirty - might break anytime if docbook html output changes
+function docbook_html_to_drupal () {
+ title=$1; shift
+ html=$1; shift
+ php=$1; shift
+
+ mkdir -p $(dirname $php)
+ if [ ! -f $html ] ; then
+ cat << __header_no_doc__ > $php
+<?php
+require_once 'plc_drupal.php';
+drupal_set_title("$title - unavailable");
+?>
+<p class='plc-warning'> Build-time error - could not locate documentation $html</p>
+__header_no_doc__
+ else
+ # insert header, makes sure we have a trailing eol
+ (cat << __header_doc__ ; cat $html ) > $php
+<?php
+require_once 'plc_drupal.php';
+drupal_set_title("$title");
+?>
+__header_doc__
+ # ignore ed return status
+ set +e
+ # cuts off around the <body> </body>
+ # preserves the 4 first lines that we just added as a header
+ ed -s $php << __ed_script__
+/BODY/
+/>/
+s,><,<,
+5,-d
+$
+?/BODY?
+s,><.*,>,
++
+;d
+w
+q
+__ed_script__
+ set -e
+ fi
+}
+
+docbook_html_to_drupal "$@"
pushd /usr/share/myplc &> /dev/null
python plc_config.py build
python plc_config.py install
+# build drupal docs - this is crappy but at least we keep PLCAPI out
+# also, we copy everythong in the same place
+mkdir -p /var/www/html/planetlab/doc
+if [ -f /usr/share/plc_api/doc/PLCAPI.html ] ; then
+ cp /usr/share/plc_api/doc/PLCAPI.{html,pdf} /var/www/html/planetlab/doc
+ ./docbook2drupal.sh "PLCAPI Documentation" \
+ /var/www/html/planetlab/doc/PLCAPI.html \
+ /var/www/html/planetlab/doc/plcapi.php
+fi || :
+# same for the PLCAPI doc
+if [ -f /usr/share/myplc/doc/myplc.html ] ; then
+ cp /usr/share/myplc/doc/myplc.{html,pdf} /var/www/html/planetlab/doc
+ ./docbook2drupal.sh "Myplc User Guide" \
+ /var/www/html/planetlab/doc/myplc.html \
+ /var/www/html/planetlab/doc/myplc.php
+fi || :
+
popd &> /dev/null
%triggerpostun -- %{name}
/etc/plc_sliceinitscripts/sirius
/etc/support-scripts/gen_aliases.py*
/etc/support-scripts/renew_reminder.py*
-/var/www/html/install-rpms/%{pldistro}-%{_arch}
-/var/www/html/install-rpms/planetlab
/usr/bin/plc-config
/usr/bin/plc-config-tty
/usr/bin/db-config
/usr/bin/mtail.py*
/usr/bin/check-ssl-peering.py*
/usr/share/myplc
+/var/www/html/install-rpms/%{pldistro}-%{_arch}
+/var/www/html/install-rpms/planetlab
+/var/www/html/planetlab/doc/
%changelog
* Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-9
# Print IP address of hostname if resolvable
gethostbyname ()
{
- perl -MSocket -e '($a,$b,$c,$d,@addrs) = gethostbyname($ARGV[0]); print inet_ntoa($addrs[0]) . "\n";' $1 2>/dev/null
+ python -c 'import socket; import sys; print socket.gethostbyname(sys.argv[1])' $1 2>/dev/null
}
# Forcefully make a symlink
mv -f /etc/hosts /etc/hosts_plc.backup
hfile=$(mktemp)
# Minimal /etc/hosts
- (
- for server in DB API BOOT WWW ; do
- hostname=PLC_${server}_HOST
- ip=PLC_${server}_IP
- if [ -n "${!ip}" ] ; then
- echo "${!ip} ${!hostname}"
- else
- ip=$(gethostbyname ${!hostname})
- if [ -n "$ip" ] ; then
- echo "$ip ${!hostname}"
- fi
+ for server in DB API BOOT WWW ; do
+ hostname=PLC_${server}_HOST
+ ip=PLC_${server}_IP
+ if [ -n "${!ip}" ] ; then
+ echo "${!ip} ${!hostname}"
+ else
+ ip=$(gethostbyname ${!hostname})
+ if [ -n "$ip" ] ; then
+ echo "$ip ${!hostname}"
fi
- done
- ) > $hfile
- grep -v "^#" /etc/hosts >> $hfile
+ fi
+ done > $hfile
echo "#generated by /etc/plc.d/network" >/etc/hosts
- echo "127.0.0.1 localhost.localdomain localhost" >> $hfile
+ echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
sort -u $hfile >> /etc/hosts
chmod +r /etc/hosts
rm -f $hfile