public
Last active — forked from /PKGBUILD

  • Download Gist
PKGBUILD
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# Maintainer: Marcello "mererghost" Rocha <https://github.com/mereghost>
# Refactored by Bla┼ż "Speed" Hrastnik <https://github.com/archSeer>
pkgname=elasticsearch
pkgver=0.20.1
pkgrel=3
pkgdesc="Distributed RESTful search engine built on top of Lucene"
arch=('i686' 'x86_64')
url="http://www.elasticsearch.org/"
license=('APACHE')
depends=('java-runtime')
install='elasticsearch.install'
source=(
"http://download.elasticsearch.org/$pkgname/$pkgname/$pkgname-$pkgver.tar.gz"
elasticsearch.service
)
md5sums=('63996902e06dee8f397fe86fc625b505'
'bcf3a9bd7062c9662d24385fbc2806c7')
 
build() {
# Remove unnesessary libraries
cd "$srcdir/$pkgname-$pkgver"
find lib/sigar/* ! -name '*.jar' ! -name '*x86-linux.so' -delete
 
# Edit the values of the config files
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"
# creates the necessary dirs
install -dm755 "$pkgdir/usr/share/elasticsearch/bin"
install -dm755 "$pkgdir/etc/elasticsearch"
install -dm755 "$pkgdir/var/lib/elasticsearch"
install -dm755 "$pkgdir/var/log/elasticsearch"
 
cp config/* "$pkgdir/etc/elasticsearch/"
cp -r {bin,lib} "$pkgdir/usr/share/elasticsearch"
# install systemd script
install -Dm644 "$srcdir/elasticsearch.service" "$pkgdir/usr/lib/systemd/system/elasticsearch.service"
}
elasticsearch.install
1 2 3 4 5 6 7 8 9 10
post_install(){
useradd -r -g daemon -d /usr/share/elasticsearch -s /bin/false elasticsearch
chown -R elasticsearch:daemon /usr/share/elasticsearch
chown -R elasticsearch:daemon /var/lib/elasticsearch
chown -R elasticsearch:daemon /var/log/elasticsearch
}
 
post_remove(){
userdel elasticsearch
}
elasticsearch.service
1 2 3 4 5 6 7 8 9 10
[Unit]
Description=ElasticSearch
After=network.target
 
[Service]
User=elasticsearch
ExecStart=/usr/share/elasticsearch/bin/elasticsearch -f
 
[Install]
WantedBy=multi-user.target

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.