Skip to content

Default OMARCHY_PATH in omarchy-update-dev - #13093

Closed
surim0n wants to merge 1 commit into
omacom:quattrofrom
surim0n:fix/update-omarchy-path
Closed

surim0n wants to merge 1 commit into
omacom:quattrofrom
surim0n:fix/update-omarchy-path

Conversation

@surim0n

@surim0n surim0n commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #12858.

omarchy update aborted when OMARCHY_PATH was unset (e.g. sudo omarchy update, cron, timers) because omarchy-update-dev reads it under set -u
without a default.

  • Default to /usr/share/omarchy so package-backed installs skip the dev
    checkout step instead of failing

Tested:

  • test/shell.d/update-dev-test.sh verifies unset OMARCHY_PATH behaves like
    the packaged path and does not invoke git

Generated with Devin

Under a stripped environment (sudo, cron, timers) the script aborted on an
unbound variable. Default to the packaged install path so package-backed
systems continue to skip the dev checkout step.

Fixes omacom#12858.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@llstrk

llstrk commented Sep 25, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: The changed line fixes the abort reported in #12858. With OMARCHY_PATH unset or empty, omarchy-update-dev now takes the packaged early exit instead of failing under set -u. A set, non-empty checkout path still validates and pulls exactly as before. The new test passes on this head and fails when run against the base script, which stops with line 7: OMARCHY_PATH: unbound variable.

OMARCHY_PATH Base This PR
unset exits 1, unbound variable exits 0, no git call
empty (OMARCHY_PATH=) runs git -C "" ... in the current directory exits 0, no git call
/usr/share/omarchy exits 0, no git call exits 0, no git call
dev checkout path pulls that checkout pulls that checkout

The empty-value row is a side benefit that the PR doesn't mention: git treats -C "" as "stay in the current directory". So on the base, OMARCHY_PATH= could fast-forward whatever clone the update was started from. A synthetic case with a real clone showed exactly that.

sudo omarchy update now continues into package and migration steps as root

The PR description and the new code comment name sudo omarchy update as a motivating case. Under default sudo settings, env_reset drops OMARCHY_PATH and sets HOME to root's home. On the base, the update ran its preparation steps as root and then stopped at omarchy-update-dev. With this change, that stop is gone, and the rest of bin/omarchy-update runs as root:

sudo omarchy update   (OMARCHY_PATH unset, HOME=/root)
  prune cache, snapshot, stay-awake       base: runs    head: runs
  omarchy-update-dev                      base: exit 1  head: exit 0 (skips)
  keyring, system packages                base: -       head: runs as root
  omarchy-migrate                         base: -       head: runs as root
    reads /usr/share/omarchy/migrations
    marker state in /root/.local/state/omarchy/migrations
  post-update hook, AUR, mise, orphans    base: -       head: runs as root

Nothing in omarchy, omarchy-update or omarchy-migrate refuses to run as root. docs/update-process.md states that migrations run per-user because they may need $HOME and session state.

Impact: root usually has no migration markers, so every packaged migration counts as pending. The whole history then replays against root's home, and the invoking user's own migration state stays untouched. Some old migrations repeat system-wide package changes; 1780739888.sh, for example, removes dust again. This comes from source tracing only. How far a real root run gets was not tested.

Suggested change: refuse to run omarchy-update as root, as bin/omarchy-dev-link already does (if (( EUID == 0 )); then ... exit 1; fi). Alternatively, drop sudo from the stated motivation so the fix covers only non-root stripped environments such as cron, timers and non-login shells.

Dev-linked systems skip the checkout pull silently when the variable is missing

On a machine set up with omarchy-dev-link, /etc/omarchy.conf records the checkout path, and default/bash/env-bootstrap treats that file as the source of truth. The new fallback ignores it, and omarchy-migrate also defaults to /usr/share/omarchy/migrations.

Impact: if OMARCHY_PATH is missing (a non-login shell, for example), the checkout is not pulled and nothing is printed. The update then continues as a packaged update, with packaged migrations. Before this change, the same run aborted visibly.

Suggested change: resolve the path the way env-bootstrap does (read /etc/omarchy.conf before falling back to /usr/share/omarchy), or print a one-line notice when the fallback is used.

Scope note: the same omarchy update run still prints omarchy-update-available: line 9: OMARCHY_PATH: unbound variable, via omarchy-update-status. That error isn't fatal, but it is reported as "no update available". The discussion on #12858 lists that script and others with the same pattern, so Fixes #12858 would close the issue while they remain. Two related open PRs overlap this one: #8590 makes the equivalent omarchy-update-dev change, and #12860 contains the identical line and also changes omarchy-update-available and omarchy-channel-current.


Review information

Test scope: The changed script and the PR's test were run in a sandbox on the head and the base, with bash 5.3.15 and git 2.55.0. The runs used a logging git stub, one real-git case with a synthetic clone for the empty value, and test/shell on single-test trees. omarchy-update-status was also probed with the variable unset. The sudo and dev-link paths through the full omarchy update pipeline were assessed from source and the sudoers documentation only. No real update, package transaction or root run was executed.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@surim0n

surim0n commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #12860, which predates this and also covers omarchy-update-available and omarchy-channel-current, the other scripts the review points out would otherwise keep failing under set -u. The root-execution concern raised above applies to that PR too and is worth a look there: bin/omarchy-update still has no EUID guard, unlike omarchy-dev-link.

@surim0n surim0n closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy update aborts: OMARCHY_PATH: unbound variable in omarchy-update-dev

2 participants