Refuse factory reset handoff to a different installed version

This commit is contained in:
Afonso Oliveira committed 2026-09-24 22:42:46 +01:00
1 parent 4dd5414bfc
commit 45a6433139
2 files changed
+8

No files matched your search

+6
View File
@@ -35,6 +35,12 @@ TOP_MNT=/run/omarchy-system-factory-reset/top
NEXT_NAME=@omarchy-reset-next
LOG_FILE=/var/log/omarchy-system-factory-reset.log
# Never replace a newer checkout reset with a different installed implementation.
if ! /usr/bin/cmp -s -- "${BASH_SOURCE[0]}" "$PACKAGED_PATH"; then
echo "Factory reset differs from the installed command. Install the matching Omarchy package before resetting." >&2
exit 1
fi
# Self-elevate so the menu entry (and a bare shell invocation) need no sudo
# prefix. The caller's gum theme vars are forwarded as `env` arguments rather
# than via `sudo -E`, so styling survives even under an env_reset sudoers.
+2
View File
@@ -201,6 +201,8 @@ yet and silently runs the packaged copy of one it has. The drop-in is validated
with `visudo -c` before install and removed by `omarchy-dev-unlink`; unlike
`/etc/omarchy.conf`, it takes effect without a reboot.
Factory reset is an exception: it always self-elevates through `/usr/bin/omarchy-system-factory-reset` and refuses a checkout copy that differs from the installed command, including when invoked with `sudo`. Install the matching package before resetting so a newer checkout cannot silently hand off to older account-scrubbing code.
## Runtime finalization (`omarchy-provision-user`)
Runs once per user. It does **not** copy `~/.config/**`, `~/.bashrc`,