- fix empty repository check; bash lazily evaluates wildcards, can't use
[myplc.git] / guest.init
index 48f21ba..cadd91f 100755 (executable)
@@ -6,7 +6,7 @@
 #
 # description: Manages all PLC services on this machine
 #
-# $Id: guest.init,v 1.12 2006/04/04 22:09:47 mlhuang Exp $
+# $Id: guest.init,v 1.16 2006/04/17 17:04:37 mlhuang Exp $
 #
 
 # Source function library and configuration
@@ -22,7 +22,7 @@ verbose=0
 # everything just works.
 steps=($(
 for step in /etc/plc.d/* ; do
-    if [ -x $step ] ; then
+    if [ -f $step -a -x $step ] ; then
        priority=$(sed -ne 's/# priority: \(.*\)/\1/p' $step)
        echo $priority $(basename $step)
     fi
@@ -33,7 +33,23 @@ nsteps=${#steps[@]}
 # Regenerate configuration files
 reload ()
 {
-    # Load configuration
+    # Regenerate the main configuration file from default values
+    # overlaid with site-specific and current values.
+    tmp=$(mktemp /tmp/plc_config.xml.XXXXXX)
+    plc-config --xml \
+       /etc/planetlab/default_config.xml \
+       /etc/planetlab/configs/* \
+       /etc/planetlab/plc_config.xml \
+       >$tmp
+    if [ $? -eq 0 ] ; then
+       mv $tmp /etc/planetlab/plc_config.xml
+       chmod 644 /etc/planetlab/plc_config.xml
+    else
+       echo "PLC: Warning: Invalid configuration file(s) detected"
+       rm -f $tmp
+    fi
+
+    # Shell constants
     plc-config --shell >/etc/planetlab/plc_config
     . /etc/planetlab/plc_config
 
@@ -123,7 +139,7 @@ define('BOOT_BASE', PLC_BOOT_HOST);
 define('DEBUG', PLC_WWW_DEBUG);
 define('API_CALL_DEBUG', PLC_API_DEBUG);
 define('SENDMAIL', PLC_MAIL_ENABLED);
-define('PLANETLAB_SUPPORT_EMAIL', PLC_NAME . 'Support <' . PLC_MAIL_SUPPORT_ADDRESS . '>');
+define('PLANETLAB_SUPPORT_EMAIL', PLC_NAME . ' Support <' . PLC_MAIL_SUPPORT_ADDRESS . '>');
 define('PLANETLAB_SUPPORT_EMAIL_ONLY', PLC_MAIL_SUPPORT_ADDRESS);
 ?>
 EOF