#!/usr/bin/env pwsh # scripts/deck-sgdb-art.ps1 # # Upload deck-sgdb-art.py to the Steam Deck and run it. # Handles the Windows SSH ASKPASS dance (no sshpass/plink on Windows). # # Prerequisites: # * Steam Deck sshd running: ssh into Deck → sudo systemctl start sshd # * Password for deck user in Obsidian vault (Homelab/ROM Library.md, Access section) # * Tailscale connected (uses 100.96.86.40 by default; swap for 192.168.1.132 on LAN) # # Usage: # .\scripts\deck-sgdb-art.ps1 # fetch all types (hero, wide, poster) # .\scripts\deck-sgdb-art.ps1 --types hero,wide # hero + wide only # .\scripts\deck-sgdb-art.ps1 --types poster # portrait capsules only # .\scripts\deck-sgdb-art.ps1 --clean # remove art for unmatched ROM hacks # .\scripts\deck-sgdb-art.ps1 --dry-run # preview without downloading # # All extra arguments are forwarded verbatim to deck-sgdb-art.py. param( [string]$DeckHost = '100.96.86.40', [string]$DeckUser = 'deck', [string]$DeckPass = 'd0fet0th3x', [Parameter(ValueFromRemainingArguments)] [string[]]$ScriptArgs ) $ErrorActionPreference = 'Stop' # --- ASKPASS setup (required on Windows — no sshpass available) --------------- $askpass = "$env:TEMP\deck-askpass.cmd" Set-Content -Path $askpass -Value "@echo $DeckPass" -Encoding ASCII $env:SSH_ASKPASS = $askpass $env:SSH_ASKPASS_REQUIRE = 'force' $sshOpts = '-o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ServerAliveInterval=30 -o ServerAliveCountMax=20' # --- Upload the Python script ------------------------------------------------- $scriptSrc = Join-Path $PSScriptRoot 'deck-sgdb-art.py' if (-not (Test-Path $scriptSrc)) { Write-Error "deck-sgdb-art.py not found at $scriptSrc" exit 1 } Write-Host "Uploading deck-sgdb-art.py to ${DeckUser}@${DeckHost}..." Get-Content $scriptSrc -Raw | ssh $sshOpts.Split() "$DeckUser@$DeckHost" "cat > /tmp/deck-sgdb-art.py && echo 'uploaded OK'" # --- Run it ------------------------------------------------------------------- $argsStr = if ($ScriptArgs) { $ScriptArgs -join ' ' } else { '' } Write-Host "Running: python3 /tmp/deck-sgdb-art.py $argsStr`n" ssh $sshOpts.Split() "$DeckUser@$DeckHost" "python3 /tmp/deck-sgdb-art.py $argsStr"