[Swift-commit] r5166 - branches/release-0.93/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Sat Sep 24 16:29:54 CDT 2011


Author: davidk
Date: 2011-09-24 16:29:54 -0500 (Sat, 24 Sep 2011)
New Revision: 5166

Modified:
   branches/release-0.93/bin/gensites
Log:
Gensites fixes


Modified: branches/release-0.93/bin/gensites
===================================================================
--- branches/release-0.93/bin/gensites	2011-09-24 20:59:40 UTC (rev 5165)
+++ branches/release-0.93/bin/gensites	2011-09-24 21:29:54 UTC (rev 5166)
@@ -88,7 +88,7 @@
 fi
 
 # List all templates
-if [ ! -z $LIST_TEMPLATES ]; then
+if [ ! -z "$LIST_TEMPLATES" ]; then
    # Templates in etc/sites
    for file in `ls -1 $SWIFT_HOME/* 2>/dev/null`
    do
@@ -115,7 +115,7 @@
 # Locate template
 if [ ! -f "$TEMPLATE_PATH" ]; then
    if [ -f "$TEMPLATE" ]; then
-      $TEMPLATE_PATH = $TEMPLATE
+      TEMPLATE_PATH=$TEMPLATE
    elif [ -f "$SWIFT_HOME/$TEMPLATE" ]; then
       TEMPLATE_PATH=$SWIFT_HOME/$TEMPLATE
    elif [ -f "$HOME/.swift/sites/$TEMPLATE" ]; then
@@ -127,7 +127,7 @@
 fi
 
 # List a specific template
-if [ ! -z $LIST_SPECIFIC_TEMPLATE ]; then
+if [ ! -z "$LIST_SPECIFIC_TEMPLATE" ]; then
    cat $TEMPLATE_PATH
    exit 0
 fi
@@ -140,6 +140,14 @@
    fi
 fi
 
+# Setup for creating a TC file
+if [ -n "`grep -e app $PROPERTIES_FILE`" ]; then
+   if [ -f "tc.data" ]; then
+      mv tc.data tc.data.old
+   fi
+   HOSTS=`grep -i "pool handle" $TEMPLATE_PATH|grep -v "^[[:space:]]*#"|cut -d'"' -f2`
+fi
+
 # Parse values into variables for later sed processing
 if [ -f "$PROPERTIES_FILE" ]; then
    while read line
@@ -175,6 +183,29 @@
          "#site $TEMPLATE internalhostname="*|'#site internalhostname='*)
             INTERNALHOSTNAME=`get_value $line`
             ;;
+         '#app'*)
+            if [ `echo $line | wc -w` == 2 ]; then
+               for HOST in $HOSTS
+               do
+                  NAME=`echo $line |cut -d'=' -f1|awk '{print $2}'`
+                  COMMAND=`echo $line |cut -d'=' -f2`
+                  COMMAND=`eval echo $COMMAND`
+                  echo $HOST $NAME `readlink -f $COMMAND` null null null >> tc.data
+              done
+           fi
+
+           if [ `echo $line |wc -w` == 3 ]; then
+              for HOST in $HOSTS
+              do
+                 if [ $HOST == `echo $line|awk '{print $2}'` ]; then
+                    NAME=`echo $line|awk '{print $3}'|cut -d'=' -f1`
+                    COMMAND=`echo $line|awk '{print $3}'|cut -d'=' -f2`
+                    COMMAND=`eval echo $COMMAND`
+                    eval echo $HOST $NAME `readlink -f $COMMAND` null null null >> tc.data
+                 fi
+               done
+            fi
+         ;;
       esac
    done < $PROPERTIES_FILE
 fi




More information about the Swift-commit mailing list