Skip to content

Commit 0541849

Browse files
Merge pull request #306 from ExtremeFiretop/dev
Dev 1.3.1 as Next Stable Release
2 parents edfc44c + 20640aa commit 0541849

File tree

4 files changed

+118
-30
lines changed

4 files changed

+118
-30
lines changed

.github/workflows/Create-NewReleases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout source code
18-
uses: actions/checkout@v4.1.7
18+
uses: actions/checkout@v4.2.0
1919
with:
2020
fetch-depth: 0
2121
ref: 'main' # Ensure we're tagging the main branch after the merge

MerlinAU.sh

Lines changed: 108 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2024-Sep-02
7+
# Last Modified: 2024-Oct-03
88
###################################################################
99
set -u
1010

1111
## Set version for each Production Release ##
12-
readonly SCRIPT_VERSION=1.3.0
12+
readonly SCRIPT_VERSION=1.3.1
1313
readonly SCRIPT_NAME="MerlinAU"
1414
## Set to "master" for Production Releases ##
1515
SCRIPT_BRANCH="master"
@@ -40,12 +40,12 @@ readonly high_risk_terms="factory default reset|features are disabled|break back
4040
DLRepoVersion=""
4141
scriptUpdateNotify=0
4242

43-
##----------------------------------------##
44-
## Modified by Martinski W. [2024-Jul-29] ##
45-
##----------------------------------------##
43+
##------------------------------------------##
44+
## Modified by ExtremeFiretop [2024-Oct-02] ##
45+
##------------------------------------------##
4646
# For minimum supported firmware version check #
4747
MinFirmwareVerCheckFailed=false
48-
MinSupportedFirmwareVers="3004.386.12.0"
48+
MinSupportedFirmwareVers="3004.386.12.6"
4949

5050
# For router model check #
5151
routerModelCheckFailed=false
@@ -77,6 +77,23 @@ readonly SETTINGS_DIR="${ADDONS_PATH}/$ScriptDirNameD"
7777
readonly SETTINGSFILE="${SETTINGS_DIR}/custom_settings.txt"
7878
readonly SCRIPTVERPATH="${SETTINGS_DIR}/version.txt"
7979

80+
##-------------------------------------##
81+
## Added by Martinski W. [2024-Sep-15] ##
82+
##-------------------------------------##
83+
# For handling 3rd-party add-on cron jobs #
84+
readonly USB_OPT_DIRPATH1="/opt"
85+
readonly USB_OPT_DIRPATH2="/tmp/opt"
86+
readonly USB_MNT_DIRPATH1="/mnt"
87+
readonly USB_MNT_DIRPATH2="/tmp/mnt"
88+
89+
readonly cronJobsRegEx1="[[:blank:]]+${ADDONS_PATH}/.* "
90+
readonly cronJobsRegEx2="[[:blank:]]+${SCRIPTS_PATH}/.* "
91+
readonly cronJobsRegEx3="[[:blank:]]+${USB_OPT_DIRPATH1}/.* "
92+
readonly cronJobsRegEx4="[[:blank:]]+${USB_OPT_DIRPATH2}/.* "
93+
readonly cronJobsRegEx5="[[:blank:]]+${USB_MNT_DIRPATH1}/.* "
94+
readonly cronJobsRegEx6="[[:blank:]]+${USB_MNT_DIRPATH2}/.* "
95+
readonly addonCronJobList="/home/root/addonCronJobList_$$.txt"
96+
8097
##----------------------------------------##
8198
## Modified by Martinski W. [2024-Jun-05] ##
8299
##----------------------------------------##
@@ -129,10 +146,27 @@ readonly IPv4octet_RegEx="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
129146
readonly IPv4addrs_RegEx="(${IPv4octet_RegEx}\.){3}${IPv4octet_RegEx}"
130147
readonly IPv4privt_RegEx="(^10\.|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168\.)"
131148

149+
##----------------------------------------##
150+
## Modified by Martinski W. [2024-Oct-03] ##
151+
##----------------------------------------##
132152
readonly fwInstalledBaseVers="$(nvram get firmver | sed 's/\.//g')"
133153
readonly fwInstalledBuildVers="$(nvram get buildno)"
134154
readonly fwInstalledExtendNum="$(nvram get extendno)"
135155
readonly fwInstalledInnerVers="$(nvram get innerver)"
156+
readonly fwInstalledBranchVer="${fwInstalledBaseVers}.$(echo "$fwInstalledBuildVers" | awk -F'.' '{print $1}')"
157+
158+
##-------------------------------------##
159+
## Added by Martinski W. [2024-Oct-03] ##
160+
##-------------------------------------##
161+
readonly MinSupportedFW_3004_386_Ver="3004.386.12.6"
162+
readonly MinSupportedFW_3004_388_Ver="3004.388.6.2"
163+
readonly MinSupportedFW_3006_102_Ver="3004.388.8.0"
164+
165+
case "$fwInstalledBranchVer" in
166+
"3004.386") MinSupportedFirmwareVers="$MinSupportedFW_3004_386_Ver" ;;
167+
"3004.388") MinSupportedFirmwareVers="$MinSupportedFW_3004_388_Ver" ;;
168+
"3006.102") MinSupportedFirmwareVers="$MinSupportedFW_3006_102_Ver" ;;
169+
esac
136170

137171
if [ "$(nvram get sw_mode)" -eq 1 ]
138172
then inRouterSWmode=true
@@ -1502,7 +1536,7 @@ _CreateEMailContent_()
15021536
if [ $# -eq 0 ] || [ -z "$1" ] ; then return 1 ; fi
15031537
local fwInstalledVersion fwNewUpdateVersion
15041538
local savedInstalledVersion savedNewUpdateVersion
1505-
local subjectStr emailBodyTitle=""
1539+
local subjectStr emailBodyTitle="" release_version
15061540

15071541
rm -f "$tempEMailContent" "$tempEMailBodyMsg"
15081542

@@ -1511,7 +1545,12 @@ _CreateEMailContent_()
15111545
else subjectStr="F/W Update Status for $MODEL_ID"
15121546
fi
15131547
fwInstalledVersion="$(_GetCurrentFWInstalledLongVersion_)"
1514-
fwNewUpdateVersion="$(_GetLatestFWUpdateVersionFromRouter_ 1)"
1548+
if ! "$offlineUpdateTrigger"
1549+
then
1550+
fwNewUpdateVersion="$(_GetLatestFWUpdateVersionFromRouter_ 1)"
1551+
else
1552+
fwNewUpdateVersion="$(Get_Custom_Setting "FW_New_Update_Notification_Vers")"
1553+
fi
15151554

15161555
# Remove "_rog" or "_tuf" suffix to avoid version comparison failures #
15171556
fwInstalledVersion="$(echo "$fwInstalledVersion" | sed 's/_\(rog\|tuf\)$//')"
@@ -5089,6 +5128,48 @@ _Toggle_FW_UpdateCheckSetting_()
50895128
_WaitForEnterKey_ "$mainMenuReturnPromptStr"
50905129
}
50915130

5131+
##-------------------------------------##
5132+
## Added by Martinski W. [2024-Sep-15] ##
5133+
##-------------------------------------##
5134+
_RemoveCronJobsFromAddOns_()
5135+
{
5136+
eval $cronListCmd | grep -E "$cronJobsRegEx1|$cronJobsRegEx2|$cronJobsRegEx3|cronJobsRegEx4|$cronJobsRegEx5|$cronJobsRegEx6" > "$addonCronJobList"
5137+
if [ ! -s "$addonCronJobList" ]
5138+
then
5139+
rm -f "$addonCronJobList"
5140+
Say "Cron jobs from 3rd-party add-ons were not found."
5141+
return 1
5142+
fi
5143+
5144+
local cronJobCount=0 cronJobIDx cronJobCMD
5145+
5146+
while read -r cronJobLINE
5147+
do
5148+
if [ -z "$cronJobLINE" ] || echo "$cronJobLINE" | grep -qE "^[[:blank:]]*#"
5149+
then continue ; fi
5150+
cronJobCount="$((cronJobCount + 1))"
5151+
Say "Cron job #${cronJobCount}: [$cronJobLINE]"
5152+
5153+
cronJobIDx="$(echo "$cronJobLINE" | awk -F '#' '{print $2}')"
5154+
cronJobCMD="$(echo "$cronJobLINE" | awk -F '#' '{print $1}' | sed 's/[[:blank:]]*$//')"
5155+
5156+
if [ -n "$cronJobIDx" ]
5157+
then
5158+
cru d "$cronJobIDx" ; sleep 1
5159+
if eval $cronListCmd | grep -qE "#${cronJobIDx}#$"
5160+
then Say "**ERROR**: Failed to remove cron job [$cronJobIDx]."
5161+
else Say "Cron job [$cronJobIDx] was removed successfully."
5162+
fi
5163+
fi
5164+
done < "$addonCronJobList"
5165+
5166+
rm -f "$addonCronJobList"
5167+
Say "Cron jobs [$cronJobCount] from 3rd-party add-ons were removed."
5168+
5169+
sleep 5
5170+
return 0
5171+
}
5172+
50925173
##----------------------------------------##
50935174
## Modified by Martinski W. [2024-Aug-02] ##
50945175
##----------------------------------------##
@@ -5230,7 +5311,7 @@ _GetOfflineFirmwareVersion_()
52305311
}
52315312

52325313
##------------------------------------------##
5233-
## Modified by ExtremeFiretop [2024-Aug-06] ##
5314+
## Modified by ExtremeFiretop [2024-Sep-07] ##
52345315
##------------------------------------------##
52355316
_SelectOfflineUpdateFile_()
52365317
{
@@ -5328,6 +5409,8 @@ _SelectOfflineUpdateFile_()
53285409
printf "\nRelease version: ${GRNct}${release_version}${NOct}\n"
53295410
printf "\n---------------------------------------------------\n"
53305411
_WaitForEnterKey_
5412+
Update_Custom_Settings FW_New_Update_Notification_Vers "$release_version"
5413+
Update_Custom_Settings FW_New_Update_Notification_Date "$(date +"$FW_UpdateNotificationDateFormat")"
53315414
clear
53325415
return 0
53335416
else
@@ -5673,8 +5756,8 @@ _RunFirmwareUpdateNow_()
56735756
fi
56745757
if "$MinFirmwareVerCheckFailed" && ! "$offlineUpdateTrigger"
56755758
then
5676-
Say "${REDct}WARNING:${NOct} The current firmware version is below the minimum supported.
5677-
Please manually update to version $MinSupportedFirmwareVers or higher to use this script.\n"
5759+
Say "${REDct}*WARNING*:${NOct} The current firmware version is below the minimum supported.
5760+
Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or higher to use this script.\n"
56785761
"$inMenuMode" && _WaitForEnterKey_ "$theMenuReturnPromptMsg"
56795762
return 1
56805763
fi
@@ -6063,7 +6146,7 @@ Please manually update to version $MinSupportedFirmwareVers or higher to use thi
60636146
_SendEMailNotification_ START_FW_UPDATE_STATUS
60646147

60656148
##------------------------------------------##
6066-
## Modified by ExtremeFiretop [2024-Jun-30] ##
6149+
## Modified by ExtremeFiretop [2024-Sep-07] ##
60676150
##------------------------------------------##
60686151

60696152
curl_response="$(curl -k "${routerURLstr}/login.cgi" \
@@ -6082,10 +6165,7 @@ Please manually update to version $MinSupportedFirmwareVers or higher to use thi
60826165

60836166
if echo "$curl_response" | grep -Eq 'url=index\.asp|url=GameDashboard\.asp'
60846167
then
6085-
if ! "$offlineUpdateTrigger"
6086-
then
6087-
_SendEMailNotification_ POST_REBOOT_FW_UPDATE_SETUP
6088-
fi
6168+
_SendEMailNotification_ POST_REBOOT_FW_UPDATE_SETUP
60896169

60906170
if [ -f /opt/bin/diversion ]
60916171
then
@@ -6145,8 +6225,14 @@ Please manually update to version $MinSupportedFirmwareVers or higher to use thi
61456225
# Stop Entware services WITHOUT exceptions BEFORE the F/W flash #
61466226
_EntwareServicesHandler_ stop -noskip
61476227

6228+
##-------------------------------------##
6229+
## Added by Martinski W. [2024-Sep-15] ##
6230+
##-------------------------------------##
6231+
# Remove cron jobs from 3rd-party Add-Ons #
6232+
_RemoveCronJobsFromAddOns_
6233+
61486234
# *WARNING*: NO MORE logging at this point & beyond #
6149-
/sbin/ejusb -1 0 -u 1
6235+
/sbin/ejusb -1 0 -u 1 2>/dev/null
61506236

61516237
nohup curl -k "${routerURLstr}/upgrade.cgi" \
61526238
--referer "${routerURLstr}/Advanced_FirmwareUpgrade_Content.asp" \
@@ -7057,24 +7143,24 @@ _ShowMainMenu_()
70577143

70587144
# New Script Update Notification #
70597145
if [ "$scriptUpdateNotify" != "0" ]; then
7060-
Say "${REDct}WARNING:${NOct} ${scriptUpdateNotify}${NOct}\n"
7146+
Say "${REDct}*WARNING*:${NOct} ${scriptUpdateNotify}\n"
70617147
fi
70627148

70637149
# Unsupported Model Check #
70647150
if "$routerModelCheckFailed"
70657151
then
7066-
Say "${REDct}WARNING:${NOct} The current router model is not supported by this script.
7152+
Say "${REDct}*WARNING*:${NOct} The current router model is not supported by this script.
70677153
Please uninstall.\n"
70687154
fi
70697155
if "$MinFirmwareVerCheckFailed"
70707156
then
7071-
Say "${REDct}WARNING:${NOct} The current firmware version is below the minimum supported.
7072-
Please manually update to version $MinSupportedFirmwareVers or higher to use this script.\n"
7157+
Say "${REDct}*WARNING*:${NOct} The current firmware version is below the minimum supported.
7158+
Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or higher to use this script.\n"
70737159
fi
70747160

70757161
if ! _HasRouterMoreThan256MBtotalRAM_ && ! _ValidateUSBMountPoint_ "$FW_ZIP_BASE_DIR"
70767162
then
7077-
Say "${REDct}WARNING:${NOct} Limited RAM detected (256MB).
7163+
Say "${REDct}*WARNING*:${NOct} Limited RAM detected (256MB).
70787164
A USB drive is required for F/W updates.\n"
70797165
fi
70807166

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
2-
## v1.3.0
3-
## 2024-09-02
2+
## v1.3.1
3+
## 2024-10-02
44

5-
![image](https://github.com/user-attachments/assets/5b1d932e-7e0f-417c-aa87-a3e391f45c7a)
6-
![image](https://github.com/user-attachments/assets/7c90d057-fe3e-46e0-8987-40276623ee5a)
7-
![image](https://github.com/user-attachments/assets/6c5ece0c-4caf-4d3c-91f3-de2298127d71)
8-
![image](https://github.com/user-attachments/assets/6d0aad68-5c02-4355-abd3-cd441cdfe108)
5+
![image](https://github.com/user-attachments/assets/b033a097-6f05-441a-8430-600ca51c13b4)
6+
![image](https://github.com/user-attachments/assets/847b6922-b953-4e65-acbb-6843ec08a10c)
7+
![image](https://github.com/user-attachments/assets/35ed7802-9848-4a09-b9b0-93fc23cfacf8)
8+
![image](https://github.com/user-attachments/assets/0c22b30b-a7d9-4e2f-b031-3f358e4f4c93)
99

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

@@ -17,6 +17,8 @@
1717
- GT-AX11000 (Tested)
1818
- GT-AC2900 **(Untested)**
1919
- RT-BE96U **(Untested)**
20+
- RT-BE88U **(Untested)**
21+
- RT-BE86U **(Untested)**
2022
- RT-AX88U_PRO (Tested)
2123
- RT-AX88U (Tested)
2224
- RT-AC86U (Tested)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.3.1

0 commit comments

Comments
 (0)