summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-misc/elasticsearch/Manifest1
-rw-r--r--app-misc/elasticsearch/elasticsearch-5.2.2.ebuild70
-rw-r--r--app-misc/elasticsearch/files/elasticsearch.init895
3 files changed, 166 insertions, 0 deletions
diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest
index f12537168d88..82a178c779e0 100644
--- a/app-misc/elasticsearch/Manifest
+++ b/app-misc/elasticsearch/Manifest
@@ -1,2 +1,3 @@
DIST elasticsearch-2.4.4.tar.gz 27343272 SHA256 981092e6ca65ba5560b8b97a74e5ed0eb2236e9128efdb85bb652cec340158e2 SHA512 899a4d2fc64548bcd488ece223f5f189dfb191eceb36390c4b9d8d0d90ef9d2cb67ada475223b9b2e0bd0fb521a4ab978bc7f60781195927e36d027925338c14 WHIRLPOOL 1a90bb8c923a9eab6cc4390b3daaa44cd85d5c1a3a1a5ef7d274050eb25b061a11a91b0f57ebe9f3cb27aafee3267af8f63ca87837f79d622ff362fbc5b6ae1a
DIST elasticsearch-5.1.2.tar.gz 33299777 SHA256 74d752f9a8b46898d306ad169b72f328e17215c0909149e156a576089ef11c42 SHA512 1867626e8a87f11ed109e1325fd1d16c9e0af06ebe6a30c78ea679ab533ab377f5da8ea55af6871be33af226f02187a2aadd77e5e23c097dd24055be21e9d691 WHIRLPOOL 2e9df71c915343e2cc8ad82c59b877f41f5e093cbeba21f471c32cb51a195eccc6223bc48da48bb4af2e6bea9f2539f2e93b866963148f4ca2940ba4466e614e
+DIST elasticsearch-5.2.2.tar.gz 33799732 SHA256 cf88930695794a8949342d386f028548bd10b26ecc8c4b422a94ea674faf8ac9 SHA512 670f8aa81a34191a13cc8c608a9dc7bec60c63bbed8fdb9bc0619585d644867576a7677eb0f14b4e4d064e59def186d4b431930bf79b54bcbf59a29b0b327e85 WHIRLPOOL 4ec1f3b5ed15b9f22d27512ea784ffe9e32e00808fec89418860955d2f4759d045775e18c0a61693da47f39de9f235de954eada231fbd6de5fbfd17f552e8452
diff --git a/app-misc/elasticsearch/elasticsearch-5.2.2.ebuild b/app-misc/elasticsearch/elasticsearch-5.2.2.ebuild
new file mode 100644
index 000000000000..ba141a646d4f
--- /dev/null
+++ b/app-misc/elasticsearch/elasticsearch-5.2.2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils systemd user
+
+DESCRIPTION="Open Source, Distributed, RESTful, Search Engine"
+HOMEPAGE="https://www.elastic.co/products/elasticsearch"
+SRC_URI="https://artifacts.elastic.co/downloads/${PN}/${P}.tar.gz"
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RESTRICT="strip"
+
+RDEPEND="virtual/jre:1.8"
+
+pkg_setup() {
+ enewgroup ${PN}
+ enewuser ${PN} -1 /bin/bash /usr/share/${PN} ${PN}
+}
+
+src_prepare() {
+ rm -rf bin/*.{bat,exe} || die
+ rm LICENSE.txt || die
+
+ default
+}
+
+src_install() {
+ keepdir /etc/${PN}
+ keepdir /etc/${PN}/scripts
+
+ insinto /etc/${PN}
+ doins config/*
+ rm -rf config || die
+
+ insinto /usr/share/${PN}
+ doins -r ./*
+
+ exeinto /usr/share/${PN}/bin
+ doexe "${FILESDIR}/elasticsearch-systemd-pre-exec"
+
+ chmod +x "${D}"/usr/share/${PN}/bin/* || die
+
+ keepdir /var/{lib,log}/${PN}
+ keepdir /usr/share/${PN}/plugins
+
+ systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles.d" "${PN}.conf"
+
+ insinto /etc/sysctl.d
+ newins "${FILESDIR}/${PN}.sysctl.d" "${PN}.conf"
+
+ newinitd "${FILESDIR}/${PN}.init8" "${PN}"
+ newconfd "${FILESDIR}/${PN}.conf3" "${PN}"
+ systemd_newunit "${FILESDIR}"/${PN}.service6 "${PN}.service"
+}
+
+pkg_postinst() {
+ elog
+ elog "You may create multiple instances of ${PN} by"
+ elog "symlinking the init script:"
+ elog "ln -sf /etc/init.d/${PN} /etc/init.d/${PN}.instance"
+ elog
+ elog "Please make sure you put elasticsearch.yml, log4j2.properties and scripts"
+ elog "from /etc/elasticsearch into the configuration directory of the instance:"
+ elog "/etc/${PN}/instance"
+ elog
+}
diff --git a/app-misc/elasticsearch/files/elasticsearch.init8 b/app-misc/elasticsearch/files/elasticsearch.init8
new file mode 100644
index 000000000000..a9200d58ca0b
--- /dev/null
+++ b/app-misc/elasticsearch/files/elasticsearch.init8
@@ -0,0 +1,95 @@
+#!/sbin/openrc-run
+
+name="Elasticsearch"
+description="Elasticsearch Server"
+
+ES_INSTANCE=${SVCNAME#*.}
+PID_DIR=${PID_DIR:="/run/elasticsearch"}
+
+if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then
+ PIDFILE="${PID_DIR}/elasticsearch.${ES_INSTANCE}.pid"
+ ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}"
+ CONF_DIR="/etc/elasticsearch/${ES_INSTANCE}"
+ LOG_DIR="/var/log/elasticsearch/${ES_INSTANCE}"
+else
+ PIDFILE="${PID_DIR}/elasticsearch.pid"
+ ES_BASE_PATH="/var/lib/elasticsearch/_default"
+ CONF_DIR="/etc/elasticsearch"
+ LOG_DIR="/var/log/elasticsearch/_default"
+fi
+
+ES_HOME=${ES_HOME:="/usr/share/elasticsearch"}
+ES_USER=${ES_USER:="elasticsearch"}
+ES_GROUP=${ES_GROUP:="elasticsearch"}
+ES_STARTUP_SLEEP_TIME=${ES_STARTUP_TIME:=5}
+MAX_OPEN_FILES=${MAX_OPEN_FILES:=65536}
+MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144}
+
+DATA_DIR=${DATA_DIR:="${ES_BASE_PATH}/data"}
+
+if [ -f "${CONF_DIR}/elasticsearch.in.sh" ]; then
+ ES_INCLUDE="${CONF_DIR}/elasticsearch.in.sh"
+fi
+
+export ES_INCLUDE
+export JAVA_HOME
+export JAVA_OPTS
+export ES_JVM_OPTIONS
+export ES_JAVA_OPTS
+export ES_STARTUP_SLEEP_TIME
+
+server_command="/usr/share/elasticsearch/bin/elasticsearch"
+server_args="-d -p ${PIDFILE} -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR}"
+
+depend() {
+ use net
+}
+
+start() {
+ local conf
+ local conf_file
+ for conf in elasticsearch.yml; do
+ conf_file="${CONF_DIR}/${conf}"
+ if [ ! -f "${conf_file}" ]; then
+ eerror "${conf_file} must be copied into place"
+ return 1
+ fi
+ done
+
+ if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then
+ sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT}
+ fi
+
+ ebegin "Starting ${SVCNAME}"
+
+ if [ -n "${MAX_LOCKED_MEMORY}" ]; then
+ ulimit -l "${MAX_LOCKED_MEMORY}"
+ fi
+
+ if [ -n "${MAX_OPEN_FILES}" ]; then
+ ulimit -n "${MAX_OPEN_FILES}"
+ fi
+
+ checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/lib/elasticsearch"
+ checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/log/elasticsearch"
+ checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${PID_DIR}"
+ checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${ES_BASE_PATH}"
+ checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${LOG_DIR}"
+
+ start-stop-daemon --start \
+ --background \
+ --chdir "${ES_HOME}" \
+ --user="${ES_USER}" \
+ --pidfile="${PIDFILE}" \
+ --exec ${server_command} -- ${server_args}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop \
+ --pidfile=${PIDFILE} \
+ --user="${ES_USER}" \
+ --retry=TERM/20
+ eend $?
+}