tailscale.sh aktualisiert

This commit is contained in:
2024-09-16 09:57:43 +02:00
parent 157071b334
commit f9ddd1ba06

View File

@@ -3,6 +3,16 @@
# #
# For more information see: [Link TBD] # For more information see: [Link TBD]
# Import variables from s6-overlay images
if [ -x "/usr/bin/with-contenv" ]; then
echo "just-containers s6-overlay image found, importing variables..."
ENV_VARS="$(/usr/bin/with-contenv bash -c 'env')"
while IFS='=' read -r KEY VALUE; do
export "${KEY}"="${VALUE}"
done <<< "${ENV_VARS}"
fi
error_handler() { error_handler() {
echo echo
echo "=======================" echo "======================="
@@ -11,6 +21,7 @@ error_handler() {
echo "=======================" echo "======================="
echo echo
if [[ ! -f /usr/bin/tailscale || ! -f /usr/bin/tailscaled ]]; then if [[ ! -f /usr/bin/tailscale || ! -f /usr/bin/tailscaled ]]; then
if [ ! -z "${TAILSCALE_EXIT_NODE_IP}" ]; then if [ ! -z "${TAILSCALE_EXIT_NODE_IP}" ]; then
if [ ! -c /dev/net/tun ]; then if [ ! -c /dev/net/tun ]; then
@@ -139,16 +150,11 @@ else
TSD_PARAMS+=">/dev/null 2>&1 " TSD_PARAMS+=">/dev/null 2>&1 "
fi fi
if [[ -z "${TAILSCALE_AUTHKEY}" && ! -f ${TSD_STATE_DIR}/.initialized ]]; then if [[ ! -z "${TAILSCALE_AUTHKEY}" && -f ${TSD_STATE_DIR}/.initialized ]]; then
echo "ERROR: No Authorization key defined! See https://tailscale.com/kb/1085/auth-keys#generate-an-auth-key"
error_handler
elif [[ ! -z "${TAILSCALE_AUTHKEY}" && -f ${TSD_STATE_DIR}/.initialized ]]; then
echo echo
echo "-> It is now save to remove the variable TAILSCALE_AUTHKEY from your template <-" echo "-> It is now save to remove the variable TAILSCALE_AUTHKEY from your template <-"
echo echo
unset TAILSCALE_AUTHKEY unset TAILSCALE_AUTHKEY
else
unset TAILSCALE_AUTHKEY
fi fi
if [ ! -z "${TAILSCALE_AUTHKEY}" ]; then if [ ! -z "${TAILSCALE_AUTHKEY}" ]; then