From df217b8353438a39d45dca23d634e0b13a08ea97 Mon Sep 17 00:00:00 2001 From: Laszlo Magyar Date: Sat, 29 Apr 2023 14:18:07 +0200 Subject: [PATCH 1/3] remove duplicate status checks from dependent s6 services --- .../etc/s6-overlay/s6-rc.d/post-tailscaled/run | 15 ++++++++++++++- tailscale/rootfs/etc/s6-overlay/s6-rc.d/proxy/run | 8 -------- .../rootfs/etc/s6-overlay/s6-rc.d/taildrop/run | 8 -------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run index 5d61ed98..db8ceb05 100755 --- a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run +++ b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run @@ -92,4 +92,17 @@ do sleep 2 done -/opt/tailscale up "${options[@]}" +# Start Tailscale +if ! /opt/tailscale up "${options[@]}"; then + bashio::log.error "Unable to start up Tailscale" + bashio::exit.nok +fi + +# Wait for the network to be available and logged in +while ! /opt/tailscale status --json --peers=false --self=false \ + | jq --exit-status '.BackendState == "Running"' > /dev/null +do + sleep 2 +done + +bashio::log.info "Tailscale is running" diff --git a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/proxy/run b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/proxy/run index 06ecf80c..2724d45a 100755 --- a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/proxy/run +++ b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/proxy/run @@ -7,14 +7,6 @@ declare domain -# Wait for the network to be available and logged in -while ! bashio::fs.socket_exists "/var/run/tailscale/tailscaled.sock" || \ - ! /opt/tailscale status --json --peers=false --self=false \ - | jq --exit-status '.BackendState == "Running"' > /dev/null -do - sleep 2 -done - # Check if Tailscale HTTPS is enabled if ! /opt/tailscale status --self=true --peers=false --json \ | jq -rce ".CertDomains[0]" > /dev/null; diff --git a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/taildrop/run b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/taildrop/run index 7aa8dd57..13ed8397 100755 --- a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/taildrop/run +++ b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/taildrop/run @@ -5,14 +5,6 @@ # Fetches files send via Taildrop # ============================================================================== -# Wait for the network to be available and logged in -while ! bashio::fs.socket_exists "/var/run/tailscale/tailscaled.sock" || \ - ! /opt/tailscale status --json --peers=false --self=false \ - | jq --exit-status '.BackendState == "Running"' > /dev/null -do - sleep 2 -done - # Ensure the directory exists mkdir -p /share/taildrop From e98ae4b0dff4efa1f95769adab40b64ae47e8061 Mon Sep 17 00:00:00 2001 From: Laszlo Magyar Date: Sat, 9 Sep 2023 10:14:41 +0200 Subject: [PATCH 2/3] warn about key expiration --- .../rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run index db8ceb05..234783ca 100755 --- a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run +++ b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run @@ -10,6 +10,7 @@ declare -a routes=() declare ipinfo declare login_server declare tags +declare keyexpiry function appendarray() { local -n array=${1} @@ -106,3 +107,10 @@ do done bashio::log.info "Tailscale is running" + +# Warn about key expiration +if keyexpiry=$(/opt/tailscale status --self=true --peers=false --json | jq -rce '.Self.KeyExpiry'); then + bashio::log.warning "The connection's key will expire on: ${keyexpiry}" + bashio::log.warning "Consider disabling key expiry to avoid losing connection to your Home Assistant device." + bashio::log.warning "Please check your configuration based on the add-on's Documentation under \"Configuration\"" +fi From ecfa7478a6cdf28a5dc1cf7ab1496d25042d0fe7 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 15 Oct 2023 19:21:43 +0200 Subject: [PATCH 3/3] Tiny tweak --- tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run index 6e06a2b5..fe0594bc 100755 --- a/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run +++ b/tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run @@ -110,7 +110,7 @@ done if keyexpiry=$(/opt/tailscale status --self=true --peers=false --json | jq -rce '.Self.KeyExpiry'); then bashio::log.warning "The connection's key will expire on: ${keyexpiry}" bashio::log.warning "Consider disabling key expiry to avoid losing connection to your Home Assistant device." - bashio::log.warning "Please check your configuration based on the add-on's Documentation under \"Configuration\"" + bashio::log.warning "Please check your configuration based on the add-on's documentation under \"Configuration\"" fi bashio::log.info "Tailscale is running"