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 | 2da6a6f9e56b6e785a8c51266c5c75e6c8dca29c (patch) | |
| tree | 9fab3f7138a3c4d21211ddc57ca3b4ae8e9a8c1a /scripts/wipedisk | |
| parent | 5dbc1d74a96e044b3b88ac20735ba5d94db1bd24 (diff) | |
| download | archsetup-2da6a6f9e56b6e785a8c51266c5c75e6c8dca29c.tar.gz archsetup-2da6a6f9e56b6e785a8c51266c5c75e6c8dca29c.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/wipedisk')
0 files changed, 0 insertions, 0 deletions
