When trying to install the rpm-based version offline, (with the repositorys synchronized from internet), it will fail to grab the /usr/lib/libKNNIndexV1_7_3_6.so from internet.
The %preinstall for opendistroforelasticsearch-1.6.0.rpm is like:
preinstall scriptlet (using /bin/sh):
RPM_ARCH=noarch
RPM_OS=linux
RPM_PACKAGE_NAME=opendistroforelasticsearch
RPM_PACKAGE_VERSION=1.6.0
RPM_PACKAGE_RELEASE=1
echo “Fetching kNN library”
FILE=/usr/lib/libKNNIndexV1_7_3_6.so
if [ -f “$FILE” ]
then
echo “$FILE exist: removing $FILE”
sudo rm $FILE
fi
FILE=/libKNNIndexV1_7_3_6.zip
if [ -f “$FILE” ]
then
echo “$FILE exist: removing $FILE”
sudo rm $FILE
fi
wget https://d3g5vo6xdbdb9a.cloudfront.net/downloads/k-NN-lib/libKNNIndexV1_7_3_6.zip
&& unzip libKNNIndexV1_7_3_6.zip
&& mv libKNNIndexV1_7_3_6.so /usr/lib
&& rm libKNNIndexV1_7_3_6.zip
This behaivour will not work if not connected to Internet…
Why not put the file in the package itself, license issues?
Otherwise I think that I should be able to put the file in the local filesystem before installing the rpm.
(Maybe something like below. Have not tested it, but it should work…
if $(wget https://d3g5vo6xdbdb9a.cloudfront.net/downloads/k-NN-lib/libKNNIndexV1_7_3_6.zip 2>/dev/null) ; then
unzip libKNNIndexV1_7_3_6.zip
&& mv libKNNIndexV1_7_3_6.so /usr/lib
&& rm libKNNIndexV1_7_3_6.zip
else
echo “Check for local zip-file”
if test -r /var/tmp/libKNNIndexV1_7_3_6.zip ; then
tmp_dir=$(mktemp -d -t libKNN-XXX)
&& unzip -d ${tmp_dir} /var/tmp/libKNNIndexV1_7_3_6.zip
&& sudo mv ${tmp_dir}/libKNNIndexV1_7_3_6.so /usr/lib
test -r ${tmp_dir} && rm -rf ${tmp_dir}
fi
fi
if [ -r “/var/tmp/libKNNIndexV1_7_3_6.zip” ] ; then
unzip /var/tmp/libKNNIndexV1_7_3_6.zip && mv libKNNIndexV1_7_3_6.so /usr/lib