forked from ungleich-public/cdist
consul, changelog, consul agent => alpine
This commit is contained in:
parent
4a5425a95e
commit
21a16f5584
7 changed files with 71 additions and 26 deletions
1
cdist/conf/type/__consul/files/versions/1.5.0/cksum
Normal file
1
cdist/conf/type/__consul/files/versions/1.5.0/cksum
Normal file
|
@ -0,0 +1 @@
|
||||||
|
886614099 103959898 consul
|
1
cdist/conf/type/__consul/files/versions/1.5.0/source
Normal file
1
cdist/conf/type/__consul/files/versions/1.5.0/source
Normal file
|
@ -0,0 +1 @@
|
||||||
|
https://releases.hashicorp.com/consul/1.5.0/consul_1.5.0_linux_amd64.zip
|
|
@ -42,7 +42,7 @@ source_file_name="${source##*/}"
|
||||||
cksum_should=$(cut -d' ' -f1,2 "$version_dir/cksum")
|
cksum_should=$(cut -d' ' -f1,2 "$version_dir/cksum")
|
||||||
|
|
||||||
cat << eof
|
cat << eof
|
||||||
tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX")
|
tmpdir=\$(mktemp -d -p /tmp "${__type##*/}.XXXXXXXXXX")
|
||||||
curl -s -L "$source" > "\$tmpdir/$source_file_name"
|
curl -s -L "$source" > "\$tmpdir/$source_file_name"
|
||||||
unzip -p "\$tmpdir/$source_file_name" > "${destination}.tmp"
|
unzip -p "\$tmpdir/$source_file_name" > "${destination}.tmp"
|
||||||
rm -rf "\$tmpdir"
|
rm -rf "\$tmpdir"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
|
alpine|scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
|
||||||
# any linux should work
|
# any linux should work
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
|
@ -47,6 +47,7 @@ fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/direct" ]; then
|
if [ -f "$__object/parameter/direct" ]; then
|
||||||
__package unzip
|
__package unzip
|
||||||
|
__package curl
|
||||||
else
|
else
|
||||||
__staged_file /usr/local/bin/consul \
|
__staged_file /usr/local/bin/consul \
|
||||||
--source "$(cat "$version_dir/source")" \
|
--source "$(cat "$version_dir/source")" \
|
||||||
|
|
38
cdist/conf/type/__consul_agent/files/consul.sys-openrc
Normal file
38
cdist/conf/type/__consul_agent/files/consul.sys-openrc
Normal 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 $?
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# 2015 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 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.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
scientific|centos|debian|devuan|redhat|ubuntu)
|
alpine|scientific|centos|debian|devuan|redhat|ubuntu)
|
||||||
# whitelist safeguard
|
# whitelist safeguard
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
|
@ -181,22 +181,25 @@ init_upstart()
|
||||||
|
|
||||||
# Install init script to start on boot
|
# Install init script to start on boot
|
||||||
case "$os" in
|
case "$os" in
|
||||||
centos|redhat)
|
alpine|devuan)
|
||||||
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
|
init_sysvinit debian
|
||||||
major_version="${os_version%%.*}"
|
;;
|
||||||
case "$major_version" in
|
centos|redhat)
|
||||||
[456])
|
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
|
||||||
init_sysvinit redhat
|
major_version="${os_version%%.*}"
|
||||||
;;
|
case "$major_version" in
|
||||||
7)
|
[456])
|
||||||
init_systemd
|
init_sysvinit redhat
|
||||||
;;
|
;;
|
||||||
*)
|
7)
|
||||||
echo "Unsupported CentOS/Redhat version: $os_version" >&2
|
init_systemd
|
||||||
exit 1
|
;;
|
||||||
;;
|
*)
|
||||||
esac
|
echo "Unsupported CentOS/Redhat version: $os_version" >&2
|
||||||
;;
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
debian)
|
debian)
|
||||||
os_version=$(cat "$__global/explorer/os_version")
|
os_version=$(cat "$__global/explorer/os_version")
|
||||||
|
@ -214,13 +217,9 @@ case "$os" in
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
devuan)
|
|
||||||
init_sysvinit debian
|
|
||||||
;;
|
|
||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
init_upstart
|
init_upstart
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
Changelog
|
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
|
5.0.2: 2019-05-17
|
||||||
* Type __package_apk: Fix @repo handling in explorer (Nico Schottelius)
|
* Type __package_apk: Fix @repo handling in explorer (Nico Schottelius)
|
||||||
* Type __postfix: Add alpine support (Nico Schottelius)
|
* Type __postfix: Add alpine support (Nico Schottelius)
|
||||||
|
|
Loading…
Reference in a new issue