Track one-time setup with completion markers

This commit is contained in:
David Heinemeier Hansson
2026-07-16 21:53:15 -07:00
parent 7b824b6e1b
commit e82df1d4d0
9 changed files with 162 additions and 18 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# omarchy:summary=Check or mark completed Omarchy setup tasks
# omarchy:args=<check|mark|ensure> <name>
# omarchy:hidden=true
set -e
if (( $# != 2 )); then
echo "Usage: omarchy-done <check|mark|ensure> <name>" >&2
exit 1
fi
action=$1
name=$2
done_dir="$HOME/.local/state/omarchy/done"
marker="$done_dir/$name"
if [[ $name == */* || $name == "." || $name == ".." ]]; then
echo "Invalid done marker name: $name" >&2
exit 1
fi
case "$action" in
check)
[[ -f $marker ]]
;;
mark)
mkdir -p "$done_dir"
touch "$marker"
;;
ensure)
mkdir -p "$done_dir"
(set -o noclobber; : >"$marker") 2>/dev/null
;;
*)
echo "Usage: omarchy-done <check|mark|ensure> <name>" >&2
exit 1
;;
esac
+3 -4
View File
@@ -20,7 +20,7 @@ For shipped configs see /etc/skel (new users) and omarchy-reinstall-configs
--first-install is used by the ISO in the target chroot. It marks shipped
migrations complete for the freshly-created user.
Idempotency marker: ~/.local/state/omarchy/finalize-user.done
Idempotency marker: ~/.local/state/omarchy/done/finalize-user
USAGE
}
@@ -55,10 +55,9 @@ while (($#)); do
done
state_dir="$HOME/.local/state/omarchy"
marker="$state_dir/finalize-user.done"
mkdir -p "$state_dir"
if [[ -f $marker && $force -eq 0 ]]; then
if omarchy-done check finalize-user && (( force == 0 )); then
echo "User finalization already complete (rerun with --force to refresh)."
exit 0
fi
@@ -113,5 +112,5 @@ if (( first_install )); then
done
fi
touch "$marker"
omarchy-done mark finalize-user
echo "User finalization complete."
+3 -3
View File
@@ -103,8 +103,8 @@ fi
run_first_run_step "notify about pending migrations" omarchy-migrate-notify
USER_MARKER="$state_dir/first-run-user.done"
if [[ ! -f $USER_MARKER || $force -eq 1 ]]; then
FIRST_RUN_DONE="first-run-user"
if ! omarchy-done check "$FIRST_RUN_DONE" || (( force )); then
run_first_run_step "install Voxtype post-update hook" \
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/install-voxtype.hook"
@@ -126,7 +126,7 @@ if [[ ! -f $USER_MARKER || $force -eq 1 ]]; then
bash "$OMARCHY_PATH/install/user/first-run/wifi.sh"
if (( first_run_failed == 0 )); then
touch "$USER_MARKER"
omarchy-done mark "$FIRST_RUN_DONE"
else
log_first_run "One or more first-run steps failed; first-run will retry next login"
fi
+7 -1
View File
@@ -2201,7 +2201,13 @@ if command -v xdg-mime >/dev/null 2>&1; then
xdg-mime default HEY.desktop x-scheme-handler/mailto || true
fi
touch "$state_dir/finalize-user.done"
if [[ -f $state_dir/first-run-user.done ]]; then
"$root/bin/omarchy-done" mark first-run-user
rm -f "$state_dir/first-run-user.done"
fi
"$root/bin/omarchy-done" mark finalize-user
rm -f "$state_dir/finalize-user.done"
USER_SETUP
}