|
|
|
|
##
|
|
|
|
|
## elasticsearch.spec -- OpenPKG RPM Package Specification
|
|
|
|
|
## Copyright (c) 2000-2017 OpenPKG Foundation e.V. <http://openpkg.net/>
|
|
|
|
|
##
|
|
|
|
|
## Permission to use, copy, modify, and distribute this software for
|
|
|
|
|
## any purpose with or without fee is hereby granted, provided that
|
|
|
|
|
## the above copyright notice and this permission notice appear in all
|
|
|
|
|
## copies.
|
|
|
|
|
##
|
|
|
|
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
|
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
## SUCH DAMAGE.
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# package version
|
|
|
|
|
%define V_opkg 2.4.1
|
|
|
|
|
%define V_dist 2.4.1
|
|
|
|
|
%define V_httpbasic 1.5.1
|
|
|
|
|
%define V_sql 2.4.1.0
|
|
|
|
|
%define V_dejavu 0.8.0
|
|
|
|
|
|
|
|
|
|
# package information
|
|
|
|
|
Name: elasticsearch
|
|
|
|
|
Summary: Enterprise Indexing and Search Server
|
|
|
|
|
URL: http://www.elasticsearch.org/
|
|
|
|
|
Vendor: Shay Banon
|
|
|
|
|
Packager: OpenPKG Foundation e.V.
|
|
|
|
|
Distribution: OpenPKG Community
|
|
|
|
|
Class: PLUS
|
|
|
|
|
Group: Web
|
|
|
|
|
License: Apache
|
|
|
|
|
Version: %{V_opkg}
|
|
|
|
|
Release: 20161004
|
|
|
|
|
|
|
|
|
|
# list of sources
|
|
|
|
|
Source0: https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/%{V_dist}/elasticsearch-%{V_dist}.tar.gz
|
|
|
|
|
Source1: https://github.com/Asquera/elasticsearch-http-basic/releases/download/v%{V_httpbasic}/elasticsearch-http-basic-%{V_httpbasic}.jar
|
|
|
|
|
Source2: https://github.com/NLPchina/elasticsearch-sql/releases/download/%{V_sql}/elasticsearch-sql-%{V_sql}.zip
|
|
|
|
|
Source3: https://github.com/appbaseio/dejaVu/archive/v%{V_dejavu}.zip
|
|
|
|
|
Source4: rc.elasticsearch
|
|
|
|
|
Source5: elasticsearch.yml
|
|
|
|
|
Source6: logging.yml
|
|
|
|
|
Patch0: elasticsearch.patch
|
|
|
|
|
|
|
|
|
|
# build information
|
|
|
|
|
BuildPreReq: OpenPKG, openpkg >= 20160101, infozip
|
|
|
|
|
PreReq: OpenPKG, openpkg >= 20160101, java, JAVA-JDK, apg, curl
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
Elasticsearch is a powerful distributed RESTful Indexing and Search
|
|
|
|
|
Server, built in top of the Apache Lucense search engine.
|
|
|
|
|
|
|
|
|
|
%track
|
|
|
|
|
prog elasticsearch = {
|
|
|
|
|
version = %{V_dist}
|
|
|
|
|
url = https://www.elastic.co/downloads/elasticsearch
|
|
|
|
|
regex = elasticsearch-(\d+\.\d+\.\d+)\.tar\.gz
|
|
|
|
|
}
|
|
|
|
|
prog elasticsearch:httpbasic = {
|
|
|
|
|
version = %{V_httpbasic}
|
|
|
|
|
url = https://github.com/Asquera/elasticsearch-http-basic/releases
|
|
|
|
|
regex = elasticsearch-http-basic-(__VER__)\.jar
|
|
|
|
|
}
|
|
|
|
|
prog elasticsearch:sql = {
|
|
|
|
|
version = %{V_sql}
|
|
|
|
|
url = https://github.com/NLPchina/elasticsearch-sql/releases
|
|
|
|
|
regex = elasticsearch-sql-(__VER__)\.zip
|
|
|
|
|
}
|
|
|
|
|
prog elasticsearch:dejavu = {
|
|
|
|
|
version = %{V_dejavu}
|
|
|
|
|
url = https://github.com/appbaseio/dejaVu/releases
|
|
|
|
|
regex = v(__VER__)\.tar\.gz
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
%setup -q -n elasticsearch-%{V_dist}
|
|
|
|
|
%patch -p0
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
# strip down distribution
|
|
|
|
|
rm -f [A-Z]*
|
|
|
|
|
rm -rf config
|
|
|
|
|
find . -name "*.orig" -print | xargs rm -f
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
# create installation hierarchy
|
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/bin \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/elasticsearch \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/http-basic \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/sql \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/dejaVu \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/elasticsearch/run \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/elasticsearch/log \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/elasticsearch/tmp \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/elasticsearch/db
|
|
|
|
|
|
|
|
|
|
# install program components
|
|
|
|
|
rm -f bin/*.bat
|
|
|
|
|
cp -r * \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/
|
|
|
|
|
|
|
|
|
|
# install link to configuration files
|
|
|
|
|
ln -s ../../etc/elasticsearch \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/config
|
|
|
|
|
|
|
|
|
|
# install link to plugins directory
|
|
|
|
|
ln -s ../../libexec/elasticsearch \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/plugins
|
|
|
|
|
|
|
|
|
|
# install additional plugins
|
|
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
|
|
%{SOURCE elasticsearch-http-basic-%{V_httpbasic}.jar} \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/http-basic/
|
|
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
|
|
%{SOURCE elasticsearch-sql-%{V_sql}.zip} \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/sql/
|
|
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
|
|
%{SOURCE v%{V_dejavu}.zip} \
|
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/dejaVu/
|
|
|
|
|
|
|
|
|
|
# install default configuration
|
|
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
|
|
%{SOURCE elasticsearch.yml} $RPM_BUILD_ROOT%{l_prefix}/etc/elasticsearch/
|
|
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
|
|
%{SOURCE logging.yml} $RPM_BUILD_ROOT%{l_prefix}/etc/elasticsearch/
|
|
|
|
|
|
|
|
|
|
# install run-command script
|
|
|
|
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
|
|
%{SOURCE rc.elasticsearch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
|
|
|
|
|
|
|
# determine installation files
|
|
|
|
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
|
|
%{l_files_std} \
|
|
|
|
|
'%config %{l_prefix}/etc/elasticsearch/*' \
|
|
|
|
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/elasticsearch' \
|
|
|
|
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/elasticsearch/*'
|
|
|
|
|
|
|
|
|
|
%files -f files
|
|
|
|
|
|
|
|
|
|
%clean
|
|
|
|
|
|
|
|
|
|
%post
|
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
|
# display final hints on initial installation
|
|
|
|
|
( echo "By default, ElasticSearch runs its server process on IPv4 address"
|
|
|
|
|
echo "127.0.0.1, TCP port 9200. Start the ElasticSearch server by running:"
|
|
|
|
|
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc elasticsearch start"
|
|
|
|
|
echo "Connect to ElasticSearch via REST through the URL:"
|
|
|
|
|
echo " http://localhost:9200/"
|
|
|
|
|
) | %{l_rpmtool} msg -b -t notice
|
|
|
|
|
fi
|
|
|
|
|
if [ $1 -eq 2 ]; then
|
|
|
|
|
# after upgrade, restart service
|
|
|
|
|
eval `%{l_rc} elasticsearch status 2>/dev/null`
|
|
|
|
|
[ ".$elasticsearch_active" = .yes ] && %{l_rc} elasticsearch restart
|
|
|
|
|
fi
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|
|
%preun
|
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
|
# before erase, stop service and remove runtime files
|
|
|
|
|
%{l_rc} elasticsearch stop 2>/dev/null
|
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/elasticsearch/run/* >/dev/null 2>&1 || true
|
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/elasticsearch/log/* >/dev/null 2>&1 || true
|
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/elasticsearch/tmp/* >/dev/null 2>&1 || true
|
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/elasticsearch/db/* >/dev/null 2>&1 || true
|
|
|
|
|
fi
|
|
|
|
|
exit 0
|
|
|
|
|
|