Index: /main/trunk/greenstone2/gsicontrol.sh
===================================================================
--- /main/trunk/greenstone2/gsicontrol.sh	(revision 23947)
+++ /main/trunk/greenstone2/gsicontrol.sh	(revision 23948)
@@ -2,4 +2,10 @@
 
 testdone=0
+
+cgibin="cgi-bin"
+if [ -d "cgi-bin/$GSDLOS$GSDLARCH" ] ; then
+  cgibin="cgi-bin/$GSDLOS$GSDLARCH"
+fi
+
 
 function test-gsdlhome {
@@ -23,11 +29,11 @@
 function configure-cgi {
     test-gsdlhome
-    if test ! -e $GSDLHOME/cgi-bin/gsdlsite.cfg ; then
-	echo "Configuring cgi-bin/gsdlsite.cfg" ;
-	sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg ;
+    if test ! -e "$GSDLHOME/$cgibin/gsdlsite.cfg" ; then
+	echo "Configuring $cgibin/gsdlsite.cfg" ;
+	sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" "$cgibin/gsdlsite.cfg.in" > "$cgibin/gsdlsite.cfg" ;
     else
 	echo "WARNING: Nothing done for make configure-cgi." ;
 	echo "   If you wish to regenerate the file " ;
-	echo "   $GSDLHOME/cgi-bin/gsdlsite.cfg" ;
+	echo "   $GSDLHOME/$cgibin/gsdlsite.cfg" ;
 	echo "   from scratch, delete the existing file first." ;
     fi
@@ -71,6 +77,6 @@
     fi
 
-    if test -e $GSDLHOME/cgi-bin/gsdlsite.cfg ; then
-	collecthome=`egrep "^collecthome" $GSDLHOME/cgi-bin/gsdlsite.cfg | awk '{print $2}'` ;
+    if test -e "$GSDLHOME/$cgibin/gsdlsite.cfg" ; then
+	collecthome=`egrep "^collecthome" "$GSDLHOME/$cgibin/gsdlsite.cfg" | awk '{print $2}'` ;
     fi
     if test -z $collecthome ; then
@@ -83,5 +89,5 @@
 	web-stop-tested ;
 	echo "Setting config file to use port $port";
-	cat "$GSDLHOME/apache-httpd/$GSDLOS/conf/httpd.conf.in" \
+	cat "$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/conf/httpd.conf.in" \
 	| sed "s@\*\*PORT\*\*@$port@g" \
 	| sed "s@\*\*CONNECTPERMISSION\*\*@$allowfromall@g" \
@@ -90,7 +96,7 @@
 	| sed "s@\*\*COLLECTHOME\*\*@$collecthome@g" \
 	| sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" \
-	| sed "s@\*\*APACHE_HOME_OS\*\*@$GSDLHOME/apache-httpd/$GSDLOS@g" \
+	| sed "s@\*\*APACHE_HOME_OS\*\*@$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH@g" \
 	| sed "s@\*\*LIBRARY_PATH_VAR\*\*@$lib_path_var@g" \
-	> "$GSDLHOME/apache-httpd/$GSDLOS/conf/httpd.conf" ;
+	> "$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/conf/httpd.conf" ;
 	echo "Type '$0 web-start' to start the web server running on port $port" ;
     fi ;
@@ -126,5 +132,5 @@
 
     echo -e "$port\n$hostIP\n$hosts\n$externalaccess" | configure-port-and-connection ;
-    if test -e "$GSDLHOME/apache-httpd/$GSDLOS/conf/httpd.conf" ; then
+    if test -e "$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/conf/httpd.conf" ; then
 	echo $MONITOR_SUCCESS;
     else
@@ -141,7 +147,7 @@
 # forces configure-cgi by deleting gsdlsite.cfg
 function reset-gsdlhome {    
-    if test -e "$GSDLHOME/cgi-bin/gsdlsite.cfg" ; then
-	echo "**** WARNING. Local changes made to $GSDLHOME/cgi-bin/gsdlsite.cfg will be lost.";
-	rm -f "$GSDLHOME/cgi-bin/gsdlsite.cfg";
+    if test -e "$GSDLHOME/$cgibin/gsdlsite.cfg" ; then
+	echo "**** WARNING. Local changes made to $GSDLHOME/$cgibin/gsdlsite.cfg will be lost.";
+	rm -f "$GSDLHOME/$cgibin/gsdlsite.cfg";
     fi
     configure-web $1
@@ -150,10 +156,10 @@
 function web-status {
     test-gsdlhome
-    $GSDLHOME/apache-httpd/$GSDLOS/bin/apachectl status
+    $GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/bin/apachectl status
 }
 
 function web-start { 
     test-gsdlhome
-    $GSDLHOME/apache-httpd/$GSDLOS/bin/apachectl start
+    $GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/bin/apachectl start
     if [ $? = 0 ] ; then
 	echo $MONITOR_SUCCESS;
@@ -166,5 +172,5 @@
 function web-restart {
     test-gsdlhome
-    $GSDLHOME/apache-httpd/$GSDLOS/bin/apachectl restart
+    $GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/bin/apachectl restart
     if [ $? = 0 ] ; then
 	echo $MONITOR_SUCCESS;
@@ -177,5 +183,5 @@
 function web-graceful {
     test-gsdlhome
-    $GSDLHOME/apache-httpd/$GSDLOS/bin/apachectl graceful
+    $GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/bin/apachectl graceful
     if [ $? = 0 ] ; then
 	echo $MONITOR_SUCCESS;
@@ -191,6 +197,6 @@
 # been done.  This avoids an unnecessary repetition of printing
 # out the values of GSDLHOME and GSDLOS
-    if test -e "$GSDLHOME/apache-httpd/$GSDLOS/conf/httpd.conf" ; then
-	$GSDLHOME/apache-httpd/$GSDLOS/bin/apachectl stop ;
+    if test -e "$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/conf/httpd.conf" ; then
+	$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH/bin/apachectl stop ;
     fi
 }
@@ -220,5 +226,5 @@
     echo "   configure-apache [config-filename]"
     echo "   configure-cgi"
-    echo "   reset-gsdlhome [config-filename]\n\t(Save a copy of cgi-bin/gsdlsite.cfg to preserve any customisations)"
+    echo "   reset-gsdlhome [config-filename]\n\t(Save a copy of $cgibin/gsdlsite.cfg to preserve any customisations)"
     echo "   test-gsdlhome"
     echo "   web-stop-tested"
