You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hestiacp/install/upgrade/manual/remove-mail-stack.sh

54 lines
1.8 KiB

#!/bin/bash
# Function Description
# Soft remove the mail stack
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# shellcheck source=/usr/local/hestia/conf/hestia.conf
source $HESTIA/conf/hestia.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
echo "This will soft remove the mail stack from HestiaCP and disable related systemd service."
echo "You won't be able to access mail related configurations from HestiaCP."
echo "Your existing mail data and apt packages will be kept back."
read -p 'Would you like to continue? [y/n]'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$ANTISPAM_SYSTEM" == "spamassassin" ]; then
echo Removing Spamassassin
sed -i "/^ANTISPAM_SYSTEM/d" $HESTIA/conf/hestia.conf
systemctl disable --now spamassassin
fi
if [ "$ANTIVIRUS_SYSTEM" == "clamav-daemon" ]; then
echo Removing ClamAV
sed -i "/^ANTIVIRUS_SYSTEM/d" $HESTIA/conf/hestia.conf
systemctl disable --now clamav-daemon clamav-freshclam
fi
if [ "$IMAP_SYSTEM" == "dovecot" ]; then
echo Removing Dovecot
sed -i "/^IMAP_SYSTEM/d" $HESTIA/conf/hestia.conf
systemctl disable --now dovecot
fi
if [ "$MAIL_SYSTEM" == "exim4" ]; then
echo Removing Exim4
sed -i "/^MAIL_SYSTEM/d" $HESTIA/conf/hestia.conf
systemctl disable --now exim4
fi