From f7eb620e9cb45136351fee1bdfc58af5973eaf2a Mon Sep 17 00:00:00 2001 From: Frank Edwards Date: Mon, 1 May 2023 15:10:42 +1000 Subject: [PATCH] 0.1.16 Tailscale 1.40.0 Alter machine deletion logic to check tailscale version. --- build.sh | 4 ++-- tailscale.sh | 29 +++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index 86a94f1..582e444 100755 --- a/build.sh +++ b/build.sh @@ -25,8 +25,8 @@ # https://mikrotik.com/products/matrix # PLATFORM="linux/arm/v7" -TAILSCALE_VERSION=1.38.1 -VERSION=0.1.15 +TAILSCALE_VERSION=1.40.0 +VERSION=0.1.16 set -eu diff --git a/tailscale.sh b/tailscale.sh index 75fff53..fbeb905 100755 --- a/tailscale.sh +++ b/tailscale.sh @@ -7,7 +7,7 @@ echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.conf echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.conf sysctl -p /etc/sysctl.conf -# Prepare run dir +# Prepare run dirs if [ ! -d "/var/run/sshd" ]; then mkdir -p /var/run/sshd fi @@ -21,23 +21,20 @@ for s in "${SUBNETS[@]}"; do ip route add "$s" via "${CONTAINER_GATEWAY}" done -# Check if this is first-time container startup -if [ ! -f "/var/run/tailscale.sh.pid" ]; then - # Delete all the old devices with this hostname. - IDS=$(curl -sSL "https://api.tailscale.com/api/v2/domain/${DOMAIN}/devices" -u "${API_KEY}:" | jq -r '.[][] | select(.hostname == "'${HOSTNAME}'") | .id' || echo "") - while IFS= read -r id; do - if [[ ! -z "$id" ]]; then - echo "deleting tailscale device: $id"; - curl -sSL -XDELETE -u "${API_KEY}:" "https://api.tailscale.com/api/v2/device/$id"; - fi - done </var/run/tailscale.sh.pid - -# Start tailscaled and bring tailscale up +# Start tailscaled and bring tailscale up /usr/local/bin/tailscaled & until /usr/local/bin/tailscale up \ --reset --authkey=${AUTH_KEY} \