From 0bbff4a4167db7dd2bfae91aa3701f6a33b54120 Mon Sep 17 00:00:00 2001 From: kload Date: Sat, 31 Oct 2015 19:38:08 +0100 Subject: [PATCH] [fix] Disable/stop previous email services only if we are forcing conf regeneration --- data/hooks/conf_regen/22-email-legacy | 42 ++++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/data/hooks/conf_regen/22-email-legacy b/data/hooks/conf_regen/22-email-legacy index 0b11ae10c..59cf75b1c 100644 --- a/data/hooks/conf_regen/22-email-legacy +++ b/data/hooks/conf_regen/22-email-legacy @@ -1,25 +1,33 @@ #!/bin/bash set -e -# Add new email services -sudo yunohost service add rspamd -l /var/log/mail.log \ - || echo "Rspamd is already listed in services" +# Execute this hook only if we force the configuration regeneration +if [[ "$1" == "True" ]]; then -sudo yunohost service add rmilter -l /var/log/mail.log \ - || echo "Rspamd is already listed in services" + # Add new email services + sudo yunohost service add rspamd -l /var/log/mail.log \ + || echo "Rspamd is already listed in services" -sudo yunohost service add memcached \ - || echo "Memcached is already listed in services" + sudo yunohost service add rmilter -l /var/log/mail.log \ + || echo "Rspamd is already listed in services" -# Remove previous email services -sudo yunohost service remove spamassassin \ - || echo "Spamassassin is already removed" \ - && sudo systemctl disable spamassassin || true + sudo yunohost service add memcached \ + || echo "Memcached is already listed in services" -sudo yunohost service remove amavis \ - || echo "Amavis is already removed" \ - && sudo systemctl disable amavis || true + # Remove previous email services + sudo yunohost service remove spamassassin \ + || echo "Spamassassin is already removed" \ + && sudo systemctl disable spamassassin || true -sudo yunohost service remove postgrey \ - || echo "Postgrey is already removed" \ - && sudo systemctl disable postgrey || true + sudo yunohost service remove amavis \ + || echo "Amavis is already removed" \ + && sudo systemctl disable amavis || true + + sudo yunohost service remove postgrey \ + || echo "Postgrey is already removed" \ + && sudo systemctl disable postgrey || true + + systemctl stop spamassassin + systemctl stop amavis + systemctl stop postgrey +fi