Skip to content

Commit 7bb87d6

Browse files
Merge pull request #181 from ExtremeFiretop/dev
Dev 1.0.10 as Next Stable Release
2 parents dc45cb0 + 80c24c5 commit 7bb87d6

File tree

4 files changed

+60
-28
lines changed

4 files changed

+60
-28
lines changed

.github/workflows/Create-NewReleases.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
id: nextver
3030
run: |
3131
if [[ -f version.txt ]]; then
32-
NEXT_TAG=$(cat version.txt)
32+
NEXT_TAG=$(cat version.txt)
3333
else
3434
CURRENT_TAG=$(git tag --sort=-v:refname | head -n 1)
35-
if [[ $TAG == '' ]]; then
36-
CURRENT_TAG='v0.1.0' # Start from v0.1.0 if no tags are found
35+
if [[ $CURRENT_TAG == '' ]]; then
36+
CURRENT_TAG='v0.1.0' # Start from v0.1.0 if no tags are found
3737
fi
3838
3939
MAJOR=$(echo $CURRENT_TAG | cut -d '.' -f 1 | cut -c 2-)

MerlinAU.sh

Lines changed: 54 additions & 22 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-Mar-23
7+
# Last Modified: 2024-Mar-26
88
###################################################################
99
set -u
1010

11-
readonly SCRIPT_VERSION=1.0.9
11+
readonly SCRIPT_VERSION=1.0.10
1212
readonly SCRIPT_NAME="MerlinAU"
1313

1414
##-------------------------------------##
@@ -89,6 +89,7 @@ advnMenuReturnPromptStr="Press <Enter> to return to the Advanced Menu..."
8989
##----------------------------------------##
9090
userLOGFile=""
9191
userTraceFile="${SETTINGS_DIR}/${ScriptFNameTag}_Trace.LOG"
92+
userDebugFile="${SETTINGS_DIR}/${ScriptFNameTag}_Debug.LOG"
9293
LOGdateFormat="%Y-%m-%d %H:%M:%S"
9394
_LogMsgNoTime_() { _UserLogMsg_ "_NOTIME_" "$@" ; }
9495

@@ -377,7 +378,7 @@ _ScriptVersionStrToNum_()
377378
##----------------------------------------##
378379
_FWVersionStrToNum_()
379380
{
380-
if [ $# -eq 0 ] || [ -z "$1" ] || [ -z "$2" ]
381+
if [ $# -lt 2 ] || [ -z "$1" ] || [ -z "$2" ]
381382
then echo ; return 1 ; fi
382383

383384
USE_BETA_WEIGHT="$(Get_Custom_Setting FW_Allow_Beta_Production_Up)"
@@ -1766,9 +1767,31 @@ _DoCleanUp_()
17661767
fi
17671768
}
17681769

1769-
##------------------------------------------##
1770-
## Modified by ExtremeFiretop [2024-Mar-23] ##
1771-
##------------------------------------------##
1770+
##-------------------------------------##
1771+
## Added by Martinski W. [2023-Mar-26] ##
1772+
##-------------------------------------##
1773+
_LogMemoryDebugInfo_()
1774+
{
1775+
{
1776+
printf "Uptime\n------\n" ; uptime ; echo
1777+
df -hT | grep -E '(^Filesystem|/jffs$|/tmp$|/var$)' | sort -d -t ' ' -k 1
1778+
echo
1779+
printf "/proc/meminfo\n-------------\n"
1780+
grep -E '^Mem[TFA].*:[[:blank:]]+.*' /proc/meminfo
1781+
grep -E '^(Buffers|Cached):[[:blank:]]+.*' /proc/meminfo
1782+
grep -E '^Swap[TFC].*:[[:blank:]]+.*' /proc/meminfo
1783+
grep -E '^(Active|Inactive)(\([af].*\))?:[[:blank:]]+.*' /proc/meminfo
1784+
grep -E '^(Dirty|Writeback|AnonPages|Unevictable):[[:blank:]]+.*' /proc/meminfo
1785+
echo "------------------------------"
1786+
} > "$userDebugFile"
1787+
"$isInteractive" && cat "$userDebugFile"
1788+
_LogMsgNoTime_ "$(cat "$userDebugFile")"
1789+
rm -f "$userDebugFile"
1790+
}
1791+
1792+
##----------------------------------------##
1793+
## Modified by Martinski W. [2024-Mar-26] ##
1794+
##----------------------------------------##
17721795
check_memory_and_prompt_reboot()
17731796
{
17741797
local required_space_kb="$1"
@@ -1789,6 +1812,7 @@ check_memory_and_prompt_reboot()
17891812
then
17901813
freeRAM_kb="$(get_free_ram)"
17911814
Say "Required RAM: ${required_space_kb} KB - RAM Free: ${freeRAM_kb} KB - RAM Available: ${availableRAM_kb} KB"
1815+
_LogMemoryDebugInfo_
17921816

17931817
# Attempt to clear dentries and inodes. #
17941818
Say "Attempting to free up memory again more aggressively..."
@@ -1801,6 +1825,7 @@ check_memory_and_prompt_reboot()
18011825
then
18021826
freeRAM_kb="$(get_free_ram)"
18031827
Say "Required RAM: ${required_space_kb} KB - RAM Free: ${freeRAM_kb} KB - RAM Available: ${availableRAM_kb} KB"
1828+
_LogMemoryDebugInfo_
18041829

18051830
# Attempt to clear clears pagecache, dentries, and inodes after shutting down services
18061831
Say "Attempting to free up memory once more even more aggressively..."
@@ -1817,6 +1842,8 @@ check_memory_and_prompt_reboot()
18171842
availableRAM_kb="$(_GetAvailableRAM_KB_)"
18181843
if [ "$availableRAM_kb" -lt "$required_space_kb" ]
18191844
then
1845+
_LogMemoryDebugInfo_
1846+
18201847
# In an interactive shell session, ask user to confirm reboot #
18211848
if "$isInteractive" && _WaitForYESorNO_ "Reboot router now"
18221849
then
@@ -2103,7 +2130,7 @@ _GetLoginCredentials_()
21032130
}
21042131

21052132
##----------------------------------------##
2106-
## Modified by Martinski W. [2023-Nov-20] ##
2133+
## Modified by Martinski W. [2024-Mar-25] ##
21072134
##----------------------------------------##
21082135
_GetLatestFWUpdateVersionFromWebsite_()
21092136
{
@@ -2128,8 +2155,12 @@ _GetLatestFWUpdateVersionFromWebsite_()
21282155
# Extracting the correct link from the page
21292156
local correct_link="$(echo "$linkStr" | sed 's|^/|https://sourceforge.net/|')"
21302157

2158+
if [ -z "$versionStr" ] || [ -z "$correct_link" ]
2159+
then echo "**ERROR** **NO_URL**" ; return 1 ; fi
2160+
21312161
echo "$versionStr"
21322162
echo "$correct_link"
2163+
return 0
21332164
}
21342165

21352166
##---------------------------------------##
@@ -2419,7 +2450,7 @@ _AddCronJobEntry_()
24192450

24202451
cru a "$CRON_JOB_TAG" "$newSchedule $CRON_JOB_RUN"
24212452
sleep 1
2422-
if $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
2453+
if eval $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
24232454
then
24242455
retCode=0
24252456
"$newSetting" && \
@@ -2434,10 +2465,10 @@ _AddCronJobEntry_()
24342465
_DelCronJobEntry_()
24352466
{
24362467
local retCode
2437-
if $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
2468+
if eval $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
24382469
then
24392470
cru d "$CRON_JOB_TAG" ; sleep 1
2440-
if $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
2471+
if eval $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
24412472
then
24422473
retCode=1
24432474
printf "${REDct}**ERROR**${NOct}: Failed to remove cron job [${GRNct}${CRON_JOB_TAG}${NOct}].\n"
@@ -2668,7 +2699,7 @@ _Set_FW_UpdateCronSchedule_()
26682699
##------------------------------------------##
26692700
_CheckNewUpdateFirmwareNotification_()
26702701
{
2671-
if [ $# -eq 0 ] || [ -z "$1" ] || [ -z "$2" ]
2702+
if [ $# -lt 2 ] || [ -z "$1" ] || [ -z "$2" ]
26722703
then echo "**ERROR** **NO_PARAMS**" ; return 1 ; fi
26732704

26742705
local numVersionFields fwNewUpdateVersNum
@@ -2718,7 +2749,7 @@ _CheckNewUpdateFirmwareNotification_()
27182749
##----------------------------------------##
27192750
_CheckTimeToUpdateFirmware_()
27202751
{
2721-
if [ $# -eq 0 ] || [ -z "$1" ] || [ -z "$2" ]
2752+
if [ $# -lt 2 ] || [ -z "$1" ] || [ -z "$2" ]
27222753
then echo "**ERROR** **NO_PARAMS**" ; return 1 ; fi
27232754

27242755
local notifyTimeSecs postponeTimeSecs currentTimeSecs dstAdjustSecs dstAdjustDays
@@ -3033,6 +3064,13 @@ Please manually update to version $minimum_supported_version or higher to use th
30333064
release_version="$1"
30343065
release_link="$2"
30353066

3067+
if [ "$release_version" = "**ERROR**" ] && [ "$release_link" = "**NO_URL**" ]
3068+
then
3069+
Say "${REDct}**ERROR**${NOct}: No firmware release URL was found for [$PRODUCT_ID] router model."
3070+
"$inMenuMode" && _WaitForEnterKey_ "$mainMenuReturnPromptStr"
3071+
return 1
3072+
fi
3073+
30363074
# Extracting the first octet to use in the curl
30373075
firstOctet="$(echo "$release_version" | cut -d'.' -f1)"
30383076
# Inserting dots between each number
@@ -3053,19 +3091,13 @@ Please manually update to version $minimum_supported_version or higher to use th
30533091
return 1
30543092
fi
30553093

3056-
if [ "$1" = "**ERROR**" ] && [ "$2" = "**NO_URL**" ]
3057-
then
3058-
Say "${REDct}**ERROR**${NOct}: No firmware release URL was found for [$PRODUCT_ID] router model."
3059-
"$inMenuMode" && _WaitForEnterKey_ "$mainMenuReturnPromptStr"
3060-
return 1
3061-
fi
3062-
30633094
##---------------------------------------##
30643095
## Added by ExtremeFiretop [2023-Dec-09] ##
30653096
##---------------------------------------##
30663097
# Get the required space for the firmware download and extraction
3067-
required_space_kb=$(get_required_space "$release_link")
3068-
if ! _HasRouterMoreThan256MBtotalRAM_ && [ "$required_space_kb" -gt 51200 ]; then
3098+
required_space_kb="$(get_required_space "$release_link")"
3099+
if ! _HasRouterMoreThan256MBtotalRAM_ && [ "$required_space_kb" -gt 51200 ]
3100+
then
30693101
if ! _ValidateUSBMountPoint_ "$FW_ZIP_BASE_DIR" 1
30703102
then
30713103
Say "${REDct}**ERROR**${NOct}: A USB drive is required for the F/W update due to limited RAM."
@@ -3919,7 +3951,7 @@ if [ "$FW_UpdateCheckState" -eq 1 ]
39193951
then
39203952
runfwUpdateCheck=true
39213953
# Check if the CRON job already exists #
3922-
if ! $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
3954+
if ! eval $cronListCmd | grep -qE "$CRON_JOB_RUN #${CRON_JOB_TAG}#$"
39233955
then
39243956
logo
39253957
# If CRON job does not exist, ask user for permission to add #

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
2-
## v1.0.9
3-
## 2024-03-24
2+
## v1.0.10
3+
## 2024-03-29
44

55
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/27e926b0-e618-45be-9879-e2b87775cdf5)
66
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/77305ae1-4917-4022-9c02-a72032beed16)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.9
1+
1.0.10

0 commit comments

Comments
 (0)