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
32 changes: 20 additions & 12 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
# Last Modified: 2023-Dec-21
# Last Modified: 2023-Dec-22
###################################################################
set -u

readonly SCRIPT_VERSION="0.2.35"
readonly SCRIPT_VERSION="0.2.36"
readonly SCRIPT_NAME="MerlinAU"

##-------------------------------------##
Expand Down Expand Up @@ -658,6 +658,14 @@ Update_Custom_Settings()
_Set_FW_UpdateLOG_DirectoryPath_()
{
local newLogBaseDirPath="$FW_LOG_BASE_DIR" newLogFileDirPath=""

if [ ! -d "$FW_LOG_DIR" ]
then
mkdir -p -m 755 "$FW_LOG_DIR"
else
# Log rotation - delete logs older than 30 days #
find "$FW_LOG_DIR" -name '*.log' -mtime +30 -exec rm {} \;
fi

while true
do
Expand Down Expand Up @@ -855,10 +863,8 @@ readonly CRON_SCRIPT_HOOK="[ -f $ScriptFilePath ] && $CRON_SCRIPT_JOB"
readonly POST_REBOOT_SCRIPT_JOB="sh $ScriptFilePath postRebootRun & $hookScriptTagStr"
readonly POST_REBOOT_SCRIPT_HOOK="[ -f $ScriptFilePath ] && $POST_REBOOT_SCRIPT_JOB"

if [ ! -d "$FW_LOG_DIR" ]
if [ -d "$FW_LOG_DIR" ]
then
mkdir -p -m 755 "$FW_LOG_DIR"
else
# Log rotation - delete logs older than 30 days #
find "$FW_LOG_DIR" -name '*.log' -mtime +30 -exec rm {} \;
fi
Expand Down Expand Up @@ -1923,12 +1929,14 @@ Would you like to use the ROG build? (y/n)${NOct}\n"
#----------------------------------------------------------#
# In the rare case that the F/W Update gets "stuck" for
# some reason & the "curl" cmd never returns, we create
# a background child process that sleeps for 4 minutes
# and then kills the "curl" process if it still exists.
# Otherwise, this child process does nothing & returns.
# a background child process that sleeps for 3 and a half
# minutes and then kills the "curl" process if it still
# exists. Otherwise, this child process does nothing
# & returns. NORMALLY the Curl returns almost instantly
# once the upload is complete.
#----------------------------------------------------------#
(
sleep 240
sleep 210
if [ "$curlPID" -gt 0 ]
then
kill -EXIT $curlPID 2>/dev/null || return
Expand All @@ -1937,10 +1945,10 @@ Would you like to use the ROG build? (y/n)${NOct}\n"
) &
wait $curlPID ; curlPID=0
#----------------------------------------------------------#
# Let's wait for 30 seconds here. If the router does not
# Let's wait for 90 seconds here. If the router does not
# reboot by itself after the process returns, do it now.
#----------------------------------------------------------#
_Reset_LEDs_ ; sleep 30
_Reset_LEDs_ ; sleep 90
/sbin/service reboot
else
Say "${REDct}**ERROR**${NOct}: Login failed. Please try the following:
Expand Down Expand Up @@ -2188,7 +2196,7 @@ A USB drive is required for F/W updates.\n"

notifyDate="$(Get_Custom_Setting FW_New_Update_Notification_Date)"
if [ "$notifyDate" = "TBD" ]
then notificationStr="${REDct}NOT SET${NOct}]"
then notificationStr="${REDct}NOT SET${NOct}"
else notificationStr="${GRNct}${notifyDate%%_*}${NOct}"
fi

Expand Down