From 9272a10f72bf573aa12361233536238af61f6a5a Mon Sep 17 00:00:00 2001 From: Meghdad <61308304+MeghdadFadaee@users.noreply.github.com> Date: Thu, 13 Aug 2026 04:28:26 +0330 Subject: [PATCH] fix(installer): refresh mailctl before finalization --- scripts/install-server.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/install-server.sh b/scripts/install-server.sh index ae747e0..38ecaa2 100755 --- a/scripts/install-server.sh +++ b/scripts/install-server.sh @@ -912,9 +912,16 @@ EOF finalize_command() { require_root require_bundle - [[ -x "$MAILCTL_BIN" ]] || die "$MAILCTL_BIN is missing; run install first" [[ -f "$BUNDLE_DIR/.env" ]] || die "$BUNDLE_DIR is not initialized" + # mailctl is installed on the host, outside the Compose lifecycle. Refresh + # it from this checkout before finalization so a container-only application + # update cannot leave an older management client calling stale Stalwart + # endpoints. + MAIL_HOSTNAME="$(sed -n 's/^MAIL_HOSTNAME=//p' "$BUNDLE_DIR/.env" | tail -n 1)" + [[ -n "$MAIL_HOSTNAME" ]] || die "MAIL_HOSTNAME is missing from $BUNDLE_DIR/.env" + validate_hostname + if ! $ASSUME_YES; then [[ -t 0 ]] || die "non-interactive use requires --yes" warn "Finalize removes the temporary Stalwart recovery administrator." @@ -922,6 +929,7 @@ finalize_command() { [[ "$answer" =~ ^[Yy]$ ]] || die "finalization cancelled" fi + build_and_install_mailctl log "Registering Certbot TLS with Stalwart" "$MAILCTL_BIN" configure-tls --directory "$BUNDLE_DIR" log "Removing temporary recovery access"