diff --git a/bin/omarchy-system-factory-reset b/bin/omarchy-system-factory-reset index c248221c..325475f7 100755 --- a/bin/omarchy-system-factory-reset +++ b/bin/omarchy-system-factory-reset @@ -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. diff --git a/docs/file-layout.md b/docs/file-layout.md index 73c48c4f..19e2bfb5 100644 --- a/docs/file-layout.md +++ b/docs/file-layout.md @@ -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`,