浏览代码

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 月之前
父节点
当前提交
1256f6aab6
共有 1 个文件被更改,包括 5 次插入0 次删除
  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