aboutsummaryrefslogtreecommitdiffstats
path: root/testing/logstash/APKBUILD
blob: b3dbe18e7e1850a65ffa5b4c201331cde317f5d4 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Contributor: Steeve Chailloux <steeve@chaahk.com>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=logstash
pkgver=5.2.2
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"
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="847b52d3148dc4dd6da53c3a7e61264f1870a16501a30ac7a86d49384f078bb865103c283d20a3201c67aa10855fd137b105ada41f7d0fb7d40543ff70de2e50  logstash-5.2.2.tar.gz
94b18da3f0ef40f68118b27654563e7aa6dd4a3b90f0d8ad61a8be579d4be62c2bf1b192a32ee6140b81224343eeb442687539f6def1e725787b8cb96c0c70d1  logstash.confd
828684ea0b9faa53ac51f7fb22bf73d862dc058d605f27958db6a8efbd10f5463a0837fa88b62a3964582c72fdd7ece434057a540b0924eae1fae17b9d5887b4  logstash.initd
21609c8f44b31a5f298573be4b5c0fdcdc165e603a95c3626570fb6dd44dad114a74ee3f10fbd518f72b537a3d6bdcdbad09798c4bead0ee16f2a3b8e2b00ed3  logstash.conf
180349d57a6a48be9052649425a945a07cf5e194d0f32f83567b460936729a70244d73c3495f8a318a3b98ac99a2848cadfbee5bd017da803c68c5140b6cd29d  logstash.profile"