From eed63b31712824f34ba681a1a1c70aac161014af Mon Sep 17 00:00:00 2001
From: Thom Pol <thom@amsterdamtech.nl>
Date: Sat, 13 Mar 2021 09:14:47 +0100
Subject: [PATCH] Add check if conf.d folder for Dovecot exists

---
 install/dist/lib/debian60.lib.php  | 3 +++
 install/lib/installer_base.lib.php | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php
index d76a45c2d3..981e6cff92 100644
--- a/install/dist/lib/debian60.lib.php
+++ b/install/dist/lib/debian60.lib.php
@@ -110,6 +110,9 @@ class installer extends installer_base {
 			}
 			// Copy custom config file
 			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master')) {
+				if(!@is_dir($config_dir . '/conf.d')) {
+					mkdir($config_dir . '/conf.d');
+				}
 				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master', $config_dir.'/conf.d/99-ispconfig-custom-config.conf');
 			}
 			replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 6de768f7e5..5617826313 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -1536,6 +1536,9 @@ class installer_base {
 			}
 			// Copy custom config file
 			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master')) {
+				if(!@is_dir($config_dir . '/conf.d')) {
+					mkdir($config_dir . '/conf.d');
+				}
 				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/dovecot_custom.conf.master', $config_dir.'/conf.d/99-ispconfig-custom-config.conf');
 			}
 			replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
-- 
GitLab