Commit 79e799cd authored by MrMan's avatar MrMan

Don't copy if from/to are the same path

parent a2523117
Pipeline #50059005 passed with stage
in 6 minutes and 35 seconds
......@@ -220,7 +220,6 @@ impl FileConfigurable<DovecotCfg> for Dovecot {
let dir = dir.unwrap_or(self.config_dir_path());
ensure_directory(&dir)?;
// Generate file paths for the dovecot.conf file
let output_dir = Path::new(&self.cfg.config_output_dir);
let main_conf_path = output_dir.join(DOVECOT_CONF_FILENAME);
......@@ -309,20 +308,26 @@ impl FileConfigurable<DovecotCfg> for Dovecot {
// Copy dovecot.conf
let dovecot_conf_from = config_dir_path.clone().join(DOVECOT_CONF_FILENAME);
let dovecot_conf_to = config_output_dir_path.clone().join(DOVECOT_CONF_FILENAME);
debug!("copying dovecot.conf from [{:?}] to [{:?}]", dovecot_conf_from, dovecot_conf_to);
copy(&dovecot_conf_from, &dovecot_conf_to)?;
if dovecot_conf_from != dovecot_conf_to {
debug!("copying dovecot.conf from [{:?}] to [{:?}]", dovecot_conf_from, dovecot_conf_to);
copy(&dovecot_conf_from, &dovecot_conf_to)?;
}
// Copy dovecot userdb conf
let userdb_conf_from = config_dir_path.clone().join(DOVECOT_USERDB_CONF_FILENAME);
let userdb_conf_to = config_output_dir_path.clone().join(DOVECOT_PASSDB_CONF_FILENAME);
debug!("copying dovecot-sql.conf.ext from [{:?}] to [{:?}]", userdb_conf_from, userdb_conf_to);
copy(&userdb_conf_from, &userdb_conf_to)?;
if userdb_conf_from != userdb_conf_to {
debug!("copying dovecot-sql.conf.ext from [{:?}] to [{:?}]", userdb_conf_from, userdb_conf_to);
copy(&userdb_conf_from, &userdb_conf_to)?;
}
// Copy dovecot passdb conf
let passdb_conf_from = config_dir_path.clone().join(DOVECOT_PASSDB_CONF_FILENAME);
let passdb_conf_to = config_output_dir_path.clone().join(DOVECOT_PASSDB_CONF_FILENAME);
debug!("copying dovecot-sql.conf.ext from [{:?}] to [{:?}]", passdb_conf_from, passdb_conf_to);
copy(&passdb_conf_from, &passdb_conf_to)?;
if passdb_conf_from != passdb_conf_to {
debug!("copying dovecot-sql.conf.ext from [{:?}] to [{:?}]", passdb_conf_from, passdb_conf_to);
copy(&passdb_conf_from, &passdb_conf_to)?;
}
Ok(())
}
......
......@@ -54,6 +54,12 @@ fn main() {
process::exit(1);
}
// Update config for dovecot
if let Err(dovecot_config_err) = dovecot.update_config(None) {
error!("failed to setup dovecot config: {}", dovecot_config_err);
process::exit(1);
}
// Start dovecot
let dovecot_thread = thread::spawn(move|| { dovecot.start() });
debug!("successfully started threaded dovecot component");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment