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 index 702f166..cec5d87 --- 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 diff --git a/uninstall.sh b/uninstall.sh old mode 100644 new mode 100755 index bcb7670..4bfe8bb --- a/uninstall.sh +++ b/uninstall.sh @@ -1,6 +1,9 @@ +#!/bin/sh systemctl stop tailscaled systemctl disable tailscaled 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