Skip to content
Open
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
4 changes: 4 additions & 0 deletions default/systemd/user/bt-agent.service
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service
# inbound pair attempts at a lower layer.
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Restart=on-failure
# Flapping Bluetooth devices can make bt-agent exit about every 15 s (#13487).
# Ramp up retries without leaving pairing stopped after a burst of failures.
RestartSec=2
RestartSteps=6
RestartMaxDelaySec=120

[Install]
WantedBy=graphical-session.target
20 changes: 20 additions & 0 deletions test/shell.d/systemd-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ pass "bt-agent skips when bluetooth.service is inactive"
grep -Fx 'Restart=on-failure' "$service" >/dev/null
pass "bt-agent still restarts after runtime failures"

declare -A bt_settings=()
section=""
while IFS= read -r line; do
if [[ $line =~ ^\[([^]]+)\]$ ]]; then
section=${BASH_REMATCH[1]}
elif [[ $line =~ ^([A-Za-z]+)=(.*)$ ]]; then
bt_settings["$section.${BASH_REMATCH[1]}"]=${BASH_REMATCH[2]}
fi
done < "$service"

[[ ${bt_settings[Service.RestartSec]:-} == "2" &&
${bt_settings[Service.RestartSteps]:-} == "6" &&
${bt_settings[Service.RestartMaxDelaySec]:-} == "120" ]] ||
fail "bt-agent must ramp its restart delay from 2 to 120 seconds over six steps"
for setting in "${!bt_settings[@]}"; do
[[ $setting != *.StartLimit* ]] ||
fail "bt-agent must not stop retrying after a flapping device exhausts a custom start limit"
done
pass "bt-agent backs off without a custom restart cap"

sleep_service="$ROOT/default/systemd/user/omarchy-sleep-lock.service"
grep -Fx 'ExecStart=/usr/bin/omarchy-system-sleep-monitor' "$sleep_service" >/dev/null
pass "sleep lock service uses the package-backed monitor path"
Expand Down