Procházet zdrojové kódy

fix: resolve INSTALL_DIR to real user home when run with sudo

$HOME resolves to /root under sudo, causing permission denied errors
when the script tries to create the venv as the non-root user.
Use ~$SUDO_USER to always resolve the invoking user's home directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris před 4 měsíci
rodič
revize
56f775f2f1
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      setup-pi.sh

+ 1 - 1
setup-pi.sh

@@ -28,7 +28,7 @@ NC='\033[0m' # No Color
 # Default options
 FIX_WIFI=true  # Applied by default for stability
 SETUP_HOTSPOT=true  # Autohotspot for first-time WiFi setup
-INSTALL_DIR="$HOME/dune-weaver"
+INSTALL_DIR="$(eval echo ~"${SUDO_USER:-$USER}")/dune-weaver"
 REPO_URL="https://github.com/tuanchris/dune-weaver"
 
 # Parse arguments