[18697] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
| 3 | # GSI-Makefile -- Greenstone Server Interface makefile
|
---|
| 4 | # A component of the Greenstone digital library software
|
---|
| 5 | # from the New Zealand Digital Library Project at the
|
---|
| 6 | # University of Waikato, New Zealand.
|
---|
| 7 | #
|
---|
| 8 | # Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 9 | #
|
---|
| 10 | #
|
---|
| 11 | # This program is free software; you can redistribute it and/or modify
|
---|
| 12 | # it under the terms of the GNU General Public License as published by
|
---|
| 13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | # (at your option) any later version.
|
---|
| 15 | #
|
---|
| 16 | # This program is distributed in the hope that it will be useful,
|
---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | # GNU General Public License for more details.
|
---|
| 20 | #
|
---|
| 21 | # You should have received a copy of the GNU General Public License
|
---|
| 22 | # along with this program; if not, write to the Free Software
|
---|
| 23 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 24 | #
|
---|
| 25 | ###########################################################################
|
---|
| 26 |
|
---|
| 27 | test-gsdlhome:
|
---|
| 28 | @ if test -z "${GSDLHOME}" ; then \
|
---|
| 29 | echo "" ; \
|
---|
| 30 | echo "Environment variable GSDLHOME not set." ; \
|
---|
| 31 | echo " This needs to be set to run this Makefile target." ; \
|
---|
| 32 | echo " Have you run 'source setup.bash'?" ; \
|
---|
| 33 | echo "" ; \
|
---|
| 34 | exit 1; \
|
---|
| 35 | else \
|
---|
| 36 | echo "Using: " ; \
|
---|
| 37 | echo " GSDLHOME = ${GSDLHOME}" ; \
|
---|
| 38 | echo " GSDLOS = ${GSDLOS}" ; \
|
---|
| 39 | fi
|
---|
| 40 |
|
---|
| 41 | configure-cgi: test-gsdlhome
|
---|
| 42 | @ echo "Configuring cgi-bin/gsdlsite.cfg" ;
|
---|
| 43 | @ sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg ;
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | configure-admin: test-gsdlhome
|
---|
| 47 | @echo "" ;
|
---|
| 48 | @echo "Configuring admin user password:" ;
|
---|
[18734] | 49 | @ (encrypted_password=`getpw` ; \
|
---|
| 50 | if [ $$? = "0" ] ; then \
|
---|
| 51 | echo -e "[admin]\n<enabled>true\n<groups>administrator,colbuilder,all-collections-editor\n<password>$$encrypted_password\n<username>admin" \
|
---|
| 52 | | txt2db -append "${GSDLHOME}/etc/users.db" ; \
|
---|
| 53 | else \
|
---|
| 54 | echo "Did not set password" ; \
|
---|
| 55 | fi )
|
---|
[18697] | 56 | @echo ""
|
---|
| 57 |
|
---|
| 58 | configure-port: test-gsdlhome
|
---|
| 59 | @ echo "Enter port number to use:"
|
---|
| 60 | @ ( read port ; \
|
---|
| 61 | if test ! -z $$port ; then \
|
---|
| 62 | echo "Port: $$port" ; \
|
---|
| 63 | echo "Stopping web server (if running)" ; \
|
---|
[18706] | 64 | make -f GSI-Makefile web-stop-tested ; \
|
---|
[18728] | 65 | echo "Setting config file to use port $$port"; \
|
---|
[18697] | 66 | cat "${GSDLHOME}/apache-httpd/conf/httpd.conf.in" \
|
---|
| 67 | | sed "s@\*\*PORT\*\*@$$port@g" \
|
---|
| 68 | | sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" \
|
---|
| 69 | > "${GSDLHOME}/apache-httpd/conf/httpd.conf" ; \
|
---|
[18707] | 70 | if test -e Makefile ; then \
|
---|
| 71 | echo "Type 'make web-start' to start the web server running on port $$port" ; \
|
---|
| 72 | else \
|
---|
| 73 | echo "Type 'make -f GSI-Makefile web-start' to start the web server running on port $$port" ; \
|
---|
| 74 | fi ; \
|
---|
[18697] | 75 | fi ; \
|
---|
| 76 | echo "Done" ; )
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | MONITOR_SUCCESS="MAKE SUCCESSFUL"
|
---|
| 81 | MONITOR_FAILED="MAKE FAILED"
|
---|
| 82 | MONITOR_FINISHED="MAKE DONE"
|
---|
| 83 |
|
---|
| 84 | configure-apache: test-gsdlhome
|
---|
| 85 | @ echo "Configuring the apache webserver..." ;
|
---|
[18728] | 86 | @ ( port=`egrep "^apache.port" ${GSDLHOME}/lib/java/build.properties | awk -F= '{print $$2}'` ; \
|
---|
[18706] | 87 | echo $$port | make -f GSI-Makefile configure-port ; )
|
---|
[18728] | 88 | @ if test -e "${GSDLHOME}/apache-httpd/conf/httpd.conf" ; then \
|
---|
| 89 | echo $(MONITOR_SUCCESS); \
|
---|
| 90 | else \
|
---|
| 91 | echo $(MONITOR_FAILED); \
|
---|
| 92 | fi
|
---|
[18697] | 93 | @ echo $(MONITOR_FINISHED)
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | configure-web: configure-cgi configure-apache
|
---|
| 97 |
|
---|
| 98 | web-status: test-gsdlhome
|
---|
| 99 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl status
|
---|
| 100 |
|
---|
| 101 | web-start: test-gsdlhome
|
---|
| 102 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl start
|
---|
| 103 | @ echo $(MONITOR_SUCCESS)
|
---|
| 104 | @ echo $(MONITOR_FINISHED)
|
---|
| 105 |
|
---|
| 106 | web-restart: test-gsdlhome
|
---|
| 107 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl restart
|
---|
| 108 | @ echo $(MONITOR_SUCCESS)
|
---|
| 109 | @ echo $(MONITOR_FINISHED)
|
---|
| 110 |
|
---|
| 111 | web-graceful: test-gsdlhome
|
---|
| 112 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl graceful
|
---|
| 113 | @ echo $(MONITOR_SUCCESS)
|
---|
| 114 | @ echo $(MONITOR_FINISHED)
|
---|
| 115 |
|
---|
| 116 | web-stop-tested:
|
---|
| 117 | @# This version runs without testing for GSDLHOME
|
---|
| 118 | @# Useful to be run as a target when we know test-gsdlhome has already
|
---|
| 119 | @# been done. This avoids a unnecessary repetition of printing
|
---|
| 120 | @# out the values of GSDLHOME and GSDLOS
|
---|
| 121 | @ if test -e "${GSDLHOME}/apache-httpd/conf/httpd.conf" ; then \
|
---|
[18726] | 122 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl stop ; \
|
---|
[18697] | 123 | fi
|
---|
| 124 |
|
---|
| 125 | web-stop: test-gsdlhome web-stop-tested
|
---|
[18728] | 126 | @ echo $(MONITOR_SUCCESS)
|
---|
| 127 | @ echo $(MONITOR_FINISHED) |
---|