yunohost/data/hooks/conf_regen/22-email-legacy

35 lines
1.1 KiB
Bash

#!/bin/bash
set -e
# Execute this hook only if we force the configuration regeneration
if [[ "$1" == "True" ]]; then
# 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 rmilter -l /var/log/mail.log \
|| echo "Rmilter is already listed in services"
sudo yunohost service add memcached \
|| echo "Memcached 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 rm -f etc/cron.daily/spamassassin
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
sudo systemctl stop spamassassin || true
sudo systemctl stop amavis || true
sudo systemctl stop postgrey || true
fi