feat(lib): helper ini_set idempotent pour merge de fichiers INI #24

Closed
Damien wants to merge 3 commits from feat/lib-ini-set into main
Showing only changes of commit 905166d1cc - Show all commits
+8
View File
@@ -151,6 +151,14 @@ ini_set() {
tmp=$(mktemp "${file}.tmp.XXXXXX") tmp=$(mktemp "${file}.tmp.XXXXXX")
# mktemp defaults to 0600 root:root, which would silently lock the
# service account that owns $file (e.g. gitea:www-data on Gitea's
# app.ini) out of the config this function just wrote. Carry the
# original file's mode/ownership onto the replacement before it lands.
# `stat -c` works identically on GNU coreutils and BusyBox.
chmod "$(stat -c '%a' "$file")" "$tmp" 2>/dev/null || true
chown "$(stat -c '%u:%g' "$file")" "$tmp" 2>/dev/null || true
awk -v section="$section" -v key="$key" -v value="$value" ' awk -v section="$section" -v key="$key" -v value="$value" '
/^\[.*\]$/ { /^\[.*\]$/ {
if (in_section && !done) { if (in_section && !done) {