# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka pkgname=elasticsearch pkgver=5.2.1 pkgrel=0 pkgdesc="Open Source, Distributed, RESTful Search Engine" url="https://www.elastic.co/products/elasticsearch" arch="x86 x86_64" license="ASL-2.0" depends="java-jna-native>=4.1 openjdk8-jre" makedepends="" install="$pkgname.pre-install" subpackages="$pkgname-doc" source="https://artifacts.elastic.co/downloads/$pkgname/$pkgname-$pkgver.tar.gz $pkgname.initd $pkgname.confd README.alpine " builddir="$srcdir/$pkgname-$pkgver" default_module=transport-netty4 _modules=$(find $builddir/modules -mindepth 1 -maxdepth 1 -type d ! -name $default_module -exec basename {} \;) for _mod in $_modules; do subpackages="$subpackages $pkgname-$_mod:_${_mod//-/_}" eval "_${_mod//-/_}() { _builtin_module $_mod; }" done _basedir="/usr/share/java/$pkgname" build() { return 0 } package() { local destdir="$pkgdir/$_basedir" local confdir="$pkgdir/etc/$pkgname" local docdir="$pkgdir/usr/share/doc/elasticsearch" local heapsize="256m" cd "$builddir" install -dm755 "$destdir"/lib "$destdir"/modules "$destdir"/bin install -m644 -t "$destdir"/lib lib/* || return 1 install -dm755 "$docdir" install -dm755 "$confdir" install -m644 -t "$confdir" config/* || return 1 # remove windows files find bin -type f -name *.bat -exec rm -f {} \; find bin -type f -name *.exe -exec rm -f {} \; # ES bin script parses the new jvm.options file install -m755 -t "$destdir"/bin bin/* || return 1 # ES does not run without a transport module install -dm755 "$destdir/modules/$default_module" install -m644 -t "$destdir/modules/$default_module" modules/"$default_module"/* || return 1 # reduce heap sizes sed -i \ -e "s|^-Xms.*|-Xms$heapsize|" \ -e "s|^-Xmx.*|-Xmx$heapsize|" \ $confdir/jvm.options install -m755 -D "$srcdir"/$pkgname.initd \ "$pkgdir"/etc/init.d/$pkgname || return 1 install -m644 -D "$srcdir"/$pkgname.confd \ "$pkgdir"/etc/conf.d/$pkgname || return 1 install -m644 -D "$srcdir"/README.alpine \ "$docdir" || return 1 } _builtin_module() { local name="$1" local destdir="$subpkgdir/$_basedir/modules/$name" install -dm755 "$destdir" install -m644 -t "$destdir" "$builddir"/modules/$name/* } sha512sums="aa8734c1e1111987d45e8dd64b5f8a0473955c48e09e6f1875e877090c21070fc18768b413e7b0c20652cec9ebd9bb6836a2c014cf8159b041f0d22b28ad5a08 elasticsearch-5.2.1.tar.gz dc916861497d4a589d6b3ab70d90ff9970e4d57003ed82d08c5f90dec337f995dcabf2556b7a27ade926e846ad435392f7845acfe9280dce17b4c172d85328ae elasticsearch.initd 2ab1baf1b5c8782f3f371ba221aadd3e841abc62175f0b1ddcfc68d711e2370465124e076f8cc2e549c25a1da9db8c90172b2f410bd6bbe4153f0e831620b6ba elasticsearch.confd 6de81485cdc059afef58382862e4155482463fde0b604aaa8dbe904c778b841467c4a383a5e54acd09e3436f1fb7be9923e001fb77bd3d7894e113a5e0f4036b README.alpine"