Commit Graph
5 Commits
Author SHA1 Message Date
Damien 905166d1cc fix(lib): preserve file mode/ownership across ini_set's atomic write
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
2026-07-31 18:46:33 +02:00
Damien 66f981af81 feat(lib): add ini_set idempotent INI merge helper
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
2026-07-31 17:34:45 +02:00
Damien 936ab2c2fb lib/common.sh: fix refresh_os_packages contract, drop set -e, add ensure_template_present
- 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.
2026-07-30 14:05:43 +02:00
Damien d0138b742d lib/common.sh: template detection + autologin + update helpers 2026-07-30 11:14:20 +02:00
Damien e545a27e9a scaffold: lib/common.sh helper skeleton (refs #12 #14 #15) 2026-07-30 11:09:51 +02:00