Skip to content

Commit

Permalink
fix: fix toggle-tailscale just command on aurora (#1621)
Browse files Browse the repository at this point in the history
  • Loading branch information
remggo authored Aug 23, 2024
1 parent 839af6c commit f6393be
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions just/bluefin-system.just
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ toggle-tailscale:
#!/bin/bash
set -euo pipefail
source /usr/lib/ujust/ujust.sh
source /usr/lib/os-release

TAILSCALED_STATUS="$(systemctl is-enabled tailscaled || true )"

Expand All @@ -301,22 +302,31 @@ toggle-tailscale:
echo "tailscaled service status: $TAILSCALED_STATUS"
fi

TAILSCALE_QS="$(gnome-extensions list | grep -q "tailscale@joaophi.github.com"; echo $?)"
if [ "$TAILSCALE_QS" == 0 ]; then
TAILSCALE_QS="Installed"
else
echo "The Tailscale QS extension for Gnome is not installed. Please install it and then run this script again."
fi

if [ "$TAILSCALE_QS" == "Installed" ] && [ "$TAILSCALED" == "Installed" ]; then
if [ "$TAILSCALED" == "Installed" ]; then
echo "Enable or disable Tailscale?"
TS_OPTION=$(ugum choose Enable Disable)

# gnome-extensions is only available on Bluefin (Gnome)
if [ "$VARIANT" == "silverblue" ]; then
TAILSCALE_QS="$(gnome-extensions list | grep -q "tailscale@joaophi.github.com"; echo $?)"
if [ "$TAILSCALE_QS" == 0 ]; then
TAILSCALE_QS="Installed"
else
echo "The Tailscale QS extension for Gnome is not installed. Please install it and then run this script again."
fi

if [ "$TS_OPTION" = "Enable" ]; then
gnome-extensions enable tailscale@joaophi.github.com
elif [ "$TS_OPTION" = "Disable" ]; then
gnome-extensions disable tailscale@joaophi.github.com
fi
fi

if [ "$TS_OPTION" = "Enable" ]; then
systemctl enable --now tailscaled
TAILSCALED_STATUS="$(systemctl is-enabled tailscaled || true )"
if [ "$TAILSCALED_STATUS" == "enabled" ]; then
gnome-extensions enable tailscale@joaophi.github.com
echo "${b}${green}Tailscale is enabled.${n}"
echo "If this is your first time using Tailscale, setup is necessary."
echo "Refer to Tailscale's documentation at https://tailscale.com/kb/1346/start."
Expand All @@ -325,7 +335,6 @@ toggle-tailscale:
systemctl disable --now tailscaled
TAILSCALED_STATUS="$(systemctl is-enabled tailscaled || true )"
if [ "$TAILSCALED_STATUS" == "disabled" ]; then
gnome-extensions disable tailscale@joaophi.github.com
echo "${b}${red}Tailscale is disabled.${n}"
fi
fi
Expand Down

0 comments on commit f6393be

Please sign in to comment.