From dd30633d723bb17edf9c1c78c5f8307cce9445ea Mon Sep 17 00:00:00 2001 From: Zac Holland Date: Mon, 18 Dec 2023 12:12:03 -0800 Subject: [PATCH] add section for removing legacy installations --- tailscale.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tailscale.sh b/tailscale.sh index 78164dc..7c8a357 100644 --- a/tailscale.sh +++ b/tailscale.sh @@ -31,6 +31,28 @@ curl -s "https://pkgs.tailscale.com/stable/${tarball}" -o tailscale.tgz echo "done." +echo -n "Uninstalling Legacy Installation..." + +# Stop and disable the systemd service +if systemctl is-active --quiet tailscaled; then + systemctl stop tailscaled +fi +if systemctl is-enabled --quiet tailscaled; then + systemctl disable tailscaled +fi + +# Remove the systemd system extension +if [ $(systemd-sysext list | grep -c "/var/lib/extensions/tailscale") -ne 0 ]; then + systemd-sysext unmerge > /dev/null + rm -rf /var/lib/extensions/tailscale + systemd-sysext merge > /dev/null +fi + +# Remove the overrides conf +if test -f /etc/systemd/system/tailscaled.service.d/override.conf; then + cp -rf $tar_dir/systemd/tailscaled.defaults /home/deck/.config/tailscaled.defaults +fi + echo -n "Installing..." # extract the tailscale binaries