Skip to content

Instantly share code, notes, and snippets.

@Luzifer
Last active December 14, 2018 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luzifer/1c94a94c25ae45986c164570ff6c2f59 to your computer and use it in GitHub Desktop.
Save Luzifer/1c94a94c25ae45986c164570ff6c2f59 to your computer and use it in GitHub Desktop.
Binary package as alternative to deprecated community/consul - https://www.archlinux.org/packages/community/x86_64/consul/
CONSUL_FLAGS=""
post_upgrade() {
# improved permissions since 0.9.3-1
if [ "$(vercmp "$2" "0.9.3")" -lt 0 ]; then
chown 0:208 /etc/consul.d
chmod 0750 /etc/consul.d
echo -en "----\nThe directory permissions for /etc/consul.d/ have been fixed.\n----\n"
fi
true
}
[Unit]
Description=Consul Agent
Requires=network-online.target
After=network-online.target
[Service]
User=consul
Group=consul
EnvironmentFile=-/etc/default/consul
Restart=on-failure
ExecStart=/usr/bin/consul agent $CONSUL_FLAGS -config-dir=/etc/consul.d
ExecReload=/usr/bin/kill -HUP $MAINPID
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
u consul 208 - /var/lib/consul
{
"data_dir": "/var/lib/consul",
"disable_update_check": true,
"log_level": "INFO",
"node_name": "example.localdomain",
"server": true
}
pkgname=consul-bin
pkgver=1.4.0
pkgrel=1
pkgdesc="A tool for service discovery, monitoring and configuration."
arch=('x86_64')
url="https://www.consul.io"
license=('MPL2')
depends=('glibc')
conflicts=('consul')
source=("${pkgname}-${pkgver}.zip::https://releases.hashicorp.com/consul/${pkgver}/consul_${pkgver}_linux_amd64.zip"
'consul.service'
'consul.default'
'consul.sysusers'
'example.json')
install=consul.install
backup=('etc/default/consul')
sha512sums=('ce1656a23f9455194354507fcf0343d410bc294a8251575d354bc3cbc994d451508e0834e14b0a14fd92a95d298df2fd5e6128dd06d47083b0c250f912b7630d'
'c70b9d1556f6c7ecb2e915ab685f289cef0e31198bd2e50c74a0483bbfb387beec67334f539a90adbf68b61b07946e98b300ab8a8e26e53b35f4ab4894adeb04'
'ec5a800529a297c709fa383c094ecf106351cf0f8ac7b613b972d415d77fe001088902d7ab805e63e78a8e6360323fec1b795db5a4446df1e21b9b4ed31e7079'
'ef872aedb2bc022a29292b7972a792b22e684c1ccb904a2b2cfec6d8966c28fb19be1452ce060821c419f1b646b236ba2e783175595e4bb6926d164c27a15c87'
'c4292b8f56ee955ed7385a49843fd90d6434029891b3e1e724cb2fc841514c06e2554a26d3937c114371b18c2168c4e64319eb2cbd726ee8b35870df19089348')
package() {
install -D -d -m750 -o 208 -g 208 "${pkgdir}/var/lib/consul"
install -D -d -m750 -o 0 -g 208 "${pkgdir}/etc/consul.d"
install -D -m644 "${srcdir}/consul.default" "${pkgdir}/etc/default/consul"
install -D -m644 -o 0 -g 0 "${srcdir}/example.json" "${pkgdir}/usr/share/doc/consul/config.example.json"
install -Dm755 "consul" "${pkgdir}/usr/bin/consul"
install -Dm644 "${srcdir}/consul.service" "${pkgdir}/usr/lib/systemd/system/consul.service"
install -Dm644 "${srcdir}/consul.sysusers" "${pkgdir}/usr/lib/sysusers.d/consul.conf"
}
# vim:set ts=2 sw=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment