Resume cups-browsed on whether it is enabled, not on whether it was running
The migration recomputed whether cups-browsed was active at the start of every run, after an earlier run may already have stopped it. A run interrupted between that stop and the completion marker left the service down, and the retry that followed read it as inactive, skipped the restart, and wrote the marker anyway: printer discovery stayed off until the next reboot with no migration left to bring it back. Keying the restart to whether the unit is enabled survives the interruption, and reports not-enabled for a unit the user masked or disabled, which restarting would fail on and abort the migration short of its marker. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Codex XHigh <noreply@openai.com>
This commit is contained in:
co-authored by
Claude Opus 5
Codex XHigh
parent
5c336885d2
commit
521f1ae9ac
@@ -14,9 +14,8 @@ if omarchy-pkg-present cups; then
|
||||
omarchy-pkg-add cups-pk-helper
|
||||
fi
|
||||
|
||||
cups_browsed_was_active=0
|
||||
# Stop the root-running daemon before changing the authorization it relies on.
|
||||
if systemctl is-active --quiet cups-browsed.service 2>/dev/null; then
|
||||
cups_browsed_was_active=1
|
||||
sudo systemctl stop cups-browsed.service
|
||||
fi
|
||||
|
||||
@@ -27,7 +26,11 @@ if omarchy-pkg-present cups; then
|
||||
sudo systemctl try-reload-or-restart cups.service
|
||||
fi
|
||||
|
||||
if (( cups_browsed_was_active )) && omarchy-pkg-present cups-browsed; then
|
||||
# Resume on whether the unit is enabled, not on whether it was running when this
|
||||
# run started: an interrupted earlier run leaves it stopped, and a retry that
|
||||
# recomputed that would skip the restart and still write the marker below. A
|
||||
# masked or disabled unit reports not-enabled and is left alone.
|
||||
if systemctl is-enabled --quiet cups-browsed.service 2>/dev/null; then
|
||||
sudo systemctl restart cups-browsed.service
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user