Skip to content

Commit 357e1aa

Browse files
Merge pull request #238 from ExtremeFiretop/dev
Dev 1.2.2 as next stable release
2 parents 6e75263 + c30c0d8 commit 357e1aa

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

MerlinAU.sh

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2024-Jun-05
7+
# Last Modified: 2024-Jun-10
88
###################################################################
99
set -u
1010

11-
readonly SCRIPT_VERSION=1.2.1
11+
readonly SCRIPT_VERSION=1.2.2
1212
readonly SCRIPT_NAME="MerlinAU"
1313

1414
##-------------------------------------##
@@ -3106,9 +3106,9 @@ expand_cron_field()
31063106
fi
31073107
}
31083108

3109-
##----------------------------------------##
3110-
## Modified by Martinski W. [2024-May-18] ##
3111-
##----------------------------------------##
3109+
##------------------------------------------##
3110+
## Modified by ExtremeFiretop [2024-Jun-10] ##
3111+
##------------------------------------------##
31123112
_EstimateNextCronTimeAfterDate_()
31133113
{
31143114
local post_date_secs="$1"
@@ -3139,6 +3139,7 @@ _EstimateNextCronTimeAfterDate_()
31393139
while [ "$found" = "false" ]
31403140
do
31413141
loopCount="$((loopCount + 1))"
3142+
31423143
if matches_month "$current_month" "$month_field" && \
31433144
matches_day_of_month "$current_day" "$dom_field" && \
31443145
matches_day_of_week "$current_dow" "$dow_field"
@@ -3149,17 +3150,17 @@ _EstimateNextCronTimeAfterDate_()
31493150
then
31503151
for this_min in $(expand_cron_field "$minute_field" 0 59)
31513152
do
3152-
echo "$(date '+%s' -d "$current_year-$current_month-$current_day $this_hour:$this_min")"
3153+
echo "$(date -d "@$(date '+%s' -d "$current_year-$current_month-$current_day $this_hour:$this_min")" '+%Y-%m-%d %H:%M:%S')"
31533154
found=true
31543155
return 0
31553156
done
31563157
elif [ "$this_hour" -eq "$current_hour" ]
31573158
then
31583159
for this_min in $(expand_cron_field "$minute_field" 0 59)
31593160
do
3160-
if [ "$this_min" -gt "$current_minute" ]
3161+
if [ "$this_min" -ge "$current_minute" ]
31613162
then
3162-
echo "$(date '+%s' -d "$current_year-$current_month-$current_day $this_hour:$this_min")"
3163+
echo "$(date -d "@$(date '+%s' -d "$current_year-$current_month-$current_day $this_hour:$this_min")" '+%Y-%m-%d %H:%M:%S')"
31633164
found=true
31643165
return 0
31653166
fi
@@ -3209,9 +3210,9 @@ _Calculate_DST_()
32093210
echo "$((notifyTimeSecs + postponeTimeSecs))"
32103211
}
32113212

3212-
##----------------------------------------##
3213-
## Modified by Martinski W. [2024-May-18] ##
3214-
##----------------------------------------##
3213+
##------------------------------------------##
3214+
## Modified by ExtremeFiretop [2024-Jun-10] ##
3215+
##------------------------------------------##
32153216
_Calculate_NextRunTime_()
32163217
{
32173218
local fwNewUpdateVersion fwNewUpdateNotificationDate
@@ -3240,18 +3241,16 @@ _Calculate_NextRunTime_()
32403241
fwNewUpdateNotificationDate="$(date +%Y-%m-%d_%H:%M:%S)"
32413242
fi
32423243
upfwDateTimeSecs="$(_Calculate_DST_ "$(echo "$fwNewUpdateNotificationDate" | sed 's/_/ /g')")"
3243-
nextCronTimeSecs="$(_EstimateNextCronTimeAfterDate_ "$upfwDateTimeSecs" "$FW_UpdateCronJobSchedule")"
3244-
if [ "$nextCronTimeSecs" = "$CRON_UNKNOWN_DATE" ]
3244+
ExpectedFWUpdateRuntime="$(_EstimateNextCronTimeAfterDate_ "$upfwDateTimeSecs" "$FW_UpdateCronJobSchedule")"
3245+
if [ "$ExpectedFWUpdateRuntime" = "$CRON_UNKNOWN_DATE" ]
32453246
then
32463247
Update_Custom_Settings FW_New_Update_Expected_Run_Date "TBD"
32473248
ExpectedFWUpdateRuntime="${REDct}UNKNOWN${NOct}"
32483249
else
3249-
Update_Custom_Settings FW_New_Update_Expected_Run_Date "$nextCronTimeSecs"
3250-
ExpectedFWUpdateRuntime="$(date -d @$nextCronTimeSecs +"%Y-%b-%d %I:%M %p")"
3250+
Update_Custom_Settings FW_New_Update_Expected_Run_Date "$ExpectedFWUpdateRuntime"
32513251
ExpectedFWUpdateRuntime="${GRNct}$ExpectedFWUpdateRuntime${NOct}"
32523252
fi
32533253
else
3254-
ExpectedFWUpdateRuntime="$(date -d @$ExpectedFWUpdateRuntime +"%Y-%b-%d %I:%M %p")"
32553254
ExpectedFWUpdateRuntime="${GRNct}$ExpectedFWUpdateRuntime${NOct}"
32563255
fi
32573256
}
@@ -3938,8 +3937,7 @@ _CheckTimeToUpdateFirmware_()
39383937
return 1
39393938
fi
39403939

3941-
upfwDateTimeStrn="$(date -d @$nextCronTimeSecs +"%A, %Y-%b-%d %I:%M %p")"
3942-
Say "The firmware update is expected to occur on ${GRNct}${upfwDateTimeStrn}${NOct}."
3940+
Say "The firmware update is expected to occur on ${GRNct}${nextCronTimeSecs}${NOct}."
39433941
echo ""
39443942

39453943
# Check if running in a menu environment

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
2-
## v1.2.1
3-
## 2024-06-08
2+
## v1.2.2
3+
## 2024-06-11
44

55
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/95562bee-aee7-4275-8ee2-6a049580d4aa)
66
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/761dd6dd-aaf2-4454-a05e-7b9a4f481086)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.1
1+
1.2.2

0 commit comments

Comments
 (0)