########################################################################### # # GSI-Makefile -- Greenstone Server Interface makefile # A component of the Greenstone digital library software # from the New Zealand Digital Library Project at the # University of Waikato, New Zealand. # # Copyright (C) 1999 The New Zealand Digital Library Project # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ########################################################################### 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 configure-cgi: test-gsdlhome @ echo "Configuring cgi-bin/gsdlsite.cfg" ; @ sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg ; configure-admin: test-gsdlhome @echo "" ; @echo "Configuring admin user password:" ; @ (encrypted_password=`getpw` ; \ if [ $$? = "0" ] ; then \ echo -e "[admin]\ntrue\nadministrator,colbuilder,all-collections-editor\n$$encrypted_password\nadmin" \ | txt2db -append "${GSDLHOME}/etc/users.db" ; \ else \ echo "Did not set password" ; \ fi ) @echo "" 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/conf/httpd.conf.in" \ | sed "s@\*\*PORT\*\*@$$port@g" \ | sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" \ > "${GSDLHOME}/apache-httpd/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" ; ) MONITOR_SUCCESS="MAKE SUCCESSFUL" MONITOR_FAILED="MAKE FAILED" MONITOR_FINISHED="MAKE DONE" 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/conf/httpd.conf" ; then \ echo $(MONITOR_SUCCESS); \ else \ echo $(MONITOR_FAILED); \ fi @ echo $(MONITOR_FINISHED) configure-web: configure-cgi configure-apache web-status: test-gsdlhome ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl status 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/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)