From 2c344bfcfea21e9f4d28f9d05c545e6dae22d9b4 Mon Sep 17 00:00:00 2001 From: sixcorners Date: Fri, 10 Jan 2025 16:02:27 -0500 Subject: [PATCH 1/3] Make .sh files executable --- readme.md | 4 ++-- tailscale.sh | 0 uninstall.sh | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 tailscale.sh mode change 100644 => 100755 uninstall.sh diff --git a/readme.md b/readme.md index bd7c815..a88f85a 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ automatically on boot (no need to enter desktop mode). ## Installing Tailscale 1. Clone this repo to your Deck. -2. Run `sudo bash tailscale.sh` to install Tailscale (or update the existing +2. Run `sudo ./tailscale.sh` to install Tailscale (or update the existing installation). 3. Run `source /etc/profile.d/tailscale.sh` to put the binaries in your path 4. Run `sudo tailscale up --qr --operator=deck --ssh` to have Tailscale generate @@ -27,7 +27,7 @@ If it doesn't, keep reading. > [Suggestions for how to fix this are welcomed.](https://github.com/legowerewolf/deck-tailscale/issues/2) 1. Git fetch and pull to make sure you're up to date. -2. Run `sudo bash tailscale.sh` again. +2. Run `sudo ./tailscale.sh` again. This process overwrites the existing binaries and service file, so it's not recommended to tweak those files directly. The configuration file at diff --git a/tailscale.sh b/tailscale.sh old mode 100644 new mode 100755 diff --git a/uninstall.sh b/uninstall.sh old mode 100644 new mode 100755 index bcb7670..daecfa9 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,3 +1,4 @@ +#!/bin/sh systemctl stop tailscaled systemctl disable tailscaled rm /etc/systemd/system/tailscaled.service From 5b6c0544610f2cf4d9b553e0be381c58cfdbb6cb Mon Sep 17 00:00:00 2001 From: sixcorners Date: Fri, 10 Jan 2025 16:02:43 -0500 Subject: [PATCH 2/3] Remove override.conf in uninstall.sh --- uninstall.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uninstall.sh b/uninstall.sh index daecfa9..4bfe8bb 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -5,3 +5,5 @@ rm /etc/systemd/system/tailscaled.service rm /etc/default/tailscaled rm /etc/profile.d/tailscale.sh rm -rf /opt/tailscale/tailscale +rm /etc/systemd/system/tailscaled.service.d/override.conf +rmdir /etc/systemd/system/tailscaled.service.d From 897f70c026d32998b9ecc4e8fa722c15201069e3 Mon Sep 17 00:00:00 2001 From: sixcorners Date: Fri, 10 Jan 2025 16:42:04 -0500 Subject: [PATCH 3/3] Use trap to delete the temporary directory --- tailscale.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tailscale.sh b/tailscale.sh index 702f166..cec5d87 100755 --- a/tailscale.sh +++ b/tailscale.sh @@ -11,6 +11,7 @@ pushd . > /dev/null # make a temporary directory, save the name, and move into it dir="$(mktemp -d)" +trap "rm -rf -- ${dir@Q}" EXIT cd "${dir}" echo -n "Getting version..." @@ -73,9 +74,8 @@ if ! test -f /etc/default/tailscaled; then cp -rf $tar_dir/systemd/tailscaled.defaults /etc/default/tailscaled fi -# return to our original directory (silently) and clean up +# return to our original directory (silently) popd > /dev/null -rm -rf "${dir}" # if an override file already exists, back up and remove if test -f /etc/systemd/system/tailscaled.service.d/override.conf; then