merge to HEAD as of 2006-08-21
authorMark Huang <mlhuang@cs.princeton.edu>
Mon, 21 Aug 2006 21:21:12 +0000 (21:21 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Mon, 21 Aug 2006 21:21:12 +0000 (21:21 +0000)
12 files changed:
build.functions
build.sh
build_devel.sh
doc/Makefile
doc/myplc.pdf
doc/myplc.php
doc/myplc.xml
doc/plc_devel_variables.xml
guest.init
myplc.spec
plc-config-tty
plc_devel_config.xml

index edc6b95..5b7ad07 100644 (file)
@@ -6,7 +6,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: build.functions,v 1.2 2006/07/24 19:32:23 mlhuang Exp $
+# $Id: build.functions,v 1.4 2006/08/16 01:27:16 mlhuang Exp $
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -29,13 +29,16 @@ PLC_DEVEL_FEDORA_RELEASE=4
 PLC_DEVEL_FEDORA_ARCH=i386
 
 # Fedora Core mirror from which to install filesystems
-PLC_DEVEL_FEDORA_URL=file:///usr/share/mirrors/fedora
+PLC_DEVEL_FEDORA_URL=file:///data/fedora
 
 # Build myplc inside myplc-devel
 PLC_DEVEL_BOOTSTRAP=true
 
 # Source tag to use for initial import of sources into local CVS
-TAG=planetlab-$(date +%Y-%m-%d)
+IMPORT_TAG=planetlab-$(date +%Y-%m-%d)
+
+# Source tag to use for building from local CVS
+BUILD_TAG=HEAD
 
 # We may be running inside a myplc-devel environment, which can
 # override these defaults. Specifically, whether to build myplc inside
@@ -68,7 +71,8 @@ while getopts "l:r:a:t:h" opt ; do
            PLC_DEVEL_FEDORA_ARCH=$OPTARG
            ;;
        t)
-           TAG=$OPTARG
+           IMPORT_TAG=$OPTARG
+           BUILD_TAG=$OPTARG
            ;;
        h|*)
            usage
index 5520aee..3635abf 100755 (executable)
--- a/build.sh
+++ b/build.sh
 # root/ (mount point)
 # data/ (various data files)
 # data/etc/planetlab/ (configuration files)
+# data/root (root's homedir)
 #
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: build.sh,v 1.27 2006/07/24 19:32:23 mlhuang Exp $
+# $Id: build.sh,v 1.33 2006/08/18 14:35:52 thierry Exp $
 #
 
 . build.functions
@@ -34,14 +35,14 @@ if [ "$PLC_DEVEL_BOOTSTRAP" = "true" ] ; then
     # If we used a local mirror, bind mount it into the chroot so that
     # we can use it again.
     if [ "${PLC_DEVEL_FEDORA_URL:0:7}" = "file://" ] ; then
-       mkdir -p devel/root/usr/share/mirrors/fedora
-       mount -o bind,ro ${PLC_DEVEL_FEDORA_URL#file://} devel/root/usr/share/mirrors/fedora
+       mkdir -p devel/root/data/fedora
+       mount -o bind,ro ${PLC_DEVEL_FEDORA_URL#file://} devel/root/data/fedora
     fi
 
     # Clean up before exiting if anything goes wrong
-    trap "umount $PWD/devel/root/data;
-          umount $PWD/devel/root/proc;
-          umount $PWD/devel/root/usr/share/mirrors/fedora" ERR INT
+    trap "umount $PWD/devel/root/data/fedora;
+          umount $PWD/devel/root/data;
+          umount $PWD/devel/root/proc" ERR INT
 
     # Build myplc inside myplc-devel. Make sure PLC_DEVEL_BOOTSTRAP is
     # false to avoid infinite recursion.
@@ -51,17 +52,17 @@ service plc start
 plc-config --category=plc_devel --variable=bootstrap --value="false" --save
 service plc reload
 cd /
-cvs -d /cvs checkout -r $TAG build
-make TAG=$TAG -C /build myplc
+cvs -d /cvs checkout -r $BUILD_TAG build
+make TAG=$BUILD_TAG -C /build myplc
 EOF
 
     # Yoink the image that was just built
     mv devel/data/build/BUILD/myplc-*/myplc/root{,.img} devel/data/build/BUILD/myplc-*/myplc/data .
 
     # Clean up
+    umount devel/root/data/fedora || :
     umount devel/root/data
     umount devel/root/proc
-    umount devel/root/usr/share/mirrors/fedora || :
     rm -rf devel/data/build
     mkdir -p devel/data/build
 
@@ -87,6 +88,7 @@ echo "* myplc: Installing configuration scripts"
 install -D -m 755 plc_config.py root/tmp/plc_config.py
 chroot root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
 install -D -m 755 plc-config root/usr/bin/plc-config
+install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
 install -D -m 755 api-config root/usr/bin/api-config
 install -D -m 755 db-config root/usr/bin/db-config
 install -D -m 755 dns-config root/usr/bin/dns-config
@@ -125,9 +127,20 @@ echo "* myplc: Installing configuration file"
 install -D -m 444 $config data/etc/planetlab/default_config.xml
 install -D -m 444 plc_config.dtd data/etc/planetlab/plc_config.dtd
 
+# handle root's homedir and tweak root prompt
+echo "* myplc: root's homedir and prompt"
+roothome=data/root
+mkdir -p $roothome
+cat << EOF > $roothome/.profile
+export PS1="<plc> \$PS1"
+EOF
+chmod 644 $roothome/.profile
+
 # Move "data" directories out of the installation
+echo "* myplc: Moving data directories out of the installation"
 datadirs=(
 /etc/planetlab
+/root
 /var/lib/pgsql
 /var/www/html/alpina-logs
 /var/www/html/boot
index 4e9a8b3..d091ff2 100755 (executable)
 # devel/data/cvs/ (local CVS repository)
 # devel/data/build/ (build area)
 # devel/data/etc/planetlab/ (configuration)
+# devel/data/root (root's home dir)
 #
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: build_devel.sh,v 1.2 2006/07/24 19:32:23 mlhuang Exp $
+# $Id: build_devel.sh,v 1.5 2006/08/18 14:35:52 thierry Exp $
 #
 
 . build.functions
@@ -40,7 +41,7 @@ for dir in * ; do
        else
            ignore="-I !"
        fi
-       cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab $TAG
+       cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab $IMPORT_TAG
        popd
     fi
 done
@@ -56,6 +57,7 @@ echo "* myplc-devel: Installing configuration scripts"
 install -D -m 755 plc_config.py devel/root/tmp/plc_config.py
 chroot devel/root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
 install -D -m 755 plc-config devel/root/usr/bin/plc-config
+install -D -m 755 plc-config-tty devel/root/usr/bin/plc-config-tty
 
 # Install initscripts
 echo "* myplc-devel: Installing initscripts"
@@ -63,10 +65,19 @@ find plc.d/functions | cpio -p -d -u devel/root/etc/
 install -D -m 755 guest.init devel/root/etc/init.d/plc
 chroot devel/root sh -c 'chkconfig --add plc; chkconfig plc on'
 
+# handle root's homedir and tweak root prompt
+echo "* myplc-devel: root's homedir and prompt"
+roothome=devel/data/root
+mkdir -p $roothome
+cat << EOF > $roothome/.profile
+export PS1="<plc-devel> \$PS1"
+EOF
+chmod 644 $roothome/.profile
+
 # Move "data" directories out of the installation
 echo "* myplc-devel: Moving data directories out of the installation"
 move_datadirs devel/root devel/data \
-    /etc/planetlab /build /cvs
+    /etc/planetlab /build /cvs /root
 
 # Make image out of directory
 echo "* myplc-devel: Building loopback image"
index f1cb444..db5736c 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Makefile,v 1.5 2006/07/18 22:41:44 mlhuang Exp $
+# $Id: Makefile,v 1.6 2006/08/11 12:39:20 thierry Exp $
 #
 
 vpath GenDoc.xsl ../../plc_www/doc
@@ -12,6 +12,8 @@ vpath %_config.xml ..
 
 all: myplc.pdf myplc.php
 
+.PHONY: all
+
 # Dependencies
 .myplc.xml.valid: architecture.eps architecture.png plc_variables.xml plc_devel_variables.xml
 
@@ -43,7 +45,7 @@ endef
 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
 
 docclean:
-       rm -f $(patsubst %,*.%,$(FORMATS)) *.pdf .*.xml.valid variables.xml
+       rm -f $(patsubst %,*.%,$(FORMATS)) *.pdf *.php .*.xml.valid variables.xml 
 
 clean: docclean
 
index 5937bd9..09412d2 100644 (file)
Binary files a/doc/myplc.pdf and b/doc/myplc.pdf differ
index d70807b..be76869 100644 (file)
@@ -13,7 +13,7 @@
 <div class="titlepage">
 <div>
 <div><h1 class="title">
-<a name="id224920"></a>MyPLC User's Guide</h1></div>
+<a name="id2703030"></a>MyPLC User's Guide</h1></div>
 <div><div class="author"><h3 class="author"><span class="firstname">Mark Huang</span></h3></div></div>
 <div><div class="revhistory"><table border="1" width="100%" summary="Revision history">
 <tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr>
 <td align="left">MLH</td>
 </tr>
 <tr><td align="left" colspan="3"><p>Add development environment.</p></td></tr>
+<tr>
+<td align="left">Revision 1.2</td>
+<td align="left">August 18, 2006</td>
+<td align="left">TPT</td>
+</tr>
+<tr><td align="left" colspan="3">
+       <p>Review section on configuration and introduce <span><strong class="command">plc-config-tty</strong></span>.</p>
+       <p>Present implementation details last.</p>
+       </td></tr>
 </table></div></div>
 <div><div class="abstract">
 <p class="title"><b>Abstract</b></p>
 <div class="toc">
 <p><b>Table of Contents</b></p>
 <dl>
-<dt><span class="section"><a href="#id225375">1. Overview</a></span></dt>
-<dt><span class="section"><a href="#Installation">2. Installation</a></span></dt>
-<dt><span class="section"><a href="#id267694">3. Quickstart</a></span></dt>
+<dt><span class="section"><a href="#id2749839">1. Overview</a></span></dt>
+<dd><dl><dt><span class="section"><a href="#id2750165">1.1.  Purpose of the <span class="emphasis"><em> myplc-devel
+    </em></span> package </a></span></dt></dl></dd>
+<dt><span class="section"><a href="#Requirements">2.  Requirements </a></span></dt>
+<dt><span class="section"><a href="#Installation">3. Installating and using MyPLC</a></span></dt>
 <dd><dl>
-<dt><span class="section"><a href="#ChangingTheConfiguration">3.1. Changing the configuration</a></span></dt>
-<dt><span class="section"><a href="#id268201">3.2. Installing nodes</a></span></dt>
-<dt><span class="section"><a href="#id268275">3.3. Administering nodes</a></span></dt>
-<dt><span class="section"><a href="#id268369">3.4. Creating a slice</a></span></dt>
+<dt><span class="section"><a href="#id2749479">3.1. Installing MyPLC.</a></span></dt>
+<dt><span class="section"><a href="#QuickStart">3.2.  QuickStart </a></span></dt>
+<dt><span class="section"><a href="#Configuration">3.3. Changing the configuration</a></span></dt>
+<dt><span class="section"><a href="#LoginRealUser">3.4.  Login as a real user </a></span></dt>
+<dt><span class="section"><a href="#id2750676">3.5. Installing nodes</a></span></dt>
+<dt><span class="section"><a href="#id2801620">3.6. Administering nodes</a></span></dt>
+<dt><span class="section"><a href="#id2801720">3.7. Creating a slice</a></span></dt>
+<dt><span class="section"><a href="#StartupSequence">3.8. Understanding the startup sequence</a></span></dt>
+<dt><span class="section"><a href="#FilesInvolvedRuntime">3.9.  Files and directories
+    involved in <span class="emphasis"><em>myplc</em></span></a></span></dt>
 </dl></dd>
-<dt><span class="section"><a href="#id268444">4. Rebuilding and customizing MyPLC</a></span></dt>
+<dt><span class="section"><a href="#DevelopmentEnvironment">4. Rebuilding and customizing MyPLC</a></span></dt>
 <dd><dl>
-<dt><span class="section"><a href="#id268469">4.1. Installation</a></span></dt>
-<dt><span class="section"><a href="#id268676">4.2. Fedora Core 4 mirror requirement</a></span></dt>
-<dt><span class="section"><a href="#BuildingMyPLC">4.3. Building MyPLC</a></span></dt>
-<dt><span class="section"><a href="#UpdatingCVS">4.4. Updating CVS</a></span></dt>
+<dt><span class="section"><a href="#id2802612">4.1. Installation</a></span></dt>
+<dt><span class="section"><a href="#id2802667">4.2. Configuration</a></span></dt>
+<dt><span class="section"><a href="#FilesInvolvedDevel">4.3.  Files and directories
+    involved in <span class="emphasis"><em>myplc-devl</em></span></a></span></dt>
+<dt><span class="section"><a href="#id2802931">4.4. Fedora Core 4 mirror requirement</a></span></dt>
+<dt><span class="section"><a href="#BuildingMyPLC">4.5. Building MyPLC</a></span></dt>
+<dt><span class="section"><a href="#UpdatingCVS">4.6. Updating CVS</a></span></dt>
 </dl></dd>
-<dt><span class="appendix"><a href="#id269037">A. Configuration variables</a></span></dt>
-<dt><span class="appendix"><a href="#id271742">B. Development environment configuration variables</a></span></dt>
-<dt><span class="bibliography"><a href="#id271824">Bibliography</a></span></dt>
+<dt><span class="appendix"><a href="#VariablesRuntime">A. Configuration variables (for <span class="emphasis"><em>myplc</em></span>)</a></span></dt>
+<dt><span class="appendix"><a href="#VariablesDevel">B. Development configuration variables (for <span class="emphasis"><em>myplc-devel</em></span>)</a></span></dt>
+<dt><span class="bibliography"><a href="#id2806472">Bibliography</a></span></dt>
 </dl>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id225375"></a>1. Overview</h2></div></div></div>
+<a name="id2749839"></a>1. Overview</h2></div></div></div>
 <p>MyPLC is a complete PlanetLab Central (PLC) portable
     installation contained within a <span><strong class="command">chroot</strong></span>
     jail. The default installation consists of a web server, an
           system.</p></div>
 </div>
 </div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id2750165"></a>1.1.  Purpose of the <span class="emphasis"><em> myplc-devel
+    </em></span> package </h3></div></div></div>
+<p> The <span class="emphasis"><em>myplc</em></span> package comes with all
+    required node software, rebuilt from the public PlanetLab CVS
+    repository. If for any reason you need to implement your own
+    customized version of this software, you can use the
+    <span class="emphasis"><em>myplc-devel</em></span> package instead, for setting up
+    your own development environment, including a local CVS
+    repository; you can then freely manage your changes and rebuild
+    your customized version of <span class="emphasis"><em>myplc</em></span>. We also
+    provide good practices, that will then allow you to resync your local
+    CVS repository with any further evolution on the mainstream public
+    PlanetLab software. </p>
+</div>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="Installation"></a>2. Installation</h2></div></div></div>
+<a name="Requirements"></a>2.  Requirements </h2></div></div></div>
+<p> <span class="emphasis"><em>myplc</em></span> and
+  <span class="emphasis"><em>myplc-devel</em></span> were designed as
+  <span><strong class="command">chroot</strong></span> jails so as to reduce the requirements on
+  your host operating system. So in theory, these distributions should
+  work on virtually any Linux 2.6 based distribution, whether it
+  supports rpm or not. </p>
+<p> However, things are never that simple and there indeed are
+  some known limitations to this, so here are a couple notes as a
+  recommended reading before you proceed with the installation.</p>
+<p> As of 17 August 2006 (i.e <span class="emphasis"><em>myplc-0.5-2</em></span>) :</p>
+<div class="itemizedlist"><ul type="disc">
+<li><p> The software is vastly based on <span class="emphasis"><em>Fedora
+  Core 4</em></span>. Please note that the build server at Princeton
+  runs <span class="emphasis"><em>Fedora Core 2</em></span>, togother with a upgraded
+  version of yum. 
+  </p></li>
+<li>
+<p> myplc and myplc-devel are known to work on both
+  <span class="emphasis"><em>Fedora Core 2</em></span> and <span class="emphasis"><em>Fedora Core
+  4</em></span>. Please note however that, on fc4 at least, it is
+  highly recommended to use the <span class="application">Security Level
+  Configuration</span> utility and to <span class="emphasis"><em>switch off
+  SElinux</em></span> on your box because : </p>
+<div class="itemizedlist"><ul type="circle">
+<li><p>
+  myplc requires you to run SElinux as 'Permissive' at most
+       </p></li>
+<li><p>
+  myplc-devel requires you to turn SElinux Off.
+       </p></li>
+</ul></div>
+</li>
+<li><p> In addition, as far as myplc is concerned, you
+  need to check your firewall configuration since you need, of course,
+  to open up the <span class="emphasis"><em>http</em></span> and
+  <span class="emphasis"><em>https</em></span> ports, so as to accept connections from
+  the managed nodes and from the users desktops. </p></li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="Installation"></a>3. Installating and using MyPLC</h2></div></div></div>
 <p>Though internally composed of commodity software
     subpackages, MyPLC should be treated as a monolithic software
     application. MyPLC is distributed as single RPM package that has
     no external dependencies, allowing it to be installed on
-    practically any Linux 2.6 based distribution:</p>
-<div class="example">
-<a name="id225278"></a><p class="title"><b>Example 1. Installing MyPLC.</b></p>
-<pre class="programlisting"># If your distribution supports RPM
-rpm -U http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
-
-# If your distribution does not support RPM
-cd /tmp
-wget http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
-cd /
-rpm2cpio /tmp/myplc-0.4-1.planetlab.i386.rpm | cpio -diu</pre>
-</div>
-<p>MyPLC installs the following files and directories:</p>
+    practically any Linux 2.6 based distribution.</p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id2749479"></a>3.1. Installing MyPLC.</h3></div></div></div>
 <div class="itemizedlist"><ul type="disc">
-<li><p><code class="filename">/plc/root.img</code>: The main
-      root filesystem of the MyPLC application. This file is an
-      uncompressed ext3 filesystem that is loopback mounted on
-      <code class="filename">/plc/root</code> when MyPLC starts. This
-      filesystem, even when mounted, should be treated as an opaque
-      binary that can and will be replaced in its entirety by any
-      upgrade of MyPLC.</p></li>
-<li><p><code class="filename">/plc/root</code>: The mount point
-      for <code class="filename">/plc/root.img</code>. Once the root filesystem
-      is mounted, all MyPLC services run in a
-      <span><strong class="command">chroot</strong></span> jail based in this
-      directory.</p></li>
 <li>
-<p><code class="filename">/plc/data</code>: The directory where user
-       data and generated files are stored. This directory is bind
-       mounted onto <code class="filename">/plc/root/data</code> so that it is
-       accessible as <code class="filename">/data</code> from within the
-       <span><strong class="command">chroot</strong></span> jail. Files in this directory are
-       marked with <span><strong class="command">%config(noreplace)</strong></span> in the
-       RPM. That is, during an upgrade of MyPLC, if a file has not
-       changed since the last installation or upgrade of MyPLC, it is
-       subject to upgrade and replacement. If the file has changed,
-       the new version of the file will be created with a
-       <code class="filename">.rpmnew</code> extension. Symlinks within the
-       MyPLC root filesystem ensure that the following directories
-       (relative to <code class="filename">/plc/root</code>) are stored
-       outside the MyPLC filesystem image:</p>
-<div class="itemizedlist"><ul type="circle">
-<li><p><code class="filename">/etc/planetlab</code>: This
-         directory contains the configuration files, keys, and
-         certificates that define your MyPLC
-         installation.</p></li>
-<li><p><code class="filename">/var/lib/pgsql</code>: This
-         directory contains PostgreSQL database
-         files.</p></li>
-<li><p><code class="filename">/var/www/html/alpina-logs</code>: This
-         directory contains node installation logs.</p></li>
-<li><p><code class="filename">/var/www/html/boot</code>: This
-         directory contains the Boot Manager, customized for your MyPLC
-         installation, and its data files.</p></li>
-<li><p><code class="filename">/var/www/html/download</code>: This
-         directory contains Boot CD images, customized for your MyPLC
-         installation.</p></li>
-<li><p><code class="filename">/var/www/html/install-rpms</code>: This
-         directory is where you should install node package updates,
-         if any. By default, nodes are installed from the tarball
-         located at
-         <code class="filename">/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2</code>,
-         which is pre-built from the latest PlanetLab Central
-         sources, and installed as part of your MyPLC
-         installation. However, nodes will attempt to install any
-         newer RPMs located in
-         <code class="filename">/var/www/html/install-rpms/planetlab</code>,
-         after initial installation and periodically thereafter. You
-         must run <span><strong class="command">yum-arch</strong></span> and
-         <span><strong class="command">createrepo</strong></span> to update the
-         <span><strong class="command">yum</strong></span> caches in this directory after
-         installing a new RPM. PlanetLab Central cannot support any
-         changes to this directory.</p></li>
-<li><p><code class="filename">/var/www/html/xml</code>: This
-         directory contains various XML files that the Slice Creation
-         Service uses to determine the state of slices. These XML
-         files are refreshed periodically by <span><strong class="command">cron</strong></span>
-         jobs running in the MyPLC root.</p></li>
-</ul></div>
+<p>If your distribution supports RPM:</p>
+<pre class="programlisting"># rpm -U http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm</pre>
 </li>
 <li>
-<p><code class="filename">/etc/init.d/plc</code>: This file
-       is a System V init script installed on your host filesystem,
-       that allows you to start up and shut down MyPLC with a single
-       command. On a Red Hat or Fedora host system, it is customary to
-       use the <span><strong class="command">service</strong></span> command to invoke System V
-       init scripts:</p>
+<p>If your distribution does not support RPM:</p>
+<pre class="programlisting"># cd /tmp
+# wget http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
+# cd /
+# rpm2cpio /tmp/myplc-0.4-1.planetlab.i386.rpm | cpio -diu</pre>
+</li>
+</ul></div>
+<p> The <a href="#FilesInvolvedRuntime" title="3.9.  Files and directories
+    involved in myplc">Section 3.9, “ Files and directories
+    involved in <span class="emphasis"><em>myplc</em></span>”</a> below explains in
+    details the installation strategy and the miscellaneous files and
+    directories involved.</p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="QuickStart"></a>3.2.  QuickStart </h3></div></div></div>
+<p> On a Red Hat or Fedora host system, it is customary to use
+    the <span><strong class="command">service</strong></span> command to invoke System V init
+    scripts. As the examples suggest, the service must be started as root:</p>
 <div class="example">
-<a name="StartingAndStoppingMyPLC"></a><p class="title"><b>Example 2. Starting and stopping MyPLC.</b></p>
-<pre class="programlisting"># Starting MyPLC
-service plc start
-
-# Stopping MyPLC
-service plc stop</pre>
+<a name="id2749652"></a><p class="title"><b>Example 1. Starting MyPLC:</b></p>
+<pre class="programlisting"># service plc start</pre>
 </div>
-<p>Like all other registered System V init services, MyPLC is
-       started and shut down automatically when your host system boots
-       and powers off. You may disable automatic startup by invoking
-       the <span><strong class="command">chkconfig</strong></span> command on a Red Hat or Fedora
-       host system:</p>
 <div class="example">
-<a name="id243568"></a><p class="title"><b>Example 3. Disabling automatic startup of MyPLC.</b></p>
-<pre class="programlisting"># Disable automatic startup
-chkconfig plc off
-
-# Enable automatic startup
-chkconfig plc on</pre>
+<a name="id2749665"></a><p class="title"><b>Example 2. Stopping MyPLC:</b></p>
+<pre class="programlisting"># service plc stop</pre>
 </div>
-</li>
-<li><p><code class="filename">/etc/sysconfig/plc</code>: This
-      file is a shell script fragment that defines the variables
-      <code class="envar">PLC_ROOT</code> and <code class="envar">PLC_DATA</code>. By default,
-      the values of these variables are <code class="filename">/plc/root</code>
-      and <code class="filename">/plc/data</code>, respectively. If you wish,
-      you may move your MyPLC installation to another location on your
-      host filesystem and edit the values of these variables
-      appropriately, but you will break the RPM upgrade
-      process. PlanetLab Central cannot support any changes to this
-      file.</p></li>
-<li><p><code class="filename">/etc/planetlab</code>: This
-      symlink to <code class="filename">/plc/data/etc/planetlab</code> is
-      installed on the host system for convenience.</p></li>
-</ul></div>
+<p> In <a href="#StartupSequence" title="3.8. Understanding the startup sequence">Section 3.8, “Understanding the startup sequence”</a>, we provide greater
+    details that might be helpful in the case where the service does
+    not seem to take off correctly.</p>
+<p>Like all other registered System V init services, MyPLC is
+    started and shut down automatically when your host system boots
+    and powers off. You may disable automatic startup by invoking the
+    <span><strong class="command">chkconfig</strong></span> command on a Red Hat or Fedora host
+    system:</p>
+<div class="example">
+<a name="id2750316"></a><p class="title"><b>Example 3. Disabling automatic startup of MyPLC.</b></p>
+<pre class="programlisting"># chkconfig plc off</pre>
 </div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id267694"></a>3. Quickstart</h2></div></div></div>
-<p>Once installed, start MyPLC (see <a href="#StartingAndStoppingMyPLC" title="Example 2. Starting and stopping MyPLC.">Example 2, “Starting and stopping MyPLC.”</a>). MyPLC must be started as
-    root. Observe the output of this command for any failures. If no
-    failures occur, you should see output similar to the
-    following:</p>
 <div class="example">
-<a name="id267814"></a><p class="title"><b>Example 4. A successful MyPLC startup.</b></p>
-<pre class="programlisting">Mounting PLC:                                              [  OK  ]
-PLC: Generating network files:                             [  OK  ]
-PLC: Starting system logger:                               [  OK  ]
-PLC: Starting database server:                             [  OK  ]
-PLC: Generating SSL certificates:                          [  OK  ]
-PLC: Configuring the API:                                  [  OK  ]
-PLC: Updating GPG keys:                                    [  OK  ]
-PLC: Generating SSH keys:                                  [  OK  ]
-PLC: Starting web server:                                  [  OK  ]
-PLC: Bootstrapping the database:                           [  OK  ]
-PLC: Starting DNS server:                                  [  OK  ]
-PLC: Starting crond:                                       [  OK  ]
-PLC: Rebuilding Boot CD:                                   [  OK  ]
-PLC: Rebuilding Boot Manager:                              [  OK  ]
-PLC: Signing node packages:                                [  OK  ]
-</pre>
+<a name="id2750328"></a><p class="title"><b>Example 4. Re-enabling automatic startup of MyPLC.</b></p>
+<pre class="programlisting"># chkconfig plc on</pre>
+</div>
 </div>
-<p>If <code class="filename">/plc/root</code> is mounted successfully, a
-    complete log file of the startup process may be found at
-    <code class="filename">/plc/root/var/log/boot.log</code>. Possible reasons
-    for failure of each step include:</p>
-<div class="itemizedlist"><ul type="disc">
-<li><p><code class="literal">Mounting PLC</code>: If this step
-      fails, first ensure that you started MyPLC as root. Check
-      <code class="filename">/etc/sysconfig/plc</code> to ensure that
-      <code class="envar">PLC_ROOT</code> and <code class="envar">PLC_DATA</code> refer to the
-      right locations. You may also have too many existing loopback
-      mounts, or your kernel may not support loopback mounting, bind
-      mounting, or the ext3 filesystem. Try freeing at least one
-      loopback device, or re-compiling your kernel to support loopback
-      mounting, bind mounting, and the ext3 filesystem. If you see an
-      error similar to <code class="literal">Permission denied while trying to open
-      /plc/root.img</code>, then SELinux may be enabled. If you
-      installed MyPLC on Fedora Core 4 or 5, use the
-      <span class="application">Security Level Configuration</span> utility
-      to configure SELinux to be
-      <code class="literal">Permissive</code>.</p></li>
-<li><p><code class="literal">Starting database server</code>: If
-      this step fails, check
-      <code class="filename">/plc/root/var/log/pgsql</code> and
-      <code class="filename">/plc/root/var/log/boot.log</code>. The most common
-      reason for failure is that the default PostgreSQL port, TCP port
-      5432, is already in use. Check that you are not running a
-      PostgreSQL server on the host system.</p></li>
-<li><p><code class="literal">Starting web server</code>: If this
-      step fails, check
-      <code class="filename">/plc/root/var/log/httpd/error_log</code> and
-      <code class="filename">/plc/root/var/log/boot.log</code> for obvious
-      errors. The most common reason for failure is that the default
-      web ports, TCP ports 80 and 443, are already in use. Check that
-      you are not running a web server on the host
-      system.</p></li>
-<li><p><code class="literal">Bootstrapping the database</code>:
-      If this step fails, it is likely that the previous step
-      (<code class="literal">Starting web server</code>) also failed. Another
-      reason that it could fail is if <code class="envar">PLC_API_HOST</code> (see
-      <a href="#ChangingTheConfiguration" title="3.1. Changing the configuration">Section 3.1, “Changing the configuration”</a>) does not resolve to
-      the host on which the API server has been enabled. By default,
-      all services, including the API server, are enabled and run on
-      the same host, so check that <code class="envar">PLC_API_HOST</code> is
-      either <code class="filename">localhost</code> or resolves to a local IP
-      address.</p></li>
-<li><p><code class="literal">Starting crond</code>: If this step
-      fails, it is likely that the previous steps (<code class="literal">Starting
-      web server</code> and <code class="literal">Bootstrapping the
-      database</code>) also failed. If not, check
-      <code class="filename">/plc/root/var/log/boot.log</code> for obvious
-      errors. This step starts the <span><strong class="command">cron</strong></span> service and
-      generates the initial set of XML files that the Slice Creation
-      Service uses to determine slice state.</p></li>
-</ul></div>
-<p>If no failures occur, then MyPLC should be active with a
-    default configuration. Open a web browser on the host system and
-    visit <code class="literal">http://localhost/</code>, which should bring you
-    to the front page of your PLC installation. The password of the
-    default administrator account
-    <code class="literal">root@localhost.localdomain</code> (set by
-    <code class="envar">PLC_ROOT_USER</code>) is <code class="literal">root</code> (set by
-    <code class="envar">PLC_ROOT_PASSWORD</code>).</p>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="ChangingTheConfiguration"></a>3.1. Changing the configuration</h3></div></div></div>
+<a name="Configuration"></a>3.3. Changing the configuration</h3></div></div></div>
 <p>After verifying that MyPLC is working correctly, shut it
       down and begin changing some of the default variable
       values. Shut down MyPLC with <span><strong class="command">service plc stop</strong></span>
-      (see <a href="#StartingAndStoppingMyPLC" title="Example 2. Starting and stopping MyPLC.">Example 2, “Starting and stopping MyPLC.”</a>). With a text
-      editor, open the file
-      <code class="filename">/etc/planetlab/plc_config.xml</code>. This file is
-      a self-documenting configuration file written in XML. Variables
-      are divided into categories. Variable identifiers must be
-      alphanumeric, plus underscore. A variable is referred to
-      canonically as the uppercase concatenation of its category
-      identifier, an underscore, and its variable identifier. Thus, a
-      variable with an <code class="literal">id</code> of
+      (see <a href="#QuickStart" title="3.2.  QuickStart ">Section 3.2, “ QuickStart ”</a>). </p>
+<p> The preferred option for changing the configuration is to
+      use the <span><strong class="command">plc-config-tty</strong></span> tool. This tools comes
+      with the root image, so you need to have it mounted first. The
+      full set of applicable variables is described in <a href="#VariablesDevel" title="B. Development configuration variables (for myplc-devel)">Appendix B, <i>Development configuration variables (for <span class="emphasis"><em>myplc-devel</em></span>)</i></a>, but using the <span><strong class="command">u</strong></span>
+      guides you to the most useful ones. Here is sample session:
+      </p>
+<div class="example">
+<a name="id2750396"></a><p class="title"><b>Example 5. Using plc-config-tty for configuration:</b></p>
+<pre class="programlisting"># service plc mount
+Mounting PLC:                                              [  OK  ]
+# chroot /plc/root su - 
+&lt;plc&gt; # plc-config-tty
+Config file /etc/planetlab/configs/site.xml located under a non-existing directory
+Want to create /etc/planetlab/configs [y]/n ? y
+Created directory /etc/planetlab/configs
+Enter command (u for usual changes, w to save, ? for help) u
+== PLC_NAME : [PlanetLab Test] OneLab
+== PLC_ROOT_USER : [root@localhost.localdomain] root@odie.inria.fr
+== PLC_ROOT_PASSWORD : [root] plain-passwd
+== PLC_MAIL_SUPPORT_ADDRESS : [root+support@localhost.localdomain] support@one-lab.org
+== PLC_DB_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_API_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_WWW_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_BOOT_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_NET_DNS1 : [127.0.0.1] 138.96.250.248
+== PLC_NET_DNS2 : [None] 138.96.250.249
+Enter command (u for usual changes, w to save, ? for help) w
+Wrote /etc/planetlab/configs/site.xml
+Merged
+        /etc/planetlab/default_config.xml
+and     /etc/planetlab/configs/site.xml
+into    /etc/planetlab/plc_config.xml
+You might want to type 'r' (restart plc) or 'q' (quit)
+Enter command (u for usual changes, w to save, ? for help) r
+==================== Stopping plc
+...
+==================== Starting plc
+...
+Enter command (u for usual changes, w to save, ? for help) q
+&lt;plc&gt; # exit
+# 
+</pre>
+</div>
+<p>If you used this method for configuring, you can skip to
+      the <a href="#LoginRealUser" title="3.4.  Login as a real user ">Section 3.4, “ Login as a real user ”</a>. As an alternative to using
+      <span><strong class="command">plc-config-tty</strong></span>, you may also use a text
+      editor, but this requires some understanding on how the
+      configuration files are used within myplc. The
+      <span class="emphasis"><em>default</em></span> configuration is stored in a file
+      named <code class="filename">/etc/planetlab/default_config.xml</code>,
+      that is designed to remain intact. You may store your local
+      changes in any file located in the <code class="filename">configs/</code>
+      sub-directory, that are loaded on top of the defaults. Finally
+      the file <code class="filename">/etc/planetlab/plc_config.xml</code> is
+      loaded, and the resulting configuration is stored in the latter
+      file, that is used as a reference.</p>
+<p> Using a separate file for storing local changes only, as
+      <span><strong class="command">plc-config-tty</strong></span> does, is not a workable option
+      with a text editor because it would involve tedious xml
+      re-assembling. So your local changes should go in
+      <code class="filename">/etc/planetlab/plc_config.xml</code>. Be warned
+      however that any change you might do this way could be lost if
+      you use <span><strong class="command">plc-config-tty</strong></span> later on. </p>
+<p>This file is a self-documenting configuration file written
+      in XML. Variables are divided into categories. Variable
+      identifiers must be alphanumeric, plus underscore. A variable is
+      referred to canonically as the uppercase concatenation of its
+      category identifier, an underscore, and its variable
+      identifier. Thus, a variable with an <code class="literal">id</code> of
       <code class="literal">slice_prefix</code> in the <code class="literal">plc</code>
       category is referred to canonically as
       <code class="envar">PLC_SLICE_PREFIX</code>.</p>
@@ -351,16 +332,33 @@ PLC: Signing node packages:                                [  OK  ]
        preferred FQDN and external IP address of your host
        system.</p></li>
 </ul></div>
-<p>After changing these variables, save the file, then
-      restart MyPLC with <span><strong class="command">service plc start</strong></span>. You
-      should notice that the password of the default administrator
-      account is no longer <code class="literal">root</code>, and that the
-      default site name includes the name of your PLC installation
-      instead of PlanetLab.</p>
+<p> After changing these variables,
+      save the file, then restart MyPLC with <span><strong class="command">service plc
+      start</strong></span>. You should notice that the password of the
+      default administrator account is no longer
+      <code class="literal">root</code>, and that the default site name includes
+      the name of your PLC installation instead of PlanetLab. As a
+      side effect of these changes, the ISO images for the boot CDs
+      now have new names, so that you can freely remove the ones names
+      after 'PlanetLab Test', which is the default value of
+      <code class="envar">PLC_NAME</code> </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="LoginRealUser"></a>3.4.  Login as a real user </h3></div></div></div>
+<p>Now that myplc is up and running, you can connect to the
+      web site that by default runs on port 80. You can either
+      directly use the default administrator user that you configured
+      in <code class="envar">PLC_ROOT_USER</code> and
+      <code class="envar">PLC_ROOT_PASSWORD</code>, or create a real user through
+      the 'Joining' tab. Do not forget to  select both PI and tech
+      roles, and to select the only site created at this stage.
+      Login as the administrator to enable this user, then login as
+      the real user.</p>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id268201"></a>3.2. Installing nodes</h3></div></div></div>
+<a name="id2750676"></a>3.5. Installing nodes</h3></div></div></div>
 <p>Install your first node by clicking <code class="literal">Add
       Node</code> under the <code class="literal">Nodes</code> tab. Fill in
       all the appropriate details, then click
@@ -384,12 +382,12 @@ PLC: Signing node packages:                                [  OK  ]
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id268275"></a>3.3. Administering nodes</h3></div></div></div>
+<a name="id2801620"></a>3.6. Administering nodes</h3></div></div></div>
 <p>You may administer nodes as <code class="literal">root</code> by
       using the SSH key stored in
       <code class="filename">/etc/planetlab/root_ssh_key.rsa</code>.</p>
 <div class="example">
-<a name="id268297"></a><p class="title"><b>Example 5. Accessing nodes via SSH. Replace
+<a name="id2801642"></a><p class="title"><b>Example 6. Accessing nodes via SSH. Replace
        <code class="literal">node</code> with the hostname of the node.</b></p>
 <pre class="programlisting">ssh -i /etc/planetlab/root_ssh_key.rsa root@node</pre>
 </div>
@@ -412,7 +410,7 @@ PLC: Signing node packages:                                [  OK  ]
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id268369"></a>3.4. Creating a slice</h3></div></div></div>
+<a name="id2801720"></a>3.7. Creating a slice</h3></div></div></div>
 <p>Create a slice by clicking <code class="literal">Create Slice</code>
       under the <code class="literal">Slices</code> tab. Fill in all the
       appropriate details, then click <code class="literal">Create</code>. Add
@@ -427,7 +425,7 @@ PLC: Signing node packages:                                [  OK  ]
       to determine if it needs to create or delete any slices. You may
       accelerate this process manually if desired.</p>
 <div class="example">
-<a name="id268427"></a><p class="title"><b>Example 6. Forcing slice creation on a node.</b></p>
+<a name="id2801783"></a><p class="title"><b>Example 7. Forcing slice creation on a node.</b></p>
 <pre class="programlisting"># Update slices.xml immediately
 service plc start crond
 
@@ -436,10 +434,193 @@ ssh -i /etc/planetlab/root_ssh_key.rsa root@node \
 vserver pl_conf exec service pl_conf restart</pre>
 </div>
 </div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="StartupSequence"></a>3.8. Understanding the startup sequence</h3></div></div></div>
+<p>During service startup described in <a href="#QuickStart" title="3.2.  QuickStart ">Section 3.2, “ QuickStart ”</a>, observe the output of this command for
+    any failures. If no failures occur, you should see output similar
+    to the following:</p>
+<div class="example">
+<a name="id2801822"></a><p class="title"><b>Example 8. A successful MyPLC startup.</b></p>
+<pre class="programlisting">Mounting PLC:                                              [  OK  ]
+PLC: Generating network files:                             [  OK  ]
+PLC: Starting system logger:                               [  OK  ]
+PLC: Starting database server:                             [  OK  ]
+PLC: Generating SSL certificates:                          [  OK  ]
+PLC: Configuring the API:                                  [  OK  ]
+PLC: Updating GPG keys:                                    [  OK  ]
+PLC: Generating SSH keys:                                  [  OK  ]
+PLC: Starting web server:                                  [  OK  ]
+PLC: Bootstrapping the database:                           [  OK  ]
+PLC: Starting DNS server:                                  [  OK  ]
+PLC: Starting crond:                                       [  OK  ]
+PLC: Rebuilding Boot CD:                                   [  OK  ]
+PLC: Rebuilding Boot Manager:                              [  OK  ]
+PLC: Signing node packages:                                [  OK  ]
+</pre>
+</div>
+<p>If <code class="filename">/plc/root</code> is mounted successfully, a
+    complete log file of the startup process may be found at
+    <code class="filename">/plc/root/var/log/boot.log</code>. Possible reasons
+    for failure of each step include:</p>
+<div class="itemizedlist"><ul type="disc">
+<li><p><code class="literal">Mounting PLC</code>: If this step
+      fails, first ensure that you started MyPLC as root. Check
+      <code class="filename">/etc/sysconfig/plc</code> to ensure that
+      <code class="envar">PLC_ROOT</code> and <code class="envar">PLC_DATA</code> refer to the
+      right locations. You may also have too many existing loopback
+      mounts, or your kernel may not support loopback mounting, bind
+      mounting, or the ext3 filesystem. Try freeing at least one
+      loopback device, or re-compiling your kernel to support loopback
+      mounting, bind mounting, and the ext3 filesystem. If you see an
+      error similar to <code class="literal">Permission denied while trying to open
+      /plc/root.img</code>, then SELinux may be enabled. See <a href="#Requirements" title="2.  Requirements ">Section 2, “ Requirements ”</a> above for details.</p></li>
+<li><p><code class="literal">Starting database server</code>: If
+      this step fails, check
+      <code class="filename">/plc/root/var/log/pgsql</code> and
+      <code class="filename">/plc/root/var/log/boot.log</code>. The most common
+      reason for failure is that the default PostgreSQL port, TCP port
+      5432, is already in use. Check that you are not running a
+      PostgreSQL server on the host system.</p></li>
+<li><p><code class="literal">Starting web server</code>: If this
+      step fails, check
+      <code class="filename">/plc/root/var/log/httpd/error_log</code> and
+      <code class="filename">/plc/root/var/log/boot.log</code> for obvious
+      errors. The most common reason for failure is that the default
+      web ports, TCP ports 80 and 443, are already in use. Check that
+      you are not running a web server on the host
+      system.</p></li>
+<li><p><code class="literal">Bootstrapping the database</code>:
+      If this step fails, it is likely that the previous step
+      (<code class="literal">Starting web server</code>) also failed. Another
+      reason that it could fail is if <code class="envar">PLC_API_HOST</code> (see
+      <a href="#Configuration" title="3.3. Changing the configuration">Section 3.3, “Changing the configuration”</a>) does not resolve to
+      the host on which the API server has been enabled. By default,
+      all services, including the API server, are enabled and run on
+      the same host, so check that <code class="envar">PLC_API_HOST</code> is
+      either <code class="filename">localhost</code> or resolves to a local IP
+      address. Also check that <code class="envar">PLC_ROOT_USER</code> looks like
+      an e-mail address.</p></li>
+<li><p><code class="literal">Starting crond</code>: If this step
+      fails, it is likely that the previous steps (<code class="literal">Starting
+      web server</code> and <code class="literal">Bootstrapping the
+      database</code>) also failed. If not, check
+      <code class="filename">/plc/root/var/log/boot.log</code> for obvious
+      errors. This step starts the <span><strong class="command">cron</strong></span> service and
+      generates the initial set of XML files that the Slice Creation
+      Service uses to determine slice state.</p></li>
+</ul></div>
+<p>If no failures occur, then MyPLC should be active with a
+    default configuration. Open a web browser on the host system and
+    visit <code class="literal">http://localhost/</code>, which should bring you
+    to the front page of your PLC installation. The password of the
+    default administrator account
+    <code class="literal">root@localhost.localdomain</code> (set by
+    <code class="envar">PLC_ROOT_USER</code>) is <code class="literal">root</code> (set by
+    <code class="envar">PLC_ROOT_PASSWORD</code>).</p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="FilesInvolvedRuntime"></a>3.9.  Files and directories
+    involved in <span class="emphasis"><em>myplc</em></span></h3></div></div></div>
+<p>MyPLC installs the following files and directories:</p>
+<div class="orderedlist"><ol type="1">
+<li><p><code class="filename">/plc/root.img</code>: The main
+      root filesystem of the MyPLC application. This file is an
+      uncompressed ext3 filesystem that is loopback mounted on
+      <code class="filename">/plc/root</code> when MyPLC starts. This
+      filesystem, even when mounted, should be treated as an opaque
+      binary that can and will be replaced in its entirety by any
+      upgrade of MyPLC.</p></li>
+<li><p><code class="filename">/plc/root</code>: The mount point
+      for <code class="filename">/plc/root.img</code>. Once the root filesystem
+      is mounted, all MyPLC services run in a
+      <span><strong class="command">chroot</strong></span> jail based in this
+      directory.</p></li>
+<li>
+<p><code class="filename">/plc/data</code>: The directory where user
+       data and generated files are stored. This directory is bind
+       mounted onto <code class="filename">/plc/root/data</code> so that it is
+       accessible as <code class="filename">/data</code> from within the
+       <span><strong class="command">chroot</strong></span> jail. Files in this directory are
+       marked with <span><strong class="command">%config(noreplace)</strong></span> in the
+       RPM. That is, during an upgrade of MyPLC, if a file has not
+       changed since the last installation or upgrade of MyPLC, it is
+       subject to upgrade and replacement. If the file has changed,
+       the new version of the file will be created with a
+       <code class="filename">.rpmnew</code> extension. Symlinks within the
+       MyPLC root filesystem ensure that the following directories
+       (relative to <code class="filename">/plc/root</code>) are stored
+       outside the MyPLC filesystem image:</p>
+<div class="itemizedlist"><ul type="disc">
+<li><p><code class="filename">/etc/planetlab</code>: This
+         directory contains the configuration files, keys, and
+         certificates that define your MyPLC
+         installation.</p></li>
+<li><p><code class="filename">/var/lib/pgsql</code>: This
+         directory contains PostgreSQL database
+         files.</p></li>
+<li><p><code class="filename">/var/www/html/alpina-logs</code>: This
+         directory contains node installation logs.</p></li>
+<li><p><code class="filename">/var/www/html/boot</code>: This
+         directory contains the Boot Manager, customized for your MyPLC
+         installation, and its data files.</p></li>
+<li><p><code class="filename">/var/www/html/download</code>: This
+         directory contains Boot CD images, customized for your MyPLC
+         installation.</p></li>
+<li><p><code class="filename">/var/www/html/install-rpms</code>: This
+         directory is where you should install node package updates,
+         if any. By default, nodes are installed from the tarball
+         located at
+         <code class="filename">/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2</code>,
+         which is pre-built from the latest PlanetLab Central
+         sources, and installed as part of your MyPLC
+         installation. However, nodes will attempt to install any
+         newer RPMs located in
+         <code class="filename">/var/www/html/install-rpms/planetlab</code>,
+         after initial installation and periodically thereafter. You
+         must run <span><strong class="command">yum-arch</strong></span> and
+         <span><strong class="command">createrepo</strong></span> to update the
+         <span><strong class="command">yum</strong></span> caches in this directory after
+         installing a new RPM. PlanetLab Central cannot support any
+         changes to this directory.</p></li>
+<li><p><code class="filename">/var/www/html/xml</code>: This
+         directory contains various XML files that the Slice Creation
+         Service uses to determine the state of slices. These XML
+         files are refreshed periodically by <span><strong class="command">cron</strong></span>
+         jobs running in the MyPLC root.</p></li>
+<li><p><code class="filename">/root</code>: this is the
+         location of the root-user's homedir, and for your
+         convenience is stored under <code class="filename">/data</code> so
+         that your local customizations survive across
+         updates - this feature is inherited from the
+         <span><strong class="command">myplc-devel</strong></span> package, where it is probably
+         more useful. </p></li>
+</ul></div>
+</li>
+<li><p><a name="MyplcInitScripts"></a><code class="filename">/etc/init.d/plc</code>: This file
+       is a System V init script installed on your host filesystem,
+       that allows you to start up and shut down MyPLC with a single
+       command, as described in <a href="#QuickStart" title="3.2.  QuickStart ">Section 3.2, “ QuickStart ”</a>.</p></li>
+<li><p><code class="filename">/etc/sysconfig/plc</code>: This
+      file is a shell script fragment that defines the variables
+      <code class="envar">PLC_ROOT</code> and <code class="envar">PLC_DATA</code>. By default,
+      the values of these variables are <code class="filename">/plc/root</code>
+      and <code class="filename">/plc/data</code>, respectively. If you wish,
+      you may move your MyPLC installation to another location on your
+      host filesystem and edit the values of these variables
+      appropriately, but you will break the RPM upgrade
+      process. PlanetLab Central cannot support any changes to this
+      file.</p></li>
+<li><p><code class="filename">/etc/planetlab</code>: This
+      symlink to <code class="filename">/plc/data/etc/planetlab</code> is
+      installed on the host system for convenience.</p></li>
+</ol></div>
+</div>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id268444"></a>4. Rebuilding and customizing MyPLC</h2></div></div></div>
+<a name="DevelopmentEnvironment"></a>4. Rebuilding and customizing MyPLC</h2></div></div></div>
 <p>The MyPLC package, though distributed as an RPM, is not a
     traditional package that can be easily rebuilt from SRPM. The
     requisite build environment is quite extensive and numerous
@@ -456,7 +637,7 @@ vserver pl_conf exec service pl_conf restart</pre>
     repository.</p>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id268469"></a>4.1. Installation</h3></div></div></div>
+<a name="id2802612"></a>4.1. Installation</h3></div></div></div>
 <p>Install the MyPLC development environment similarly to how
       you would install MyPLC. You may install both packages on the same
       host system if you wish. As with MyPLC, the MyPLC development
@@ -464,17 +645,35 @@ vserver pl_conf exec service pl_conf restart</pre>
       application, and any files present in the
       <span><strong class="command">chroot</strong></span> jail should not be modified directly, as
       they are subject to upgrade.</p>
-<div class="example">
-<a name="id268487"></a><p class="title"><b>Example 7. Installing the MyPLC development environment.</b></p>
-<pre class="programlisting"># If your distribution supports RPM
-rpm -U http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
-
-# If your distribution does not support RPM
-cd /tmp
-wget http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
-cd /
-rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<p>If your distribution supports RPM:</p>
+<pre class="programlisting"># rpm -U http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm</pre>
+</li>
+<li>
+<p>If your distribution does not support RPM:</p>
+<pre class="programlisting"># cd /tmp
+# wget http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
+# cd /
+# rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu</pre>
+</li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id2802667"></a>4.2. Configuration</h3></div></div></div>
+<p> The default configuration should work as-is on most
+      sites. Configuring the development package can be achieved in a
+      similar way as for <span class="emphasis"><em>myplc</em></span>, as described in
+      <a href="#Configuration" title="3.3. Changing the configuration">Section 3.3, “Changing the configuration”</a>. <span><strong class="command">plc-config-tty</strong></span> supports a
+      <span class="emphasis"><em>-d</em></span> option for supporting the
+      <span class="emphasis"><em>myplc-devel</em></span> case, that can be useful in a
+      context where it would not guess it by itself.  Refer to <a href="#VariablesDevel" title="B. Development configuration variables (for myplc-devel)">Appendix B, <i>Development configuration variables (for <span class="emphasis"><em>myplc-devel</em></span>)</i></a> for a list of variables.</p>
 </div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="FilesInvolvedDevel"></a>4.3.  Files and directories
+    involved in <span class="emphasis"><em>myplc-devl</em></span></h3></div></div></div>
 <p>The MyPLC development environment installs the following
       files and directories:</p>
 <div class="itemizedlist"><ul type="disc">
@@ -508,15 +707,20 @@ rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu</pre>
            snapshot of the PlanetLab source code is stored as a CVS
            repository in this directory. Files in this directory will
            <span class="bold"><strong>not</strong></span> be updated by an upgrade of
-           <code class="filename">myplc-devel</code>. See <a href="#UpdatingCVS" title="4.4. Updating CVS">Section 4.4, “Updating CVS”</a> for more information about updating
+           <code class="filename">myplc-devel</code>. See <a href="#UpdatingCVS" title="4.6. Updating CVS">Section 4.6, “Updating CVS”</a> for more information about updating
            PlanetLab source code.</p></li>
 <li><p><code class="filename">/build</code>:
            Builds are stored in this directory. This directory is bind
            mounted onto <code class="filename">/plc/devel/root/build</code> so that
            it is accessible as <code class="filename">/build</code> from within the
            <span><strong class="command">chroot</strong></span> jail. The build scripts in this
-           directory are themselves source controlled; see <a href="#BuildingMyPLC" title="4.3. Building MyPLC">Section 4.3, “Building MyPLC”</a> for more information about executing
+           directory are themselves source controlled; see <a href="#BuildingMyPLC" title="4.5. Building MyPLC">Section 4.5, “Building MyPLC”</a> for more information about executing
            builds.</p></li>
+<li><p><code class="filename">/root</code>: this is the
+           location of the root-user's homedir, and for your
+           convenience is stored under <code class="filename">/data</code> so
+           that your local customizations survive across
+           updates. </p></li>
 </ul></div>
 </li>
 <li><p><code class="filename">/etc/init.d/plc-devel</code>: This file is
@@ -527,7 +731,7 @@ rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu</pre>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id268676"></a>4.2. Fedora Core 4 mirror requirement</h3></div></div></div>
+<a name="id2802931"></a>4.4. Fedora Core 4 mirror requirement</h3></div></div></div>
 <p>The MyPLC development environment requires access to a
       complete Fedora Core 4 i386 RPM repository, because several
       different filesystems based upon Fedora Core 4 are constructed
@@ -559,13 +763,13 @@ rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu</pre>
       such as <span><strong class="command">wget</strong></span> or <span><strong class="command">rsync</strong></span> to
       download the RPMS from a public mirror:</p>
 <div class="example">
-<a name="id268807"></a><p class="title"><b>Example 8. Setting up a local Fedora Core 4 repository.</b></p>
-<pre class="programlisting">mkdir -p /plc/devel/data/fedora
-cd /plc/devel/data/fedora
+<a name="id2803072"></a><p class="title"><b>Example 9. Setting up a local Fedora Core 4 repository.</b></p>
+<pre class="programlisting">mkdir -p /plc/devel/data/fedora
+cd /plc/devel/data/fedora
 
-for repo in core/4/i386/os core/updates/4/i386 extras/4/i386 ; do
-    wget -m -nH --cut-dirs=3 http://coblitz.planet-lab.org/pub/fedora/linux/$repo
-done</pre>
+for repo in core/4/i386/os core/updates/4/i386 extras/4/i386 ; do
+&gt;     wget -m -nH --cut-dirs=3 http://coblitz.planet-lab.org/pub/fedora/linux/$repo
+&gt; done</pre>
 </div>
 <p>Change the repository URI and <span><strong class="command">--cut-dirs</strong></span>
       level as needed to produce a hierarchy that resembles:</p>
@@ -577,17 +781,25 @@ done</pre>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="BuildingMyPLC"></a>4.3. Building MyPLC</h3></div></div></div>
+<a name="BuildingMyPLC"></a>4.5. Building MyPLC</h3></div></div></div>
 <p>All PlanetLab source code modules are built and installed
       as RPMS. A set of build scripts, checked into the
       <code class="filename">build/</code> directory of the PlanetLab CVS
       repository, eases the task of rebuilding PlanetLab source
       code.</p>
+<p> Before you try building MyPLC, you might check the
+      configuration, in a file named
+      <span class="emphasis"><em>plc_config.xml</em></span> that relies on a very
+      similar model as MyPLC, located in
+      <span class="emphasis"><em>/etc/planetlab</em></span> within the chroot jail, or
+      in <span class="emphasis"><em>/plc/devel/data/etc/planetlab</em></span> from the
+      root context. The set of applicable variables is described in
+      <a href="#VariablesDevel" title="B. Development configuration variables (for myplc-devel)">Appendix B, <i>Development configuration variables (for <span class="emphasis"><em>myplc-devel</em></span>)</i></a>. </p>
 <p>To build MyPLC, or any PlanetLab source code module, from
       within the MyPLC development environment, execute the following
       commands as root:</p>
 <div class="example">
-<a name="id268873"></a><p class="title"><b>Example 9. Building MyPLC.</b></p>
+<a name="id2803174"></a><p class="title"><b>Example 10. Building MyPLC.</b></p>
 <pre class="programlisting"># Initialize MyPLC development environment
 service plc-devel start
 
@@ -610,11 +822,11 @@ make -C $DATE</pre>
       <code class="filename">/plc/devel/data/build/$DATE/RPMS/</code> that you
       may copy to the
       <code class="filename">/var/www/html/install-rpms/planetlab</code>
-      directory of your MyPLC installation (see <a href="#Installation" title="2. Installation">Section 2, “Installation”</a>).</p>
+      directory of your MyPLC installation (see <a href="#Installation" title="3. Installating and using MyPLC">Section 3, “Installating and using MyPLC”</a>).</p>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="UpdatingCVS"></a>4.4. Updating CVS</h3></div></div></div>
+<a name="UpdatingCVS"></a>4.6. Updating CVS</h3></div></div></div>
 <p>A complete snapshot of the PlanetLab source code is included
       with the MyPLC development environment as a CVS repository in
       <code class="filename">/plc/devel/data/cvs</code>. This CVS repository may
@@ -631,18 +843,19 @@ make -C $DATE</pre>
 <p>Because the CVS repository is not automatically upgraded,
       if you wish to keep your local repository synchronized with the
       public PlanetLab repository, it is highly recommended that you
-      use CVS's support for <a href="http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Tracking_third-party_sources" target="_top">vendor
-      branches</a> to track changes. Vendor branches ease the task
-      of merging upstream changes with your local modifications. To
-      import a new snapshot into your local repository (for example,
-      if you have just upgraded from
+      use CVS's support for vendor branches to track changes, as
+      described <a href="http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Tracking_third-party_sources" target="_top">here</a>
+      and <a href="http://cvsbook.red-bean.com/cvsbook.html#Tracking%20Third-Party%20Sources%20(Vendor%20Branches)" target="_top">here</a>.
+      Vendor branches ease the task of merging upstream changes with
+      your local modifications. To import a new snapshot into your
+      local repository (for example, if you have just upgraded from
       <code class="filename">myplc-devel-0.4-2</code> to
       <code class="filename">myplc-devel-0.4-3</code> and you notice the new
       repository in <code class="filename">/plc/devel/data/cvs-0.4-3</code>),
       execute the following commands as root from within the MyPLC
       development environment:</p>
 <div class="example">
-<a name="id269004"></a><p class="title"><b>Example 10. Updating /data/cvs from /data/cvs-0.4-3.</b></p>
+<a name="id2803332"></a><p class="title"><b>Example 11. Updating /data/cvs from /data/cvs-0.4-3.</b></p>
 <p><span class="bold"><strong>Warning</strong></span>: This may cause
        severe, irreversible changes to be made to your local
        repository. Always tag your local repository before
@@ -660,25 +873,40 @@ cvs -d /cvs rtag before-myplc-0_4-3-merge
 TMP=$(mktemp -d /data/export.XXXXXX)
 pushd $TMP
 cvs -d /data/cvs-0.4-3 export -r HEAD .
-cvs -d /cvs import -m "PlanetLab sources from myplc-0.4-3" -ko -I ! . planetlab myplc-0_4-3
+cvs -d /cvs import -m "Merging myplc-0.4-3" -ko -I ! . planetlab myplc-0_4-3
 popd
 rm -rf $TMP</pre>
 </div>
-<p>If there any merge conflicts, use the command suggested by
-      CVS to help the merge. Explaining how to fix merge conflicts is
-      beyond the scope of this document; consult the CVS documentation
-      for more information on how to use CVS.</p>
+<p>If there are any merge conflicts, use the command
+      suggested by CVS to help the merge. Explaining how to fix merge
+      conflicts is beyond the scope of this document; consult the CVS
+      documentation for more information on how to use CVS.</p>
 </div>
 </div>
 <div class="appendix" lang="en">
 <h2 class="title" style="clear: both">
-<a name="id269037"></a>A. Configuration variables</h2>
+<a name="VariablesRuntime"></a>A. Configuration variables (for <span class="emphasis"><em>myplc</em></span>)</h2>
 <p>Listed below is the set of standard configuration variables
     and their default values, defined in the template
     <code class="filename">/etc/planetlab/default_config.xml</code>. Additional
     variables and their defaults may be defined in site-specific XML
     templates that should be placed in
     <code class="filename">/etc/planetlab/configs/</code>.</p>
+<p>This information is available online within
+    <span><strong class="command">plc-config-tty</strong></span>, e.g.:</p>
+<div class="example">
+<a name="id2803414"></a><p class="title"><b>Example A.1. Advanced usage of plc-config-tty</b></p>
+<pre class="programlisting">&lt;plc&gt; # plc-config-tty
+Enter command (u for usual changes, w to save, ? for help) V plc_dns
+========== Category = PLC_DNS
+### Enable DNS
+# Enable the internal DNS server. The server does not provide reverse
+# resolution and is not a production quality or scalable DNS solution.
+# Use the internal DNS server only for small deployments or for testing.
+PLC_DNS_ENABLED
+</pre>
+</div>
+<p> List of the <span><strong class="command">myplc</strong></span> configuration variables:</p>
 <div class="variablelist"><dl>
 <dt><span class="term">PLC_NAME</span></dt>
 <dd>
@@ -1271,7 +1499,7 @@ rm -rf $TMP</pre>
 </div>
 <div class="appendix" lang="en">
 <h2 class="title" style="clear: both">
-<a name="id271742"></a>B. Development environment configuration variables</h2>
+<a name="VariablesDevel"></a>B. Development configuration variables (for <span class="emphasis"><em>myplc-devel</em></span>)</h2>
 <div class="variablelist"><dl>
 <dt><span class="term">PLC_DEVEL_FEDORA_RELEASE</span></dt>
 <dd>
@@ -1298,7 +1526,7 @@ rm -rf $TMP</pre>
 <p>
                  Type: string</p>
 <p>
-                 Default: file:///usr/share/mirrors/fedora</p>
+                 Default: file:///data/fedora</p>
 <p>Fedora Core mirror from which to install
          filesystems.</p>
 </dd>
@@ -1323,7 +1551,7 @@ rm -rf $TMP</pre>
 </div>
 <div class="bibliography">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="id271824"></a>Bibliography</h2></div></div></div>
+<a name="id2806472"></a>Bibliography</h2></div></div></div>
 <div class="biblioentry">
 <a name="TechsGuide"></a><p>[1] <span class="author"><span class="firstname">Mark</span> <span class="surname">Huang</span>. </span><span class="title"><i><a href="http://www.planet-lab.org/doc/TechsGuide.php" target="_top">PlanetLab
       Technical Contact's Guide</a></i>. </span></p>
index fa35162..07e96a8 100644 (file)
         <authorinitials>MLH</authorinitials>
         <revdescription><para>Add development environment.</para></revdescription>
       </revision>
+      <revision>
+        <revnumber>1.2</revnumber>
+        <date>August 18, 2006</date>
+        <authorinitials>TPT</authorinitials>
+        <revdescription>
+       <para>Review section on configuration and introduce <command>plc-config-tty</command>.</para>
+       <para>Present implementation details last.</para>
+       </revdescription>
+      </revision>
     </revhistory>
   </articleinfo>
 
        </caption>
       </mediaobject>
     </figure>
+
+    <section> <title> Purpose of the <emphasis> myplc-devel
+    </emphasis> package </title>
+    <para> The <emphasis>myplc</emphasis> package comes with all
+    required node software, rebuilt from the public PlanetLab CVS
+    repository. If for any reason you need to implement your own
+    customized version of this software, you can use the
+    <emphasis>myplc-devel</emphasis> package instead, for setting up
+    your own development environment, including a local CVS
+    repository; you can then freely manage your changes and rebuild
+    your customized version of <emphasis>myplc</emphasis>. We also
+    provide good practices, that will then allow you to resync your local
+    CVS repository with any further evolution on the mainstream public
+    PlanetLab software. </para> </section>
+
+    </section>
+
+
+  <section id="Requirements"> <title> Requirements </title>
+
+  <para> <emphasis>myplc</emphasis> and
+  <emphasis>myplc-devel</emphasis> were designed as
+  <command>chroot</command> jails so as to reduce the requirements on
+  your host operating system. So in theory, these distributions should
+  work on virtually any Linux 2.6 based distribution, whether it
+  supports rpm or not. </para>
+
+  <para> However, things are never that simple and there indeed are
+  some known limitations to this, so here are a couple notes as a
+  recommended reading before you proceed with the installation.</para>
+
+  <para> As of 17 August 2006 (i.e <emphasis>myplc-0.5-2</emphasis>) :</para>
+
+  <itemizedlist>
+  <listitem><para> The software is vastly based on <emphasis>Fedora
+  Core 4</emphasis>. Please note that the build server at Princeton
+  runs <emphasis>Fedora Core 2</emphasis>, togother with a upgraded
+  version of yum. 
+  </para></listitem>
+
+  <listitem><para> myplc and myplc-devel are known to work on both
+  <emphasis>Fedora Core 2</emphasis> and <emphasis>Fedora Core
+  4</emphasis>. Please note however that, on fc4 at least, it is
+  highly recommended to use the <application>Security Level
+  Configuration</application> utility and to <emphasis>switch off
+  SElinux</emphasis> on your box because : </para>
+
+  <itemizedlist>
+  <listitem><para>
+  myplc requires you to run SElinux as 'Permissive' at most
+       </para></listitem>
+  <listitem><para>
+  myplc-devel requires you to turn SElinux Off.
+       </para></listitem>
+  </itemizedlist>
+  </listitem>
+
+  <listitem> <para> In addition, as far as myplc is concerned, you
+  need to check your firewall configuration since you need, of course,
+  to open up the <emphasis>http</emphasis> and
+  <emphasis>https</emphasis> ports, so as to accept connections from
+  the managed nodes and from the users desktops. </para> </listitem>
+
+  </itemizedlist>
   </section>
 
   <section id="Installation">
-    <title>Installation</title>
+    <title>Installating and using MyPLC</title>
 
     <para>Though internally composed of commodity software
     subpackages, MyPLC should be treated as a monolithic software
     application. MyPLC is distributed as single RPM package that has
     no external dependencies, allowing it to be installed on
-    practically any Linux 2.6 based distribution:</para>
+    practically any Linux 2.6 based distribution.</para>
 
-    <example>
+    <section>
       <title>Installing MyPLC.</title>
 
-      <programlisting><![CDATA[# If your distribution supports RPM
-rpm -U http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
-
-# If your distribution does not support RPM
-cd /tmp
-wget http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
-cd /
-rpm2cpio /tmp/myplc-0.4-1.planetlab.i386.rpm | cpio -diu]]></programlisting>
-    </example>
-
-    <para>MyPLC installs the following files and directories:</para>
-
-    <itemizedlist>
-
-      <listitem><para><filename>/plc/root.img</filename>: The main
-      root filesystem of the MyPLC application. This file is an
-      uncompressed ext3 filesystem that is loopback mounted on
-      <filename>/plc/root</filename> when MyPLC starts. This
-      filesystem, even when mounted, should be treated as an opaque
-      binary that can and will be replaced in its entirety by any
-      upgrade of MyPLC.</para></listitem>
-
-      <listitem><para><filename>/plc/root</filename>: The mount point
-      for <filename>/plc/root.img</filename>. Once the root filesystem
-      is mounted, all MyPLC services run in a
-      <command>chroot</command> jail based in this
-      directory.</para></listitem>
-
-      <listitem>
-       <para><filename>/plc/data</filename>: The directory where user
-       data and generated files are stored. This directory is bind
-       mounted onto <filename>/plc/root/data</filename> so that it is
-       accessible as <filename>/data</filename> from within the
-       <command>chroot</command> jail. Files in this directory are
-       marked with <command>%config(noreplace)</command> in the
-       RPM. That is, during an upgrade of MyPLC, if a file has not
-       changed since the last installation or upgrade of MyPLC, it is
-       subject to upgrade and replacement. If the file has changed,
-       the new version of the file will be created with a
-       <filename>.rpmnew</filename> extension. Symlinks within the
-       MyPLC root filesystem ensure that the following directories
-       (relative to <filename>/plc/root</filename>) are stored
-       outside the MyPLC filesystem image:</para>
-
-       <itemizedlist>
-         <listitem><para><filename>/etc/planetlab</filename>: This
-         directory contains the configuration files, keys, and
-         certificates that define your MyPLC
-         installation.</para></listitem>
-
-         <listitem><para><filename>/var/lib/pgsql</filename>: This
-         directory contains PostgreSQL database
-         files.</para></listitem>
-
-         <listitem><para><filename>/var/www/html/alpina-logs</filename>: This
-         directory contains node installation logs.</para></listitem>
-
-         <listitem><para><filename>/var/www/html/boot</filename>: This
-         directory contains the Boot Manager, customized for your MyPLC
-         installation, and its data files.</para></listitem>
-
-         <listitem><para><filename>/var/www/html/download</filename>: This
-         directory contains Boot CD images, customized for your MyPLC
-         installation.</para></listitem>
-
-         <listitem><para><filename>/var/www/html/install-rpms</filename>: This
-         directory is where you should install node package updates,
-         if any. By default, nodes are installed from the tarball
-         located at
-         <filename>/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2</filename>,
-         which is pre-built from the latest PlanetLab Central
-         sources, and installed as part of your MyPLC
-         installation. However, nodes will attempt to install any
-         newer RPMs located in
-         <filename>/var/www/html/install-rpms/planetlab</filename>,
-         after initial installation and periodically thereafter. You
-         must run <command>yum-arch</command> and
-         <command>createrepo</command> to update the
-         <command>yum</command> caches in this directory after
-         installing a new RPM. PlanetLab Central cannot support any
-         changes to this directory.</para></listitem>
-
-         <listitem><para><filename>/var/www/html/xml</filename>: This
-         directory contains various XML files that the Slice Creation
-         Service uses to determine the state of slices. These XML
-         files are refreshed periodically by <command>cron</command>
-         jobs running in the MyPLC root.</para></listitem>
-       </itemizedlist>
-      </listitem>
-
-      <listitem>
-       <para><filename>/etc/init.d/plc</filename>: This file
-       is a System V init script installed on your host filesystem,
-       that allows you to start up and shut down MyPLC with a single
-       command. On a Red Hat or Fedora host system, it is customary to
-       use the <command>service</command> command to invoke System V
-       init scripts:</para>
-
-       <example id="StartingAndStoppingMyPLC">
-         <title>Starting and stopping MyPLC.</title>
-
-         <programlisting><![CDATA[# Starting MyPLC
-service plc start
-
-# Stopping MyPLC
-service plc stop]]></programlisting>
-       </example>
-
-       <para>Like all other registered System V init services, MyPLC is
-       started and shut down automatically when your host system boots
-       and powers off. You may disable automatic startup by invoking
-       the <command>chkconfig</command> command on a Red Hat or Fedora
-       host system:</para>
-
-       <example>
-         <title>Disabling automatic startup of MyPLC.</title>
-
-         <programlisting><![CDATA[# Disable automatic startup
-chkconfig plc off
-
-# Enable automatic startup
-chkconfig plc on]]></programlisting>
-       </example>
-      </listitem>
-
-      <listitem><para><filename>/etc/sysconfig/plc</filename>: This
-      file is a shell script fragment that defines the variables
-      <envar>PLC_ROOT</envar> and <envar>PLC_DATA</envar>. By default,
-      the values of these variables are <filename>/plc/root</filename>
-      and <filename>/plc/data</filename>, respectively. If you wish,
-      you may move your MyPLC installation to another location on your
-      host filesystem and edit the values of these variables
-      appropriately, but you will break the RPM upgrade
-      process. PlanetLab Central cannot support any changes to this
-      file.</para></listitem>
-
-      <listitem><para><filename>/etc/planetlab</filename>: This
-      symlink to <filename>/plc/data/etc/planetlab</filename> is
-      installed on the host system for convenience.</para></listitem>
+      <itemizedlist>
+      <listitem> <para>If your distribution supports RPM:</para>
+      <programlisting><![CDATA[# rpm -U http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm]]></programlisting></listitem>
+
+      <listitem> <para>If your distribution does not support RPM:</para>
+<programlisting><![CDATA[# cd /tmp
+# wget http://build.planet-lab.org/build/myplc-0_4-rc1/RPMS/i386/myplc-0.4-1.planetlab.i386.rpm
+# cd /
+# rpm2cpio /tmp/myplc-0.4-1.planetlab.i386.rpm | cpio -diu]]></programlisting></listitem>
     </itemizedlist>
-  </section>
 
-  <section>
-    <title>Quickstart</title>
+    <para> The <xref linkend="FilesInvolvedRuntime" /> below explains in
+    details the installation strategy and the miscellaneous files and
+    directories involved.</para>
+    </section>
 
-    <para>Once installed, start MyPLC (see <xref
-    linkend="StartingAndStoppingMyPLC" />). MyPLC must be started as
-    root. Observe the output of this command for any failures. If no
-    failures occur, you should see output similar to the
-    following:</para>
+    <section id="QuickStart"> <title> QuickStart </title>
 
-    <example>
-      <title>A successful MyPLC startup.</title>
+    <para> On a Red Hat or Fedora host system, it is customary to use
+    the <command>service</command> command to invoke System V init
+    scripts. As the examples suggest, the service must be started as root:</para> 
 
-      <programlisting><![CDATA[Mounting PLC:                                              [  OK  ]
-PLC: Generating network files:                             [  OK  ]
-PLC: Starting system logger:                               [  OK  ]
-PLC: Starting database server:                             [  OK  ]
-PLC: Generating SSL certificates:                          [  OK  ]
-PLC: Configuring the API:                                  [  OK  ]
-PLC: Updating GPG keys:                                    [  OK  ]
-PLC: Generating SSH keys:                                  [  OK  ]
-PLC: Starting web server:                                  [  OK  ]
-PLC: Bootstrapping the database:                           [  OK  ]
-PLC: Starting DNS server:                                  [  OK  ]
-PLC: Starting crond:                                       [  OK  ]
-PLC: Rebuilding Boot CD:                                   [  OK  ]
-PLC: Rebuilding Boot Manager:                              [  OK  ]
-PLC: Signing node packages:                                [  OK  ]
-]]></programlisting>
+    <example><title>Starting MyPLC:</title>
+         <programlisting><![CDATA[# service plc start]]></programlisting>
+    </example>
+    <example><title>Stopping MyPLC:</title>
+         <programlisting><![CDATA[# service plc stop]]></programlisting>
     </example>
 
-    <para>If <filename>/plc/root</filename> is mounted successfully, a
-    complete log file of the startup process may be found at
-    <filename>/plc/root/var/log/boot.log</filename>. Possible reasons
-    for failure of each step include:</para>
-
-    <itemizedlist>
-      <listitem><para><literal>Mounting PLC</literal>: If this step
-      fails, first ensure that you started MyPLC as root. Check
-      <filename>/etc/sysconfig/plc</filename> to ensure that
-      <envar>PLC_ROOT</envar> and <envar>PLC_DATA</envar> refer to the
-      right locations. You may also have too many existing loopback
-      mounts, or your kernel may not support loopback mounting, bind
-      mounting, or the ext3 filesystem. Try freeing at least one
-      loopback device, or re-compiling your kernel to support loopback
-      mounting, bind mounting, and the ext3 filesystem. If you see an
-      error similar to <literal>Permission denied while trying to open
-      /plc/root.img</literal>, then SELinux may be enabled. If you
-      installed MyPLC on Fedora Core 4 or 5, use the
-      <application>Security Level Configuration</application> utility
-      to configure SELinux to be
-      <literal>Permissive</literal>.</para></listitem>
-
-      <listitem><para><literal>Starting database server</literal>: If
-      this step fails, check
-      <filename>/plc/root/var/log/pgsql</filename> and
-      <filename>/plc/root/var/log/boot.log</filename>. The most common
-      reason for failure is that the default PostgreSQL port, TCP port
-      5432, is already in use. Check that you are not running a
-      PostgreSQL server on the host system.</para></listitem>
+    <para> In <xref linkend="StartupSequence" />, we provide greater
+    details that might be helpful in the case where the service does
+    not seem to take off correctly.</para>
 
-      <listitem><para><literal>Starting web server</literal>: If this
-      step fails, check
-      <filename>/plc/root/var/log/httpd/error_log</filename> and
-      <filename>/plc/root/var/log/boot.log</filename> for obvious
-      errors. The most common reason for failure is that the default
-      web ports, TCP ports 80 and 443, are already in use. Check that
-      you are not running a web server on the host
-      system.</para></listitem>
+    <para>Like all other registered System V init services, MyPLC is
+    started and shut down automatically when your host system boots
+    and powers off. You may disable automatic startup by invoking the
+    <command>chkconfig</command> command on a Red Hat or Fedora host
+    system:</para>
 
-      <listitem><para><literal>Bootstrapping the database</literal>:
-      If this step fails, it is likely that the previous step
-      (<literal>Starting web server</literal>) also failed. Another
-      reason that it could fail is if <envar>PLC_API_HOST</envar> (see
-      <xref linkend="ChangingTheConfiguration" />) does not resolve to
-      the host on which the API server has been enabled. By default,
-      all services, including the API server, are enabled and run on
-      the same host, so check that <envar>PLC_API_HOST</envar> is
-      either <filename>localhost</filename> or resolves to a local IP
-      address.</para></listitem>
+    <example> <title>Disabling automatic startup of MyPLC.</title>
+    <programlisting><![CDATA[# chkconfig plc off]]></programlisting></example>
+    <example> <title>Re-enabling automatic startup of MyPLC.</title>
+    <programlisting><![CDATA[# chkconfig plc on]]></programlisting></example>
 
-      <listitem><para><literal>Starting crond</literal>: If this step
-      fails, it is likely that the previous steps (<literal>Starting
-      web server</literal> and <literal>Bootstrapping the
-      database</literal>) also failed. If not, check
-      <filename>/plc/root/var/log/boot.log</filename> for obvious
-      errors. This step starts the <command>cron</command> service and
-      generates the initial set of XML files that the Slice Creation
-      Service uses to determine slice state.</para></listitem>
-    </itemizedlist>
-
-    <para>If no failures occur, then MyPLC should be active with a
-    default configuration. Open a web browser on the host system and
-    visit <literal>http://localhost/</literal>, which should bring you
-    to the front page of your PLC installation. The password of the
-    default administrator account
-    <literal>root@localhost.localdomain</literal> (set by
-    <envar>PLC_ROOT_USER</envar>) is <literal>root</literal> (set by
-    <envar>PLC_ROOT_PASSWORD</envar>).</para>
+    </section>
 
-    <section id="ChangingTheConfiguration">
+    <section id="Configuration">
       <title>Changing the configuration</title>
 
       <para>After verifying that MyPLC is working correctly, shut it
       down and begin changing some of the default variable
       values. Shut down MyPLC with <command>service plc stop</command>
-      (see <xref linkend="StartingAndStoppingMyPLC" />). With a text
-      editor, open the file
-      <filename>/etc/planetlab/plc_config.xml</filename>. This file is
-      a self-documenting configuration file written in XML. Variables
-      are divided into categories. Variable identifiers must be
-      alphanumeric, plus underscore. A variable is referred to
-      canonically as the uppercase concatenation of its category
-      identifier, an underscore, and its variable identifier. Thus, a
-      variable with an <literal>id</literal> of
+      (see <xref linkend="QuickStart" />). </para>
+
+      <para> The preferred option for changing the configuration is to
+      use the <command>plc-config-tty</command> tool. This tools comes
+      with the root image, so you need to have it mounted first. The
+      full set of applicable variables is described in <xref
+      linkend="VariablesDevel" />, but using the <command>u</command>
+      guides you to the most useful ones. Here is sample session:
+      </para>
+
+      <example><title>Using plc-config-tty for configuration:</title>
+         <programlisting><![CDATA[# service plc mount
+Mounting PLC:                                              [  OK  ]
+# chroot /plc/root su - 
+<plc> # plc-config-tty
+Config file /etc/planetlab/configs/site.xml located under a non-existing directory
+Want to create /etc/planetlab/configs [y]/n ? y
+Created directory /etc/planetlab/configs
+Enter command (u for usual changes, w to save, ? for help) u
+== PLC_NAME : [PlanetLab Test] OneLab
+== PLC_ROOT_USER : [root@localhost.localdomain] root@odie.inria.fr
+== PLC_ROOT_PASSWORD : [root] plain-passwd
+== PLC_MAIL_SUPPORT_ADDRESS : [root+support@localhost.localdomain] support@one-lab.org
+== PLC_DB_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_API_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_WWW_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_BOOT_HOST : [localhost.localdomain] odie.inria.fr
+== PLC_NET_DNS1 : [127.0.0.1] 138.96.250.248
+== PLC_NET_DNS2 : [None] 138.96.250.249
+Enter command (u for usual changes, w to save, ? for help) w
+Wrote /etc/planetlab/configs/site.xml
+Merged
+        /etc/planetlab/default_config.xml
+and     /etc/planetlab/configs/site.xml
+into    /etc/planetlab/plc_config.xml
+You might want to type 'r' (restart plc) or 'q' (quit)
+Enter command (u for usual changes, w to save, ? for help) r
+==================== Stopping plc
+...
+==================== Starting plc
+...
+Enter command (u for usual changes, w to save, ? for help) q
+<plc> # exit
+# 
+]]></programlisting>
+    </example>
+
+      <para>If you used this method for configuring, you can skip to
+      the <xref linkend="LoginRealUser" />. As an alternative to using
+      <command>plc-config-tty</command>, you may also use a text
+      editor, but this requires some understanding on how the
+      configuration files are used within myplc. The
+      <emphasis>default</emphasis> configuration is stored in a file
+      named <filename>/etc/planetlab/default_config.xml</filename>,
+      that is designed to remain intact. You may store your local
+      changes in any file located in the <filename>configs/</filename>
+      sub-directory, that are loaded on top of the defaults. Finally
+      the file <filename>/etc/planetlab/plc_config.xml</filename> is
+      loaded, and the resulting configuration is stored in the latter
+      file, that is used as a reference.</para>
+
+      <para> Using a separate file for storing local changes only, as
+      <command>plc-config-tty</command> does, is not a workable option
+      with a text editor because it would involve tedious xml
+      re-assembling. So your local changes should go in
+      <filename>/etc/planetlab/plc_config.xml</filename>. Be warned
+      however that any change you might do this way could be lost if
+      you use <command>plc-config-tty</command> later on. </para>
+
+      <para>This file is a self-documenting configuration file written
+      in XML. Variables are divided into categories. Variable
+      identifiers must be alphanumeric, plus underscore. A variable is
+      referred to canonically as the uppercase concatenation of its
+      category identifier, an underscore, and its variable
+      identifier. Thus, a variable with an <literal>id</literal> of
       <literal>slice_prefix</literal> in the <literal>plc</literal>
       category is referred to canonically as
       <envar>PLC_SLICE_PREFIX</envar>.</para>
@@ -379,13 +324,30 @@ PLC: Signing node packages:                                [  OK  ]
        system.</para></listitem>
       </itemizedlist>
 
-      <para>After changing these variables, save the file, then
-      restart MyPLC with <command>service plc start</command>. You
-      should notice that the password of the default administrator
-      account is no longer <literal>root</literal>, and that the
-      default site name includes the name of your PLC installation
-      instead of PlanetLab.</para>
-    </section>
+      <para> After changing these variables,
+      save the file, then restart MyPLC with <command>service plc
+      start</command>. You should notice that the password of the
+      default administrator account is no longer
+      <literal>root</literal>, and that the default site name includes
+      the name of your PLC installation instead of PlanetLab. As a
+      side effect of these changes, the ISO images for the boot CDs
+      now have new names, so that you can freely remove the ones names
+      after 'PlanetLab Test', which is the default value of
+      <envar>PLC_NAME</envar> </para> 
+      </section>
+
+      <section id="LoginRealUser"> <title> Login as a real user </title>
+
+      <para>Now that myplc is up and running, you can connect to the
+      web site that by default runs on port 80. You can either
+      directly use the default administrator user that you configured
+      in <envar>PLC_ROOT_USER</envar> and
+      <envar>PLC_ROOT_PASSWORD</envar>, or create a real user through
+      the 'Joining' tab. Do not forget to  select both PI and tech
+      roles, and to select the only site created at this stage.
+      Login as the administrator to enable this user, then login as
+      the real user.</para>
+      </section>
 
     <section>
       <title>Installing nodes</title>
@@ -481,9 +443,221 @@ ssh -i /etc/planetlab/root_ssh_key.rsa root@node \
 vserver pl_conf exec service pl_conf restart]]></programlisting>
       </example>
     </section>
+
+  <section id="StartupSequence">
+    <title>Understanding the startup sequence</title>
+
+    <para>During service startup described in <xref
+    linkend="QuickStart" />, observe the output of this command for
+    any failures. If no failures occur, you should see output similar
+    to the following:</para>
+
+    <example>
+      <title>A successful MyPLC startup.</title>
+
+      <programlisting><![CDATA[Mounting PLC:                                              [  OK  ]
+PLC: Generating network files:                             [  OK  ]
+PLC: Starting system logger:                               [  OK  ]
+PLC: Starting database server:                             [  OK  ]
+PLC: Generating SSL certificates:                          [  OK  ]
+PLC: Configuring the API:                                  [  OK  ]
+PLC: Updating GPG keys:                                    [  OK  ]
+PLC: Generating SSH keys:                                  [  OK  ]
+PLC: Starting web server:                                  [  OK  ]
+PLC: Bootstrapping the database:                           [  OK  ]
+PLC: Starting DNS server:                                  [  OK  ]
+PLC: Starting crond:                                       [  OK  ]
+PLC: Rebuilding Boot CD:                                   [  OK  ]
+PLC: Rebuilding Boot Manager:                              [  OK  ]
+PLC: Signing node packages:                                [  OK  ]
+]]></programlisting>
+    </example>
+
+    <para>If <filename>/plc/root</filename> is mounted successfully, a
+    complete log file of the startup process may be found at
+    <filename>/plc/root/var/log/boot.log</filename>. Possible reasons
+    for failure of each step include:</para>
+
+    <itemizedlist>
+      <listitem><para><literal>Mounting PLC</literal>: If this step
+      fails, first ensure that you started MyPLC as root. Check
+      <filename>/etc/sysconfig/plc</filename> to ensure that
+      <envar>PLC_ROOT</envar> and <envar>PLC_DATA</envar> refer to the
+      right locations. You may also have too many existing loopback
+      mounts, or your kernel may not support loopback mounting, bind
+      mounting, or the ext3 filesystem. Try freeing at least one
+      loopback device, or re-compiling your kernel to support loopback
+      mounting, bind mounting, and the ext3 filesystem. If you see an
+      error similar to <literal>Permission denied while trying to open
+      /plc/root.img</literal>, then SELinux may be enabled. See <xref
+      linkend="Requirements" /> above for details.</para></listitem>
+
+      <listitem><para><literal>Starting database server</literal>: If
+      this step fails, check
+      <filename>/plc/root/var/log/pgsql</filename> and
+      <filename>/plc/root/var/log/boot.log</filename>. The most common
+      reason for failure is that the default PostgreSQL port, TCP port
+      5432, is already in use. Check that you are not running a
+      PostgreSQL server on the host system.</para></listitem>
+
+      <listitem><para><literal>Starting web server</literal>: If this
+      step fails, check
+      <filename>/plc/root/var/log/httpd/error_log</filename> and
+      <filename>/plc/root/var/log/boot.log</filename> for obvious
+      errors. The most common reason for failure is that the default
+      web ports, TCP ports 80 and 443, are already in use. Check that
+      you are not running a web server on the host
+      system.</para></listitem>
+
+      <listitem><para><literal>Bootstrapping the database</literal>:
+      If this step fails, it is likely that the previous step
+      (<literal>Starting web server</literal>) also failed. Another
+      reason that it could fail is if <envar>PLC_API_HOST</envar> (see
+      <xref linkend="Configuration" />) does not resolve to
+      the host on which the API server has been enabled. By default,
+      all services, including the API server, are enabled and run on
+      the same host, so check that <envar>PLC_API_HOST</envar> is
+      either <filename>localhost</filename> or resolves to a local IP
+      address. Also check that <envar>PLC_ROOT_USER</envar> looks like
+      an e-mail address.</para></listitem>
+
+      <listitem><para><literal>Starting crond</literal>: If this step
+      fails, it is likely that the previous steps (<literal>Starting
+      web server</literal> and <literal>Bootstrapping the
+      database</literal>) also failed. If not, check
+      <filename>/plc/root/var/log/boot.log</filename> for obvious
+      errors. This step starts the <command>cron</command> service and
+      generates the initial set of XML files that the Slice Creation
+      Service uses to determine slice state.</para></listitem>
+    </itemizedlist>
+
+    <para>If no failures occur, then MyPLC should be active with a
+    default configuration. Open a web browser on the host system and
+    visit <literal>http://localhost/</literal>, which should bring you
+    to the front page of your PLC installation. The password of the
+    default administrator account
+    <literal>root@localhost.localdomain</literal> (set by
+    <envar>PLC_ROOT_USER</envar>) is <literal>root</literal> (set by
+    <envar>PLC_ROOT_PASSWORD</envar>).</para>
+    </section>
+
+    <section id="FilesInvolvedRuntime"> <title> Files and directories
+    involved in <emphasis>myplc</emphasis></title>
+    <para>MyPLC installs the following files and directories:</para>
+
+    <orderedlist>
+
+      <listitem><para><filename>/plc/root.img</filename>: The main
+      root filesystem of the MyPLC application. This file is an
+      uncompressed ext3 filesystem that is loopback mounted on
+      <filename>/plc/root</filename> when MyPLC starts. This
+      filesystem, even when mounted, should be treated as an opaque
+      binary that can and will be replaced in its entirety by any
+      upgrade of MyPLC.</para></listitem>
+
+      <listitem><para><filename>/plc/root</filename>: The mount point
+      for <filename>/plc/root.img</filename>. Once the root filesystem
+      is mounted, all MyPLC services run in a
+      <command>chroot</command> jail based in this
+      directory.</para></listitem>
+
+      <listitem>
+       <para><filename>/plc/data</filename>: The directory where user
+       data and generated files are stored. This directory is bind
+       mounted onto <filename>/plc/root/data</filename> so that it is
+       accessible as <filename>/data</filename> from within the
+       <command>chroot</command> jail. Files in this directory are
+       marked with <command>%config(noreplace)</command> in the
+       RPM. That is, during an upgrade of MyPLC, if a file has not
+       changed since the last installation or upgrade of MyPLC, it is
+       subject to upgrade and replacement. If the file has changed,
+       the new version of the file will be created with a
+       <filename>.rpmnew</filename> extension. Symlinks within the
+       MyPLC root filesystem ensure that the following directories
+       (relative to <filename>/plc/root</filename>) are stored
+       outside the MyPLC filesystem image:</para>
+
+       <itemizedlist>
+         <listitem><para><filename>/etc/planetlab</filename>: This
+         directory contains the configuration files, keys, and
+         certificates that define your MyPLC
+         installation.</para></listitem>
+
+         <listitem><para><filename>/var/lib/pgsql</filename>: This
+         directory contains PostgreSQL database
+         files.</para></listitem>
+
+         <listitem><para><filename>/var/www/html/alpina-logs</filename>: This
+         directory contains node installation logs.</para></listitem>
+
+         <listitem><para><filename>/var/www/html/boot</filename>: This
+         directory contains the Boot Manager, customized for your MyPLC
+         installation, and its data files.</para></listitem>
+
+         <listitem><para><filename>/var/www/html/download</filename>: This
+         directory contains Boot CD images, customized for your MyPLC
+         installation.</para></listitem>
+
+         <listitem><para><filename>/var/www/html/install-rpms</filename>: This
+         directory is where you should install node package updates,
+         if any. By default, nodes are installed from the tarball
+         located at
+         <filename>/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2</filename>,
+         which is pre-built from the latest PlanetLab Central
+         sources, and installed as part of your MyPLC
+         installation. However, nodes will attempt to install any
+         newer RPMs located in
+         <filename>/var/www/html/install-rpms/planetlab</filename>,
+         after initial installation and periodically thereafter. You
+         must run <command>yum-arch</command> and
+         <command>createrepo</command> to update the
+         <command>yum</command> caches in this directory after
+         installing a new RPM. PlanetLab Central cannot support any
+         changes to this directory.</para></listitem>
+
+         <listitem><para><filename>/var/www/html/xml</filename>: This
+         directory contains various XML files that the Slice Creation
+         Service uses to determine the state of slices. These XML
+         files are refreshed periodically by <command>cron</command>
+         jobs running in the MyPLC root.</para></listitem>
+
+         <listitem><para><filename>/root</filename>: this is the
+         location of the root-user's homedir, and for your
+         convenience is stored under <filename>/data</filename> so
+         that your local customizations survive across
+         updates - this feature is inherited from the
+         <command>myplc-devel</command> package, where it is probably
+         more useful. </para></listitem> 
+
+       </itemizedlist>
+      </listitem>
+
+      <listitem id="MyplcInitScripts">
+       <para><filename>/etc/init.d/plc</filename>: This file
+       is a System V init script installed on your host filesystem,
+       that allows you to start up and shut down MyPLC with a single
+       command, as described in <xref linkend="QuickStart" />.</para>
+      </listitem>
+
+      <listitem><para><filename>/etc/sysconfig/plc</filename>: This
+      file is a shell script fragment that defines the variables
+      <envar>PLC_ROOT</envar> and <envar>PLC_DATA</envar>. By default,
+      the values of these variables are <filename>/plc/root</filename>
+      and <filename>/plc/data</filename>, respectively. If you wish,
+      you may move your MyPLC installation to another location on your
+      host filesystem and edit the values of these variables
+      appropriately, but you will break the RPM upgrade
+      process. PlanetLab Central cannot support any changes to this
+      file.</para></listitem>
+
+      <listitem><para><filename>/etc/planetlab</filename>: This
+      symlink to <filename>/plc/data/etc/planetlab</filename> is
+      installed on the host system for convenience.</para></listitem>
+    </orderedlist>
+  </section>
   </section>
 
-  <section>
+  <section id="DevelopmentEnvironment">
     <title>Rebuilding and customizing MyPLC</title>
 
     <para>The MyPLC package, though distributed as an RPM, is not a
@@ -513,18 +687,34 @@ vserver pl_conf exec service pl_conf restart]]></programlisting>
       <command>chroot</command> jail should not be modified directly, as
       they are subject to upgrade.</para>
 
-      <example>
-       <title>Installing the MyPLC development environment.</title>
-
-       <programlisting><![CDATA[# If your distribution supports RPM
-rpm -U http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
+      <itemizedlist>
+      <listitem> <para>If your distribution supports RPM:</para>
+      <programlisting><![CDATA[# rpm -U http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm]]></programlisting></listitem>
+
+      <listitem> <para>If your distribution does not support RPM:</para>
+<programlisting><![CDATA[# cd /tmp
+# wget http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
+# cd /
+# rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu]]></programlisting></listitem>
+    </itemizedlist>
+    </section>
 
-# If your distribution does not support RPM
-cd /tmp
-wget http://build.planet-lab.org/build/myplc-0_4-rc2/RPMS/i386/myplc-devel-0.4-2.planetlab.i386.rpm
-cd /
-rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu]]></programlisting>
-      </example>
+    <section>
+      <title>Configuration</title> 
+      
+      <para> The default configuration should work as-is on most
+      sites. Configuring the development package can be achieved in a
+      similar way as for <emphasis>myplc</emphasis>, as described in
+      <xref linkend="Configuration"
+      />. <command>plc-config-tty</command> supports a
+      <emphasis>-d</emphasis> option for supporting the
+      <emphasis>myplc-devel</emphasis> case, that can be useful in a
+      context where it would not guess it by itself.  Refer to <xref
+      linkend="VariablesDevel" /> for a list of variables.</para>
+      </section>
+
+    <section id="FilesInvolvedDevel"> <title> Files and directories
+    involved in <emphasis>myplc-devl</emphasis></title>
 
       <para>The MyPLC development environment installs the following
       files and directories:</para>
@@ -576,8 +766,12 @@ rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu]]></programlistin
            directory are themselves source controlled; see <xref
            linkend="BuildingMyPLC" /> for more information about executing
            builds.</para></listitem>
-         </itemizedlist>
-       </listitem>
+
+           <listitem><para><filename>/root</filename>: this is the
+           location of the root-user's homedir, and for your
+           convenience is stored under <filename>/data</filename> so
+           that your local customizations survive across
+           updates. </para></listitem> </itemizedlist> </listitem>
 
        <listitem>
          <para><filename>/etc/init.d/plc-devel</filename>: This file is
@@ -627,12 +821,12 @@ rpm2cpio /tmp/myplc-devel-0.4-2.planetlab.i386.rpm | cpio -diu]]></programlistin
       <example>
        <title>Setting up a local Fedora Core 4 repository.</title>
        
-       <programlisting><![CDATA[mkdir -p /plc/devel/data/fedora
-cd /plc/devel/data/fedora
+       <programlisting><![CDATA[mkdir -p /plc/devel/data/fedora
+cd /plc/devel/data/fedora
 
-for repo in core/4/i386/os core/updates/4/i386 extras/4/i386 ; do
-    wget -m -nH --cut-dirs=3 http://coblitz.planet-lab.org/pub/fedora/linux/$repo
-done]]></programlisting>
+for repo in core/4/i386/os core/updates/4/i386 extras/4/i386 ; do
+    wget -m -nH --cut-dirs=3 http://coblitz.planet-lab.org/pub/fedora/linux/$repo
+done]]></programlisting>
       </example>
       
       <para>Change the repository URI and <command>--cut-dirs</command>
@@ -655,6 +849,15 @@ done]]></programlisting>
       repository, eases the task of rebuilding PlanetLab source
       code.</para>
 
+      <para> Before you try building MyPLC, you might check the
+      configuration, in a file named
+      <emphasis>plc_config.xml</emphasis> that relies on a very
+      similar model as MyPLC, located in
+      <emphasis>/etc/planetlab</emphasis> within the chroot jail, or
+      in <emphasis>/plc/devel/data/etc/planetlab</emphasis> from the
+      root context. The set of applicable variables is described in
+      <xref linkend="VariablesDevel" />. </para>
+
       <para>To build MyPLC, or any PlanetLab source code module, from
       within the MyPLC development environment, execute the following
       commands as root:</para>
@@ -711,12 +914,14 @@ make -C $DATE]]></programlisting>
       <para>Because the CVS repository is not automatically upgraded,
       if you wish to keep your local repository synchronized with the
       public PlanetLab repository, it is highly recommended that you
-      use CVS's support for <ulink
-      url="http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Tracking_third-party_sources">vendor
-      branches</ulink> to track changes. Vendor branches ease the task
-      of merging upstream changes with your local modifications. To
-      import a new snapshot into your local repository (for example,
-      if you have just upgraded from
+      use CVS's support for vendor branches to track changes, as
+      described <ulink
+      url="http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Tracking_third-party_sources">here</ulink>
+      and <ulink
+      url="http://cvsbook.red-bean.com/cvsbook.html#Tracking%20Third-Party%20Sources%20(Vendor%20Branches)">here</ulink>.
+      Vendor branches ease the task of merging upstream changes with
+      your local modifications. To import a new snapshot into your
+      local repository (for example, if you have just upgraded from
       <filename>myplc-devel-0.4-2</filename> to
       <filename>myplc-devel-0.4-3</filename> and you notice the new
       repository in <filename>/plc/devel/data/cvs-0.4-3</filename>),
@@ -744,20 +949,19 @@ cvs -d /cvs rtag before-myplc-0_4-3-merge
 TMP=$(mktemp -d /data/export.XXXXXX)
 pushd $TMP
 cvs -d /data/cvs-0.4-3 export -r HEAD .
-cvs -d /cvs import -m "PlanetLab sources from myplc-0.4-3" -ko -I ! . planetlab myplc-0_4-3
+cvs -d /cvs import -m "Merging myplc-0.4-3" -ko -I ! . planetlab myplc-0_4-3
 popd
 rm -rf $TMP]]></programlisting>
       </example>
 
-      <para>If there any merge conflicts, use the command suggested by
-      CVS to help the merge. Explaining how to fix merge conflicts is
-      beyond the scope of this document; consult the CVS documentation
-      for more information on how to use CVS.</para>
-    </section>
-  </section>
+      <para>If there are any merge conflicts, use the command
+      suggested by CVS to help the merge. Explaining how to fix merge
+      conflicts is beyond the scope of this document; consult the CVS
+      documentation for more information on how to use CVS.</para>
+      </section> </section>
 
-  <appendix>
-    <title>Configuration variables</title>
+  <appendix id="VariablesRuntime">
+    <title>Configuration variables (for <emphasis>myplc</emphasis>)</title>
 
     <para>Listed below is the set of standard configuration variables
     and their default values, defined in the template
@@ -766,11 +970,27 @@ rm -rf $TMP]]></programlisting>
     templates that should be placed in
     <filename>/etc/planetlab/configs/</filename>.</para>
 
-    &Variables;
+    <para>This information is available online within
+    <command>plc-config-tty</command>, e.g.:</para>
+
+<example><title>Advanced usage of plc-config-tty</title>
+<programlisting><![CDATA[<plc> # plc-config-tty
+Enter command (u for usual changes, w to save, ? for help) V plc_dns
+========== Category = PLC_DNS
+### Enable DNS
+# Enable the internal DNS server. The server does not provide reverse
+# resolution and is not a production quality or scalable DNS solution.
+# Use the internal DNS server only for small deployments or for testing.
+PLC_DNS_ENABLED
+]]></programlisting></example>
+
+
+  <para> List of the <command>myplc</command> configuration variables:</para>
+   &Variables;
   </appendix>
 
-  <appendix>
-    <title>Development environment configuration variables</title>
+  <appendix id="VariablesDevel">
+    <title>Development configuration variables (for <emphasis>myplc-devel</emphasis>)</title>
 
     &DevelVariables;
   </appendix>
index 263aa3c..4dacd1c 100644 (file)
@@ -29,7 +29,7 @@
       <para>
                  Type: string</para>
       <para>
-                 Default: file:///usr/share/mirrors/fedora</para>
+                 Default: file:///data/fedora</para>
       <para>Fedora Core mirror from which to install
          filesystems.</para>
     </listitem>
index 5d14608..28e6836 100755 (executable)
@@ -6,7 +6,7 @@
 #
 # description: Manages all PLC services on this machine
 #
-# $Id: guest.init,v 1.19 2006/07/10 21:10:21 mlhuang Exp $
+# $Id: guest.init,v 1.20 2006/08/08 23:19:52 mlhuang Exp $
 #
 
 # Source function library and configuration
@@ -33,6 +33,8 @@ nsteps=${#steps[@]}
 # Regenerate configuration files
 reload ()
 {
+    force=$1
+
     # Regenerate the main configuration file from default values
     # overlaid with site-specific and current values.
     files=(
@@ -41,7 +43,7 @@ reload ()
        /etc/planetlab/plc_config.xml
     )
     for file in "${files[@]}" ; do
-       if [ $file -nt /etc/planetlab/plc_config.xml ] ; then
+       if [ -n "$force" -o $file -nt /etc/planetlab/plc_config.xml ] ; then
            tmp=$(mktemp /tmp/plc_config.xml.XXXXXX)
            plc-config --xml "${files[@]}" >$tmp
            if [ $? -eq 0 ] ; then
@@ -56,10 +58,10 @@ reload ()
     done
 
     # Convert configuration to various formats
-    if [ /etc/planetlab/plc_config.xml -nt /etc/planetlab/plc_config ] ; then
+    if [ -n "$force" -o /etc/planetlab/plc_config.xml -nt /etc/planetlab/plc_config ] ; then
        plc-config --shell >/etc/planetlab/plc_config
     fi
-    if [ /etc/planetlab/plc_config.xml -nt /etc/planetlab/php/plc_config.php ] ; then
+    if [ -n "$force" -o /etc/planetlab/plc_config.xml -nt /etc/planetlab/php/plc_config.php ] ; then
        mkdir -p /etc/planetlab/php
        plc-config --php >/etc/planetlab/php/plc_config.php
     fi
@@ -117,7 +119,7 @@ command=$1
 shift 1
 if [ -z "$1" ] ; then
     # Start or stop everything. Regenerate configuration first.
-    reload
+    reload force
 else
     # Start or stop a particular step
     steps=("$@")
@@ -166,6 +168,7 @@ case "$command" in
        ;;
 
     reload)
+       reload force
        ;;
 
     *)
index bd82763..028f677 100644 (file)
@@ -5,13 +5,18 @@ URL: http://cvs.planet-lab.org/cvs/myplc
 
 Summary: PlanetLab Central (PLC) Portable Installation
 Name: myplc
-Version: 0.4
+Version: 0.5
 Release: 2%{?pldistro:.%{pldistro}}%{?date:.%{date}}
 License: PlanetLab
 Group: Applications/Systems
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
+# for preventing myplc-devel from being built
+# *should* support invokation like rpmbuild --define "build_level 0" 
+# *but* this does not seem to work : so just set to 0 here
+%{!?build_level: %define build_devel 1}
+
 %define debug_package %{nil}
 
 %description
@@ -23,24 +28,33 @@ through a graphical interface. All PLC services are started up and
 shut down through a single System V init script installed in the host
 system.
 
+%if %{build_devel}
 %package devel
 Summary: PlanetLab Central (PLC) Development Environment
 Group: Development/Tools
 AutoReqProv: no
+%endif
 
+%if %{build_devel}
 %description devel
 This package install a complete PlanetLab development environment
 contained within a chroot jail. The default installation consists of a
 local CVS repository bootstrapped with a snapshot of all PlanetLab
 source code, and all the tools necessary to compile it.
+%endif
 
 %prep
 %setup -q
 
 %build
 pushd myplc
+%if %{build_devel}
+echo -n "XXXXXXXXXXXXXXX myplc::build_devel " ; date
 ./build_devel.sh %{?cvstag:-t %{cvstag}}
+%endif
+echo -n "XXXXXXXXXXXXXXX myplc::build " ; date
 ./build.sh %{?cvstag:-t %{cvstag}}
+echo -n "XXXXXXXXXXXXXXX myplc::endbuild " ; date
 popd
 
 %install
@@ -71,6 +85,8 @@ find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
 # myplc-devel
 #
 
+%if %{build_devel}
+
 # Install host startup script and configuration file
 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc-devel
 install -D -m 644 plc-devel.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc-devel
@@ -86,6 +102,8 @@ find devel/data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
 # unique name. A hard-linked copy is made in %post.
 mv $RPM_BUILD_ROOT/plc/devel/data/{cvs,cvs-%{version}-%{release}}
 
+%endif
+
 popd
 
 %clean
@@ -124,9 +142,15 @@ fi
 # 0 = install, 1 = upgrade
 if [ $1 -gt 0 ] ; then
     for dir in /var/lib/pgsql/data /etc/planetlab ; do
-       if [ -d /plc/data/$dir -a ! -d /plc/data/$dir.rpmsave ] ; then
+       if [ -d /plc/data/$dir ] ; then
            echo "Preserving /plc/data/$dir"
-           cp -ra /plc/data/$dir{,.rpmsave}
+           mkdir -p /plc/data/$dir.rpmsave
+           tar -C /plc/data/$dir -cpf - . | \
+              tar -C /plc/data/$dir.rpmsave -xpf -
+
+           # Except for the default configuration file and DTD, which
+           # really should be considered for upgrade.
+           rm -f /plc/data/$dir.rpmsave/{default_config.xml,plc_config.dtd}
        fi
     done
 fi
@@ -137,19 +161,6 @@ if [ -x /sbin/chkconfig ] ; then
     /sbin/chkconfig plc on
 fi
 
-for dir in /var/lib/pgsql/data /etc/planetlab ; do
-    if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
-       echo "Merging /plc/data/$dir"
-       if tar -C /plc/data/$dir.rpmsave -cpf - . | \
-           tar -C /plc/data/$dir -xpf - ; then
-           rm -rf /plc/data/$dir.rpmsave
-       fi
-    fi
-done
-
-# Force a regeneration to take into account new variables
-touch /plc/data/etc/planetlab/default_config.xml
-
 %triggerpostun -- %{name}
 # 0 = erase, 1 = upgrade
 if [ $1 -gt 0 ] ; then
@@ -174,11 +185,14 @@ if [ $1 -eq 0 ] ; then
     fi
 fi
 
+%if %{build_devel}
 %pre devel
 if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then
     %{_sysconfdir}/init.d/plc-devel stop
 fi
+%endif
 
+%if %{build_devel}
 %post devel
 if [ -x /sbin/chkconfig ] ; then
     /sbin/chkconfig --add plc-devel
@@ -190,7 +204,9 @@ fi
 if [ ! -d /plc/devel/data/cvs ] ; then
     cp -rl /plc/devel/data/{cvs-%{version}-%{release},cvs}
 fi
+%endif
 
+%if %{build_devel}
 %preun devel
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
@@ -200,6 +216,7 @@ if [ $1 -eq 0 ] ; then
        /sbin/chkconfig --del plc-devel
     fi
 fi
+%endif
 
 %files
 %defattr(-,root,root,-)
@@ -218,6 +235,7 @@ fi
 %dir /plc/data
 %config(noreplace) /plc/data/*
 
+%if %{build_devel}
 %files devel
 %defattr(-,root,root,-)
 # Host startup script and configuration file
@@ -231,8 +249,13 @@ fi
 # Data directory
 %dir /plc/devel/data
 %config(noreplace) /plc/devel/data/*
+%endif
 
 %changelog
+* Wed Aug 09 2006 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
+- introduces variable %{build_devel} to allow custom sites to skip building
+  the myplc-devel package.
+
 * Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
 - MyPLC 0.4 RC2.
 - Fix many spec files (License replaces Copyright).
index 95c1e2f..6a2c873 100755 (executable)
@@ -2,40 +2,95 @@
 
 # Interactively prompts for variable values
 # expected arguments are
-# command [default-xml [custom-xml]]
+# command -d [default-xml [custom-xml [ consolidated-xml ]]]
 #
-# Two-steps logic:
-# (1) scans all variables (todo: pass categories as arguments)
-#     and prompts for value
-#     current value proposed as default
-#     also allows to remove site-dependent setting
-# (2) epilogue : allows to
-#     list the site-dependent vars with values
-#     and to locally (re-)edit a variable from its shell name
-#     quit with or without saving
+# -d is for the myplc-devel package
+
+# we use 3 instances of PLCConfiguration throughout:
+# cdef : models the defaults, from plc_default.xml
+# cread : merged from plc_default & configs/site.xml
+# cwrite : site.xml + pending changes
 
 import sys
 import os
 import re
 import readline
+import getopt
 
 from plc_config import PLCConfiguration
 
 ####################
-release = "$Id"
+release_id = "$Id: plc-config-tty,v 1.8 2006/08/18 14:34:45 thierry Exp $"
+release_rev = "$Revision: 1.8 $"
+
+def init_flavour (flavour):
+    global service
+    global common_variables
+    if (flavour == "devel"):
+        service="plc-devel"
+        common_variables=("PLC_DEVEL_FEDORA_URL",
+                          "PLC_DEVEL_CVSROOT")
+        config_dir = "/plc/devel/data/etc/planetlab"
+    else:
+        service="plc"
+        common_variables=("PLC_NAME",
+                          "PLC_ROOT_USER",
+                          "PLC_ROOT_PASSWORD",
+                          "PLC_MAIL_SUPPORT_ADDRESS",
+                          "PLC_DB_HOST",
+                          "PLC_API_HOST",
+                          "PLC_WWW_HOST",
+                          "PLC_BOOT_HOST",
+                          "PLC_NET_DNS1",
+                          "PLC_NET_DNS2")
+        config_dir = "/etc/planetlab"
+    global def_default_config
+    def_default_config= "%s/default_config.xml" % config_dir
+    global def_site_config
+    def_site_config = "%s/configs/site.xml" % config_dir
+    global def_consolidated_config
+    def_consolidated_config = "%s/plc_config.xml" % config_dir
 
-def_main_config = "/etc/planetlab/default_config.xml"
-def_site_config = "/etc/planetlab/configs/site.xml"
-def_consolidated_config = "/etc/planetlab/plc_config.xml"
+    global mainloop_usage
+    mainloop_usage= """Available commands:
+ Uppercase versions give variables comments, when available
+-u/U\t\t\tEdit usual variables
+-w\t\t\tWrite & consolidate
+-r\t\t\tRestart %s service
+-q\t\t\tQuit (without saving)
+-h/?\t\t\tThis help
+---
+l/L [<cat>|<var>]\tShow Locally modified variables/values
+-s/S [<cat>|<var>]\tShow variables/values (all, in category, single)
+-e/E [<cat>|<var>]\tEdit variables (all, in category, single)
+---
+-c\t\t\tList categories
+-v/V [<cat>|<var>]List Variables (all, in category, single)
+---
+Typical usage involves: u, [l,] w, r, q
+""" % service
 
-command_usage="""Usage: %s [default-xml [site-xml [consolidated-xml]]]
+def usage ():
+    command_usage="Usage: %s [-d] [-v] [default-xml [site-xml [consolidated-xml]]]"% sys.argv[0]
+    init_flavour ("boot")
+    command_usage +="""
+  -v shows version and exits
+\t default-xml defaults to %s
+\t site-xml defaults to %s
+\t consolidated-xml defaults to %s""" % (def_default_config,def_site_config, def_consolidated_config)
+    command_usage += """
+  Unless you specify the -d option, meaning you want to configure
+  myplc-devel instead of regular myplc, in which case""" 
+    init_flavour ("devel")
+    command_usage +="""
 \t default-xml defaults to %s
 \t site-xml defaults to %s
-\t consolidated-xml defaults to %s
-""" % (sys.argv[0],def_main_config,def_site_config, def_consolidated_config)
+\t consolidated-xml defaults to %s""" % (def_default_config,def_site_config, def_consolidated_config)
+    print(command_usage)
+    sys.exit(1)
 
 ####################
-variable_usage= """Special answers :
+variable_usage= """Edit Commands :
 #\tShow variable comments
 .\tStops prompting, return to mainloop
 /\tCleans any site-defined value, reverts to default
@@ -44,21 +99,97 @@ variable_usage= """Special answers :
 ?\tThis help
 """
 
-def usage ():
-    print(command_usage)
-    sys.exit(1)
-
 ####################
 def get_value (config,  category_id, variable_id):
     (category, variable) = config.get (category_id, variable_id)
     return variable['value']
 
+def get_current_value (cread, cwrite, category_id, variable_id):
+    # the value stored in cwrite, if present, is the one we want
+    try:
+        result=get_value (cwrite,category_id,variable_id)
+    except:
+        result=get_value (cread,category_id,variable_id)
+    return result
+
 # refrain from using plc_config's _sanitize 
 def get_varname (config,  category_id, variable_id):
     (category, variable) = config.get (category_id, variable_id)
     return (category_id+"_"+variable['id']).upper()
 
-def prompt_variable (cdef, cread, cwrite, category, variable):
+# could not avoid using _sanitize here..
+def get_name_comments (config, cid, vid):
+    try:
+        (category, variable) = config.get (cid, vid)
+        (id, name, value, comments) = config._sanitize_variable (cid,variable)
+        return (name,comments)
+    except:
+        return (None,[])
+
+def print_name_comments (config, cid, vid):
+    (name,comments)=get_name_comments(config,cid,vid)
+    if name:
+        print "### %s" % name
+    if comments:
+        for line in comments:
+            print "# %s" % line
+    else:
+        print "!!! No comment associated to %s_%s" % (cid,vid)
+
+####################
+def list_categories (config):
+    result=[]
+    for (category_id, (category, variables)) in config.variables().iteritems():
+        result += [category_id]
+    return result
+
+def print_categories (config):
+    print "Known categories"
+    for cid in list_categories(config):
+        print "%s" % (cid.upper())
+
+####################
+def list_category (config, cid):
+    result=[]
+    for (category_id, (category, variables)) in config.variables().iteritems():
+        if (cid == category_id):
+            for variable in variables.values():
+                result += ["%s_%s" %(cid,variable['id'])]
+    return result
+    
+def print_category (config, cid, show_comments=True):
+    cid=cid.lower()
+    CID=cid.upper()
+    vids=list_category(config,cid)
+    if (len(vids) == 0):
+        print "%s : no such category"%CID
+    else:
+        print "Category %s contains" %(CID)
+        for vid in vids:
+            print vid.upper()
+
+####################
+def consolidate (default_config, site_config, consolidated_config):
+    try:
+        conso = PLCConfiguration (default_config)
+        conso.load (site_config)
+        conso.save (consolidated_config)
+    except Exception, inst:
+        print "Could not consolidate, %s" % (str(inst))
+        return
+    print ("Merged\n\t%s\nand\t%s\ninto\t%s"%(default_config,site_config,
+                                              consolidated_config))
+        
+####################
+def restart_plc ():
+    print ("==================== Stopping %s" % service)
+    os.system("service %s stop" % service)
+    print ("==================== Starting %s" % service)
+    os.system("service %s start" % service)
+
+####################
+def prompt_variable (cdef, cread, cwrite, category, variable,
+                     show_comments, support_next=False):
 
     assert category.has_key('id')
     assert variable.has_key('id')
@@ -68,9 +199,11 @@ def prompt_variable (cdef, cread, cwrite, category, variable):
 
     while True:
         default_value = get_value(cdef,category_id,variable_id)
-        current_value = get_value(cread,category_id, variable_id)
+        current_value = get_current_value(cread,cwrite,category_id, variable_id)
         varname = get_varname (cread,category_id, variable_id)
         
+        if show_comments :
+            print_name_comments (cdef, category_id, variable_id)
         prompt = "== %s : [%s] " % (varname,current_value)
         try:
             answer = raw_input(prompt).strip()
@@ -82,16 +215,8 @@ def prompt_variable (cdef, cread, cwrite, category, variable):
             return None
         elif (answer == "."):
             raise Exception ('BailOut')
-        elif (answer == ">"):
-            raise Exception ('NextCategory')
         elif (answer == "#"):
-            if friendly_name is not None:
-                print ("### " + friendly_name)
-            if comments == None:
-                print ("!!! No comment associated to %s" % varname)
-            else:
-                for line in comments:
-                    print ("# " + line)
+            print_name_comments(cread,category_id,variable_id)
         elif (answer == "?"):
             print variable_usage.strip()
         elif (answer == "="):
@@ -101,19 +226,24 @@ def prompt_variable (cdef, cread, cwrite, category, variable):
             cwrite.delete(category_id,variable_id)
             print ("%s reverted to %s" %(varname,default_value))
             return
+        elif (answer == ">"):
+            if support_next:
+                raise Exception ('NextCategory')
+            else:
+                print "No support for next category"
         else:
             variable['value'] = answer
             cwrite.set(category,variable)
             return
 
-####################
-def prompt_all_variables (cdef, cread, cwrite):
+def prompt_variables_all (cdef, cread, cwrite, show_comments):
     try:
         for (category_id, (category, variables)) in cread.variables().iteritems():
-            print ("========== Category = %s" % category_id)
+            print ("========== Category = %s" % category_id.upper())
             for variable in variables.values():
                 try:
-                    newvar = prompt_variable (cdef, cread, cwrite, category, variable)
+                    newvar = prompt_variable (cdef, cread, cwrite, category, variable,
+                                              show_comments, True)
                 except Exception, inst:
                     if (str(inst) == 'NextCategory'): break
                     else: raise
@@ -122,137 +252,214 @@ def prompt_all_variables (cdef, cread, cwrite):
         if (str(inst) == 'BailOut'): return
         else: raise
 
-
-####################
-def consolidate (main_config, site_config, consolidated_config):
+def prompt_variables_category (cdef, cread, cwrite, cid, show_comments):
+    cid=cid.lower()
+    CID=cid.upper()
     try:
-        conso = PLCConfiguration (main_config)
-        conso.load (site_config)
-        conso.save (consolidated_config)
+        print ("========== Category = %s" % CID)
+        for vid in list_category(cdef,cid):
+            (category,variable) = cdef.locate_varname(vid.upper())
+            newvar = prompt_variable (cdef, cread, cwrite, category, variable,
+                                      show_comments, False)
     except Exception, inst:
-        print "Could not consolidate, %s" % (str(inst))
-        return
-    print ("Merged\n\t%s\nand\t%s\ninto\t%s"%(main_config,site_config,consolidated_config))
-        
+        if (str(inst) == 'BailOut'): return
+        else: raise
+
 ####################
-def restart_plc ():
-    print ("==================== Stopping plc")
-    os.system("service plc stop")
-    print ("==================== Starting plc")
-    os.system("service plc start")
+def show_variable (cdef, cread, cwrite,
+                   category, variable,show_value,show_comments):
+    assert category.has_key('id')
+    assert variable.has_key('id')
+
+    category_id = category ['id']
+    variable_id = variable['id']
+
+    default_value = get_value(cdef,category_id,variable_id)
+    current_value = get_current_value(cread,cwrite,category_id,variable_id)
+    varname = get_varname (cread,category_id, variable_id)
+    if show_comments :
+        print_name_comments (cdef, category_id, variable_id)
+    if show_value:
+        print "%s = %s" % (varname,current_value)
+    else:
+        print "%s" % (varname)
+
+def show_variables_all (cdef, cread, cwrite, show_value, show_comments):
+    for (category_id, (category, variables)) in cread.variables().iteritems():
+        print ("========== Category = %s" % category_id.upper())
+        for variable in variables.values():
+            show_variable (cdef, cread, cwrite,
+                           category, variable,show_value,show_comments)
+
+def show_variables_category (cdef, cread, cwrite, cid, show_value,show_comments):
+    cid=cid.lower()
+    CID=cid.upper()
+    print ("========== Category = %s" % CID)
+    for vid in list_category(cdef,cid):
+        (category,variable) = cdef.locate_varname(vid.upper())
+        show_variable (cdef, cread, cwrite, category, variable,
+                       show_value,show_comments)
 
 ####################
-mainloop_usage= """Available commands
-c\tEdits commonly tuned variables
-e\tEdits all variables
-p\tPrints all locally-customized vars and values
-e <var>\tPrompts (edit) fro variable <var>
-p <var>\tShows current setting for <var>
-l\tlists all known variables
-w\tsaves & consolidates
-r\trestarts plc service
-q\tQuits without saving
----
-Typical usage involves: c, [p,] w, r
-"""
+re_mainloop_0arg="^(?P<command>[uUwrqlLsSeEcvVhH\?])[ \t]*$"
+re_mainloop_1arg="^(?P<command>[sSeEvV])[ \t]+(?P<arg>\w+)$"
+matcher_mainloop_0arg=re.compile(re_mainloop_0arg)
+matcher_mainloop_1arg=re.compile(re_mainloop_1arg)
 
-re_mainloop_var="^(?P<command>[pe])[ \t]+(?P<varname>\w+)$"
-matcher_mainloop_var=re.compile(re_mainloop_var)
-
-common_variables=("PLC_NAME",
-                  "PLC_ROOT_USER",
-                  "PLC_ROOT_PASSWORD",
-                  "PLC_MAIL_SUPPORT_ADDRESS",
-                  "PLC_DB_HOST",
-                  "PLC_API_HOST",
-                  "PLC_WWW_HOST",
-                  "PLC_BOOT_HOST",
-                  "PLC_NET_DNS1",
-                  "PLC_NET_DNS2")
-
-def mainloop (cdef, cread, cwrite,main_config, site_config, consolidated_config):
+def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_config):
     while True:
         try:
-            answer = raw_input("Enter command (c for usual changes, w to save, ? for help) ").strip()
+            answer = raw_input("Enter command (u for usual changes, w to save, ? for help) ").strip()
         except EOFError:
             answer =""
-        answer=answer.lower()
-        if (answer == "") or (answer == "?") or (answer == "h"):
+        if (answer == "") or (answer in "?hH"):
             print mainloop_usage
-        elif (answer == "q"):
+            continue
+        groups_parse = matcher_mainloop_0arg.match(answer)
+        command=None
+        if (groups_parse):
+            command = groups_parse.group('command')
+            arg=None
+        else:
+            groups_parse = matcher_mainloop_1arg.match(answer)
+            if (groups_parse):
+                command = groups_parse.group('command')
+                arg=groups_parse.group('arg')
+        if not command:
+            print ("Unknown command >%s< -- use h for help" % answer)
+            continue
+
+        show_comments=command.isupper()
+        command=command.lower()
+
+        mode='ALL'
+        if arg:
+            mode=None
+            arg=arg.lower()
+            variables=list_category (cdef,arg)
+            if len(variables):
+                # category_id as the category name
+                # variables as the list of variable names
+                mode='CATEGORY'
+                category_id=arg
+            arg=arg.upper()
+            (category,variable)=cdef.locate_varname(arg)
+            if variable:
+                # category/variable as output by locate_varname
+                mode='VARIABLE'
+            if not mode:
+                print "%s: no such category or variable" % arg
+                continue
+
+        if (command in "qQ"):
             # todo check confirmation
             return
-        elif (answer == "e"):
-            prompt_all_variables(cdef, cread, cwrite)
-        elif (answer == "w"):
+        elif (command in "wW"):
             try:
                 cwrite.save(site_config)
             except:
                 print ("Could not save -- fix write access on %s" % site_config)
                 break
             print ("Wrote %s" % site_config)
-            consolidate(main_config, site_config, consolidated_config)
+            consolidate(default_config, site_config, consolidated_config)
             print ("You might want to type 'r' (restart plc) or 'q' (quit)")
-        elif (answer == "l"):
-            print ("Config involves the following variables")
-            sys.stdout.write(cread.output_variables())
-        elif (answer == "p"):
-            print ("Current site config")
-            sys.stdout.write(cwrite.output_shell(False))
-        elif (answer == "c"):
+        elif (command == "u"):
             try:
                 for varname in common_variables:
                     (category,variable) = cdef.locate_varname(varname)
-                    prompt_variable(cdef, cread, cwrite, category, variable)
+                    prompt_variable(cdef, cread, cwrite, category, variable, False)
             except Exception, inst:
                 if (str(inst) != 'BailOut'):
                     raise
-        elif (answer == "r"):
+        elif (command == "r"):
             restart_plc()
+        elif (command == "c"):
+            print_categories(cread)
+        elif (command in "eE"):
+            if mode == 'ALL':
+                prompt_variables_all(cdef, cread, cwrite,show_comments)
+            elif mode == 'CATEGORY':
+                prompt_variables_category(cdef,cread,cwrite,category_id,show_comments)
+            elif mode == 'VARIABLE':
+                try:
+                    prompt_variable (cdef,cread,cwrite,category,variable,
+                                     show_comments,False)
+                except Exception, inst:
+                    if (str(inst) != 'BailOut'):
+                        raise
+        elif (command in "vVsSlL"):
+            show_value=(command in "sSlL")
+            (c1,c2,c3) = (cdef, cread, cwrite)
+            if (command in "lL"):
+                (c1,c2,c3) = (cwrite,cwrite,cwrite)
+            if mode == 'ALL':
+                show_variables_all(c1,c2,c3,show_value,show_comments)
+            elif mode == 'CATEGORY':
+                show_variables_category(c1,c2,c3,category_id,show_value,show_comments)
+            elif mode == 'VARIABLE':
+                show_variable (c1,c2,c3,category,variable,show_value,show_comments)
+        else:
+            print ("Unknown command >%s< -- use h for help" % answer)
+
+####################
+def check_dir (config_file):
+    dirname = os.path.dirname (config_file)
+    if (not os.path.exists (dirname)):
+        print "Config file %s located under a non-existing directory" % config_file
+        answer=raw_input("Want to create %s [y]/n ? " % dirname)
+        answer = answer.lower()
+        if (answer == 'n'):
+            print "Cannot proceed - good bye"
+            sys.exit(1)
         else:
-            groups_var = matcher_mainloop_var.match(answer)
-            if (groups_var):
-                command = groups_var.group('command')
-                varname = groups_var.group('varname')
-                (category,variable) = cdef.locate_varname(varname)
-                if not category:
-                    print "Unknown variable %s" % varname
-                elif (command == 'p'):
-                    print ("%s = %s" % (varname,get_value(cwrite,
-                                                          category['id'],
-                                                          variable['id'])))
-                else:
-                    try:
-                        prompt_variable(cdef, cread, cwrite, category,variable)
-                    except Exception, inst:
-                        if (str(inst) != 'BailOut'):
-                            raise
+            os.makedirs(dirname,0755)
+            if (not os.path.exists (dirname)):
+                print "Cannot create dir %s - exiting" % dirname
+                sys.exit(1)
             else:
-                print ("Unknown command >%s<" % answer)
+                print "Created directory %s" % dirname
 
+                
 ####################
 def main ():
 
-    save = True
     command=sys.argv[0]
     argv = sys.argv[1:]
+
+    save = True
+    # default is myplc (non -devel) unless -d is specified
+    init_flavour("boot")
+    optlist,list = getopt.getopt(argv,":dhv")
+    for opt in optlist:
+        if opt[0] == "-h":
+            usage()
+        if opt[0] == "-v":
+            print ("This is %s - %s" %(command,release_rev))
+            sys.exit(1)
+        if opt[0] == "-d":
+            init_flavour("devel")
+            argv=argv[1:]
+
     if len(argv) == 0:
-        (main_config,site_config,consolidated_config) = (def_main_config, def_site_config, def_consolidated_config)
+        (default_config,site_config,consolidated_config) = (def_default_config, def_site_config, def_consolidated_config)
     elif len(argv) == 1:
-        (main_config,site_config,consolidated_config) = (argv[1], def_site_config, def_consolidated_config)
+        (default_config,site_config,consolidated_config) = (argv[0], def_site_config, def_consolidated_config)
     elif len(argv) == 2:
-        (main_config, site_config,consolidated_config)  = (argv[1], argv[2], def_consolidated_config)
+        (default_config, site_config,consolidated_config)  = (argv[0], argv[1], def_consolidated_config)
     elif len(argv) == 3:
-        (main_config, site_config,consolidated_config)  = argv
+        (default_config, site_config,consolidated_config)  = argv
     else:
         usage()
 
+    for c in (default_config,site_config,consolidated_config):
+        check_dir (c)
+
     try:
         # the default settings only - read only
-        cdef = PLCConfiguration(main_config)
+        cdef = PLCConfiguration(default_config)
 
         # in effect : default settings + local settings - read only
-        cread = PLCConfiguration(main_config)
+        cread = PLCConfiguration(default_config)
 
     except:
         print ("default config files not found, is myplc installed ?")
@@ -267,8 +474,7 @@ def main ():
     except:
         cwrite = PLCConfiguration()
 
-        print ("This is %s - %s -- Type ? at the prompt for help" %(command,release))
-    mainloop (cdef, cread, cwrite,main_config, site_config, consolidated_config)
+    mainloop (cdef, cread, cwrite,default_config, site_config, consolidated_config)
     return 0
 
 if __name__ == '__main__':
index 5c14e3a..bf24a3f 100644 (file)
@@ -6,7 +6,7 @@ Default PLC build environment configuration file
 Mark Huang <mlhuang@cs.princeton.edu>
 Copyright (C) 2006 The Trustees of Princeton University
 
-$Id: plc_devel_config.xml,v 1.2 2006/07/18 17:37:53 mlhuang Exp $
+$Id: plc_devel_config.xml,v 1.3 2006/08/16 01:27:16 mlhuang Exp $
 -->
 
 <!DOCTYPE configuration PUBLIC "-//PlanetLab Central//DTD PLC configuration//EN" "plc_config.dtd">
@@ -37,7 +37,7 @@ $Id: plc_devel_config.xml,v 1.2 2006/07/18 17:37:53 mlhuang Exp $
 
        <variable id="fedora_url" type="string">
          <name>Fedora Core Mirror URL</name>
-         <value>file:///usr/share/mirrors/fedora</value>
+         <value>file:///data/fedora</value>
          <description>Fedora Core mirror from which to install
          filesystems.</description>
        </variable>