From 7c4e67edf985e3386d882973bd78662a9296a750 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 23 Jan 2019 14:56:52 +0100 Subject: community/elasticsearch: fix and improve init script * SVCNAME is deprecated for a very long time, RC_SVCNAME should be used * nice 0 is the default value, not needed to define * error.log was previously owned by root instead of the ES user, so we need to fix it --- community/elasticsearch/APKBUILD | 6 +++--- community/elasticsearch/elasticsearch.initd | 13 +++++++------ community/elasticsearch/elasticsearch.post-upgrade | 11 +++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 community/elasticsearch/elasticsearch.post-upgrade (limited to 'community/elasticsearch') diff --git a/community/elasticsearch/APKBUILD b/community/elasticsearch/APKBUILD index f01eb17446..02415ba9ff 100644 --- a/community/elasticsearch/APKBUILD +++ b/community/elasticsearch/APKBUILD @@ -2,14 +2,14 @@ # Maintainer: Jakub Jirutka pkgname=elasticsearch pkgver=6.4.1 -pkgrel=0 +pkgrel=1 pkgdesc="Open Source, Distributed, RESTful Search Engine" url="https://www.elastic.co/products/elasticsearch" arch="x86 x86_64 ppc64le" license="Apache-2.0" depends="java-jna-native>=4.1 openjdk8-jre bash" makedepends="" -install="$pkgname.pre-install" +install="$pkgname.pre-install $pkgname.post-upgrade" subpackages="$pkgname-doc $pkgname-x-pack:_x_pack" options="!check" # no test suite pkgusers="elastico" @@ -115,7 +115,7 @@ _x_pack() { } sha512sums="a023a6db5554dee6f10718dfa297aa06a735c7857542c2db80fa5c2b86ff4bf405bb8167578c5b60741ad05ed96a64b54bc71d128a0ff955468b0449588b053c elasticsearch-6.4.1.tar.gz -c16b8c724dbcfd938b50d75a1676a8428f8cd10df4c2e60f719a1c8bd1f229756fabcb351882426dd44e14944a28c4fc0bd341bcfe7fea89ccca5e4a23e74efc elasticsearch.initd +2477cb748ea08de0b0a4c931e68d875b1a363c029820dcc2144f0da9a5adb3ad2c17d8f2f7cc7bea85a16b61951a782e6eb48e3d5890505638e3245ec04e21d7 elasticsearch.initd 2ab1baf1b5c8782f3f371ba221aadd3e841abc62175f0b1ddcfc68d711e2370465124e076f8cc2e549c25a1da9db8c90172b2f410bd6bbe4153f0e831620b6ba elasticsearch.confd 6de81485cdc059afef58382862e4155482463fde0b604aaa8dbe904c778b841467c4a383a5e54acd09e3436f1fb7be9923e001fb77bd3d7894e113a5e0f4036b README.alpine 1f9d13bbc42c04c523ef4e9ce734f919ec3d79748d78f288ed3dd725cf7c74e83d66d8b48fbc782b27b1a760096a647cb33773578071710542b19fda18ea0b84 busybox-mktemp.patch" diff --git a/community/elasticsearch/elasticsearch.initd b/community/elasticsearch/elasticsearch.initd index f992b0b8a6..eefaceb7a7 100644 --- a/community/elasticsearch/elasticsearch.initd +++ b/community/elasticsearch/elasticsearch.initd @@ -3,7 +3,7 @@ supervisor=supervise-daemon description="A Distributed RESTful Search Engine." -instance_name="${SVCNAME#elasticsearch.}" +instance_name="${RC_SVCNAME#elasticsearch.}" instance_name="${instance_name/elasticsearch/_default}" name="Elasticsearch" @@ -20,6 +20,7 @@ name="Elasticsearch" : ${default_script_dir:="$conf_dir/scripts"} : ${default_work_dir:="/var/tmp/elasticsearch/$instance_name"} : ${create_logs_dir:="yes"} +: ${error_log:="$default_logs_dir/error.log"} elastic_opts=" -Epath.data=$default_data_dir @@ -41,11 +42,11 @@ export ES_JAVA_OPTS="$java_opts" export ES_JVM_OPTIONS="$conf_dir/jvm.options" export ES_PATH_CONF="$conf_dir" -nice="0" -pidfile="/run/$SVCNAME.sd.pid" -supervise_daemon_args="-u $user -g $group -p $pidfile -N $nice" -command=/usr/share/java/elasticsearch/bin/elasticsearch -command_args="$elastic_opts 1>/dev/null 2>>$default_logs_dir/error.log" +command="/usr/share/java/elasticsearch/bin/elasticsearch" +command_args="$elastic_opts" +command_user="$user:$group" +command_background="yes" +pidfile="/run/$RC_SVCNAME.sd.pid" depends() { use net diff --git a/community/elasticsearch/elasticsearch.post-upgrade b/community/elasticsearch/elasticsearch.post-upgrade new file mode 100644 index 0000000000..af936afd41 --- /dev/null +++ b/community/elasticsearch/elasticsearch.post-upgrade @@ -0,0 +1,11 @@ +#!/bin/sh + +ver_new="$1" +ver_old="$2" + +if [ "$(apk version -t "$ver_old" "6.4.1-r1")" = "<" ]; then + chown elastico:elastico /var/log/elasticsearch/error.log 2>/dev/null + chown elastico:elastico /var/log/elasticsearch/*/error.log 2>/dev/null +fi + +exit 0 -- cgit v1.2.3