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
2 changes: 1 addition & 1 deletion .github/workflows/Create-NewReleases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id: nextver
run: |
if [[ -f version.txt ]]; then
NEXT_TAG=$(cat version.txt)
NEXT_TAG=$(head -n 1 version.txt)
else
CURRENT_TAG=$(git tag --sort=-v:refname | head -n 1)
if [[ $CURRENT_TAG == '' ]]; then
Expand Down
67 changes: 52 additions & 15 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: 2023-Nov-01
# Last Modified: 2025-Mar-20
# Last Modified: 2025-Mar-24
###################################################################
set -u

Expand Down Expand Up @@ -37,11 +37,13 @@ readonly CL_URL_3006="${FW_SFURL_BASE}/Documentation/Changelog-3006.txt/download
readonly high_risk_terms="factory default reset|features are disabled|break backward compatibility|must be manually|strongly recommended"

##----------------------------------------##
## Modified by Martinski W. [2024-Dec-31] ##
## Modified by Martinski W. [2025-Mar-24] ##
##----------------------------------------##
# For new script version updates from source repository #
DLRepoVersion=""
DLRepoVersionNum=""
DLRepoBuildNum=0
ScriptBuildNum=0
ScriptVersionNum=""
scriptUpdateNotify=0

Expand Down Expand Up @@ -2608,6 +2610,24 @@ _CheckForNewGUIVersionUpdate_()
return "$retCode"
}

##-------------------------------------##
## Added by Martinski W. [2025-Mar-24] ##
##-------------------------------------##
_GetDLScriptVersion_()
{
if [ $# -eq 0 ] || [ -z "$1" ] || [ ! -s "$1" ]
then echo ; return 1 ; fi

local DLversBuildNum=0
if [ "$(wc -l < "$1")" -eq 2 ]
then
DLversBuildNum="$(tail -n1 "$1")"
[ -z "$DLversBuildNum" ] && DLversBuildNum=0
fi
echo "$(head -n1 "$1")|$DLversBuildNum"
return 0
}

##----------------------------------------##
## Modified by Martinski W. [2025-Feb-15] ##
##----------------------------------------##
Expand Down Expand Up @@ -2692,7 +2712,7 @@ _DownloadScriptFiles_()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Feb-15] ##
## Modified by Martinski W. [2025-Mar-24] ##
##----------------------------------------##
_SCRIPT_UPDATE_()
{
Expand All @@ -2701,10 +2721,7 @@ _SCRIPT_UPDATE_()
if [ $# -gt 0 ] && [ "$1" = "force" ]
then
printf "\n${CYANct}Force downloading latest script version...${NOct}\n"
if ! _CheckForNewScriptUpdates_ -quietcheck
then
DLRepoVersion="$(/usr/sbin/curl -LSs --retry 4 --retry-delay 5 "${SCRIPT_URL_REPO}/version.txt")"
fi
_CheckForNewScriptUpdates_ -quietcheck
if _CheckForNewGUIVersionUpdate_ "$SCRIPT_VERSION" "$DLRepoVersion"
then extraParam="install"
fi
Expand Down Expand Up @@ -2749,7 +2766,8 @@ _SCRIPT_UPDATE_()
if _DownloadScriptFiles_ update
then
if "$mountWebGUI_OK"
then _SetVersionSharedSettings_ local "$DLRepoVersion" ; fi
then _SetVersionSharedSettings_ local "$DLRepoVersion"
fi
printf "\n${CYANct}Download successful!${NOct}\n"
printf "$(date) - Successfully downloaded $SCRIPT_NAME v${DLRepoVersion}\n"
fi
Expand All @@ -2770,7 +2788,8 @@ _SCRIPT_UPDATE_()
if _DownloadScriptFiles_ update
then
if "$mountWebGUI_OK"
then _SetVersionSharedSettings_ local "$DLRepoVersion" ; fi
then _SetVersionSharedSettings_ local "$DLRepoVersion"
fi
printf "\n$(date) - Successfully downloaded $SCRIPT_NAME v${DLRepoVersion}\n"
printf "${CYANct}Update successful! Restarting script...${NOct}\n"
sleep 1
Expand All @@ -2791,23 +2810,37 @@ _SCRIPT_UPDATE_()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Feb-15] ##
## Modified by Martinski W. [2025-Mar-24] ##
##----------------------------------------##
_CheckForNewScriptUpdates_()
{
local verStr DLScriptVerPath="${SCRIPT_VERPATH}.DL.tmp"
echo
DLRepoVersion="$SCRIPT_VERSION"
[ -s "$SCRIPT_VERPATH" ] && DLRepoVersion="$(cat "$SCRIPT_VERPATH")"
rm -f "$SCRIPT_VERPATH"
if [ -s "$SCRIPT_VERPATH" ]
then
if verStr="$(_GetDLScriptVersion_ "$SCRIPT_VERPATH")"
then
DLRepoVersion="$(echo "$verStr" | awk -F '|' '{print $1}')"
DLRepoBuildNum="$(echo "$verStr" | awk -F '|' '{print $2}')"
ScriptBuildNum="$DLRepoBuildNum"
fi
fi

if ! _CurlFileDownload_ "version.txt" "$SCRIPT_VERPATH"
if ! _CurlFileDownload_ "version.txt" "$DLScriptVerPath"
then
Say "${REDct}**ERROR**${NOct}: Unable to download latest version file for $SCRIPT_NAME."
scriptUpdateNotify=0
return 1
fi

DLRepoVersion="$(cat "$SCRIPT_VERPATH")"
if verStr="$(_GetDLScriptVersion_ "$DLScriptVerPath")"
then
DLRepoVersion="$(echo "$verStr" | awk -F '|' '{print $1}')"
DLRepoBuildNum="$(echo "$verStr" | awk -F '|' '{print $2}')"
fi
rm -f "$DLScriptVerPath"

if [ -z "$DLRepoVersion" ]
then
Say "${REDct}**ERROR**${NOct}: Variable for downloaded version is empty."
Expand All @@ -2818,7 +2851,11 @@ _CheckForNewScriptUpdates_()
DLRepoVersionNum="$(_ScriptVersionStrToNum_ "$DLRepoVersion")"
ScriptVersionNum="$(_ScriptVersionStrToNum_ "$SCRIPT_VERSION")"

if [ "$DLRepoVersionNum" -gt "$ScriptVersionNum" ]
if [ "$DLRepoVersionNum" -gt "$ScriptVersionNum" ] || \
{
[ "$DLRepoBuildNum" -gt "$ScriptBuildNum" ] && \
[ "$DLRepoVersionNum" -eq "$ScriptVersionNum" ]
}
then
scriptUpdateNotify="New script update available.
${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
## v1.4.0
## 2025-Mar-20
## 2025-Mar-25

## WebUI:
![image](https://github.com/user-attachments/assets/10d0971c-b3c6-477a-8904-d4bf013f72df)
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
1.4.0
25032500