yunohost/data/hooks/conf_regen/22-email-legacy
2016-03-08 14:15:35 +01:00

45 lines
1.8 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 redis-server -l /var/log/redis/redis-server.log \
|| echo "redis-server is already listed in services"
# Remove previous email services
systemctl is-enabled spamassassin > /dev/null 2>&1 \
&& { sudo systemctl disable spamassassin || true ; }
systemctl is-active spamassassin > /dev/null \
&& { sudo systemctl stop spamassassin || true ; }
sudo rm -f /etc/cron.daily/spamassassin
sudo yunohost service status spamassassin > /dev/null 2>&1 \
&& { sudo yunohost service remove spamassassin || true ; }
# 'systemctl is-enabled' does not work for service with no systemd unit file
sudo ls /etc/rc2.d/S??amavis > /dev/null 2>&1 \
|| sudo systemctl disable amavis || true
sudo systemctl is-active amavis > /dev/null \
&& { sudo systemctl stop amavis || true ; } \
|| true
sudo yunohost service status amavis > /dev/null 2>&1 \
&& { sudo yunohost service remove amavis || true ; } \
|| true
# 'systemctl is-enabled' does not work for service with no systemd unit file
sudo ls /etc/rc2.d/S??postgrey > /dev/null 2>&1 \
|| sudo systemctl disable postgrey || true
sudo systemctl is-active postgrey > /dev/null \
&& { sudo systemctl stop postgrey || true ; } \
|| true
sudo yunohost service status postgrey > /dev/null 2>&1 \
&& { sudo yunohost service remove postgrey || true ; } \
|| true
fi