summaryrefslogtreecommitdiff
path: root/community/elasticsearch
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2013-12-27 23:55:53 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2013-12-27 23:55:53 +0000
commit65eeff79fff8a1bfdf67ca51d147384f46f4d5c0 (patch)
treefbfdff322b28d9a3c37e6e31c94caf1d8e48dac1 /community/elasticsearch
parentd53c44f055929b18d7d1b25f8367ee5836c435fc (diff)
Fri Dec 27 23:54:04 UTC 2013
Diffstat (limited to 'community/elasticsearch')
-rw-r--r--community/elasticsearch/PKGBUILD75
-rw-r--r--community/elasticsearch/elasticsearch-tmpfile.conf1
-rw-r--r--community/elasticsearch/elasticsearch.install24
-rw-r--r--community/elasticsearch/elasticsearch.service13
4 files changed, 113 insertions, 0 deletions
diff --git a/community/elasticsearch/PKGBUILD b/community/elasticsearch/PKGBUILD
new file mode 100644
index 000000000..edcc42159
--- /dev/null
+++ b/community/elasticsearch/PKGBUILD
@@ -0,0 +1,75 @@
+# $Id: PKGBUILD 102806 2013-12-20 13:45:23Z mtorromeo $
+# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+# Contributor: Marcello "mererghost" Rocha <https://github.com/mereghost>
+# Refactored by Blaž "Speed" Hrastnik <https://github.com/archSeer>
+
+pkgname=elasticsearch
+pkgver=0.90.8
+pkgrel=2
+pkgdesc="Distributed RESTful search engine built on top of Lucene"
+arch=('i686' 'x86_64')
+url="http://www.elasticsearch.org/"
+license=('APACHE')
+depends=('java-runtime' 'bash')
+install='elasticsearch.install'
+source=(
+ "http://download.elasticsearch.org/$pkgname/$pkgname/$pkgname-$pkgver.tar.gz"
+ elasticsearch.service
+ elasticsearch-tmpfile.conf
+)
+
+backup=('etc/elasticsearch/elasticsearch.yml'
+ 'etc/elasticsearch/logging.yml')
+
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for script in plugin elasticsearch; do
+ sed 's|^ES_HOME=.*dirname.*|ES_HOME=/usr/share/elasticsearch|' \
+ -i bin/$script
+
+ for java in jre jdk; do
+ sed "/^CDPATH/i [ -f /etc/profile.d/$java.sh ] && . /etc/profile.d/$java.sh" \
+ -i bin/$script
+ done
+ done
+
+ sed 's|$ES_HOME/lib|/usr/lib/elasticsearch|g' -i bin/elasticsearch.in.sh
+
+ echo -e '\nJAVA_OPTS="$JAVA_OPTS -Des.path.conf=/etc/elasticsearch"' >> bin/elasticsearch.in.sh
+
+ sed -e 's/# \(path\.conf: \).*$/\1\/etc\/elasticsearch/' \
+ -e '0,/# \(path\.data: \).*$/s//\1\/var\/lib\/elasticsearch/' \
+ -e 's/# \(path\.work: \).*$/\1\/tmp\/elasticsearch/' \
+ -e 's/# \(path\.logs: \).*$/\1\/var\/log\/elasticsearch/' \
+ -i config/elasticsearch.yml
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ install -dm755 "$pkgdir/etc/elasticsearch"
+ install -dm755 "$pkgdir/var/lib/elasticsearch"
+ install -dm755 "$pkgdir/var/log/elasticsearch"
+
+ if [ $CARCH = 'x86_64' ]; then
+ install -Dm644 lib/sigar/libsigar-amd64-linux.so "$pkgdir/usr/lib/elasticsearch/sigar/libsigar-amd64-linux.so"
+ else
+ install -Dm644 lib/sigar/libsigar-x86-linux.so "$pkgdir/usr/lib/elasticsearch/sigar/libsigar-x86-linux.so"
+ fi
+ cp lib/sigar/sigar*.jar "$pkgdir/usr/lib/elasticsearch/sigar/"
+ cp lib/*.jar "$pkgdir/usr/lib/elasticsearch/"
+
+ cp config/* "$pkgdir/etc/elasticsearch/"
+
+ install -Dm755 bin/elasticsearch "$pkgdir/usr/bin/elasticsearch"
+ install -Dm755 bin/plugin "$pkgdir/usr/bin/elasticsearch-plugin"
+ install -Dm644 bin/elasticsearch.in.sh "$pkgdir/usr/share/elasticsearch/elasticsearch.in.sh"
+
+ install -Dm644 "$srcdir/elasticsearch.service" "$pkgdir/usr/lib/systemd/system/elasticsearch.service"
+
+ install -Dm644 "$srcdir/elasticsearch-tmpfile.conf" "$pkgdir/usr/lib/tmpfiles.d/elasticsearch.conf"
+}
+
+sha256sums=('4006e9aa9382f386e79a1c44a14c1aef34765eb5480fb6b29a2facf62ab3a321'
+ '09a4027780d73103c26f311c64774dcbc47b5e1d54789c1f2d9c697f518f2eeb'
+ '48b5a876e14819270c85f8ca626a011e01d10a2728758ced9a4d5bcf5c1fd23f')
diff --git a/community/elasticsearch/elasticsearch-tmpfile.conf b/community/elasticsearch/elasticsearch-tmpfile.conf
new file mode 100644
index 000000000..b2844a919
--- /dev/null
+++ b/community/elasticsearch/elasticsearch-tmpfile.conf
@@ -0,0 +1 @@
+d /run/elasticsearch 0755 elasticsearch elasticsearch - \ No newline at end of file
diff --git a/community/elasticsearch/elasticsearch.install b/community/elasticsearch/elasticsearch.install
new file mode 100644
index 000000000..82ff64dbb
--- /dev/null
+++ b/community/elasticsearch/elasticsearch.install
@@ -0,0 +1,24 @@
+post_install() {
+ getent group elasticsearch >/dev/null 2>&1 || groupadd -g 114 elasticsearch &>/dev/null
+ getent passwd elasticsearch >/dev/null 2>&1 || useradd -u 114 -g elasticsearch -d /usr/share/elasticsearch -s /bin/false elasticsearch &>/dev/null
+
+ chown -R elasticsearch:elasticsearch /usr/share/elasticsearch
+ chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
+ chown -R elasticsearch:elasticsearch /var/log/elasticsearch
+
+ usr/bin/systemd-tmpfiles --create elasticsearch.conf
+}
+
+post_upgrade(){
+ getent group elasticsearch >/dev/null 2>&1 || groupadd -g 114 elasticsearch &>/dev/null
+ getent passwd elasticsearch >/dev/null 2>&1 || useradd -u 114 -g elasticsearch -d /usr/share/elasticsearch -s /bin/false elasticsearch &>/dev/null
+}
+
+post_remove() {
+ if getent passwd elasticsearch >/dev/null 2>&1; then
+ userdel elasticsearch
+ fi
+ if getent group elasticsearch >/dev/null 2>&1; then
+ groupdel elasticsearch
+ fi
+}
diff --git a/community/elasticsearch/elasticsearch.service b/community/elasticsearch/elasticsearch.service
new file mode 100644
index 000000000..28364b878
--- /dev/null
+++ b/community/elasticsearch/elasticsearch.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=ElasticSearch
+After=network.target
+
+[Service]
+User=elasticsearch
+Type=forking
+PIDFile=/run/elasticsearch/elasticsearch.pid
+ExecStart=/usr/bin/elasticsearch -p /run/elasticsearch/elasticsearch.pid
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target