Pārlūkot izejas kodu

fix: add defensive chown in deploy_native before venv creation

The chown after git clone may not be effective if the downloaded script
was cached by CDN. Adding a second chown right before venv creation
ensures the repo is always user-owned regardless of execution order.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris 4 mēneši atpakaļ
vecāks
revīzija
1256f6aab6
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      setup-pi.sh

+ 5 - 0
setup-pi.sh

@@ -257,6 +257,11 @@ deploy_native() {
 
     cd "$INSTALL_DIR"
 
+    # Ensure repo is owned by real user before creating venv
+    if [[ $EUID -eq 0 && -n "$SUDO_USER" ]]; then
+        chown -R "$SUDO_USER:$SUDO_USER" "$INSTALL_DIR"
+    fi
+
     # Create venv — if running as root (sudo), create as the real user
     local real_user="${SUDO_USER:-$USER}"
     if [[ $EUID -eq 0 && -n "$SUDO_USER" ]]; then