[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
|
---|
[18756] | 42 | @ if test ! -e ${GSDLHOME}/cgi-bin/gsdlsite.cfg ; then \
|
---|
| 43 | echo "Configuring cgi-bin/gsdlsite.cfg" ; \
|
---|
| 44 | sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg ; \
|
---|
| 45 | else \
|
---|
| 46 | echo "WARNING: Nothing done for make configure-cgi." ; \
|
---|
| 47 | echo " If you wish to regenerate the file " ; \
|
---|
| 48 | echo " ${GSDLHOME}/cgi-bin/gsdlsite.cfg" ; \
|
---|
| 49 | echo " from scratch, delete the existing file first." ; \
|
---|
| 50 | fi
|
---|
[18697] | 51 |
|
---|
| 52 | configure-admin: test-gsdlhome
|
---|
| 53 | @echo "" ;
|
---|
| 54 | @echo "Configuring admin user password:" ;
|
---|
[18734] | 55 | @ (encrypted_password=`getpw` ; \
|
---|
| 56 | if [ $$? = "0" ] ; then \
|
---|
| 57 | echo -e "[admin]\n<enabled>true\n<groups>administrator,colbuilder,all-collections-editor\n<password>$$encrypted_password\n<username>admin" \
|
---|
| 58 | | txt2db -append "${GSDLHOME}/etc/users.db" ; \
|
---|
| 59 | else \
|
---|
| 60 | echo "Did not set password" ; \
|
---|
[18735] | 61 | fi)
|
---|
[18697] | 62 | @echo ""
|
---|
| 63 |
|
---|
| 64 | configure-port: test-gsdlhome
|
---|
| 65 | @ echo "Enter port number to use:"
|
---|
| 66 | @ ( read port ; \
|
---|
| 67 | if test ! -z $$port ; then \
|
---|
| 68 | echo "Port: $$port" ; \
|
---|
| 69 | echo "Stopping web server (if running)" ; \
|
---|
[18706] | 70 | make -f GSI-Makefile web-stop-tested ; \
|
---|
[18728] | 71 | echo "Setting config file to use port $$port"; \
|
---|
[18756] | 72 | cat "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf.in" \
|
---|
[18697] | 73 | | sed "s@\*\*PORT\*\*@$$port@g" \
|
---|
| 74 | | sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" \
|
---|
[18756] | 75 | > "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf" ; \
|
---|
[18707] | 76 | if test -e Makefile ; then \
|
---|
| 77 | echo "Type 'make web-start' to start the web server running on port $$port" ; \
|
---|
| 78 | else \
|
---|
| 79 | echo "Type 'make -f GSI-Makefile web-start' to start the web server running on port $$port" ; \
|
---|
| 80 | fi ; \
|
---|
[18697] | 81 | fi ; \
|
---|
| 82 | echo "Done" ; )
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | MONITOR_SUCCESS="MAKE SUCCESSFUL"
|
---|
| 87 | MONITOR_FAILED="MAKE FAILED"
|
---|
| 88 | MONITOR_FINISHED="MAKE DONE"
|
---|
| 89 |
|
---|
| 90 | configure-apache: test-gsdlhome
|
---|
| 91 | @ echo "Configuring the apache webserver..." ;
|
---|
[18728] | 92 | @ ( port=`egrep "^apache.port" ${GSDLHOME}/lib/java/build.properties | awk -F= '{print $$2}'` ; \
|
---|
[18706] | 93 | echo $$port | make -f GSI-Makefile configure-port ; )
|
---|
[18756] | 94 | @ if test -e "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf" ; then \
|
---|
[18728] | 95 | echo $(MONITOR_SUCCESS); \
|
---|
| 96 | else \
|
---|
| 97 | echo $(MONITOR_FAILED); \
|
---|
| 98 | fi
|
---|
[18697] | 99 | @ echo $(MONITOR_FINISHED)
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | configure-web: configure-cgi configure-apache
|
---|
| 103 |
|
---|
| 104 | web-status: test-gsdlhome
|
---|
| 105 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl status
|
---|
| 106 |
|
---|
| 107 | web-start: test-gsdlhome
|
---|
| 108 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl start
|
---|
| 109 | @ echo $(MONITOR_SUCCESS)
|
---|
| 110 | @ echo $(MONITOR_FINISHED)
|
---|
| 111 |
|
---|
| 112 | web-restart: test-gsdlhome
|
---|
| 113 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl restart
|
---|
| 114 | @ echo $(MONITOR_SUCCESS)
|
---|
| 115 | @ echo $(MONITOR_FINISHED)
|
---|
| 116 |
|
---|
| 117 | web-graceful: test-gsdlhome
|
---|
| 118 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl graceful
|
---|
| 119 | @ echo $(MONITOR_SUCCESS)
|
---|
| 120 | @ echo $(MONITOR_FINISHED)
|
---|
| 121 |
|
---|
| 122 | web-stop-tested:
|
---|
| 123 | @# This version runs without testing for GSDLHOME
|
---|
| 124 | @# Useful to be run as a target when we know test-gsdlhome has already
|
---|
| 125 | @# been done. This avoids a unnecessary repetition of printing
|
---|
| 126 | @# out the values of GSDLHOME and GSDLOS
|
---|
[18756] | 127 | @ if test -e "${GSDLHOME}/apache-httpd/${GSDLOS}/conf/httpd.conf" ; then \
|
---|
[18726] | 128 | ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl stop ; \
|
---|
[18697] | 129 | fi
|
---|
| 130 |
|
---|
| 131 | web-stop: test-gsdlhome web-stop-tested
|
---|
[18728] | 132 | @ echo $(MONITOR_SUCCESS)
|
---|
| 133 | @ echo $(MONITOR_FINISHED) |
---|