fix(installer): refresh mailctl before finalization

This commit is contained in:
Meghdad committed 2026-08-13 04:28:26 +03:30
1 parent 2d84a780d4
commit 9272a10f72
1 file changed
+9 -1
+9 -1
View File
@@ -912,9 +912,16 @@ EOF
finalize_command() { finalize_command() {
require_root require_root
require_bundle require_bundle
[[ -x "$MAILCTL_BIN" ]] || die "$MAILCTL_BIN is missing; run install first"
[[ -f "$BUNDLE_DIR/.env" ]] || die "$BUNDLE_DIR is not initialized" [[ -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 if ! $ASSUME_YES; then
[[ -t 0 ]] || die "non-interactive use requires --yes" [[ -t 0 ]] || die "non-interactive use requires --yes"
warn "Finalize removes the temporary Stalwart recovery administrator." warn "Finalize removes the temporary Stalwart recovery administrator."
@@ -922,6 +929,7 @@ finalize_command() {
[[ "$answer" =~ ^[Yy]$ ]] || die "finalization cancelled" [[ "$answer" =~ ^[Yy]$ ]] || die "finalization cancelled"
fi fi
build_and_install_mailctl
log "Registering Certbot TLS with Stalwart" log "Registering Certbot TLS with Stalwart"
"$MAILCTL_BIN" configure-tls --directory "$BUNDLE_DIR" "$MAILCTL_BIN" configure-tls --directory "$BUNDLE_DIR"
log "Removing temporary recovery access" log "Removing temporary recovery access"