mktemp defaults to 0600 root:root. The tmpfile+mv swap in ini_set was
carrying that over onto the replaced config, silently locking out
whatever service account owned the original file (e.g. gitea:www-data
on Gitea's app.ini — the service failed to start with a permission
denied on its own config after the very first ini_set call). Restore
the original file's mode and ownership on the tmpfile before the mv.
Verified on both BusyBox (Alpine) and GNU coreutils (Debian) stat -c.
Refs #18
openbao's "write config only if absent" pattern would silently skip
newly-required keys on a rejoué script. ini_set() merges key by key
instead: creates file/section/key as needed, replaces an existing
key's value in place, no-ops when already correct, and never touches
other sections — so a duplicate key name across sections (e.g.
[metrics] ENABLED vs [actions] ENABLED) stays scoped correctly.
Atomic write via tmpfile + mv. First OS-agnostic helper in the file,
documented as such in the header contract.
Refs #18
- refresh_os_packages()'s header claimed it was callable both host-side (via
pct exec) and inside the LXC; it's a plain bash function in this process,
it cannot cross a pct exec boundary. Corrected to match the comment
already present at its one host-side non-call-site in openbao/install.sh.
- Removed `set -euo pipefail`: a sourced file must not impose shell options
on the caller. Both install scripts already set these before sourcing.
- Added ensure_template_present(), ported from openbao/install.sh, so
gitea-runner can reuse it (issue #12 follow-up) instead of duplicating a
template-download check that skipped `pveam update` and could silently
settle for a stale cached template list.