From 76dd558dfe33cb7f10dfe976b8840d41f4378026 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Tue, 5 Mar 2024 19:34:03 -0800 Subject: [PATCH] src/tailscale: improve compatibility of io redirects (#32) Fixes #26 --- src/tailscale/tailscaled-entrypoint.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tailscale/tailscaled-entrypoint.sh b/src/tailscale/tailscaled-entrypoint.sh index c800a9d..195f227 100644 --- a/src/tailscale/tailscaled-entrypoint.sh +++ b/src/tailscale/tailscaled-entrypoint.sh @@ -12,18 +12,21 @@ set -euxo pipefail export TS_DEBUG_FIREWALL_MODE=auto if [[ "$(id -u)" -eq 0 ]]; then mkdir -p /workspaces/.tailscale || true - /usr/local/sbin/tailscaled \ + 2>/dev/null >/dev/null \ + /usr/local/sbin/tailscaled \ --statedir=/workspaces/.tailscale/ \ --socket=/var/run/tailscale/tailscaled.sock \ - --port=41641 \ - &> /dev/null & -elif command -v sudo &> /dev/null; then - sudo --non-interactive sh -c 'mkdir -p /workspaces/.tailscale ; /usr/local/sbin/tailscaled \ + --port=41641 & +elif command -v sudo > /dev/null; then + sudo --non-interactive mkdir -p /workspaces/.tailscale + 2>/dev/null >/dev/null \ + sudo --non-interactive \ + /usr/local/sbin/tailscaled \ --statedir=/workspaces/.tailscale/ \ --socket=/var/run/tailscale/tailscaled.sock \ - --port=41641 &> /dev/null' & + --port=41641 & else - echo "tailscaled could not start as root." 1&>2 + >&2 echo "tailscaled could not start as root." fi unset TS_DEBUG_FIREWALL_MODE