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 | 445f384464a3dd9fea45fe6623341261b57fd831 (patch) | |
| tree | 65f402be8ab550ffb3b1371187e00f305fd58fc6 /scripts/testing/lib/validation.sh | |
| parent | 3695ecc08f23380f758c93ac9c46815aecead42d (diff) | |
| download | archsetup-445f384464a3dd9fea45fe6623341261b57fd831.tar.gz archsetup-445f384464a3dd9fea45fe6623341261b57fd831.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/lib/validation.sh')
0 files changed, 0 insertions, 0 deletions
