From afd4b6a1cf4fd48a3075993b8750c7bd07535d27 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 3 Jun 2026 08:18:17 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20use=20sudo=5Fif=20rm=20-f=20app=20?= =?UTF-8?q?=E2=80=94=20delete=20root-owned=20binary=20as=20app=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index abd924f..2654116 100755 --- a/install.sh +++ b/install.sh @@ -102,7 +102,7 @@ if [ "${1:-}" = "-update" ]; then mkdir -p "${GOMODCACHE}" "${GOCACHE}" 2>/dev/null || sudo_if mkdir -p "${GOMODCACHE}" "${GOCACHE}" # Ensure build cache and old binary are writable by the app user. sudo_if chown -R "${APP_USER:-${SUDO_USER:-$(whoami)}}" "${INSTALL_DIR}/.go" "${INSTALL_DIR}/app" 2>/dev/null || true - rm -f app + sudo_if rm -f app CGO_ENABLED=0 go build -buildvcs=false -ldflags="-s -w" -o app . else warn "Go not found — downloading pre-built binary..." @@ -210,7 +210,7 @@ if command -v go &>/dev/null; then mkdir -p "${GOMODCACHE}" "${GOCACHE}" 2>/dev/null || sudo_if mkdir -p "${GOMODCACHE}" "${GOCACHE}" # Ensure cache is owned by the app user. sudo_if chown -R "$(whoami):$(whoami)" "${INSTALL_DIR}/.go" "${INSTALL_DIR}/app" 2>/dev/null || true - rm -f app + sudo_if rm -f app CGO_ENABLED=0 go build -buildvcs=false -ldflags="-s -w" -o app . else info "Go not found — downloading pre-built binary..."