Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/omarchy-update
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ if [[ ${1:-} == "-y" ]] || omarchy-update-confirm; then
omarchy-update-orphan-pkgs -y

omarchy-update-analyze-logs
omarchy-update-status

# The dev checkout was fast-forwarded and the full upgrade went through, so
# there is no Omarchy update left to show. Rechecking would download every
# sync database again and refetch the checkout only to hear the same.
omarchy-shell -q omarchy.system-update clear

# Service restart helpers can need sudo. The reboot-only phase below
# performs no privileged work.
Expand Down
14 changes: 6 additions & 8 deletions bin/omarchy-update-status
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/bash

# omarchy:summary=Refresh the shell update status
# omarchy:summary=Clear the shell update indicator after an update
# omarchy:hidden=true

set -e

if omarchy-update-available >/dev/null; then
omarchy-shell -q omarchy.system-update refresh
else
omarchy-shell -q omarchy.system-update clear
fi
# omarchy-update now clears the indicator itself. This stays for an update
# started by an older omarchy-update: its pipeline was parsed before the
# upgrade replaced it, and still calls this right after a full upgrade that
# went through, so there is nothing left for the indicator to show.
omarchy-shell -q omarchy.system-update clear
7 changes: 3 additions & 4 deletions docs/update-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ omarchy-update
├─ run system-package updates
├─ run migrations
├─ automatically remove orphan packages and run log analysis
├─ omarchy-update-status
│ └─ refresh or clear the shell update indicator
├─ clear the shell update indicator: the update just installed what it showed
├─ restart marked services and the shell
├─ run the post-update hook, then update mise tools
├─ stop the keepalive and invalidate sudo, then update AUR packages with
Expand Down Expand Up @@ -319,7 +318,7 @@ scripts.
| `omarchy-update` | Public user command. Adds transcript logging, confirmation, snapshot, and restart checks around the locked, sleep-inhibited update pipeline. | **Keep.** This is the blessed entry point and orchestrates the update pipeline. |
| `omarchy-update-lock` | Hidden command wrapper that holds the per-user update lock while its child runs. | **Keep internal/hidden.** Isolates update concurrency and lock descriptor handling. |
| `omarchy-update-stay-awake` | Hidden helper that starts or stops update-owned sleep and idle inhibition, restoring only the state it changed. | **Keep internal/hidden.** Keeps inhibitor ownership and cleanup together. |
| `omarchy-update-status` | Hidden helper that refreshes or clears the shell update indicator after rechecking available updates. | **Keep internal/hidden.** Keeps shell status synchronization out of the main pipeline. |
| `omarchy-update-status` | Hidden compatibility helper that clears the shell update indicator. `omarchy-update` clears it directly now; an update started by an older `omarchy-update` still calls this after its upgrade. | **Temporary.** Keep only for updates started before the change. |
| `omarchy-update-confirm` | Gum confirmation copy for `omarchy update`. | **Question.** Could be inlined into `omarchy-update`; separate file only helps keep copy isolated. |
| `omarchy-update-dev` | Fast-forwards the active dev-linked checkout from its configured upstream; no-ops for package-backed installs. | **Keep.** Runs before package updates so a checkout conflict stops the update before system mutation. |
| `omarchy-update-keyring` | Ensures Omarchy keyring and Arch keyring (and Arch Linux ARM keyring on aarch64, where installed) are current before the main transaction. | **Keep, but review.** It uses targeted `pacman -Sy` for keyring bootstrapping; acceptable for this special case but should remain tightly scoped. |
Expand All @@ -332,7 +331,7 @@ scripts.
| `omarchy-update-pacman` | Hidden helper that runs a guard-approved pacman transaction as a PID 1 scope (`systemd-run --scope`) so a mid-transaction systemd reexec cannot kill it; runs pacman directly when not booted under systemd. | **Keep internal/hidden.** Single place that owns how Omarchy invokes pacman for system mutation. |
| `omarchy-migrate-notify` | Internal login-time notification helper. Uses `omarchy-migrate --pending` and shows a notification only when this user has pending migrations. | **Keep internal/hidden.** Clear name now that the public command is `omarchy-migrate`. |
| `omarchy-update-user-notify` | Hidden compatibility wrapper for `omarchy-migrate-notify`. | **Temporary.** Keep only for old callers. |
| `omarchy-update-available` | Update checker for shell widget and post-update refresh. | **Keep.** Could eventually be renamed `omarchy-update-check`, but current name matches widget semantics. |
| `omarchy-update-available` | Update checker for the shell widget. The update itself clears the widget instead of rechecking. | **Keep.** Could eventually be renamed `omarchy-update-check`, but current name matches widget semantics. |
| `omarchy-update-aur-pkgs` | Updates AUR packages with `yay -Sua` if foreign packages exist and AUR is reachable. | **Question.** Omarchy is package-backed now, but users may still install AUR packages. Keep for now. |
| `omarchy-update-mise` | Runs `MISE_MINIMUM_RELEASE_AGE=0 mise up` for mise-managed tools — the override of mise's release-age cooldown is the point. | **Keep.** Mise-managed tools are intentionally part of the blessed update path. |
| `omarchy-update-orphan-pkgs` | Lists orphans and prompts before removal unless passed `-y`, as the update pipeline does; standalone noninteractive mode only reports. | **Keep for now.** Automates cleanup during updates and supports standalone review. |
Expand Down
2 changes: 1 addition & 1 deletion test/shell.d/fixtures/sudo-boundary-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ case "$step" in
esac
STUB
chmod +x "$SUDO_TEST_ROOT/bin/test-step"
for step in omarchy-update-lock omarchy-update-requires-free-space omarchy-update-confirm omarchy-update-pkg-prune omarchy-snapshot omarchy-update-stay-awake omarchy-update-dev omarchy-update-boot omarchy-update-keyring omarchy-update-system-pkgs omarchy-migrate omarchy-hook omarchy-update-aur-pkgs omarchy-update-mise omarchy-update-orphan-pkgs omarchy-update-analyze-logs omarchy-update-status omarchy-update-restart omarchy-pkg-aur-accessible omarchy-notification-dismiss pacman systemd-run cp yay; do
for step in omarchy-update-lock omarchy-update-requires-free-space omarchy-update-confirm omarchy-update-pkg-prune omarchy-snapshot omarchy-update-stay-awake omarchy-update-dev omarchy-update-boot omarchy-update-keyring omarchy-update-system-pkgs omarchy-migrate omarchy-hook omarchy-update-aur-pkgs omarchy-update-mise omarchy-update-orphan-pkgs omarchy-update-analyze-logs omarchy-shell omarchy-update-restart omarchy-pkg-aur-accessible omarchy-notification-dismiss pacman systemd-run cp yay; do
ln -s test-step "$SUDO_TEST_ROOT/bin/$step"
done
ln -s ../bin/test-step "$SUDO_TEST_ROOT/mock/pacman"
Expand Down
14 changes: 11 additions & 3 deletions test/shell.d/update-sequence-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test_tmp="$boundary_tmp"
stub_bin="$SUDO_TEST_ROOT/bin"

# Every step omarchy-update runs, recorded in order with the unattended flag it
# was handed. One of them can be told to fail.
# was handed. One of them can be told to fail. omarchy-update-available is here
# so a recheck after the update would show up as an unexpected step.
steps=(
omarchy-update-lock
omarchy-update-requires-free-space
Expand All @@ -27,7 +28,8 @@ steps=(
omarchy-update-mise
omarchy-update-orphan-pkgs
omarchy-update-analyze-logs
omarchy-update-status
omarchy-shell
omarchy-update-available
omarchy-update-restart
)

Expand All @@ -39,6 +41,9 @@ printf '%s unattended=%s\n' "${0##*/}" "${OMARCHY_UPDATE_UNATTENDED:-}" >>"$STEP
if [[ ${0##*/} == "omarchy-update-orphan-pkgs" ]]; then
printf '%s\n' "$@" >"$STEP_LOG.orphan-args"
fi
if [[ ${0##*/} == "omarchy-shell" ]]; then
printf '%s\n' "$*" >"$STEP_LOG.shell-args"
fi
[[ ${FAILING_STEP:-} != "${0##*/}" ]] || exit 1
STUB
chmod +x "$stub_bin/$step"
Expand Down Expand Up @@ -75,7 +80,7 @@ expected_steps() {
omarchy-migrate \
omarchy-update-orphan-pkgs \
omarchy-update-analyze-logs \
omarchy-update-status \
omarchy-shell \
omarchy-update-restart \
omarchy-hook \
omarchy-update-mise \
Expand All @@ -91,6 +96,9 @@ diff <(expected_steps) <(steps_run) >"$test_tmp/order" ||
pass "an update where every step works runs all of them, in order"
[[ $(cat "$test_tmp/steps.orphan-args") == "-y" ]] || fail "an unattended update approves orphan removal"
pass "an unattended update approves orphan removal"
[[ $(cat "$test_tmp/steps.shell-args") == "-q omarchy.system-update clear" ]] ||
fail "a finished update clears the shell update indicator" "$(cat "$test_tmp/steps.shell-args")"
pass "a finished update clears the shell update indicator without rechecking"

grep -q '^omarchy-update-system-pkgs unattended=1$' "$test_tmp/steps" ||
fail "-y does not mark the update unattended"
Expand Down
24 changes: 9 additions & 15 deletions test/shell.d/update-status-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,26 @@ test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT

stub_bin="$test_tmp/bin"
shell_calls="$test_tmp/shell-calls"
calls="$test_tmp/calls"
mkdir -p "$stub_bin"

cat >"$stub_bin/omarchy-update-available" <<'SH'
#!/bin/bash

exit "${UPDATE_AVAILABLE_STATUS:-0}"
printf 'available\n' >>"$CALLS"
SH

cat >"$stub_bin/omarchy-shell" <<'SH'
#!/bin/bash

printf '%s\n' "$*" >>"$SHELL_CALLS"
printf 'shell %s\n' "$*" >>"$CALLS"
SH

chmod +x "$stub_bin/omarchy-update-available" "$stub_bin/omarchy-shell"

PATH="$stub_bin:$PATH" SHELL_CALLS="$shell_calls" UPDATE_AVAILABLE_STATUS=0 \
"$ROOT/bin/omarchy-update-status"
grep -Fx -- "-q omarchy.system-update refresh" "$shell_calls" >/dev/null ||
fail "update status refreshes the shell indicator when updates remain"
pass "update status refreshes the shell indicator when updates remain"

: >"$shell_calls"
PATH="$stub_bin:$PATH" SHELL_CALLS="$shell_calls" UPDATE_AVAILABLE_STATUS=1 \
"$ROOT/bin/omarchy-update-status"
grep -Fx -- "-q omarchy.system-update clear" "$shell_calls" >/dev/null ||
fail "update status clears the shell indicator when no updates remain"
pass "update status clears the shell indicator when no updates remain"
# An older omarchy-update, already parsed when the upgrade replaced it, still
# calls this once the packages are in.
PATH="$stub_bin:$PATH" CALLS="$calls" "$ROOT/bin/omarchy-update-status"
[[ $(<"$calls") == "shell -q omarchy.system-update clear" ]] ||
fail "update status clears the shell indicator without rechecking" "$(<"$calls")"
pass "update status clears the shell indicator without rechecking"