From ea7dc3b94d5f9b11e84887a5c8282fee14dffa0f Mon Sep 17 00:00:00 2001 From: boban Date: Mon, 27 Apr 2026 01:34:32 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Dovecot24-Migration=20erg=C3=A4nzt=20mai?= =?UTF-8?q?l=5Flocation=20=E2=86=92=20mail=5Fdriver=20+=20mail=5Fpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- app/Console/Commands/MigrateDovecot24.php | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/MigrateDovecot24.php b/app/Console/Commands/MigrateDovecot24.php index 2f1780c..d7d23b6 100644 --- a/app/Console/Commands/MigrateDovecot24.php +++ b/app/Console/Commands/MigrateDovecot24.php @@ -19,7 +19,10 @@ class MigrateDovecot24 extends Command // 2) 10-auth.conf: disable_plaintext_auth → auth_allow_cleartext $this->fixAuthConf($dry); - // 3) auth-sql.conf.ext: neue passdb/userdb-Syntax + // 3) 10-mail.conf: mail_location → mail_driver + mail_path + $this->fixMailConf($dry); + + // 4) auth-sql.conf.ext: neue passdb/userdb-Syntax $this->fixAuthSqlConf($dry); if (!$dry) { @@ -56,6 +59,27 @@ class MigrateDovecot24 extends Command $this->info(" aktualisiert: {$file}"); } + private function fixMailConf(bool $dry): void + { + $file = '/etc/dovecot/conf.d/10-mail.conf'; + $content = @file_get_contents($file); + if ($content === false) { $this->warn("Nicht gefunden: {$file}"); return; } + + $new = preg_replace_callback( + '/^mail_location\s*=\s*(\w+):(.+)$/m', + function ($m) { + return "mail_driver = {$m[1]}\nmail_path = {$m[2]}"; + }, + $content + ); + + if ($new === $content) { $this->line(" ok (unverändert): {$file}"); return; } + + if ($dry) { $this->line(" [dry-run] würde mail_location aufteilen in {$file}"); return; } + file_put_contents($file, $new); + $this->info(" aktualisiert: {$file}"); + } + private function fixAuthConf(bool $dry): void { $file = '/etc/dovecot/conf.d/10-auth.conf';