Browse Source

set webmail system on upgrade

cmstew 4 years ago
parent
commit
8ecd4c84b2
2 changed files with 13 additions and 3 deletions
  1. 4 3
      bin/v-rebuild-mail-domain
  2. 9 0
      install/upgrade/versions/1.4.0.sh

+ 4 - 3
bin/v-rebuild-mail-domain

@@ -68,9 +68,10 @@ rebuild_mail_domain_conf
 if [ ! -z "$WEB_SYSTEM" ] || [ ! -z "$PROXY_SYSTEM" ]; then
     if [ ! -z "$IMAP_SYSTEM" ]; then
         WEBMAIL=$(get_object_value 'web' 'DOMAIN' "$domain" "$WEBMAIL")
-        if [ -z "$WEBMAIL" ]; then WEBMAIL='roundcube'; fi
-        $BIN/v-delete-mail-domain-webmail $user $domain '' $restart 'yes'
-        $BIN/v-add-mail-domain-webmail $user $domain $WEBMAIL '' $restart 'yes'
+        if [ ! -z "$WEBMAIL" ]; then
+            $BIN/v-delete-mail-domain-webmail $user $domain '' $restart 'yes'
+            $BIN/v-add-mail-domain-webmail $user $domain $WEBMAIL '' $restart 'yes'
+        fi
     fi
 fi
 

+ 9 - 0
install/upgrade/versions/1.4.0.sh

@@ -110,6 +110,15 @@ if [ "$MAIL_SYSTEM" == "exim4" ]; then
     fi
 fi
 
+# Set default webmail system for mail domains
+if [ ! -z "$WEBMAIL_SYSTEM" ]; then
+    for user in $($BIN/v-list-users plain | cut -f1); do
+        for domain in $($BIN/v-list-mail-domains $user plain | cut -f1); do
+            $BIN/v-add-mail-domain-webmail $user $domain
+        done 
+    done
+fi
+
 # Fix PostgreSQL repo
 if [ -f /etc/apt/sources.list.d/postgresql.list ]; then
     echo "[ * ] Updating PostgreSQL repository..."