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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## Unreleased

- **A migration that is waiting no longer counts as failed.** Since
omacom/omarchy#19754, a migration exits 75 to stay pending until a package
lands or a graphical or audio session exists, and `omarchy-migrate` goes on
with the update. `omarchy-mu-migrate` took that as a failure, so users outside
`wheel` got "A migration failed for your account" at every login (five of
the migrations Omarchy added on 2026-11-25 do it). It now keeps the migration
pending, holds back the ones after it as upstream does, logs it as deferred,
and exits 4; `omarchy-mu-update` says it will run again later.
- **The Dell XPS 16 N1x speaker tuning reaches every account.** Migration
1795613633 installs a package and then writes the tuning to the user's own
`~/.config/pipewire`; read as machine-wide, it was only marked done for
everyone but the administrator. It is now `mixed`.

## 0.14.2 (2026-11-24)

- **A wrong password on the lock screen counts once.** PAM can answer one
Expand Down
28 changes: 25 additions & 3 deletions bin/omarchy-mu-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
#
# Order matters as it does upstream: the first migration that can't run
# (failed, or waiting for an admin) stops the run, and the next login retries.
# A migration that exits 75 (EX_TEMPFAIL) is waiting, as upstream's
# omarchy-migrate has it, for a package that hasn't landed yet or for a
# graphical or audio session: it stays pending and holds back the rest, but
# it is no failure.
# Administrators get upstream's omarchy-migrate unchanged, under the same
# machine-wide lock as omarchy-mu-update, so two administrators never run one
# migration at once.
#
# Usage: omarchy-mu-migrate [--pending] [--quiet]
# Exit: 0 nothing pending, 3 waiting for an admin, 1 a migration failed
# Exit: 0 nothing pending, 3 waiting for an admin, 4 a migration is waiting
# for a package or a session (it exited 75), 1 a migration failed

set -uo pipefail

Expand Down Expand Up @@ -136,6 +141,15 @@ run_migration() {
bash -euo pipefail "$file" </dev/null
}

# Exit 75: the migration stays pending and the run stops there, without
# counting as a failure.
defer_migration() {
local name=$1 class=$2
log_line "deferred $name ($class, exit 75: waiting for a package or a session)"
say "Migration ${name%.sh} is waiting for a package or a session; it will run again later."
exit 4
}

mkdir -p "$state_dir"
for file in "$OMU_MIGRATIONS_DIR"/*.sh; do
[[ -f $file ]] || continue
Expand All @@ -150,9 +164,13 @@ for file in "$OMU_MIGRATIONS_DIR"/*.sh; do
case $class in
user)
say "\e[32mRunning migration (${name%.sh})\e[0m"
if run_migration "$file" "$shims/strict"; then
status=0
run_migration "$file" "$shims/strict" || status=$?
if (( status == 0 )); then
touch "$marker"
log_line "ran $name (user)"
elif (( status == 75 )); then
defer_migration "$name" user
else
log_line "FAILED $name (user)"
say "\e[31mMigration ${name%.sh} failed; see $log.\e[0m"
Expand All @@ -177,13 +195,17 @@ for file in "$OMU_MIGRATIONS_DIR"/*.sh; do
fi
say "\e[32mRunning migration (${name%.sh}, your part)\e[0m"
rm -f "$needs_admin"
if run_migration "$file" "$shims/lenient"; then
status=0
run_migration "$file" "$shims/lenient" || status=$?
if (( status == 0 )); then
touch "$marker"
log_line "ran $name ($class, privileged part skipped)"
elif [[ -s $needs_admin ]]; then
log_line "waiting for an admin: $name ($class, for this account: $(head -1 "$needs_admin"))"
say "Migration ${name%.sh} needs an administrator to run, for your account: $(head -1 "$needs_admin")"
exit 3
elif (( status == 75 )); then
defer_migration "$name" "$class"
else
log_line "FAILED $name ($class)"
say "\e[31mMigration ${name%.sh} failed; see $log.\e[0m"
Expand Down
1 change: 1 addition & 0 deletions bin/omarchy-mu-update
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ omarchy-mu-migrate
case $? in
0) echo "Your account is up to date." ;;
3) echo "Some migrations are waiting for an administrator (see the message above)." ;;
4) echo "A migration is waiting for a package or a session; it will run again later." ;;
*) echo "A migration failed; see ~/.local/state/omarchy-multiuser/migrate.log." ;;
esac
echo
Expand Down
4 changes: 4 additions & 0 deletions share/migrations-overrides.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Corrections to the automatic migration classes (lib/omarchy-multiuser/migrations.sh).
# <migration file name><TAB><user|system|mixed>
# Speaker tuning for the Dell XPS 16 N1x: the package (omarchy-pkg-add) is the
# admin's, the tuning (omarchy-audio-tuning on) lives in each user's
# ~/.config/pipewire and user units.
1795613633.sh mixed
43 changes: 43 additions & 0 deletions tests/sh/migrate.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,47 @@ test_pending_lists_unmarked() {
assert_eq "$(omarchy-mu-migrate --pending)" "101.sh"
}

test_exit_75_defers_without_failing() {
setup
migration 100 'exit 75'
migration 101 'touch "$HOME/ran-101"'
omarchy-mu-migrate --quiet
assert_eq $? 4
assert_no_file "$(marker 100)"
assert_no_file "$HOME/ran-101" # it holds back the rest, as upstream
assert_contains "$HOME/.local/state/omarchy-multiuser/migrate.log" "deferred 100.sh (user"
# Once what it waited for is there, it runs, and the queue goes on.
migration 100 'touch "$HOME/ran-100"'
omarchy-mu-migrate --quiet || fail "exit $?"
assert_file "$(marker 100)"
assert_file "$HOME/ran-101"
}

test_mixed_exit_75_defers_after_admin() {
setup
# Like 1795613633: a package, then a wait for the audio session.
migration 100 'sudo pacman -S foo
[[ -e $HOME/session ]] || exit 75
touch "$HOME/ran-100"'
assert_eq "$(classify 100)" mixed
register 100
omarchy-mu-migrate --quiet
assert_eq $? 4
assert_no_file "$(marker 100)"
assert_contains "$HOME/.local/state/omarchy-multiuser/migrate.log" "deferred 100.sh (mixed"
touch "$HOME/session"
omarchy-mu-migrate --quiet || fail "exit $?"
assert_file "$HOME/ran-100"
assert_file "$(marker 100)"
}

test_shipped_overrides() {
setup
export OMU_MIGRATION_OVERRIDES=$REPO/share/migrations-overrides.tsv
# omarchy-pkg-add (the admin's) and ~/.config/pipewire (each user's).
migration 1795613633 'omarchy-pkg-add lsp-plugins-lv2
omarchy-audio-tuning on'
assert_eq "$(classify 1795613633)" mixed
}

run_tests