diff --git a/bin/omarchy-apply-pacman b/bin/omarchy-apply-pacman index d5a92234..0af0fb0c 100755 --- a/bin/omarchy-apply-pacman +++ b/bin/omarchy-apply-pacman @@ -49,5 +49,6 @@ for file in pacman.conf pacman.d/mirrorlist; do cp -f "$etc/$file" "$etc/$file.bak" fi done -install -m 644 "$staging/pacman.conf" "$etc/pacman.conf" -install -m 644 "$staging/mirrorlist" "$etc/pacman.d/mirrorlist" +# Copying over an existing file keeps its owner and mode, as refresh always has. +cp -f "$staging/pacman.conf" "$etc/pacman.conf" +cp -f "$staging/mirrorlist" "$etc/pacman.d/mirrorlist" diff --git a/test/shell.d/region-pacman-test.sh b/test/shell.d/region-pacman-test.sh index 92682e5e..2d0eb25a 100644 --- a/test/shell.d/region-pacman-test.sh +++ b/test/shell.d/region-pacman-test.sh @@ -18,6 +18,12 @@ for channel in stable rc edge; do done pass "missing region preserves all global channel templates byte for byte" +chmod 600 "$TARGET_ROOT/etc/pacman.conf" +apply stable +[[ $(stat -c %a "$TARGET_ROOT/etc/pacman.conf") == 600 ]] || fail "refresh keeps a customized pacman.conf mode" +chmod 644 "$TARGET_ROOT/etc/pacman.conf" +pass "refresh keeps existing config file modes" + printf 'cn\n' > "$TARGET_ROOT/etc/omarchy/region" for channel in stable rc edge; do case "$channel" in