<feed xmlns='http://www.w3.org/2005/Atom'>
<title>archsetup/tests/backup-system-file/test_backup_system_file.py, branch main</title>
<subtitle>Builds a full dev workstation from a bare Arch Linux install.
</subtitle>
<id>https://git.cjennings.net/archsetup/atom?h=main</id>
<link rel='self' href='https://git.cjennings.net/archsetup/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/archsetup/'/>
<updated>2026-06-25T04:23:47+00:00</updated>
<entry>
<title>feat(archsetup): back up system files before in-place edits</title>
<updated>2026-06-25T04:23:47+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-06-25T04:23:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/archsetup/commit/?id=2da6a6f9e56b6e785a8c51266c5c75e6c8dca29c'/>
<id>urn:sha1:2da6a6f9e56b6e785a8c51266c5c75e6c8dca29c</id>
<content type='text'>
Add a backup_system_file helper that snapshots a pre-existing file to &lt;path&gt;.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).
</content>
</entry>
</feed>
