[fix] Disable/stop previous email services only if we are forcing conf regeneration

This commit is contained in:
kload 2015-10-31 19:38:08 +01:00
parent 12127d1a71
commit 0bbff4a416

View file

@ -1,25 +1,33 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Add new email services # Execute this hook only if we force the configuration regeneration
sudo yunohost service add rspamd -l /var/log/mail.log \ if [[ "$1" == "True" ]]; then
|| echo "Rspamd is already listed in services"
sudo yunohost service add rmilter -l /var/log/mail.log \ # Add new email services
|| echo "Rspamd is already listed in services" sudo yunohost service add rspamd -l /var/log/mail.log \
|| echo "Rspamd is already listed in services"
sudo yunohost service add memcached \ sudo yunohost service add rmilter -l /var/log/mail.log \
|| echo "Memcached is already listed in services" || echo "Rspamd is already listed in services"
# Remove previous email services sudo yunohost service add memcached \
sudo yunohost service remove spamassassin \ || echo "Memcached is already listed in services"
|| echo "Spamassassin is already removed" \
&& sudo systemctl disable spamassassin || true
sudo yunohost service remove amavis \ # Remove previous email services
|| echo "Amavis is already removed" \ sudo yunohost service remove spamassassin \
&& sudo systemctl disable amavis || true || echo "Spamassassin is already removed" \
&& sudo systemctl disable spamassassin || true
sudo yunohost service remove postgrey \ sudo yunohost service remove amavis \
|| echo "Postgrey is already removed" \ || echo "Amavis is already removed" \
&& sudo systemctl disable postgrey || true && 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