Skip to content
Merged
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
52 changes: 37 additions & 15 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1776,35 +1776,46 @@ then
fi

##-------------------------------------##
## Added by Martinski W. [2025-Jan-11] ##
## Added by Martinski W. [2025-Feb-12] ##
##-------------------------------------##
_GetWebUIPage_()
_Check_WebGUI_Page_Exists_()
{
local webPageFile webPagePath webPageTemp webPageEntry
local webPageStr webPageFile theWebPage

webPageFile="NONE"
if [ ! -f "$TEMP_MENU_TREE" ]
then echo "NONE" ; return 1 ; fi

if [ -f "$TEMP_MENU_TREE" ]
theWebPage="NONE"
webPageStr="$(grep -E -m1 "$webPageLineRegExp" "$TEMP_MENU_TREE")"
if [ -n "$webPageStr" ]
then
webPageEntry="$(grep -E "$webPageLineRegExp" "$TEMP_MENU_TREE")"
if [ -n "$webPageEntry" ]
then
webPageTemp="$(echo "$webPageEntry" | grep -owE "$webPageFileRegExp")"
[ -n "$webPageTemp" ] && webPageFile="$webPageTemp"
fi
webPageFile="$(echo "$webPageStr" | grep -owE "$webPageFileRegExp" | head -n1)"
if [ -n "$webPageFile" ] && [ -s "${SHARED_WEB_DIR}/$webPageFile" ]
then theWebPage="$webPageFile" ; fi
fi
echo "$theWebPage"
}

##----------------------------------------##
## Modified by Martinski W. [2025-Feb-12] ##
##----------------------------------------##
_GetWebUIPage_()
{
local webPageFile webPagePath webPageTemp

webPageFile="$(_Check_WebGUI_Page_Exists_)"

for index in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
webPageTemp="user${index}.asp"
webPagePath="${SHARED_WEB_DIR}/$webPageTemp"

if [ -f "$webPagePath" ] && \
if [ -s "$webPagePath" ] && \
[ "$(md5sum < "$1")" = "$(md5sum < "$webPagePath")" ]
then
webPageFile="$webPageTemp"
break
elif [ "$webPageFile" = "NONE" ] && [ ! -f "$webPagePath" ]
elif [ "$webPageFile" = "NONE" ] && [ ! -s "$webPagePath" ]
then
webPageFile="$webPageTemp"
fi
Expand All @@ -1824,7 +1835,7 @@ _Mount_WebUI_()
fi
local webPageFile

Say "Mounting WebUI page for $SCRIPT_NAME"
Say "Mounting WebUI page for ${SCRIPT_NAME}..."

eval exec "$WEBUI_LOCKFD>$WEBUI_LOCKFILE"
flock -x "$WEBUI_LOCKFD"
Expand Down Expand Up @@ -1856,6 +1867,16 @@ _Mount_WebUI_()
return 0
}

##-------------------------------------##
## Added by Martinski W. [2025-Feb-12] ##
##-------------------------------------##
_CheckFor_WebGUI_Page_()
{
if "$inRouterSWmode" && \
[ "$(_Check_WebGUI_Page_Exists_)" = "NONE" ]
then _Mount_WebUI_ ; fi
}

##----------------------------------------##
## Modified by Martinski W. [2025-Jan-11] ##
##----------------------------------------##
Expand Down Expand Up @@ -10263,7 +10284,7 @@ FW_InstalledVerStr="${GRNct}${FW_InstalledVersion}${NOct}"
FW_NewUpdateVerInit=TBD

##----------------------------------------##
## Modified by Martinski W. [2025-Jan-10] ##
## Modified by Martinski W. [2025-Feb-12] ##
##----------------------------------------##
if [ $# -eq 0 ] || [ -z "$1" ] || \
{ [ $# -gt 1 ] && [ "$1" = "reload" ] ; }
Expand All @@ -10281,6 +10302,7 @@ then
if [ "$ScriptAutoUpdateSetting" = "ENABLED" ]
then _AddScriptAutoUpdateCronJob_ ; fi
_ConfirmCronJobForFWAutoUpdates_
_CheckFor_WebGUI_Page_

_MainMenu_ "$@"
_DoExit_ 0
Expand Down