aboutsummaryrefslogtreecommitdiffstats
path: root/testing/consul/APKBUILD
blob: a2345caf8baf4b6cf22e0f3f0b0943efdcddc1d5 (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
# Contributor: Olivier Mauras <olivier@mauras.ch>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=consul
pkgver=0.9.2
pkgrel=0
pkgdesc="A tool for service discovery, monitoring and configuration"
url="https://www.consul.io/"
arch="all !aarch64"
license="MPL 2.0"
depends=""
makedepends="go bash"
install="$pkgname.pre-install"
pkgusers="consul"
pkggroups="consul"
source="$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/$pkgname/archive/v$pkgver.tar.gz
	consul.initd
	consul.confd
	acl.json.sample
	encrypt.json.sample
	server.json
	tls.json.sample"
builddir="$srcdir/src/github.com/hashicorp/$pkgname"

check() {
	cd "$builddir"
	GOPATH="$srcdir" go test
}

prepare() {
	mkdir -p "$srcdir/src/github.com/hashicorp"
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/ || return 1
	default_prepare
}

build() {
	cd "$builddir"

	GOPATH="$srcdir" go build -v -o bin/$pkgname \
		-ldflags "-X github.com/hashicorp/consul/version.GitDescribe='${pkgver}'" \
		--tags consul || return 1
}

package() {
	cd "$builddir"
	# Consul init script
	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	# Consul init conf
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname || return 1
	# Main binary
	install -m750 -o root -g consul \
		-D bin/${pkgname} \
		"$pkgdir"/usr/sbin/${pkgname} || return 1
	# Consul datadir
	install -m750 -o consul -g consul -d "$pkgdir"/var/${pkgname} || return 1
	# Consul configdir
	install -m750 -o root -g consul -d "$pkgdir"/etc/${pkgname} || return 1
	# Consul sample config files
	for cf in acl.json.sample encrypt.json.sample server.json tls.json.sample; do
		install -m640 -o root -g consul "$srcdir"/$cf "$pkgdir"/etc/${pkgname} || return 1
	done
}
sha512sums="67f596083848715c3bca6787caef0cdd7e67fba68274cd5208affecea984dd9b4e4e72c469723f8cc7f7f7d34e2f5302b5763f5b1a951ee0d33be91e87bdcb1a  consul-0.9.2.tar.gz
b0b6ba59d5b2c07f269bf901a24d1dcfbf96953185582577cecf7e17a2909a98673ec780d107b6264e910425aeadcf21d4adcedb89d4616c4eb9840e08639c17  consul.initd
f2c5af74dfcbca2fea8ebea31139d93f44455b93ef17ec611b880d7071af4125615dbbd23969d0d04ca636c26d7b4e7eb97f1266baa89252097f4cbc5173d817  consul.confd
d4310dde63d3b8fc4791124bd255bf2a1402b86d00f6b1732e18b0caedb75eae6c77382e1a48f12469828ef4bb363db4580fb1aafa63fcdc97b1431f6ea96d58  acl.json.sample
ec30ad73c13f9dd5ba15389567436dbf74c24e822cb959c6ccc40a35e36e212313c70f3cf1ccee3f63a7bb98760173d6c2478161a25b85e14dd889a47572aff1  encrypt.json.sample
a8b984db03f0bfb652d541dbdd3f1bc9be22f16cce78f73e495cc54adea1e09e9ac0e2f306ca8436590433c80a2ef824641f790b30aea9acb806b01fcabc918e  server.json
7582f1845a742cf570db5aa52077eb4c4cbfe68ee2ae9569cc2806444217eba0ee960a3a52f3edd1a7c36ca8b7811df5cab6dd062b060ab43ed57b8c811c85de  tls.json.sample"