consul, changelog, consul agent => alpine

This commit is contained in:
Nico Schottelius 2019-05-18 23:46:09 +02:00
parent 4a5425a95e
commit 21a16f5584
7 changed files with 71 additions and 26 deletions

View file

@ -0,0 +1 @@
886614099 103959898 consul

View file

@ -0,0 +1 @@
https://releases.hashicorp.com/consul/1.5.0/consul_1.5.0_linux_amd64.zip

View file

@ -42,7 +42,7 @@ source_file_name="${source##*/}"
cksum_should=$(cut -d' ' -f1,2 "$version_dir/cksum")
cat << eof
tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX")
tmpdir=\$(mktemp -d -p /tmp "${__type##*/}.XXXXXXXXXX")
curl -s -L "$source" > "\$tmpdir/$source_file_name"
unzip -p "\$tmpdir/$source_file_name" > "${destination}.tmp"
rm -rf "\$tmpdir"

View file

@ -24,7 +24,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
alpine|scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
# any linux should work
:
;;
@ -47,6 +47,7 @@ fi
if [ -f "$__object/parameter/direct" ]; then
__package unzip
__package curl
else
__staged_file /usr/local/bin/consul \
--source "$(cat "$version_dir/source")" \

View file

@ -0,0 +1,38 @@
#!/sbin/openrc-run
# 2019 Nico Schottelius (nico-cdist at schottelius.org)
description="consul agent"
pidfile="${CONSUL_PIDFILE:-"/var/run/$RC_SVCNAME/pidfile"}"
command="${CONSUL_BINARY:-"/usr/local/bin/consul"}"
checkconfig() {
if [ ! -d /var/run/consul ] ; then
mkdir -p /var/run/consul || return 1
chown consul:consul /var/run/$NAME || return 1
chmod 2770 /var/run/$NAME || return 1
fi
}
start() {
need net
start-stop-daemon --start --quiet --oknodo \
--pidfile "$pidfile" --background \
--exec $command -- agent -pid-file="$pidfile" -config-dir /etc/consul/conf.d
}
start_pre() {
checkconfig
}
stop() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop --exec "$command" \
--pidfile "$pidfile" --quiet
eend $?
}

View file

@ -1,7 +1,7 @@
#!/bin/sh -e
#
# 2015 Steven Armstrong (steven-cdist at armstrong.cc)
# 2015 Nico Schottelius (nico-cdist at schottelius.org)
# 2015-2019 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
scientific|centos|debian|devuan|redhat|ubuntu)
alpine|scientific|centos|debian|devuan|redhat|ubuntu)
# whitelist safeguard
:
;;
@ -181,22 +181,25 @@ init_upstart()
# Install init script to start on boot
case "$os" in
centos|redhat)
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
major_version="${os_version%%.*}"
case "$major_version" in
[456])
init_sysvinit redhat
;;
7)
init_systemd
;;
*)
echo "Unsupported CentOS/Redhat version: $os_version" >&2
exit 1
;;
esac
;;
alpine|devuan)
init_sysvinit debian
;;
centos|redhat)
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
major_version="${os_version%%.*}"
case "$major_version" in
[456])
init_sysvinit redhat
;;
7)
init_systemd
;;
*)
echo "Unsupported CentOS/Redhat version: $os_version" >&2
exit 1
;;
esac
;;
debian)
os_version=$(cat "$__global/explorer/os_version")
@ -214,13 +217,9 @@ case "$os" in
exit 1
;;
esac
;;
devuan)
init_sysvinit debian
;;
;;
ubuntu)
init_upstart
;;
;;
esac

View file

@ -1,6 +1,11 @@
Changelog
---------
next:
* Type __consul: Add alpine support (Nico Schottelius)
* Type __consul: Add version 1.5.0 (Nico Schottelius)
* Type __consul_agent: Add alpine support (Nico Schottelius)
5.0.2: 2019-05-17
* Type __package_apk: Fix @repo handling in explorer (Nico Schottelius)
* Type __postfix: Add alpine support (Nico Schottelius)