Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
# Official Co-Author: @Martinski W. - Date: 2021-Nov-01
# Last Modified: 2023-Dec-15
# Last Modified: 2023-Dec-16
###################################################################
set -u

Expand Down Expand Up @@ -226,8 +226,7 @@ readonly SETTINGSFILE="${SETTINGS_DIR}/custom_settings.txt"
readonly SCRIPTVERPATH="${SETTINGS_DIR}/version.txt"

##-----------------------------------------------##
## Original Author: ExtremeFiretop [2023-Nov-26] ##
## Modified by: Martinski W. [2023-Dec-01] ##
## Modified by: ExtremeFiretop [2023-Dec-16] ##
##-----------------------------------------------##
_CheckForNewScriptUpdates_()
{
Expand All @@ -247,15 +246,15 @@ _CheckForNewScriptUpdates_()
# Version comparison
if [ "$DLRepoVersionNum" -gt "$ScriptVersionNum" ]
then
UpdateNotify="New script update available: v$SCRIPT_VERSION -> v$DLRepoVersion"
UpdateNotify="New script update available.
${REDct}v$SCRIPT_VERSION${NOct} --> ${GRNct}v$DLRepoVersion${NOct}"
Say "$(date +'%b %d %Y %X') $(nvram get lan_hostname) ${ScriptFNameTag}_[$$] - INFO: A new script update (v$DLRepoVersion) is available to download."
else
UpdateNotify=0
fi
}

##-----------------------------------------------##
## Original Author: ExtremeFiretop [2023-Nov-26] ##
## Modified by: Martinski W. [2023-Dec-01] ##
##-----------------------------------------------##
#a function that provides a UI to check for script updates and allows you to install the latest version...
Expand Down Expand Up @@ -1583,7 +1582,7 @@ _Toggle_FW_UpdateCheckSetting_()
}

##------------------------------------------##
## Modified by ExtremeFiretop [2023-Dec-05] ##
## Modified by ExtremeFiretop [2023-Dec-16] ##
##------------------------------------------##
# Embed functions from second script, modified as necessary.
_RunFirmwareUpdateNow_()
Expand Down Expand Up @@ -1691,9 +1690,6 @@ _RunFirmwareUpdateNow_()
return 1
fi

#BEGIN: Redirect both stdout and stderr to log file #
{

if [ "$1" = "**ERROR**" ] && [ "$2" = "**NO_URL**" ]
then
Say "${REDct}**ERROR**${NOct}: No firmware release URL was found for [$PRODUCT_ID] router model."
Expand All @@ -1706,6 +1702,17 @@ _RunFirmwareUpdateNow_()
##---------------------------------------##
# Get the required space for the firmware download and extraction
required_space_kb=$(get_required_space "$release_link")
if ! _HasRouterMoreThan256MBtotalRAM_ && [ "$required_space_kb" -gt 51200 ]; then
if ! _ValidateUSBMountPoint_ "$FW_ZIP_BASE_DIR"; then
Say "${REDct}**ERROR**${NOct}: A USB drive is required for the F/W update due to limited RAM."
"$inMenuMode" && _WaitForEnterKey_ "$menuReturnPromptStr"
return 1
fi
fi

#BEGIN: Redirect both stdout and stderr to log file #
{

availableRAM_kb=$(_GetAvailableRAM_KB_)
Say "Required RAM: ${required_space_kb}KB - Available RAM: ${availableRAM_kb}KB"
check_memory_and_prompt_reboot "$required_space_kb" "$availableRAM_kb"
Expand All @@ -1731,7 +1738,7 @@ _RunFirmwareUpdateNow_()
fi

##---------------------------------------##
## Added by ExtremeFiretop [2023-Dec-09] ##
## Added by ExtremeFiretop [2023-Dec-16] ##
##---------------------------------------##
availableRAM_kb=$(_GetAvailableRAM_KB_)
Say "Required RAM: ${required_space_kb}KB - Available RAM: ${availableRAM_kb}KB"
Expand Down Expand Up @@ -1789,7 +1796,8 @@ _RunFirmwareUpdateNow_()
if [ -n "$rog_file" ]; then
# If in interactive mode, prompt the user for their choice
if [ "$inMenuMode" = true ]; then
printf "${REDct}Found ROG build: $rog_file. Would you like to use the ROG build? (y/n)${NOct}\n"
printf "${REDct}Found ROG build: $rog_file.
Would you like to use the ROG build? (y/n)${NOct}\n"
read -rp "Enter your choice: " choice
if [ "$choice" = "y" ] || [ "$choice" = "Y" ]; then
firmware_file="$rog_file"
Expand Down Expand Up @@ -2089,7 +2097,7 @@ FW_NewUpdateVersion="$(_GetLatestFWUpdateVersionFromRouter_ 1)"
FW_InstalledVersion="${GRNct}$(_GetCurrentFWInstalledLongVersion_)${NOct}"

##------------------------------------------##
## Modified by ExtremeFiretop [2023-Dec-10] ##
## Modified by ExtremeFiretop [2023-Dec-16] ##
##------------------------------------------##
show_menu()
{
Expand All @@ -2100,7 +2108,12 @@ show_menu()

# New Script Update Notification #
if [ "$UpdateNotify" != "0" ]; then
Say "${REDct}${UpdateNotify}${NOct}"
Say "${REDct}WARNING:${NOct} ${UpdateNotify}${NOct}\n"
fi

if ! _HasRouterMoreThan256MBtotalRAM_ && ! _ValidateUSBMountPoint_ "$FW_ZIP_BASE_DIR"; then
Say "${REDct}WARNING:${NOct} Limited RAM detected (256MB).
A USB drive is required for F/W updates.\n"
fi

padStr=" " arrowStr=" ${REDct}<<---${NOct}"
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---WORK IN PROGRESS---
- PREVIEW, NOT YET COMPLETE. PLEASE EXPECT BUGS.
---WORK IN PROGRESS---

![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/e948e3c3-9068-41ab-b8dc-3678a6eb4a68)
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/3d3a0a27-4871-4ca6-be76-249b35b95899)

---TESTERS NEEDED!---
- If you see your router listed as untested below, feel free to test and report any issues.
Expand Down Expand Up @@ -58,7 +57,6 @@ Blocked due to low RAM/ROM space and/or have not received updates in several yea
- Only once it's been vetted through most routers.

- Notes:
- Might need to add some "overhead" to the file size comparison to account for the "ZIP + F/W" files being on the "$HOME" directory at the same time, even if just temporarily.
- New routers use UBIFS instead of JFFS2.

## Merlin(A)uto(U)pdate
Expand Down