# Contributor: Steeve Chailloux # Maintainer: Stuart Cardall pkgname=logstash pkgver=6.3.1 pkgrel=0 pkgdesc="A flexible, open source, data collection, parsing and enrichment pipeline" url="http://logstash.net" arch="noarch" license="Apache" depends="openjdk8-jre-base java-jffi-native libc6-compat bash" makedepends="$depends_dev" install="$pkgname.pre-install" pkgusers="logstash" subpackages="$pkgname-doc $pkgname-openrc" options="!strip !check" source="$pkgname-$pkgver.tar.gz::https://artifacts.elastic.co/downloads/$pkgname/$pkgname-$pkgver.tar.gz $pkgname.confd $pkgname.initd $pkgname.conf $pkgname.profile " builddir="${srcdir}/${pkgname}-${pkgver}" build() { return 0 } package() { local datadir=/var/lib/logstash logdir=$datadir/logs confdir=/etc/logstash local homedir=/usr/share/logstash heapsize=150m cd "$builddir" # create the necessary dirs install -dm755 "$pkgdir/$homedir" || return 1 install -dm755 "$pkgdir/$logdir" || return 1 install -dm755 "$pkgdir/$datadir" || return 1 install -dm755 "$pkgdir/$confdir" || return 1 install -dm755 "$pkgdir/$confdir/conf.d" || return 1 # install scripts 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"/$pkgname.conf \ "$pkgdir/$confdir"/conf.d/ || return 1 install -m644 -D "$srcdir"/$pkgname.profile \ "$pkgdir"/etc/profile.d/logstash.sh || return 1 # copy files cp -r * "$pkgdir/$homedir/" || return 1 cp config/* "$pkgdir/$confdir/" || return 1 # move docs mkdir -p "$pkgdir"/usr/share/doc/logstash && cd "$pkgdir" find usr/share/logstash -maxdepth 1 -type f ! -name Gemfile* \ -name "[[:upper:]]*" -exec mv {} usr/share/doc/logstash/ \; # remove files for windows find usr/share/logstash -type f -name *.bat -exec rm -f {} \; find usr/share/logstash -type f -name *win32* -exec rm -f {} \; find usr/share/logstash -type f -name *Win32* -exec rm -f {} \; # remove bundled libjffi (we use Alpine's java-jffi-native) rm -rf "$pkgdir"/usr/share/logstash/vendor/jruby/lib/jni || return 1 # set default paths sed -i \ -e "s|# path.config:|path.config: $confdir/conf.d|" \ -e "s|# path.logs:|path.logs: $logdir|" \ -e "s|# path.data:|path.data: $datadir|" \ "$pkgdir/$confdir"/logstash.yml || return 1 # symlink so manual commands without -path.settings works rmdir "$pkgdir/$homedir"/data || return 1 ln -s "$datadir" "$pkgdir/$homedir"/data ln -s "$logdir" "$pkgdir/$homedir"/logs # reduce heap sizes sed -i \ -e "s|^-Xms.*|-Xms$heapsize|" \ -e "s|^-Xmx.*|-Xmx$heapsize|" \ "$pkgdir/$confdir"/jvm.options || return 1 } sha512sums="dd9f55384bc5ec6c7530d62c2ba9f25dc1f7db4a736138ede8d3dece9a66705d7ed642877bac842a2252847e5b122afe5dee2b2258d4b0acb3750aa6c22f23bf logstash-6.3.1.tar.gz 94b18da3f0ef40f68118b27654563e7aa6dd4a3b90f0d8ad61a8be579d4be62c2bf1b192a32ee6140b81224343eeb442687539f6def1e725787b8cb96c0c70d1 logstash.confd 828684ea0b9faa53ac51f7fb22bf73d862dc058d605f27958db6a8efbd10f5463a0837fa88b62a3964582c72fdd7ece434057a540b0924eae1fae17b9d5887b4 logstash.initd 21609c8f44b31a5f298573be4b5c0fdcdc165e603a95c3626570fb6dd44dad114a74ee3f10fbd518f72b537a3d6bdcdbad09798c4bead0ee16f2a3b8e2b00ed3 logstash.conf 180349d57a6a48be9052649425a945a07cf5e194d0f32f83567b460936729a70244d73c3495f8a318a3b98ac99a2848cadfbee5bd017da803c68c5140b6cd29d logstash.profile"