Shield Omarchy pacman transactions from desktop session teardown
Upgrading systemd runs its post_upgrade scriptlet mid-transaction, which reexecs both the system manager and every user manager. When pacman runs inside a user-session scope (the floating update terminal), that reexec can SIGKILL it and abandon the transaction halfway, with packages upgraded but none of the post-transaction hooks run. Route every Omarchy-owned system mutation through a new hidden omarchy-update-pacman helper that registers the transaction as a PID 1 scope via systemd-run, keeping it out of the user manager's cgroups. System scopes survive the system manager's own reexec, and as a bonus the transaction now also survives its terminal window closing. On unbooted systems (the installer chroot) the helper runs pacman directly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b001a69d3
commit
f5194e3ff5
7 files changed
+53
-16
No files matched your search
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Run a pacman transaction for the Omarchy update flow, shielded from desktop session teardown.
|
||||
# omarchy:args=<pacman-args>
|
||||
# omarchy:hidden=true
|
||||
# omarchy:requires-sudo=true
|
||||
|
||||
# Upgrading systemd runs its post_upgrade scriptlet mid-transaction, which
|
||||
# reexecs both the system manager and every user manager. A pacman running
|
||||
# inside a user-session scope can be SIGKILLed by that reexec, abandoning the
|
||||
# transaction halfway. Registering the transaction as a PID 1 scope keeps it
|
||||
# out of the user manager's cgroups entirely, and system scopes survive the
|
||||
# system manager's own reexec.
|
||||
scope=()
|
||||
if [[ -d /run/systemd/system && ! -L /run/systemd/system ]]; then
|
||||
scope=(systemd-run --scope --quiet --collect)
|
||||
fi
|
||||
|
||||
# LC_ALL passes through so callers that parse pacman's stderr can pin the locale.
|
||||
env_args=(OMARCHY_UPDATE_PACMAN=1)
|
||||
if [[ -n ${LC_ALL:-} ]]; then
|
||||
env_args+=(LC_ALL="$LC_ALL")
|
||||
fi
|
||||
|
||||
exec sudo env "${env_args[@]}" "${scope[@]}" pacman "$@"
|
||||
Reference in new issue
Block a user