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
This commit is contained in:
Alex Kretzschmar
2025-06-23 16:45:33 -04:00
parent 76ced54ce8
commit d79c4acec2
2 changed files with 18 additions and 9 deletions

View File

@@ -63,18 +63,26 @@ cp -rf $tar_dir/tailscaled /opt/tailscale/tailscaled
chmod +x /opt/tailscale/tailscale chmod +x /opt/tailscale/tailscale
chmod +x /opt/tailscale/tailscaled chmod +x /opt/tailscale/tailscaled
# Create symbolic links in /usr/local/bin (which is typically in PATH) # Create symbolic links for PATH access
# Ensure the directory exists first # On Steam Deck, /usr/local/bin is read-only, so use ~/.local/bin instead
mkdir -p /usr/local/bin 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 # 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 # Create new symbolic links
ln -s /opt/tailscale/tailscale /usr/local/bin/tailscale ln -s /opt/tailscale/tailscale "$SYMLINK_DIR/tailscale"
ln -s /opt/tailscale/tailscaled /usr/local/bin/tailscaled 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 if ! test -f /etc/profile.d/tailscale.sh; then
echo 'PATH="$PATH:/opt/tailscale"' >> /etc/profile.d/tailscale.sh echo 'PATH="$PATH:/opt/tailscale"' >> /etc/profile.d/tailscale.sh
source /etc/profile.d/tailscale.sh source /etc/profile.d/tailscale.sh

View File

@@ -4,8 +4,9 @@ rm -f /etc/systemd/system/tailscaled.service
rm -rf /etc/systemd/system/tailscaled.service.d rm -rf /etc/systemd/system/tailscaled.service.d
rm -f /etc/default/tailscaled rm -f /etc/default/tailscaled
rm -f /etc/profile.d/tailscale.sh rm -f /etc/profile.d/tailscale.sh
rm -f /usr/local/bin/tailscale # Remove symlinks from both possible locations (Steam Deck and other systems)
rm -f /usr/local/bin/tailscaled 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 # Remove specific Tailscale binaries
rm -f /opt/tailscale/tailscale rm -f /opt/tailscale/tailscale
rm -f /opt/tailscale/tailscaled rm -f /opt/tailscale/tailscaled