Index: gsdl/trunk/GSI-Makefile
===================================================================
--- gsdl/trunk/GSI-Makefile	(revision 18816)
+++ gsdl/trunk/GSI-Makefile	(revision 18851)
@@ -25,110 +25,40 @@
 ###########################################################################
 
+# execute as: make -f GSI-Makefile <command>
+# where command is any of the following make targets
+
 test-gsdlhome:
-	@ if test -z "${GSDLHOME}" ; then \
-	  echo "" ; \
-	  echo "Environment variable GSDLHOME not set." ; \
-	  echo "  This needs to be set to run this Makefile target." ; \
-          echo "  Have you run 'source setup.bash'?" ; \
-	  echo "" ; \
-	  exit 1; \
-	else \
-	  echo "Using: " ; \
-	  echo "  GSDLHOME = ${GSDLHOME}" ; \
-	  echo "  GSDLOS   = ${GSDLOS}" ; \
-	fi
+	./gsicontrol.sh test-gsdlhome:
 
-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 ; \
-	else \
-	  echo "WARNING: Nothing done for make configure-cgi." ; \
-	  echo "   If you wish to regenerate the file " ; \
-	  echo "   ${GSDLHOME}/cgi-bin/gsdlsite.cfg" ; \
-	  echo "   from scratch, delete the existing file first." ; \
-	fi
+configure-cgi:
+	./gsicontrol.sh configure-cgi
 
-configure-admin: test-gsdlhome
-	@echo "" ;
-	@echo "Configuring admin user password:" ; 
-	@ (encrypted_password=`getpw` ;  \
-	   if [ $$? = "0" ] ; then \
-	     echo -e "[admin]\n<enabled>true\n<groups>administrator,colbuilder,all-collections-editor\n<password>$$encrypted_password\n<username>admin" \
-              | txt2db -append "${GSDLHOME}/etc/users.db" ; \
-	   else \
-	     echo "Did not set password" ; \
-	   fi)
-	@echo ""
+configure-admin:
+	./gsicontrol.sh configure-admin
 
-configure-port: test-gsdlhome
-	@ echo "Enter port number to use:"
-	@ ( read port ; \
-	    if test ! -z $$port ; then \
-	      echo "Port: $$port" ; \
-	      echo "Stopping web server (if running)" ; \
-	      make -f GSI-Makefile web-stop-tested ; \
-	      echo "Setting config file to use port $$port"; \
-	      cat "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf.in" \
-		| sed "s@\*\*PORT\*\*@$$port@g" \
-		| sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" \
-		| sed "s@\*\*APACHE_HOME_OS\*\*@${GSDLHOME}/apache-httpd/${GSDLOS}@g" \
-		> "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf" ; \
-	      if test -e Makefile ; then \
-	        echo "Type 'make web-start' to start the web server running on port $$port" ; \
-	      else \
-		echo "Type 'make -f GSI-Makefile web-start' to start the web server running on port $$port" ; \
-	      fi ; \
-	    fi ; \
-	    echo "Done" ; )
+configure-port:
+	./gsicontrol.sh configure-port
 
+configure-apache:
+	./gsicontrol.sh configure-apache
 
+configure-web:
+	./gsicontrol.sh configure-web
 
-MONITOR_SUCCESS="MAKE SUCCESSFUL"
-MONITOR_FAILED="MAKE FAILED"
-MONITOR_FINISHED="MAKE DONE"
+web-status:
+	./gsicontrol.sh web-status
 
-configure-apache: test-gsdlhome
-	@ echo "Configuring the apache webserver..." ;
-	@ ( port=`egrep "^apache.port" ${GSDLHOME}/lib/java/build.properties | awk -F= '{print $$2}'` ; \
-	    echo $$port | make -f GSI-Makefile configure-port ; )
-	@ if test -e "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf" ; then \
-	  echo $(MONITOR_SUCCESS); \
-	else \
-	  echo $(MONITOR_FAILED); \
-	fi
-	@ echo $(MONITOR_FINISHED)
+web-start:
+	./gsicontrol.sh web-start
 
+web-restart:
+	./gsicontrol.sh web-restart
 
-configure-web: configure-cgi configure-apache
+web-graceful:
+	./gsicontrol.sh graceful
 
-web-status: test-gsdlhome
-	${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl status
+web-stop-tested:
+	./gsicontrol.sh web-stop-tested
 
-web-start: test-gsdlhome
-	${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl start
-	@ echo $(MONITOR_SUCCESS)
-	@ echo $(MONITOR_FINISHED)
-
-web-restart: test-gsdlhome
-	${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl restart
-	@ echo $(MONITOR_SUCCESS)
-	@ echo $(MONITOR_FINISHED)
-
-web-graceful: test-gsdlhome
-	${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl graceful
-	@ echo $(MONITOR_SUCCESS)
-	@ echo $(MONITOR_FINISHED)
-
-web-stop-tested: 
-	@# This version runs without testing for GSDLHOME
-	@# Useful to be run as a target when we know test-gsdlhome has already
-	@# been done.  This avoids a 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 ; \
-	fi
-
-web-stop: test-gsdlhome web-stop-tested
-	@ echo $(MONITOR_SUCCESS)
-	@ echo $(MONITOR_FINISHED)
+web-stop:
+	./gsicontrol.sh web-stop
