[24428] | 1 | #!/bin/bash
|
---|
| 2 | # Used to merge in the code needed to add TDB support to Greenstone. The script
|
---|
| 3 | # is responsible for updating both Makefile.in and source code files. You can
|
---|
| 4 | # later run 'disable_tdb.sh' to undo these changes.
|
---|
| 5 | # @author John Thompson, University of Waikato, NZ
|
---|
| 6 |
|
---|
| 7 | echo
|
---|
| 8 | echo '===== Removing TDB support code from Greenstone ====='
|
---|
| 9 | echo
|
---|
| 10 |
|
---|
| 11 | # Test that GSDLHOME is set otherwise we won't be able to find the required files
|
---|
[30239] | 12 | if [ "${GSDLHOME}x" == "x" ] ; then echo 'Error! GSDLHOME not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
|
---|
| 13 | if [ "${GSDLOS}x" == "x" ] ; then echo 'Error! GSDLOS not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
|
---|
[24428] | 14 |
|
---|
[30239] | 15 | # Black magic to determine the actual name of the extension folder (in case I
|
---|
| 16 | # change from tdb-edit to tdb in the future (writing in hindsight))
|
---|
| 17 | EXTNAME=${PWD##*/}
|
---|
[24428] | 18 |
|
---|
| 19 | echo ' - removing TDB support from common function library'
|
---|
| 20 | # - Makefile.in
|
---|
[30239] | 21 | MAKEFILE="${GSDLHOME}/common-src/src/lib/Makefile.in"
|
---|
| 22 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 23 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include\s*-I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 24 | sed -i 's:\(EXT_SOURCES\s*=.*\)\stdbclass.cpp\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 25 | sed -i 's:\(EXT_OBJECTS\s*=.*\)\stdbclass.o\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 26 | # (note - NOT Makefile.in ...)
|
---|
| 27 | rm -f "${GSDLHOME}/common-src/src/lib/Makefile"
|
---|
[24428] | 28 | # - Remove symlink
|
---|
[30239] | 29 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.h"
|
---|
| 30 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.cpp"
|
---|
[24428] | 31 | # - Remove compiled files
|
---|
[30239] | 32 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.o"
|
---|
| 33 | rm -f "${GSDLHOME}/common-src/src/lib/gsdllib.a"
|
---|
[24428] | 34 |
|
---|
| 35 |
|
---|
| 36 | echo ' - removing TDB support from collection server'
|
---|
| 37 | # - Makefile.in
|
---|
[30239] | 38 | MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
|
---|
| 39 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 40 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include\s*-I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 41 | rm -f "${GSDLHOME}/runtime-src/src/colservr/Makefile"
|
---|
[24428] | 42 | # - collectset.cpp
|
---|
[25251] | 43 | # BUG: leaves behind the newlines...
|
---|
[30239] | 44 | SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectset.cpp"
|
---|
| 45 | sed -i '/^#include "tdbclass.h" \/\/TDB/ d' "${SRCFILE}"
|
---|
| 46 | sed -i '/^[ ]*if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} \/\/TDB/ d' "${SRCFILE}"
|
---|
| 47 | sed -i '/^[ ]*if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} \/\/TDBServer/ d' "${SRCFILE}"
|
---|
[25251] | 48 | # - collectserver.cpp
|
---|
[30239] | 49 | SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectserver.cpp"
|
---|
| 50 | sed -i '/^if (infodbtype == "tdb") { } \/\/ TDB Do nothing/ d' "${SRCFILE}"
|
---|
| 51 | sed -i '/^if (infodbtype == "tdbserver") { } \/\/ TDBServer Do nothing/ d' "${SRCFILE}"
|
---|
[24428] | 52 | # - Remove compiled files
|
---|
[30239] | 53 | rm -f "${GSDLHOME}/runtime-src/src/colservr/gsdlcolservr.a"
|
---|
[24428] | 54 |
|
---|
| 55 |
|
---|
| 56 | echo ' - removing TDB support from Greenstone receptionist'
|
---|
| 57 | # - Makefile.in
|
---|
[30239] | 58 | MAKEFILE="${GSDLHOME}/runtime-src/src/recpt/Makefile.in"
|
---|
| 59 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 60 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include\s*-I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 61 | sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 62 | sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 63 | rm -f "${GSDLHOME}/runtime-src/src/recpt/Makefile"
|
---|
[24428] | 64 | # - Remove compiled files
|
---|
[30239] | 65 | rm -f "${GSDLHOME}/runtime-src/src/recpt/gsdlrecpt.a"
|
---|
| 66 | rm -f "${GSDLHOME}/runtime-src/src/recpt/library.cgi"
|
---|
| 67 | rm -f "${GSDLHOME}/cgi-bin/library.cgi"
|
---|
[24428] | 68 |
|
---|
| 69 |
|
---|
| 70 | echo ' - removing TDB support from OAI Server receptionist'
|
---|
| 71 | # - Makefile.in
|
---|
[30239] | 72 | MAKEFILE="${GSDLHOME}/runtime-src/src/oaiservr/Makefile.in"
|
---|
| 73 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 74 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include\s*-I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 75 | sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 76 | sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' "${MAKEFILE}"
|
---|
| 77 | rm -f "${GSDLHOME}/runtime-src/src/oaiservr/Makefile"
|
---|
[24428] | 78 | # - Remove compiled files
|
---|
[30239] | 79 | rm -f "${GSDLHOME}/runtime-src/src/oaiservr/oaiserver.cgi"
|
---|
| 80 | rm -f "${GSDLHOME}/cgi-bin/oaiserver.cgi"
|
---|
[24428] | 81 |
|
---|
| 82 | echo
|
---|
| 83 | echo '====================================================='
|
---|
| 84 | echo
|
---|
| 85 | echo 'TDB support has now been removed from Greenstone.'
|
---|
| 86 | echo 'Please return to the main Greenstone directory and'
|
---|
| 87 | echo 'rerun:'
|
---|
| 88 | echo
|
---|
| 89 | echo ' ./configure <any required arguments>'
|
---|
| 90 | echo ' make'
|
---|
| 91 | echo ' make install'
|
---|
| 92 | echo
|
---|
| 93 | echo 'to complete TDB removal.'
|
---|
| 94 | echo
|
---|
[30239] | 95 | echo 'Should you later wish to restore TDB support rerun:'
|
---|
| 96 | echo
|
---|
| 97 | echo ' ./enable_tdb.sh'
|
---|
| 98 | echo
|
---|
[24428] | 99 | echo '====================================================='
|
---|
| 100 | echo
|
---|
| 101 |
|
---|
[30239] | 102 | exit 0
|
---|