From d79c4acec27f5bd0e1566b16f8a499bae84e8145 Mon Sep 17 00:00:00 2001 From: Alex Kretzschmar Date: Mon, 23 Jun 2025 16:45:33 -0400 Subject: [PATCH] Fix PATH issue on Steam Deck by using adaptive symlink locations - Detect Steam Deck via /etc/os-release and use ~/.local/bin for symlinks - Fall back to /usr/local/bin on other systems to avoid read-only filesystem - Ensure target directories exist with mkdir -p before creating symlinks - Keep profile.d approach as fallback and source for immediate availability - Update uninstall script to clean up symlinks from both possible locations - Use rm -rf for systemd override directory and specific file removal Fixes #38 --- tailscale.sh | 22 +++++++++++++++------- uninstall.sh | 5 +++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tailscale.sh b/tailscale.sh index 7025185..c584d11 100644 --- a/tailscale.sh +++ b/tailscale.sh @@ -63,18 +63,26 @@ cp -rf $tar_dir/tailscaled /opt/tailscale/tailscaled chmod +x /opt/tailscale/tailscale chmod +x /opt/tailscale/tailscaled -# Create symbolic links in /usr/local/bin (which is typically in PATH) -# Ensure the directory exists first -mkdir -p /usr/local/bin +# 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 + # Steam Deck detected - use ~/.local/bin + SYMLINK_DIR="/home/deck/.local/bin" + mkdir -p "$SYMLINK_DIR" +else + # Other systems - use /usr/local/bin + SYMLINK_DIR="/usr/local/bin" + mkdir -p "$SYMLINK_DIR" +fi # Remove existing symlinks first if they exist -rm -f /usr/local/bin/tailscale /usr/local/bin/tailscaled +rm -f "$SYMLINK_DIR/tailscale" "$SYMLINK_DIR/tailscaled" # Create new symbolic links -ln -s /opt/tailscale/tailscale /usr/local/bin/tailscale -ln -s /opt/tailscale/tailscaled /usr/local/bin/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 /usr/local/bin isn't in PATH +# 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 diff --git a/uninstall.sh b/uninstall.sh index b0e3c77..9867710 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -4,8 +4,9 @@ rm -f /etc/systemd/system/tailscaled.service rm -rf /etc/systemd/system/tailscaled.service.d rm -f /etc/default/tailscaled rm -f /etc/profile.d/tailscale.sh -rm -f /usr/local/bin/tailscale -rm -f /usr/local/bin/tailscaled +# Remove symlinks from both possible locations (Steam Deck and other systems) +rm -f /usr/local/bin/tailscale /usr/local/bin/tailscaled +rm -f /home/deck/.local/bin/tailscale /home/deck/.local/bin/tailscaled # Remove specific Tailscale binaries rm -f /opt/tailscale/tailscale rm -f /opt/tailscale/tailscaled