[fix] do not output warnings when services are already uninstalled/disabled (fix #215)

This commit is contained in:
Julien Malik 2016-03-08 14:10:18 +01:00
parent 479a0d0abf
commit c4d5f664d1

View file

@ -15,19 +15,29 @@ if [[ "$1" == "True" ]]; then
|| echo "redis-server 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 systemctl stop spamassassin || true
sudo rm -f etc/cron.daily/spamassassin
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 ; }
sudo yunohost service remove amavis \
|| echo "Amavis is already removed"
sudo systemctl disable amavis || true
sudo systemctl stop amavis || 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 ; }
sudo yunohost service status amavis > /dev/null 2>&1 \
&& { sudo yunohost service remove amavis || true ; } \
|| true
sudo yunohost service remove postgrey \
|| echo "Postgrey is already removed" \
sudo systemctl disable postgrey || true
sudo systemctl stop postgrey || 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 ; }
sudo yunohost service status postgrey > /dev/null 2>&1 \
&& { sudo yunohost service remove postgrey || true ; } \
|| true
fi