The Thunderbolt approval watcher is enabled by its setup command, a migration and first-run, but no package put it in a user unit folder and nothing installed it. On edge the migration failed with "Unit omarchy-thunderbolt-authorization.service does not exist", so every later migration stayed pending. First-run failed too, and enabled none of its units: given a list, systemctl enables nothing when one unit is unknown. The units are now shipped by the settings packages (omarchy-pkgs#922). Here, first-run enables its units one at a time, so a unit missing from a build costs only that unit, and config-test fails when a unit under default/systemd/user is enabled without being shipped or installed first.
57 lines
2.1 KiB
Bash
57 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
source "$(dirname "$0")/base-test.sh"
|
|
|
|
test_tmp=$(mktemp -d)
|
|
trap 'rm -rf "$test_tmp"' EXIT
|
|
|
|
mock_bin="$test_tmp/bin"
|
|
mkdir -p "$mock_bin" "$test_tmp/home"
|
|
|
|
cat >"$mock_bin/omarchy-done" <<'SH'
|
|
#!/bin/bash
|
|
[[ $1 == "check" && $2 == "first-run-user" ]]
|
|
SH
|
|
cat >"$mock_bin/omarchy-provision-user" <<'SH'
|
|
#!/bin/bash
|
|
touch "$OMARCHY_TEST_FINALIZE_CALLED"
|
|
SH
|
|
chmod +x "$mock_bin/omarchy-done" "$mock_bin/omarchy-provision-user"
|
|
|
|
finalize_called="$test_tmp/finalize-called"
|
|
HOME="$test_tmp/home" PATH="$mock_bin:$PATH" OMARCHY_TEST_FINALIZE_CALLED="$finalize_called" \
|
|
bash "$ROOT/bin/omarchy-provision-first-run" >"$test_tmp/output"
|
|
|
|
[[ ! -e $finalize_called ]] || fail "completed first-run exits before any setup step"
|
|
grep -F 'First-run already complete' "$test_tmp/output" >/dev/null || fail "completed first-run reports its lifecycle gate"
|
|
|
|
if grep -F 'user-migration-notify-watch-enabled' "$ROOT/bin/omarchy-provision-first-run" >/dev/null; then
|
|
fail "first-run does not track the migration watcher separately"
|
|
fi
|
|
if grep -F 'skip-first-run-update-notification' "$ROOT/install/user/first-run/wifi.sh" >/dev/null; then
|
|
fail "first-run does not track update notifications separately"
|
|
fi
|
|
|
|
pass "first-run uses one lifecycle completion marker"
|
|
|
|
# systemctl enables none of a list when one unit in it is unknown, so a unit
|
|
# missing from a build must cost first-run only that unit.
|
|
cat >"$mock_bin/systemctl" <<'SH'
|
|
#!/bin/bash
|
|
[[ $* != *omarchy-sleep-lock.service* ]] || exit 1
|
|
printf '%s\n' "$*" >>"$OMARCHY_TEST_CALLS"
|
|
SH
|
|
cat >"$mock_bin/omarchy-hook-install" <<'SH'
|
|
#!/bin/bash
|
|
echo hook >>"$OMARCHY_TEST_CALLS"
|
|
SH
|
|
chmod +x "$mock_bin/systemctl" "$mock_bin/omarchy-hook-install"
|
|
|
|
if PATH="$mock_bin:$PATH" OMARCHY_TEST_CALLS="$test_tmp/calls" bash "$ROOT/install/user/first-run/enable-user-units.sh"; then
|
|
fail "first-run reports a unit it could not enable"
|
|
fi
|
|
for expected in bt-agent.service omarchy-crash-watch.service hook; do
|
|
grep -Fq "$expected" "$test_tmp/calls" || fail "a unit missing from the build does not cost first-run $expected"
|
|
done
|
|
pass "a unit missing from the build costs first-run only that unit"
|