44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2025-Nov-02
7+ # Last Modified: 2025-Nov-05
88# ##################################################################
99set -u
1010
1111# # Set version for each Production Release ##
12- readonly SCRIPT_VERSION=1.5.5
13- readonly SCRIPT_VERSTAG=" 25110200 "
12+ readonly SCRIPT_VERSION=1.5.6
13+ readonly SCRIPT_VERSTAG=" 25110520 "
1414readonly SCRIPT_NAME=" MerlinAU"
1515# # Set to "master" for Production Releases ##
1616SCRIPT_BRANCH=" dev"
@@ -8773,7 +8773,7 @@ _RunOfflineUpdateNow_()
87738773}
87748774
87758775# #----------------------------------------##
8776- # # Modified by Martinski W. [2025-Nov-01 ] ##
8776+ # # Modified by Martinski W. [2025-Nov-05 ] ##
87778777# #----------------------------------------##
87788778_RunFirmwareUpdateNow_ ()
87798779{
@@ -9247,6 +9247,36 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
92479247 # Send last email notification before F/W flash #
92489248 _SendEMailNotification_ START_FW_UPDATE_STATUS
92499249
9250+ # # To handle stopping and restarting Diversion when needed ##
9251+ local DIVER_VERSION currentDIVER_version=" " requiredDIVER_version=" "
9252+ if [ -f /opt/bin/diversion ]
9253+ then
9254+ DIVER_VERSION=" $( grep " ^VERSION=" /opt/bin/diversion | awk -F' =' ' {print $2}' | tr -d ' ' ) "
9255+
9256+ # Adjust version format from 1.46 to 1.4.6 if needed #
9257+ local DDOT_COUNT=" $( echo " $DIVER_VERSION " | tr -cd ' .' | wc -c) "
9258+ if [ " $DDOT_COUNT " -eq 0 ]
9259+ then
9260+ # If there's no dot, it's a simple version like "1" (unlikely but let's handle it) #
9261+ DIVER_VERSION=" ${DIVER_VERSION} .0.0"
9262+ elif [ " $DDOT_COUNT " -eq 1 ]
9263+ then
9264+ # Check if there is only one character after the dot #
9265+ if echo " $DIVER_VERSION " | grep -qE ' ^[0-9]+\.[0-9]{1}$'
9266+ then
9267+ # If the version is like 5.2, convert it to 5.2.0 #
9268+ DIVER_VERSION=" ${DIVER_VERSION} .0"
9269+ else
9270+ # For versions like 5.26, insert a dot between the last two digits #
9271+ DIVER_VERSION=" $( echo " $DIVER_VERSION " | sed ' s/\.\([0-9]\)\([0-9]\)/.\1.\2/' ) "
9272+ fi
9273+ fi
9274+
9275+ # Convert version strings to numeric values #
9276+ currentDIVER_version=" $( _ScriptVersionStrToNum_ " $DIVER_VERSION " ) "
9277+ requiredDIVER_version=" $( _ScriptVersionStrToNum_ " 5.2.0" ) "
9278+ fi
9279+
92509280 # #------------------------------------------##
92519281 # # Modified by ExtremeFiretop [2024-Sep-07] ##
92529282 # #------------------------------------------##
@@ -9263,31 +9293,9 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
92639293 if echo " $curl_response " | grep -Eq ' url=index\.asp|url=GameDashboard\.asp'
92649294 then
92659295 _UpdateLoginPswdCheckHelper_ SUCCESS
9296+
92669297 if [ -f /opt/bin/diversion ]
92679298 then
9268- # Extract version number from Diversion
9269- local DIVER_VERSION=" $( grep " ^VERSION=" /opt/bin/diversion | awk -F' =' ' {print $2}' | tr -d ' ' ) "
9270-
9271- # Adjust version format from 1.46 to 1.4.6 if needed
9272- local DDOT_COUNT=" $( echo " $DIVER_VERSION " | tr -cd ' .' | wc -c) "
9273- if [ " $DDOT_COUNT " -eq 0 ]; then
9274- # If there's no dot, it's a simple version like "1" (unlikely but let's handle it)
9275- DIVER_VERSION=" ${DIVER_VERSION} .0.0"
9276- elif [ " $DDOT_COUNT " -eq 1 ]; then
9277- # Check if there is only one character after the dot
9278- if echo " $DIVER_VERSION " | grep -qE ' ^[0-9]+\.[0-9]{1}$' ; then
9279- # If the version is like 5.2, convert it to 5.2.0
9280- DIVER_VERSION=" ${DIVER_VERSION} .0"
9281- else
9282- # For versions like 5.26, insert a dot between the last two digits
9283- DIVER_VERSION=" $( echo " $DIVER_VERSION " | sed ' s/\.\([0-9]\)\([0-9]\)/.\1.\2/' ) "
9284- fi
9285- fi
9286-
9287- # Convert version strings to comparable numbers
9288- local currentDIVER_version=" $( _ScriptVersionStrToNum_ " $DIVER_VERSION " ) "
9289- local requiredDIVER_version=" $( _ScriptVersionStrToNum_ " 5.2.0" ) "
9290-
92919299 # Diversion unmount command also unloads entware services #
92929300 Say " Stopping Diversion service..."
92939301 if [ " $currentDIVER_version " -ge " $requiredDIVER_version " ]
@@ -9391,6 +9399,7 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
93919399 _SendEMailNotification_ FAILED_FW_UPDATE_STATUS
93929400 _DoCleanUp_ 1 " $keepZIPfile " " $keepWfile "
93939401 _EntwareServicesHandler_ start
9402+
93949403 if [ -f /opt/bin/diversion ]
93959404 then
93969405 Say " Restarting Diversion service..."
0 commit comments