mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-10-01 19:43:49 +00:00
fix(forgejo): install the pinned release by renaming over the running binary (#136)
setup.sh downloaded straight to /usr/local/bin/forgejo while forgejo.service
was running, which fails with ETXTBSY ("Text file busy"). Every deploy logged
"forgejo download failed" and prod stayed on 11.0.1 although the pin is
11.0.15. Download to forgejo.new, check its --version, and rename it over the
old binary; the existing `systemctl restart forgejo` then starts the new one.
A failed or wrong download now keeps the installed binary instead of warning
that the backend will be unavailable.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2537977711
commit
f5c8e31d26
1 changed files with 15 additions and 3 deletions
18
setup.sh
18
setup.sh
|
|
@ -1104,9 +1104,21 @@ if [ "$FORGEJO" = "1" ]; then
|
|||
esac
|
||||
if [ -n "$FJ_ARCH" ]; then
|
||||
log "downloading forgejo ${FORGEJO_VERSION} (${FJ_ARCH})"
|
||||
curl -fsSL "https://codeberg.org/forgejo/forgejo/releases/download/v${FORGEJO_VERSION}/forgejo-${FORGEJO_VERSION}-linux-${FJ_ARCH}" \
|
||||
-o /usr/local/bin/forgejo && chmod 0755 /usr/local/bin/forgejo \
|
||||
|| warn "forgejo download failed — backend will be unavailable"
|
||||
# Download beside the binary and rename over it. Writing straight to
|
||||
# /usr/local/bin/forgejo while forgejo.service runs fails with ETXTBSY
|
||||
# ("Text file busy"), which left prod pinned to an old release with a
|
||||
# "download failed" warning on every redeploy. A rename is atomic and
|
||||
# legal on a running executable; the old inode lives until the restart.
|
||||
if curl -fsSL "https://codeberg.org/forgejo/forgejo/releases/download/v${FORGEJO_VERSION}/forgejo-${FORGEJO_VERSION}-linux-${FJ_ARCH}" \
|
||||
-o /usr/local/bin/forgejo.new \
|
||||
&& chmod 0755 /usr/local/bin/forgejo.new \
|
||||
&& /usr/local/bin/forgejo.new --version 2>/dev/null | grep -q "$FORGEJO_VERSION"; then
|
||||
mv -f /usr/local/bin/forgejo.new /usr/local/bin/forgejo
|
||||
log "forgejo ${FORGEJO_VERSION} installed"
|
||||
else
|
||||
rm -f /usr/local/bin/forgejo.new
|
||||
warn "forgejo ${FORGEJO_VERSION} download failed — keeping the installed binary"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue