Skip to content

Make sh files executable, have uninstall remove override.conf, and use trap to clean up the temp dir #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tailscale.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions uninstall.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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