Gate first-run setup as one lifecycle
This commit is contained in:
+29
-33
@@ -35,9 +35,15 @@ while (($#)); do
|
||||
esac
|
||||
done
|
||||
|
||||
state_dir=~/.local/state/omarchy
|
||||
FIRST_RUN_DONE="first-run-user"
|
||||
if omarchy-done check "$FIRST_RUN_DONE" && (( force == 0 )); then
|
||||
echo "First-run already complete (rerun with --force to refresh)."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
omarchy-finalize-user "${finalize_user_args[@]}" || true
|
||||
|
||||
state_dir=~/.local/state/omarchy
|
||||
mkdir -p "$state_dir"
|
||||
|
||||
FIRST_RUN_LOG="$state_dir/first-run.log"
|
||||
@@ -94,42 +100,32 @@ run_first_run_step() {
|
||||
|
||||
wait_for_notifications
|
||||
|
||||
MIGRATION_NOTIFY_WATCH_MARKER="$state_dir/user-migration-notify-watch-enabled"
|
||||
if [[ ! -f $MIGRATION_NOTIFY_WATCH_MARKER || $force -eq 1 ]]; then
|
||||
if systemctl --user enable --now omarchy-update-user-notify.path >/dev/null 2>&1; then
|
||||
touch "$MIGRATION_NOTIFY_WATCH_MARKER"
|
||||
fi
|
||||
fi
|
||||
|
||||
run_first_run_step "enable migration notification watcher" \
|
||||
systemctl --user enable --now omarchy-update-user-notify.path
|
||||
run_first_run_step "notify about pending migrations" omarchy-migrate-notify
|
||||
|
||||
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"
|
||||
run_first_run_step "install Voxtype post-update hook" \
|
||||
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/install-voxtype.hook"
|
||||
|
||||
run_first_run_step "enable user systemd units" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/enable-user-units.sh"
|
||||
run_first_run_step "set GNOME theme" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/gnome-theme.sh"
|
||||
run_first_run_step "set GTK primary paste" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/gtk-primary-paste.sh"
|
||||
run_first_run_step "enable user systemd units" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/enable-user-units.sh"
|
||||
run_first_run_step "set GNOME theme" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/gnome-theme.sh"
|
||||
run_first_run_step "set GTK primary paste" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/gtk-primary-paste.sh"
|
||||
|
||||
wait_for_notifications
|
||||
run_first_run_step "show welcome notification" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/welcome.sh"
|
||||
# The first-run notification scripts register action callbacks in background
|
||||
# notify-send processes. Give the notification server a tick to ingest the
|
||||
# welcome toast before queueing the Wi-Fi/update toasts.
|
||||
sleep 0.3
|
||||
run_first_run_step "show Wi-Fi/update notifications" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/wifi.sh"
|
||||
wait_for_notifications
|
||||
run_first_run_step "show welcome notification" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/welcome.sh"
|
||||
# The first-run notification scripts register action callbacks in background
|
||||
# notify-send processes. Give the notification server a tick to ingest the
|
||||
# welcome toast before queueing the Wi-Fi/update toasts.
|
||||
sleep 0.3
|
||||
run_first_run_step "show Wi-Fi/update notifications" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/wifi.sh"
|
||||
|
||||
if (( first_run_failed == 0 )); then
|
||||
omarchy-done mark "$FIRST_RUN_DONE"
|
||||
else
|
||||
log_first_run "One or more first-run steps failed; first-run will retry next login"
|
||||
fi
|
||||
if (( first_run_failed == 0 )); then
|
||||
omarchy-done mark "$FIRST_RUN_DONE"
|
||||
else
|
||||
echo "First-run already complete (rerun with --force to refresh)."
|
||||
log_first_run "One or more first-run steps failed; first-run will retry next login"
|
||||
fi
|
||||
|
||||
@@ -1175,14 +1175,8 @@ run_post_upgrade_update_steps() {
|
||||
omarchy-update-available 2>&1) || update_status=$?
|
||||
|
||||
if (( update_status == 0 )); then
|
||||
warn "Updates are still available after the upgrade; first-run will still offer to run omarchy-update:"
|
||||
warn "Updates are still available after the upgrade; run omarchy-update after reboot:"
|
||||
printf '%s\n' "$update_output" >&2
|
||||
else
|
||||
# The live upgrade has already completed the package update. Let first-run
|
||||
# finish session-only setup, but skip its generic fresh-install update
|
||||
# toast when the update checker confirms nothing remains.
|
||||
run_as_user mkdir -p "$target_home/.local/state/omarchy"
|
||||
run_as_user touch "$target_home/.local/state/omarchy/skip-first-run-update-notification"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -2201,10 +2195,8 @@ if command -v xdg-mime >/dev/null 2>&1; then
|
||||
xdg-mime default HEY.desktop x-scheme-handler/mailto || true
|
||||
fi
|
||||
|
||||
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 first-run-user
|
||||
rm -f "$state_dir/first-run-user.done"
|
||||
|
||||
"$root/bin/omarchy-done" mark finalize-user
|
||||
rm -f "$state_dir/finalize-user.done"
|
||||
|
||||
Reference in New Issue
Block a user