forked from opensemanticsearch/open-semantic-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deb
executable file
·212 lines (152 loc) · 6.43 KB
/
build-deb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#/bin/bash
VERSION=`date +%y.%m.%d`
PACKAGE=open-semantic-search_${VERSION}.deb
BUILDDIR=/tmp/open-semantic-search-$$.deb
INCLUDE_PACKAGES="solr.deb tika-server.deb spacy-services.deb open-semantic-etl neo4j.deb solr-php-ui open-semantic-search-apps"
echo "Building ${PACKAGE} in temp directory ${BUILDDIR}"
mkdir ${BUILDDIR}
mkdir ${BUILDDIR}/opt
cp -a DEBIAN ${BUILDDIR}/
#
# Include Debian subpackages metadata and install scripts
#
for INCLUDE_PACKAGE in $INCLUDE_PACKAGES ; do
echo "Including ${INCLUDE_PACKAGE}"
# Append conffiles names from the included package to our conffiles info
[ -f src/${INCLUDE_PACKAGE}/DEBIAN/conffiles ] && cat src/${INCLUDE_PACKAGE}/DEBIAN/conffiles >> ${BUILDDIR}/DEBIAN/conffiles
# Copy postinst files, which will be called from our postint script
if [ -f src/${INCLUDE_PACKAGE}/DEBIAN/postinst ]
then
cp src/${INCLUDE_PACKAGE}/DEBIAN/postinst ${BUILDDIR}/opt/postinst.${INCLUDE_PACKAGE}
# Add call to postinst script
cat << EOF >> ${BUILDDIR}/DEBIAN/postinst
if [ -f /opt/postinst.${INCLUDE_PACKAGE} ]
then
if /opt/postinst.${INCLUDE_PACKAGE}
then
rm /opt/postinst.${INCLUDE_PACKAGE}
else
exit 1
fi
fi
EOF
fi
done
mkdir -p ${BUILDDIR}/usr/lib/python3/dist-packages
#
# Include Open Semantic ETL
#
cp -a src/open-semantic-etl/etc ${BUILDDIR}/
cp -a src/open-semantic-etl/usr ${BUILDDIR}/
cp -a src/open-semantic-etl/src/opensemanticetl ${BUILDDIR}/usr/lib/python3/dist-packages/
cp -a src/open-semantic-etl/src/tesseract-ocr-cache/tesseract_cache ${BUILDDIR}/usr/lib/python3/dist-packages/
cp -a src/open-semantic-etl/src/tesseract-ocr-cache/tesseract_fake ${BUILDDIR}/usr/lib/python3/dist-packages/
mkdir -p ${BUILDDIR}/var/opensemanticsearch/media/thumbnails
mkdir -p ${BUILDDIR}/var/cache/tesseract
#
# Include Open Semantic Search Apps
#
cp -a src/open-semantic-search-apps/etc ${BUILDDIR}/
mkdir -p ${BUILDDIR}/var/lib/opensemanticsearch/
cp -a src/open-semantic-search-apps/src/* ${BUILDDIR}/var/lib/opensemanticsearch/
#
# Include solr-php-ui
#
cp -a src/solr-php-ui/etc ${BUILDDIR}/
mkdir -p ${BUILDDIR}/usr/share/solr-php-ui/
cp -a src/solr-php-ui/src/* ${BUILDDIR}/usr/share/solr-php-ui/
# Move config from php directory config to systems config directory /etc
mv ${BUILDDIR}/usr/share/solr-php-ui/config/* ${BUILDDIR}/etc/solr-php-ui
# link from deleted php directory to this new config destination
rmdir ${BUILDDIR}/usr/share/solr-php-ui/config
ln -s /etc/solr-php-ui/ ${BUILDDIR}/usr/share/solr-php-ui/config
#
# Include solr.deb
#
# if not yet there, download Solr binary release
if [ ! -f "src/solr.deb/usr/src/solr-7.7.2.tgz" ]; then
mkdir src/solr.deb/usr
mkdir src/solr.deb/usr/src
echo "Downloading Solr"
wget -P src/solr.deb/usr/src/ https://www-eu.apache.org/dist/lucene/solr/7.7.2/solr-7.7.2.tgz
fi
cp -a src/solr.deb/etc ${BUILDDIR}/
cp -a src/solr.deb/var ${BUILDDIR}/
cp -a src/solr.deb/usr ${BUILDDIR}/
#
# Include tika-server.deb
#
# if not yet there, download Tika-server binary release
if [ ! -f "src/tika-server.deb/usr/share/java/tika-server-1.23.jar" ]; then
echo "Downloading Tika"
wget -P src/tika-server.deb/usr/share/java/ https://archive.apache.org/dist/tika/tika-server-1.23.jar
fi
cp -a src/tika-server.deb/etc ${BUILDDIR}/
cp -a src/tika-server.deb/usr ${BUILDDIR}/
# Change Tika default config
# Extract Tika config from JAR
jar xf ${BUILDDIR}/usr/share/java/tika-server-*.jar org/apache/tika/parser/ocr/TesseractOCRConfig.properties
# Edit config: Increase OCR timeout
sed -i -e 's/timeout=120/timeout=10000/g' org/apache/tika/parser/ocr/TesseractOCRConfig.properties
# Update Tika JAR: Overwrite config with changed version
jar uf ${BUILDDIR}/usr/share/java/tika-server-*.jar org/apache/tika/parser/ocr/TesseractOCRConfig.properties
# Delete changed version of extracted config (since archived in JAR by step before)
rm org/apache/tika/parser/ocr/TesseractOCRConfig.properties
rmdir org/apache/tika/parser/ocr
rmdir org/apache/tika/parser
rmdir org/apache/tika
rmdir org/apache
rmdir org
# set rights
chown -R root:root ${BUILDDIR}/
chmod g+r ${BUILDDIR}/usr/share/java/tika-server*
chmod o+r ${BUILDDIR}/usr/share/java/tika-server*
#
# Include python-tika since no official Debian package yet
#
# copy python-tika library to created python libraries directory
cp -a src/tika-python/tika ${BUILDDIR}/usr/lib/python3/dist-packages/
#
# Include Open Semantic Entity Search API
#
cp -a src/open-semantic-entity-search-api/src/entity_import ${BUILDDIR}/usr/lib/python3/dist-packages/
cp -a src/open-semantic-entity-search-api/src/entity_linking ${BUILDDIR}/usr/lib/python3/dist-packages/
cp -a src/open-semantic-entity-search-api/src/entity_manager ${BUILDDIR}/usr/lib/python3/dist-packages/
cp -a src/open-semantic-entity-search-api/src/entity_rest_api ${BUILDDIR}/var/lib/opensemanticsearch/
cp -a src/open-semantic-entity-search-api/src/solr/* ${BUILDDIR}/var/solr/data/
#
# Include spacy-services.deb
#
cp -a src/spacy-services.deb/etc ${BUILDDIR}/
cp -a src/spacy-services.deb/src/spacy-services ${BUILDDIR}/usr/lib/python3/dist-packages/
#
# Include Solr Relevance Ranking Analysis Tool
#
cp -a src/solr-relevance-ranking-analysis/src/solr_relevance_ranking_analysis ${BUILDDIR}/var/lib/opensemanticsearch/
#
# Include Open Semantic Visual Linked Data Explorer
#
cp -a src/open-semantic-visual-graph-explorer/src/* ${BUILDDIR}/var/lib/opensemanticsearch/
# and its base / dependencies cytoscape.js and cytoscape.js-panzoom
mkdir ${BUILDDIR}/var/lib/opensemanticsearch/visual_graph_explorer/static/
cp -a src/cytoscape.js/dist/* ${BUILDDIR}/var/lib/opensemanticsearch/visual_graph_explorer/static/
cp -a src/cytoscape.js-panzoom/cytoscape-panzoom.js ${BUILDDIR}/var/lib/opensemanticsearch/visual_graph_explorer/static/
cp -a src/cytoscape.js-panzoom/cytoscape.js-panzoom.css ${BUILDDIR}/var/lib/opensemanticsearch/visual_graph_explorer/static/
cp -a src/cytoscape.js-panzoom/font-awesome-4.0.3 ${BUILDDIR}/var/lib/opensemanticsearch/visual_graph_explorer/static/
#
# Include Solr-Ontology-Tagger
#
cp -a src/solr-ontology-tagger/src/* ${BUILDDIR}/usr/lib/python3/dist-packages/
#
# Include Neo4j
#
mkdir -p ${BUILDDIR}/opt/neo4j
cp -a src/neo4j.deb/etc ${BUILDDIR}/
cp -a src/neo4j.deb/neo4j*/* ${BUILDDIR}/opt/neo4j/
mv ${BUILDDIR}/etc/neo4j/neo4j.conf ${BUILDDIR}/opt/neo4j/conf/neo4j.conf
rmdir ${BUILDDIR}/etc/neo4j
ln -s /opt/neo4j/conf ${BUILDDIR}/etc/neo4j
#
# Build deb
#
dpkg -b ${BUILDDIR} ${PACKAGE}