diff --git a/tailscale.sh b/tailscale.sh index c584d11..a4f15fa 100644 --- a/tailscale.sh +++ b/tailscale.sh @@ -65,14 +65,26 @@ chmod +x /opt/tailscale/tailscaled # Create symbolic links for PATH access # On Steam Deck, /usr/local/bin is read-only, so use ~/.local/bin instead -if [ -f /etc/os-release ] && grep -q "steamdeck" /etc/os-release; then +if [ -f /etc/os-release ] && (grep -q "ID=steamos" /etc/os-release || grep -q "VARIANT_ID=steamdeck" /etc/os-release); then # Steam Deck detected - use ~/.local/bin SYMLINK_DIR="/home/deck/.local/bin" mkdir -p "$SYMLINK_DIR" + + # Create the profile script with both paths for Steam Deck + if ! test -f /etc/profile.d/tailscale.sh; then + echo 'PATH="$PATH:/home/deck/.local/bin:/opt/tailscale"' >> /etc/profile.d/tailscale.sh + source /etc/profile.d/tailscale.sh + fi else # Other systems - use /usr/local/bin SYMLINK_DIR="/usr/local/bin" mkdir -p "$SYMLINK_DIR" + + # Create the profile script for other systems + if ! test -f /etc/profile.d/tailscale.sh; then + echo 'PATH="$PATH:/opt/tailscale"' >> /etc/profile.d/tailscale.sh + source /etc/profile.d/tailscale.sh + fi fi # Remove existing symlinks first if they exist @@ -82,12 +94,6 @@ rm -f "$SYMLINK_DIR/tailscale" "$SYMLINK_DIR/tailscaled" ln -s /opt/tailscale/tailscale "$SYMLINK_DIR/tailscale" ln -s /opt/tailscale/tailscaled "$SYMLINK_DIR/tailscaled" -# Also add to profile.d as fallback for environments where symlink directory isn't in PATH -if ! test -f /etc/profile.d/tailscale.sh; then - echo 'PATH="$PATH:/opt/tailscale"' >> /etc/profile.d/tailscale.sh - source /etc/profile.d/tailscale.sh -fi - # copy the systemd file into place cp -rf $tar_dir/systemd/tailscaled.service /etc/systemd/system/tailscaled.service