fix: git safe.directory + ownership after clone/pull

- Adds safe.directory exception so git doesn't reject the repo
- chown directory to invoking user after clone/pull so build works
This commit is contained in:
Claus Lohmar 2026-05-30 16:02:44 +00:00
parent bb11a7f32c
commit bc5a5172dc

View file

@ -104,6 +104,8 @@ echo ""
# ── 1. Clone repo ────────────────────────────────────────────────
if [ -d "$INSTALL_DIR" ]; then
warn "$INSTALL_DIR already exists — pulling latest..."
# Mark the repo as safe — it was created by root via sudo
sudo_if git config --global --add safe.directory "$INSTALL_DIR" 2>/dev/null || true
cd "$INSTALL_DIR"
sudo_if git pull
else
@ -111,6 +113,8 @@ else
sudo_if git clone "$REPO_URL" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
# Fix ownership so the build/pull steps can write as the invoking user
sudo_if chown -R "$(whoami):$(whoami)" "$INSTALL_DIR" 2>/dev/null || true
# ── 2. Build or download binary ──────────────────────────────────
ARCH="$(uname -m)"