forked from opensemanticsearch/open-semantic-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deb
executable file
·222 lines (154 loc) · 6.48 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
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
PACKAGE=open-semantic-search.deb
BUILDDIR=/tmp/open-semantic-search-$$.deb
INCLUDE_PACKAGES="solr.deb tika-server.deb spacy-services.deb open-semantic-etl solr-php-ui open-semantic-search-apps solr-synonames flower"
# Change dir to src dir (for the case this build script is started from other dir)
cd "$(dirname "$0")"
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 flower
#
cp -a src/flower/etc ${BUILDDIR}/
#
# Include Open Semantic Search Apps
#
cp -a src/open-semantic-search-apps/etc ${BUILDDIR}/
cp -a src/open-semantic-search-apps/var ${BUILDDIR}/
mkdir -p ${BUILDDIR}/var/lib/opensemanticsearch/
cp -a src/open-semantic-search-apps/src/* ${BUILDDIR}/var/lib/opensemanticsearch/
#
# Include docs
#
mkdir -p ${BUILDDIR}/usr/share/doc/open-semantic-search
cp -a docs ${BUILDDIR}/usr/share/doc/open-semantic-search/
cp mkdocs.yml ${BUILDDIR}/usr/share/doc/open-semantic-search/
mkdocs build --config-file ${BUILDDIR}/usr/share/doc/open-semantic-search/mkdocs.yml
#
# 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
#
# read $SOLR_VERSION and $SOLR_URL from config file solr-version.env
source src/solr.deb/solr-version.env
# if not yet there, download Solr binary release
if [ ! -f "src/solr.deb/usr/src/solr-$SOLR_VERSION.tgz" ]; then
mkdir src/solr.deb/usr
mkdir src/solr.deb/usr/src
echo "Downloading Solr"
wget -P src/solr.deb/usr/src/ $SOLR_URL
fi
cp -a src/solr.deb/etc ${BUILDDIR}/
cp -a src/solr.deb/var ${BUILDDIR}/
cp -a src/solr.deb/usr ${BUILDDIR}/
#
# Include solr-synonames
#
mkdir -p ${BUILDDIR}/usr/share/synonames
cp src/solr-synonames/aleph-elasticsearch/synonames.txt ${BUILDDIR}/usr/share/synonames/
cp src/solr-synonames/synonames2solr.py ${BUILDDIR}/usr/lib/python3/dist-packages/
#
# Include tika-server.deb
#
# read $TIKA_VERSION and $TIKA_URL from config file tika-version.env
source src/tika-server.deb/tika-version.env
# if not yet there, download Tika-server binary release
if [ ! -f "src/tika-server.deb/usr/share/java/tika-server-standard-$TIKA_VERSION.jar" ]; then
echo "Downloading Tika"
wget -P src/tika-server.deb/usr/share/java/ $TIKA_URL
fi
cp -a src/tika-server.deb/etc ${BUILDDIR}/
mkdir -p ${BUILDDIR}/usr/share/java/
cp src/tika-server.deb/usr/share/java/tika-server-standard-$TIKA_VERSION.jar ${BUILDDIR}/usr/share/java/
ln -s tika-server-standard-$TIKA_VERSION.jar ${BUILDDIR}/usr/share/java/tika-server-standard.jar
# 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/
#
# Build deb
#
dpkg -b ${BUILDDIR} ${PACKAGE}