|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Function Description |
| 4 | +# Soft remove the mail stack |
| 5 | + |
| 6 | +#----------------------------------------------------------# |
| 7 | +# Variable&Function # |
| 8 | +#----------------------------------------------------------# |
| 9 | + |
| 10 | +# Includes |
| 11 | +# shellcheck source=/etc/hestiacp/hestia.conf |
| 12 | +source /etc/hestiacp/hestia.conf |
| 13 | +# shellcheck source=/usr/local/hestia/func/main.sh |
| 14 | +source $HESTIA/func/main.sh |
| 15 | +# shellcheck source=/usr/local/hestia/conf/hestia.conf |
| 16 | +source $HESTIA/conf/hestia.conf |
| 17 | + |
| 18 | +#----------------------------------------------------------# |
| 19 | +# Verifications # |
| 20 | +#----------------------------------------------------------# |
| 21 | + |
| 22 | +echo "This will soft remove the mail stack from HestiaCP and disable related systemd service." |
| 23 | +echo "You won't be able to access mail related configurations from HestiaCP." |
| 24 | +echo "Your existing mail data and apt packages will be kept back." |
| 25 | +read -p 'Would you like to continue? [y/n]' |
| 26 | + |
| 27 | +#----------------------------------------------------------# |
| 28 | +# Action # |
| 29 | +#----------------------------------------------------------# |
| 30 | + |
| 31 | +if [ "$ANTISPAM_SYSTEM" == "spamassassin" ]; then |
| 32 | + echo Removing Spamassassin |
| 33 | + sed -i "/^ANTISPAM_SYSTEM/d" $HESTIA/conf/hestia.conf |
| 34 | + systemctl disable --now spamassassin |
| 35 | +fi |
| 36 | + |
| 37 | +if [ "$ANTIVIRUS_SYSTEM" == "clamav-daemon" ]; then |
| 38 | + echo Removing ClamAV |
| 39 | + sed -i "/^ANTIVIRUS_SYSTEM/d" $HESTIA/conf/hestia.conf |
| 40 | + systemctl disable --now clamav-daemon clamav-freshclam |
| 41 | +fi |
| 42 | + |
| 43 | +if [ "$IMAP_SYSTEM" == "dovecot" ]; then |
| 44 | + echo Removing Dovecot |
| 45 | + sed -i "/^IMAP_SYSTEM/d" $HESTIA/conf/hestia.conf |
| 46 | + systemctl disable --now dovecot |
| 47 | +fi |
| 48 | + |
| 49 | +if [ "$MAIL_SYSTEM" == "exim4" ]; then |
| 50 | + echo Removing Exim4 |
| 51 | + sed -i "/^MAIL_SYSTEM/d" $HESTIA/conf/hestia.conf |
| 52 | + systemctl disable --now exim4 |
| 53 | +fi |
0 commit comments