Repository navigation
Fix omarchy update under sudo: unset OMARCHY_PATH and yay-as-root - #12796
mrpink77it wants to merge 4 commits into
Conversation
|
Verified: The unset-path fixes work in the tested cases, but supporting The newly unblocked pipeline retains root's homeWith Impact: With sudo setting Suggested change: Either reject root invocation with guidance to run Shell config discovery does not restore session targetingIn An isolated namespace-root test used a mocked user manager, real
Impact: The original config-path error is avoided, but the advertised sudo restart remains incomplete when sudo clears session variables. Suggested change: Execute the restart in the initiating user's session context, covering Hyprland, Quickshell IPC and invitation-unit restarts. Restoring the runtime in the diagnostic control proves dispatch reachability only, not a complete graphical restart. Optional test improvement: The new sudo restart case passes against unchanged baseline because the plain Verified: The new unset-path cases for Review informationTest scope: Head Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra initial source inspection, independent Fable 5.1 and separate Astra technical reviews, followed by verification of claims against targeted evidence. |
|
Reviewed against current What reproduces. On this PR's base (8f324c9), Why it no longer applies on
If running the update as root still needs handling, the small fix would be for Who checked it: Claude Opus 5.5 reviewed it. The second opinion, Codex Medium, did not run: the reviewer is reachable ( Waiting on the maintainer to decide whether to close this. |
Problem
Running
omarchy updatethe way the package advertises it —sudo omarchy update(# omarchy:requires-sudo=true) — resets the environment withsudo, soOMARCHY_PATHis unset and every step runs as root. Three update helpers break under that, and the AUR step cannot work at all as root:omarchy-update-devandomarchy-update-availableabort withOMARCHY_PATH: unbound variable(both useset -euo pipefailand reference$OMARCHY_PATHunguarded), instead of treating the checkout as package-backed and moving on.omarchy-update-aur-pkgsrunsyayas root; makepkg refuses root, soyay -Suafailsexit status 10and the AUR packages are never updated.omarchy-update-restart's final shell restart printsOmarchy shell config not found: /shelland skips the restart, because root's own user manager carries noOMARCHY_PATH.Everything is currently gated behind
path != /usr/share/omarchy, which assumes the variable is always set (true in a session, false under sudo).Changes
omarchy-update-dev/omarchy-update-available: treat an unsetOMARCHY_PATHas the package-backed checkout (${OMARCHY_PATH:-/usr/share/omarchy}), matching the precedent inomarchy-migrate,omarchy-version, andprovision-*.omarchy-update-aur-pkgs: when running as root, runyayas theSUDO_USERwho started the update (with a cleanHOME/XDG environment, since makepkg refuses root); skip with a clear message if there is no owner user to run it as.omarchy-restart-shell: whenOMARCHY_PATHis empty andSUDO_USERis set, fall back to that user's manager (systemctl --user --machine "$SUDO_USER@.host" show-environment), then to the packaged path, so the post-update shell restart actually happens.Tests
Added hermetic coverage for each fix and ran the related suites:
Note
These were reproduced and validated on a shipped
omarchy4.0.4 install (sudo omarchy update), where a full update run went through cleanly after applying the same changes locally.