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
|
---|
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
|
---|
14 |
|
---|
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##*/}
|
---|
18 |
|
---|
19 | echo ' - removing TDB support from common function library'
|
---|
20 | # - Makefile.in
|
---|
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"
|
---|
28 | # - Remove symlink
|
---|
29 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.h"
|
---|
30 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.cpp"
|
---|
31 | # - Remove compiled files
|
---|
32 | rm -f "${GSDLHOME}/common-src/src/lib/tdbclass.o"
|
---|
33 | rm -f "${GSDLHOME}/common-src/src/lib/gsdllib.a"
|
---|
34 |
|
---|
35 |
|
---|
36 | echo ' - removing TDB support from collection server'
|
---|
37 | # - Makefile.in
|
---|
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"
|
---|
42 | # - collectset.cpp
|
---|
43 | # BUG: leaves behind the newlines...
|
---|
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}"
|
---|
48 | # - collectserver.cpp
|
---|
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}"
|
---|
52 | # - Remove compiled files
|
---|
53 | rm -f "${GSDLHOME}/runtime-src/src/colservr/gsdlcolservr.a"
|
---|
54 |
|
---|
55 |
|
---|
56 | echo ' - removing TDB support from Greenstone receptionist'
|
---|
57 | # - Makefile.in
|
---|
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"
|
---|
64 | # - Remove compiled files
|
---|
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"
|
---|
68 |
|
---|
69 |
|
---|
70 | echo ' - removing TDB support from OAI Server receptionist'
|
---|
71 | # - Makefile.in
|
---|
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"
|
---|
78 | # - Remove compiled files
|
---|
79 | rm -f "${GSDLHOME}/runtime-src/src/oaiservr/oaiserver.cgi"
|
---|
80 | rm -f "${GSDLHOME}/cgi-bin/oaiserver.cgi"
|
---|
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
|
---|
95 | echo 'Should you later wish to restore TDB support rerun:'
|
---|
96 | echo
|
---|
97 | echo ' ./enable_tdb.sh'
|
---|
98 | echo
|
---|
99 | echo '====================================================='
|
---|
100 | echo
|
---|
101 |
|
---|
102 | exit 0
|
---|