Browse Source

Fixes to upgrade script

* Only add webmail alias if mail services are installed
* Fix syntax error during global variable detection
* Ensure BIN variable is set correctly
Kristan Kenney 6 years ago
parent
commit
b31f50e340
1 changed files with 11 additions and 7 deletions
  1. 11 7
      install/upgrade/1.00.0-190618.sh

+ 11 - 7
install/upgrade/1.00.0-190618.sh

@@ -1,8 +1,9 @@
 #!/bin/bash
 #!/bin/bash
 
 
 # Define global variables
 # Define global variables
-if [ -z "$HESTIA" ] || [ ! -f "${HESTIA}/conf/hestia.conf"]; then
+if [ -z "$HESTIA" ] || [ ! -f "${HESTIA}/conf/hestia.conf" ]; then
     export HESTIA="/usr/local/hestia"
     export HESTIA="/usr/local/hestia"
+    export BIN="/usr/local/hestia/bin"
 fi
 fi
 
 
 # Set backup folder
 # Set backup folder
@@ -23,11 +24,14 @@ if ! grep -q 'arch=amd64' /etc/apt/sources.list.d/mariadb.list; then
 fi
 fi
 
 
 # Add webmail alias variable to system configuration if non-existent
 # 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
+imap_check=$(cat $HESTIA/conf/hestia.conf | grep IMAP_SYSTEM)
+if [ ! -z "$imap_check" ]; then
+    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
+    fi
 fi
 fi
 
 
 # Add release branch system configuration if non-existent
 # Add release branch system configuration if non-existent
@@ -38,7 +42,7 @@ if [ -z "$release_branch_check" ]; then
     echo "RELEASE_BRANCH='develop'" >> $HESTIA/conf/hestia.conf
     echo "RELEASE_BRANCH='develop'" >> $HESTIA/conf/hestia.conf
 fi
 fi
 
 
-# Load hestia.conf
+# Load global variables
 source $HESTIA/conf/hestia.conf
 source $HESTIA/conf/hestia.conf
 
 
 # Load hestia main functions
 # Load hestia main functions