aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-17 14:32:38 -0500
committerCraig Jennings <c@cjennings.net>2026-05-17 14:32:38 -0500
commit19cd3ffad4874a812fb5ecbff636e15b0d0a7fc7 (patch)
treee9a62b1ebcdce73b25147289a3af0accdaea3965
parentdae765970268dcbea96060de63cae06c3e63bea6 (diff)
downloadarchsetup-19cd3ffad4874a812fb5ecbff636e15b0d0a7fc7.tar.gz
archsetup-19cd3ffad4874a812fb5ecbff636e15b0d0a7fc7.zip
fix(cmail-setup-finish): verify both Bridge ports and dump status on failure
The "verifying Bridge is listening" check used a regex `127\.0\.0\.1:(1143|1025)` against `ss -ltn` output. That matches if *either* port is listening, but the success message claims both are. So a half-broken Bridge (IMAP up, SMTP down or vice versa) would pass the check. I split the check into two greps and report which port is missing. When the check fails, the script now also prints the last 10 lines of `systemctl --user status protonmail-bridge` to stderr so the operator sees the service state immediately instead of being told to go run the command themselves.
-rwxr-xr-xscripts/cmail-setup-finish.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/cmail-setup-finish.sh b/scripts/cmail-setup-finish.sh
index 3e119f6..704b707 100755
--- a/scripts/cmail-setup-finish.sh
+++ b/scripts/cmail-setup-finish.sh
@@ -112,10 +112,16 @@ fi
# 8. Verify
info "verifying Bridge is listening"
-if ss -ltn 2>/dev/null | grep -qE '127\.0\.0\.1:(1143|1025)'; then
+listening="$(ss -ltn 2>/dev/null || true)"
+missing=""
+echo "$listening" | grep -q '127\.0\.0\.1:1143' || missing="$missing 1143 (IMAP)"
+echo "$listening" | grep -q '127\.0\.0\.1:1025' || missing="$missing 1025 (SMTP)"
+if [ -z "$missing" ]; then
ok "127.0.0.1:1143 + :1025 LISTEN"
else
- err "Bridge isn't listening on the expected ports — check 'systemctl --user status protonmail-bridge'"
+ error_status="$(systemctl --user status protonmail-bridge --no-pager --lines=10 2>&1 || true)"
+ printf '%s\n' "$error_status" >&2
+ err "Bridge isn't listening on:${missing}"
fi
echo