Browse Source

soft remove mail stack (#3497)

Istiak Ferdous 2 years ago
parent
commit
ff94c5ef92

+ 1 - 1
install/upgrade/manual/migrate_apache.sh

@@ -22,7 +22,7 @@ if [ ! -z "$WEB_BACKEND" ]; then
 fi
 
 if [ "$(multiphp_count)" -gt 1 ]; then
-	check_result $E_EXISTS "Multiphp allready enabled" > /dev/null
+	check_result $E_EXISTS "Multiphp already enabled" > /dev/null
 fi
 
 #----------------------------------------------------------#

+ 53 - 0
install/upgrade/manual/remove-mail-stack.sh

@@ -0,0 +1,53 @@
+#!/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