Browse Source

improve packaging and upgrade to latest version

master
parent
commit
4540eb2435
  1. 48
      elasticsearch-xpack/elasticsearch-xpack.spec

48
elasticsearch-xpack/elasticsearch-xpack.spec

@ -22,8 +22,8 @@
##
# package version
%define V_elasticsearch_xpack 6.1.4
%define V_elasticsearch 6.1
%define V_elasticsearch_xpack 6.2.4
%define V_elasticsearch 6.2
# package information
Name: elasticsearch-xpack
@ -36,7 +36,7 @@ Class: PLUS
Group: Database
License: Apache
Version: %{V_elasticsearch_xpack}
Release: 20180320
Release: 20180513
# list of sources
Source0: https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-%{V_elasticsearch_xpack}.zip
@ -65,6 +65,7 @@ PreReq: elasticsearch
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch \
$RPM_BUILD_ROOT%{l_prefix}/libexec/elasticsearch/plugins
@ -73,7 +74,7 @@ PreReq: elasticsearch
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/bin
mkdir $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/bin
cp -p %{l_prefix}/lib/elasticsearch/bin/* \
cp -p %{l_prefix}/lib/elasticsearch/bin/elasticsearch* \
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/bin/
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/config
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/plugins
@ -85,6 +86,20 @@ PreReq: elasticsearch
install --verbose --batch \
file:%{SOURCE0}
# post-adjust installation
%{l_shtool} subst \
-e 's;/bin/bash;%{l_bash};g' \
$RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/bin/x-pack/*
# install wrapper command
( echo "#!/bin/sh"
echo "cmd=\"\$1\""
echo "shift"
echo "exec %{l_prefix}/lib/elasticsearch/bin/x-pack/\$cmd \${1+\"\$@\"}"
) >elasticsearch-xpack
%{l_shtool} install -c -m 755 \
elasticsearch-xpack $RPM_BUILD_ROOT%{l_prefix}/bin/
# cleanup environment
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/* >/dev/null 2>&1 || true
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/elasticsearch/bin/elasticsearch* >/dev/null 2>&1 || true
@ -99,3 +114,28 @@ PreReq: elasticsearch
%clean
%post
if [ ".$1" = .1 ]; then
# add default config to ElasticSearch configuration
conf="$RPM_INSTALL_PREFIX/etc/elasticsearch/elasticsearch.yml"
if [ -f $conf ]; then
( echo "xpack.security.enabled: false"
echo "xpack.security.audit.enabled: false"
echo "xpack.watcher.enabled: false"
echo "xpack.graph.enabled: false"
echo "xpack.ml.enabled: false"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:elasticsearch-xpack" -p "#" $conf
fi
fi
%postun
if [ ".$1" = .0 ]; then
# remove default config from ElasticSearch configuration
conf="$RPM_INSTALL_PREFIX/etc/elasticsearch/elasticsearch.yml"
if [ -f $conf ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:elasticsearch-xpack" -p "#" $conf
fi
fi

Loading…
Cancel
Save