Commit 43f2f985 authored by Gennady Feldman's avatar Gennady Feldman Committed by Jakub Jirutka

testing/consul: update to 0.7.0

* Update consul to 0.7.0
* Update init.d script to run configtest and create a log file
parent 8bb108c2
# Contributor: Olivier Mauras <olivier@mauras.ch>
# Maintainer:
pkgname=consul
pkgver=0.5.2
pkgrel=1
pkgver=0.7.0
pkgrel=0
pkgdesc="A tool for service discovery, monitoring and configuration"
url="https://www.consul.io/"
arch="all !aarch64"
license="MPL 2.0"
depends=""
depends_dev=""
makedepends="go godep perl bash mercurial $depends_dev"
makedepends="go"
install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
pkgusers="consul"
pkggroups="consul"
subpackages=""
options="!strip"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
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/$pkgname-$pkgver"
_disturl="dev.alpinelinux.org:/archive/$pkgname/"
_gourl="github.com/hashicorp/consul"
_builddir="$srcdir"/src/github.com/hashicorp
snapshot() {
abuild clean
abuild deps
abuild fetch
export GOPATH="$srcdir"
mkdir -p $_builddir
cd $_builddir
msg "Checking out v${pkgver} tag"
git clone -q --branch v${pkgver} https://$_gourl || return 1
cd $pkgname
# use custom godeps file
install -D "${_builddir}"/$pkgname/deps/v${pkgver//./-}.json \
$_builddir/$pkgname/Godeps/Godeps.json || return 1
go get -v -d || return 1
godep restore
cd "$srcdir"
tar zcf $pkgname-$pkgver.tar.gz src || return 1
rsync --progress -La $pkgname-$pkgver.tar.gz \
$_disturl || return 1
cd $startdir && abuild undeps
}
build() {
cd "$builddir"/$pkgname || return 1
prepare() {
cd "$_builddir" || return 1
local i
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
mkdir -p "$builddir/src/github.com/hashicorp"
ln -s "$builddir" "$builddir/src/github.com/hashicorp/consul"
cd "$builddir/src/github.com/hashicorp/consul"
build() {
cd "$_builddir"/$pkgname || return 1
export GOPATH="$srcdir"
go build -v -o bin/consul \
-ldflags "-X main.GitDescribe $pkgver" || return 1
GOPATH="$builddir" go build -v -o bin/consul \
-ldflags "-X main.GitDescribe=$pkgver" || return 1
}
package() {
cd "$_builddir"
cd "$builddir"
# Consul init script
install -m755 -D "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname || return 1
......@@ -76,7 +43,7 @@ package() {
"$pkgdir"/etc/conf.d/$pkgname || return 1
# Main binary
install -m750 -o root -g consul \
-D ${pkgname}/bin/${pkgname} \
-D bin/${pkgname} \
"$pkgdir"/usr/sbin/${pkgname} || return 1
# Consul datadir
install -m750 -o consul -g consul -d "$pkgdir"/var/${pkgname} || return 1
......@@ -87,22 +54,22 @@ package() {
install -m640 -o root -g consul "$srcdir"/$cf "$pkgdir"/etc/${pkgname} || return 1
done
}
md5sums="9b75081b44ad0c6893e8efc2ab9a55f1 consul-0.5.2.tar.gz
34adfd50f993e57f5941d77963a23eef consul.initd
md5sums="fd77c4b472db5a3b7be79c71cd6686a3 consul-0.7.0.tar.gz
2b5a6c8ef08fe4b31bf812fa1157d2ba consul.initd
9873f8d9a30f788eda9298e89366a1c9 consul.confd
3ecdfa3d217bf8517a2b025da321811d acl.json.sample
3cfcc6f98d15ce3f3ac7021657786ab6 encrypt.json.sample
75a654690d6096987d52796a6e01e405 server.json
f16f70961c3297b54affc6f2c615873a tls.json.sample"
sha256sums="a2e8e8b180f74e22500832b562ddd9654e951b55aadf953b6fba3851195bceb5 consul-0.5.2.tar.gz
f6caf13d0797f1cdc3d861e3417baa4e4fc3e8beaf5698b278ce514b3af5edac consul.initd
sha256sums="d3616f204370aa199df516d792fe0835019aed7b6596aa7f6bdc71c2b1067494 consul-0.7.0.tar.gz
9f86a7da0b857ffff9e39b8e722285ed481636d4696f7311858c62a843176ad2 consul.initd
888aaaee84b3d8431526960becfdb123eaf438ae10fa58f59b5520ae0c0d0830 consul.confd
40b230f47a5a52eac87cfea4cdda99125a2136630bdf49d22af0df814201f313 acl.json.sample
927f9b480d4593a9d3dfe5e3e047e30fddc954a83157517135db3f60e7596a6f encrypt.json.sample
1058636fbbe66890c8a04a264f1200572202b205976aa562b07fe86f4faab89f server.json
b10bd00587a8ed56284e1c0bc9f1bdc6d556986320113ddf4e118042dc39cd2d tls.json.sample"
sha512sums="aad19aabf7652356837f3fd05f2c69d74a3324176c0ac22ed3212ad0545ef906024a66cef23d6f966fb5a0ab5322664e201b2ed11ce9a3ec338154f615286cf1 consul-0.5.2.tar.gz
8510cdd05c8fa8e856cbc3806d8851adfebf64f34d7736503e6516050df6c98537e0fe334a28dc8ce2278be87ab7e1c0e09f77f26848bb6fff70f28ff702218a consul.initd
sha512sums="1073dacbd2c9ceb5bb05f15f173daf8ac8ae215e32eefdb7fec0e5bf2c49cd486bb7d07829da217cf78956ea978d02c03611b74a7fa9d77003c42d1ba392f06f consul-0.7.0.tar.gz
b0b6ba59d5b2c07f269bf901a24d1dcfbf96953185582577cecf7e17a2909a98673ec780d107b6264e910425aeadcf21d4adcedb89d4616c4eb9840e08639c17 consul.initd
f2c5af74dfcbca2fea8ebea31139d93f44455b93ef17ec611b880d7071af4125615dbbd23969d0d04ca636c26d7b4e7eb97f1266baa89252097f4cbc5173d817 consul.confd
d4310dde63d3b8fc4791124bd255bf2a1402b86d00f6b1732e18b0caedb75eae6c77382e1a48f12469828ef4bb363db4580fb1aafa63fcdc97b1431f6ea96d58 acl.json.sample
ec30ad73c13f9dd5ba15389567436dbf74c24e822cb959c6ccc40a35e36e212313c70f3cf1ccee3f63a7bb98760173d6c2478161a25b85e14dd889a47572aff1 encrypt.json.sample
......
#!/sbin/runscript
#!/sbin/openrc-run
CONSUL_LOG_FILE="/var/log/${SVCNAME}.log"
name=consul
description="A tool for service discovery, monitoring and configuration"
description_checkconfig="Verify configuration file"
daemon=/usr/sbin/$name
daemon_user=$name
daemon_group=$name
extra_commands="checkconfig"
start_pre() {
checkpath -f -m 0644 -o ${SVCNAME}:${SVCNAME} "$CONSUL_LOG_FILE"
}
depend() {
need net
after firewall
}
checkconfig() {
consul configtest -config-dir /etc/consul
}
start() {
checkconfig || return 1
ebegin "Starting ${name}"
start-stop-daemon --start --quiet \
-m --pidfile /var/run/${name}.pid \
--user ${daemon_user} --group ${daemon_group} \
-b -1 /dev/null -2 /dev/null \
-b --stdout $CONSUL_LOG_FILE --stderr $CONSUL_LOG_FILE \
-k 027 --exec ${daemon} -- ${consul_opts}
eend $?
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment