Просмотр исходного кода

Fixes to how webmail aliases are handled

Kristan Kenney 6 лет назад
Родитель
Сommit
426a952d44

+ 4 - 5
bin/v-add-sys-webmail

@@ -43,7 +43,6 @@ get_user_ip
 
 check_args '2' "$#" 'USER DOMAIN [RESTART]'
 is_format_valid 'user' 'domain'
-is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
 is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
 is_system_enabled "$IMAP_SYSTEM" 'IMAP_SYSTEM'
 is_object_valid 'user' 'USER' "$user"
@@ -55,8 +54,10 @@ is_object_unsuspended 'mail' 'DOMAIN' "$domain"
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Verify that webmail alias variable exists
-if [ ! -z "$WEBMAIL_ALIAS" ]; then
+# Verify that webmail alias variable exists and create it if it does not
+if [ -z "$WEBMAIL_ALIAS" ]; then
+    $BIN/v-change-sys-config-value 'WEBMAIL_ALIAS' "webmail"
+else
     # Ensure DNS record exists if Hestia is hosting DNS zones
     if [ ! -z "$DNS_SYSTEM" ]; then
         dns_domain=$($BIN/v-list-dns-domains $user | grep $domain | cut -d' ' -f1)
@@ -91,8 +92,6 @@ if [ ! -z "$WEBMAIL_ALIAS" ]; then
             add_webmail_config "$PROXY_SYSTEM" "default.stpl"
         fi
     fi
-else
-    echo "Error: WEBMAIL_ALIAS is not defined in hestia.conf"
 fi
 
 #----------------------------------------------------------#

+ 0 - 1
install/hst-install-ubuntu.sh

@@ -1027,7 +1027,6 @@ fi
 # Mail stack
 if [ "$exim" = 'yes' ]; then
     echo "MAIL_SYSTEM='exim4'" >> $HESTIA/conf/hestia.conf
-    echo "WEBMAIL_ALIAS='webmail'" >> $HESTIA/conf/hestia.conf
     if [ "$clamd" = 'yes'  ]; then
         echo "ANTIVIRUS_SYSTEM='clamav-daemon'" >> $HESTIA/conf/hestia.conf
     fi

+ 3 - 5
install/upgrade/versions/previous/1.00.0-190618.sh

@@ -7,11 +7,9 @@
 #######################################################################################
 
 # Add webmail alias variable to system configuration if non-existent
-WEBMAIL_ALIAS_CHECK=$(cat $HESTIA/conf/hestia.conf | grep WEBMAIL_ALIAS)
-if [ -z "$WEBMAIL_ALIAS_CHECK" ]; then
-    echo "(*) Adding global webmail alias to system configuration..."
-    sed -i "/WEBMAIL_ALIAS/d" $HESTIA/conf/hestia.conf
-    echo "WEBMAIL_ALIAS='webmail'" >> $HESTIA/conf/hestia.conf
+if [ -z "$WEBMAIL_ALIAS" ]; then
+    echo "(*) Updating webmail alias configuration..."
+    $HESTIA/bin/v-change-sys-config-value 'WEBMAIL_ALIAS' "webmail"
 fi
 
 # Update Apache and Nginx configuration to support new file structure