Skip to content

Commit 4b3f4ac

Browse files
Merge pull request #258 from ExtremeFiretop/dev
Dev 1.2.5 as Next Stable Release
2 parents 5923f38 + 7fa9df5 commit 4b3f4ac

File tree

3 files changed

+77
-36
lines changed

3 files changed

+77
-36
lines changed

MerlinAU.sh

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2024-Jun-28
7+
# Last Modified: 2024-Jun-30
88
###################################################################
99
set -u
1010

11-
readonly SCRIPT_VERSION=1.2.4
11+
readonly SCRIPT_VERSION=1.2.5
1212
readonly SCRIPT_NAME="MerlinAU"
1313

1414
##-------------------------------------##
@@ -2618,7 +2618,7 @@ _Toggle_VPN_Access_()
26182618
if [ "$currentSetting" = "ENABLED" ]
26192619
then
26202620
printf "${REDct}*WARNING*${NOct}\n"
2621-
printf "Disabling this feature will shut down Diversion and Tailscale VPN access during updates.\n"
2621+
printf "Disabling this feature will shut down Tailscale VPN access during updates.\n"
26222622
printf "Proceed only if you do not need VPN access during updates.\n"
26232623

26242624
if _WaitForYESorNO_ "\nProceed to ${GRNct}DISABLE${NOct}?"
@@ -2630,7 +2630,7 @@ _Toggle_VPN_Access_()
26302630
fi
26312631
else
26322632
printf "${REDct}*WARNING*${NOct}\n"
2633-
printf "Enabling this feature will keep Diversion and Tailscale VPN access active during updates.\n"
2633+
printf "Enabling this feature will keep Tailscale VPN access active during updates.\n"
26342634
printf "Proceed only if you need VPN access during updates.\n"
26352635
if _WaitForYESorNO_ "\nProceed to ${REDct}ENABLE${NOct}?"
26362636
then
@@ -4264,7 +4264,10 @@ Please manually update to version $minimum_supported_version or higher to use th
42644264
FW_ZIP_FPATH="${FW_ZIP_DIR}/${FW_FileName}.zip"
42654265
fi
42664266

4267-
_ProcessMeshNodes_ 0
4267+
if ! node_online_status="$(_NodeActiveStatus_)"
4268+
then node_online_status=""
4269+
else _ProcessMeshNodes_ 0
4270+
fi
42684271

42694272
local credsBase64=""
42704273
local currentVersionNum="" releaseVersionNum=""
@@ -4375,10 +4378,10 @@ Please manually update to version $minimum_supported_version or higher to use th
43754378
if [ "$current_backup_settings" = "ENABLED" ]
43764379
then
43774380
# Extract version number from backupmon.sh
4378-
BM_VERSION="$(grep "^Version=" /jffs/scripts/backupmon.sh | awk -F'"' '{print $2}')"
4381+
local BM_VERSION="$(grep "^Version=" /jffs/scripts/backupmon.sh | awk -F'"' '{print $2}')"
43794382

43804383
# Adjust version format from 1.46 to 1.4.6 if needed
4381-
DOT_COUNT="$(echo "$BM_VERSION" | tr -cd '.' | wc -c)"
4384+
local DOT_COUNT="$(echo "$BM_VERSION" | tr -cd '.' | wc -c)"
43824385
if [ "$DOT_COUNT" -eq 0 ]; then
43834386
# If there's no dot, it's a simple version like "1" (unlikely but let's handle it)
43844387
BM_VERSION="${BM_VERSION}.0.0"
@@ -4619,10 +4622,13 @@ Please manually update to version $minimum_supported_version or higher to use th
46194622
fi
46204623

46214624
##----------------------------------------##
4622-
## Modified by Martinski W. [2024-Jun-05] ##
4625+
## Modified by Martinski W. [2024-Jun-30] ##
46234626
##----------------------------------------##
46244627
# Fetch the latest SHA256 checksums from ASUSWRT-Merlin website #
4625-
checksums="$(curl -Ls --retry 4 --retry-delay 5 https://www.asuswrt-merlin.net/download | sed -n '/<pre>/,/</pre>/p' | sed -e 's/<[^>]*>//g')"
4628+
checksums="$(curl -Ls --retry 4 --retry-delay 5 --retry-connrefused \
4629+
https://www.asuswrt-merlin.net/download | \
4630+
sed -n '/<.*>SHA256 signatures:<\/.*>/,/<\/pre>/p' | \
4631+
sed -n '/<pre[^>].*>/,/<\/pre>/p' | sed -e 's/<[^>].*>//g')"
46264632

46274633
if [ -z "$checksums" ]
46284634
then
@@ -4656,6 +4662,8 @@ Please manually update to version $minimum_supported_version or higher to use th
46564662
# Assume non-interactive mode; perform exit.
46574663
_DoExit_ 1
46584664
fi
4665+
else
4666+
Say "SHA256 signature check for firmware image file passed successfully."
46594667
fi
46604668
else
46614669
Say "${REDct}**ERROR**${NOct}: Firmware image file NOT found!"
@@ -4709,7 +4717,7 @@ Please manually update to version $minimum_supported_version or higher to use th
47094717
_EntwareServicesHandler_ stop
47104718

47114719
##------------------------------------------##
4712-
## Modified by ExtremeFiretop [2024-Mar-15] ##
4720+
## Modified by ExtremeFiretop [2024-Jun-30] ##
47134721
##------------------------------------------##
47144722

47154723
curl_response="$(curl -k "${routerURLstr}/login.cgi" \
@@ -4730,21 +4738,49 @@ Please manually update to version $minimum_supported_version or higher to use th
47304738
then
47314739
_SendEMailNotification_ POST_REBOOT_FW_UPDATE_SETUP
47324740

4733-
Say "Flashing ${GRNct}${firmware_file}${NOct}... ${REDct}Please wait for reboot in about 4 minutes or less.${NOct}"
4734-
echo
4735-
4736-
local AllowVPN="$(Get_Custom_Setting Allow_Updates_OverVPN)"
4737-
if [ "$AllowVPN" = "DISABLED" ]
4741+
if [ -f /opt/bin/diversion ]
47384742
then
4739-
if [ -f /opt/bin/diversion ]
4740-
then
4741-
# Diversion unmount command also unloads entware services #
4742-
Say "Stopping Diversion service..."
4743-
/opt/bin/diversion unmount &
4744-
sleep 5
4745-
fi
4743+
# Extract version number from Diversion
4744+
local DIVER_VERSION="$(grep "^VERSION=" /opt/bin/diversion | awk -F'=' '{print $2}' | tr -d ' ')"
4745+
4746+
# Adjust version format from 1.46 to 1.4.6 if needed
4747+
local DDOT_COUNT="$(echo "$DIVER_VERSION" | tr -cd '.' | wc -c)"
4748+
if [ "$DDOT_COUNT" -eq 0 ]; then
4749+
# If there's no dot, it's a simple version like "1" (unlikely but let's handle it)
4750+
DIVER_VERSION="${DIVER_VERSION}.0.0"
4751+
elif [ "$DDOT_COUNT" -eq 1 ]; then
4752+
# Check if there is only one character after the dot
4753+
if echo "$DIVER_VERSION" | grep -qE '^[0-9]+\.[0-9]{1}$'; then
4754+
# If the version is like 5.2, convert it to 5.2.0
4755+
DIVER_VERSION="${DIVER_VERSION}.0"
4756+
else
4757+
# For versions like 5.26, insert a dot between the last two digits
4758+
DIVER_VERSION="$(echo "$DIVER_VERSION" | sed 's/\.\([0-9]\)\([0-9]\)/.\1.\2/')"
4759+
fi
4760+
fi
4761+
4762+
# Convert version strings to comparable numbers
4763+
local currentDIVER_version="$(_ScriptVersionStrToNum_ "$DIVER_VERSION")"
4764+
local requiredDIVER_version="$(_ScriptVersionStrToNum_ "5.2.0")"
4765+
4766+
# Diversion unmount command also unloads entware services #
4767+
Say "Stopping Diversion service..."
4768+
if [ "$currentDIVER_version" -ge "$requiredDIVER_version" ]
4769+
then
4770+
/opt/bin/diversion temp_disable &
4771+
else
4772+
local AllowVPN="$(Get_Custom_Setting Allow_Updates_OverVPN)"
4773+
if [ "$AllowVPN" = "DISABLED" ]
4774+
then
4775+
/opt/bin/diversion unmount &
4776+
fi
4777+
fi
4778+
sleep 5
47464779
fi
47474780

4781+
Say "Flashing ${GRNct}${firmware_file}${NOct}... ${REDct}Please wait for reboot in about 4 minutes or less.${NOct}"
4782+
echo
4783+
47484784
# *WARNING*: No more logging at this point & beyond #
47494785
/sbin/ejusb -1 0 -u 1
47504786

@@ -4802,7 +4838,21 @@ Please manually update to version $minimum_supported_version or higher to use th
48024838
_SendEMailNotification_ FAILED_FW_UPDATE_STATUS
48034839
_DoCleanUp_ 1 "$keepZIPfile"
48044840
_EntwareServicesHandler_ start
4805-
# /opt/bin/diversion mount >/dev/null #Does not work temporarily
4841+
if [ -f /opt/bin/diversion ]
4842+
then
4843+
Say "Restarting Diversion service..."
4844+
if [ "$currentDIVER_version" -ge "$requiredDIVER_version" ]
4845+
then
4846+
/opt/bin/diversion enable &
4847+
else
4848+
AllowVPN="$(Get_Custom_Setting Allow_Updates_OverVPN)"
4849+
if [ "$AllowVPN" = "DISABLED" ]
4850+
then
4851+
Say "Unable to Restart Diversion. Please reboot to restart entware services."
4852+
fi
4853+
fi
4854+
sleep 5
4855+
fi
48064856
fi
48074857

48084858
"$inMenuMode" && _WaitForEnterKey_ "$mainMenuReturnPromptStr"
@@ -5769,7 +5819,7 @@ _ShowAdvancedOptionsMenu_()
57695819
fi
57705820

57715821
local VPNAccess="$(Get_Custom_Setting "Allow_Updates_OverVPN")"
5772-
printf "\n ${GRNct}4${NOct}. Toggle VPN Service During Updates"
5822+
printf "\n ${GRNct}4${NOct}. Toggle Tailscale Access During Updates"
57735823
if [ "$VPNAccess" = "DISABLED" ]
57745824
then
57755825
printf "\n${padStr}[Currently ${GRNct}DISABLED${NOct}]\n"

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/99b11bf5-20bb-43b3-adae-061a6181f329)
88
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/939732db-a296-4a1a-8503-225b1e77acf2)
99

10-
## TESTED MODELS (Multi-image models) - i.e. Any model that uses a .w or a .pkgtb file
10+
## SUPPORTED MERLIN MODELS (Multi-image models) - i.e. Any model that uses a .w or a .pkgtb file
1111

12+
- GT-BE98_PRO (Tested)
1213
- GT-AX6000 (Tested)
1314
- GT-AXE16000 (Tested)
1415
- GT-AXE11000 (Tested)
@@ -40,16 +41,6 @@ Blocked due to low RAM/ROM space and/or have not received updates in several yea
4041
- RT-AC66U_B1 (Blocked)
4142
- RT-AC1900 (Blocked)
4243

43-
## UNTESTED MODELS: (Multi-image models) - i.e. Any model that uses a .w or a .pkgtb file
44-
45-
- GT-AC2900 (Untested)
46-
- RT-AX56U (Untested)
47-
48-
## TESTERS NEEDED!
49-
- If you see your router listed as untested above, feel free to test and report any issues.
50-
- If the test was successful on your model, feel free to leave a comment on snb forums or open an issue with your successful test and router model.
51-
- https://www.snbforums.com/threads/introducing-merlinau-the-ultimate-firmware-auto-updater-addon.88577/
52-
5344
## Merlin(A)uto(U)pdate
5445

5546
MerlinAU.sh is a versatile shell script designed to automate the firmware update process for ASUS routers running Asuswrt-Merlin firmware.

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.4
1+
1.2.5

0 commit comments

Comments
 (0)