diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-25 00:23:47 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-25 00:23:47 -0400 |
| commit | c15ca2adb9c757ed30e08efc06cf8f9783831880 (patch) | |
| tree | 65f402be8ab550ffb3b1371187e00f305fd58fc6 /scripts/testing/tests/test_archsetup.py | |
| parent | d24d48fbace674ba7465e0e03db4b1c8a70ba637 (diff) | |
| download | archsetup-c15ca2adb9c757ed30e08efc06cf8f9783831880.tar.gz archsetup-c15ca2adb9c757ed30e08efc06cf8f9783831880.zip | |
feat(archsetup): back up system files before in-place edits
Add a backup_system_file helper that snapshots a pre-existing file to <path>.archsetup.bak before archsetup edits it in place, so a botched edit to fstab, mkinitcpio.conf, or sudoers is recoverable. It is idempotent: it never overwrites an existing backup, so the pristine original survives repeated edits within a run and across re-runs. It uses cp -p to preserve mode and ownership.
Only the in-place sed and append edits to pre-existing files route through it (locale.gen, makepkg.conf, pacman.conf, sudoers, wireless-regdom, geoclue.conf, pacman-contrib, fstab, mkinitcpio.conf, vconsole.conf). The brand-new drop-in files archsetup fully owns are skipped: there is no prior state to save, and recovery is just deleting them.
Covered by tests/backup-system-file/ (Normal, Boundary, Error cases, including mode preservation and the no-overwrite guarantee).
Diffstat (limited to 'scripts/testing/tests/test_archsetup.py')
0 files changed, 0 insertions, 0 deletions
