Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Post Update Release Lock Email Issue #352

Closed
wants to merge 7 commits into from
Closed
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
29 changes: 16 additions & 13 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
# Last Modified: 2024-Oct-19
# Last Modified: 2024-Nov-12
###################################################################
set -u

## Set version for each Production Release ##
readonly SCRIPT_VERSION=1.3.4
readonly SCRIPT_VERSION=1.3.5
readonly SCRIPT_NAME="MerlinAU"
## Set to "master" for Production Releases ##
SCRIPT_BRANCH="dev"
Expand Down Expand Up @@ -6260,6 +6260,8 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
--cookie /tmp/cookie.txt > /tmp/upload_response.txt 2>&1 &
curlPID=$!

_ReleaseLock_

#----------------------------------------------------------#
# In the rare case that the F/W Update gets "stuck" for
# some reason & the "curl" cmd never returns, we create
Expand All @@ -6283,7 +6285,6 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
# reboot by itself after the process returns, do it now.
#----------------------------------------------------------#
sleep 180
_ReleaseLock_
/sbin/service reboot
else
Say "${REDct}**ERROR**${NOct}: Router Login failed."
Expand Down Expand Up @@ -6315,27 +6316,28 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
"$inMenuMode" && _WaitForEnterKey_ "$theMenuReturnPromptMsg"
}

##-------------------------------------##
## Added by Martinski W. [2024-Jan-24] ##
##-------------------------------------##
##------------------------------------------##
## Modified by ExtremeFiretop [2024-Nov-12] ##
##------------------------------------------##
_PostUpdateEmailNotification_()
{
_DelPostUpdateEmailNotifyScriptHook_
Update_Custom_Settings FW_New_Update_Changelog_Approval TBD

local theWaitDelaySecs=10
local maxWaitDelaySecs=360 #6 minutes#
local maxWaitDelaySecs=600 #10 minutes#
local curWaitDelaySecs=0
#---------------------------------------------------------
# Wait until all services are started, including NTP
# so the system clock is updated with correct time.
#---------------------------------------------------------
while [ "$curWaitDelaySecs" -lt "$maxWaitDelaySecs" ]
do
# Check if services are ready
if [ "$(nvram get ntp_ready)" -eq 1 ] && \
[ "$(nvram get start_service_ready)" -eq 1 ] && \
[ "$(nvram get success_start_service)" -eq 1 ]
then sleep 30 ; break; fi
then sleep 60 ; break; fi

echo "Waiting for all services to be started [$theWaitDelaySecs secs.]..."
sleep $theWaitDelaySecs
Expand All @@ -6345,15 +6347,15 @@ _PostUpdateEmailNotification_()
_SendEMailNotification_ POST_REBOOT_FW_UPDATE_STATUS
}

##-------------------------------------##
## Added by Martinski W. [2023-Nov-20] ##
##-------------------------------------##
##------------------------------------------##
## Modified by ExtremeFiretop [2024-Nov-12] ##
##------------------------------------------##
_PostRebootRunNow_()
{
_DelPostRebootRunScriptHook_

local theWaitDelaySecs=10
local maxWaitDelaySecs=360 #6 minutes#
local maxWaitDelaySecs=600 #10 minutes#
local curWaitDelaySecs=0
#---------------------------------------------------------
# Wait until all services are started, including NTP
Expand All @@ -6362,11 +6364,12 @@ _PostRebootRunNow_()
#---------------------------------------------------------
while [ "$curWaitDelaySecs" -lt "$maxWaitDelaySecs" ]
do
# Check if services are ready
if [ -d "$FW_ZIP_BASE_DIR" ] && \
[ "$(nvram get ntp_ready)" -eq 1 ] && \
[ "$(nvram get start_service_ready)" -eq 1 ] && \
[ "$(nvram get success_start_service)" -eq 1 ]
then sleep 30 ; break; fi
then sleep 60 ; break; fi

echo "Waiting for all services to be started [$theWaitDelaySecs secs.]..."
sleep $theWaitDelaySecs
Expand Down