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" == "" ] ; then echo 'Error! GSDLHOME not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
|
---|
13 |
|
---|
14 |
|
---|
15 | echo ' - removing TDB support from common function library'
|
---|
16 | # - Makefile.in
|
---|
17 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
18 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
19 | sed -i 's:\(EXT_SOURCES\s*=.*\)\stdbclass.cpp\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
20 | sed -i 's:\(EXT_OBJECTS\s*=.*\)\stdbclass.o\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
21 | rm -f $GSDLHOME/common-src/src/lib/Makefile
|
---|
22 | # - Remove symlink
|
---|
23 | rm -f $GSDLHOME/common-src/src/lib/tdbclass.h
|
---|
24 | rm -f $GSDLHOME/common-src/src/lib/tdbclass.cpp
|
---|
25 | # - Remove compiled files
|
---|
26 | rm -f $GSDLHOME/common-src/src/lib/tdbclass.o
|
---|
27 | rm -f $GSDLHOME/common-src/src/lib/gsdllib.a
|
---|
28 |
|
---|
29 |
|
---|
30 | echo ' - removing TDB support from collection server'
|
---|
31 | # - Makefile.in
|
---|
32 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
|
---|
33 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
|
---|
34 | rm -f $GSDLHOME/runtime-src/src/colservr/Makefile
|
---|
35 | # - collectset.cpp
|
---|
36 | # BUG: leaves behind the newlines...
|
---|
37 | sed -i '/^#include "tdbclass.h" \/\/TDB/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
38 | sed -i '/^[ ]*if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} \/\/TDB/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
39 | sed -i '/^[ ]*if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} \/\/TDBServer/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
40 | # - collectserver.cpp
|
---|
41 | sed -i '/^if (infodbtype == "tdb") { } \/\/ TDB Do nothing/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
42 | sed -i '/^if (infodbtype == "tdbserver") { } \/\/ TDBServer Do nothing/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
43 | # - Remove compiled files
|
---|
44 | rm -f $GSDLHOME/runtime-src/src/colservr/gsdlcolservr.a
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | echo ' - removing TDB support from Greenstone receptionist'
|
---|
50 | # - Makefile.in
|
---|
51 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
52 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
53 | sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
54 | sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
55 | rm -f $GSDLHOME/runtime-src/src/recpt/Makefile
|
---|
56 | # - Remove compiled files
|
---|
57 | rm -f $GSDLHOME/runtime-src/src/recpt/gsdlrecpt.a
|
---|
58 | rm -f $GSDLHOME/runtime-src/src/recpt/library.cgi
|
---|
59 | rm -f $GSDLHOME/cgi-bin/library.cgi
|
---|
60 |
|
---|
61 |
|
---|
62 | echo ' - removing TDB support from OAI Server receptionist'
|
---|
63 | # - Makefile.in
|
---|
64 | sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
65 | sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
66 | sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
67 | sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
68 | rm -f $GSDLHOME/runtime-src/src/oaiservr/Makefile
|
---|
69 | # - Remove compiled files
|
---|
70 | rm -f $GSDLHOME/runtime-src/src/oaiservr/oaiserver.cgi
|
---|
71 | rm -f $GSDLHOME/cgi-bin/oaiserver.cgi
|
---|
72 |
|
---|
73 | echo
|
---|
74 | echo '====================================================='
|
---|
75 | echo
|
---|
76 | echo 'TDB support has now been removed from Greenstone.'
|
---|
77 | echo 'Please return to the main Greenstone directory and'
|
---|
78 | echo 'rerun:'
|
---|
79 | echo
|
---|
80 | echo ' ./configure <any required arguments>'
|
---|
81 | echo ' make'
|
---|
82 | echo ' make install'
|
---|
83 | echo
|
---|
84 | echo 'to complete TDB removal.'
|
---|
85 | echo
|
---|
86 | echo '====================================================='
|
---|
87 | echo
|
---|
88 |
|
---|
89 | exit 0 |
---|