From e548e7823a08b13da26c14078612afbfb8059bb3 Mon Sep 17 00:00:00 2001 From: Martinski <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:41:29 -0800 Subject: [PATCH] Minor UI Improvement Added a user-friendly/human-readable schedule line below the "F/W Update Cron Schedule" menu option. --- MerlinAU.sh | 68 +++++++++++++++++++++++++++++++++++++---------------- README.md | 4 ++-- version.txt | 2 +- 3 files changed, 51 insertions(+), 23 deletions(-) diff --git a/MerlinAU.sh b/MerlinAU.sh index 14f362ed..1c18eec3 100644 --- a/MerlinAU.sh +++ b/MerlinAU.sh @@ -4,12 +4,12 @@ # # Original Creation Date: 2023-Oct-01 by @ExtremeFiretop. # Official Co-Author: @Martinski W. - Date: 2023-Nov-01 -# Last Modified: 2024-Dec-01 +# Last Modified: 2024-Dec-21 ################################################################### set -u ## Set version for each Production Release ## -readonly SCRIPT_VERSION=1.3.8 +readonly SCRIPT_VERSION=1.3.9 readonly SCRIPT_NAME="MerlinAU" ## Set to "master" for Production Releases ## SCRIPT_BRANCH="dev" @@ -4704,9 +4704,9 @@ _TranslateCronSchedHR_() infoStrDAYS="every $freqNumDAYW days of the week, in every month" elif echo "$theCronDAYW" | grep -qE "[,-]" then - infoStrDAYS="days $theCronDAYW of the week, in every month" + infoStrDAYS="days ${theCronDAYW}, in every month" else - infoStrDAYS="day $theCronDAYW of the week, in every month" + infoStrDAYS="day ${theCronDAYW}, in every month" fi elif [ "$theCronDAYM" != "*" ] then @@ -4736,7 +4736,7 @@ _TranslateCronSchedHR_() else hasFreqMINS=false ; freqNumMINS="" fi - if [ "$theCronHOUR" = "*" ] && [ "$theCronMINS" -eq 0 ] + if [ "$theCronHOUR" = "*" ] && [ "$theCronMINS" = "0" ] then schedInfoStr="Every hour" elif [ "$theCronHOUR" = "*" ] && [ "$theCronMINS" = "*" ] @@ -4745,7 +4745,7 @@ _TranslateCronSchedHR_() elif [ "$theCronHOUR" = "*" ] && _IsValidNumber_ "$theCronMINS" then schedInfoStr="Every hour at minute $theCronMINS" - elif "$hasFreqHOUR" && [ "$theCronMINS" -eq 0 ] + elif "$hasFreqHOUR" && [ "$theCronMINS" = "0" ] then schedInfoStr="Every $freqNumHOUR hours" elif "$hasFreqHOUR" && [ "$theCronMINS" = "*" ] @@ -4774,12 +4774,12 @@ _TranslateCronSchedHR_() schedInfoStr="$theCronHOUR, every $freqNumMINS minutes" elif [ "$theCronHOUR" = "*" ] then - schedInfoStr="Every hour, Minutes: $theCronMINS" + schedInfoStr="Every hour, Minutes: $theCronMINS" elif [ "$theCronMINS" = "*" ] then schedInfoStr="$theCronHOUR, every minute" else - schedInfoStr="$theCronHOUR, Minutes: $theCronMINS" + schedInfoStr="$theCronHOUR, Minutes: $theCronMINS" fi echo "${schedInfoStr}, $infoStrDAYS" } @@ -5116,15 +5116,25 @@ _ShowCronMenuHeader_() printf "${SEPstr}\n" } -##-------------------------------------## -## Added by Martinski W. [2024-Nov-24] ## -##-------------------------------------## +##----------------------------------------## +## Modified by Martinski W. [2024-Dec-20] ## +##----------------------------------------## _GetCronScheduleInputDAYofMONTH_() { if [ $# -eq 0 ] || [ -z "$1" ] ; then return 1 ; fi - local oldSchedDAYM="$1" newSchedDAYM + local oldSchedDAYM newSchedDAYM oldSchedDAYHR + + _GetSchedDaysHR_() + { + local cruDAYS="$1" + [ "$1" = "*" ] && cruDAYS="Every day" + echo "$cruDAYS" + } newSchedDAYM="" + oldSchedDAYM="$1" + oldSchedDAYHR="$(_GetSchedDaysHR_ "$1")" + while true do _ShowCronMenuHeader_ @@ -5136,7 +5146,7 @@ _GetCronScheduleInputDAYofMONTH_() printf " ${GRNct}*/7${NOct}=Every 7 days ${GRNct}*/10${NOct}=Every 10 days ${GRNct}*/15${NOct}=Every 15 days\n" printf "\n[${menuCancelAndExitStr}]\n" - printf "\nEnter ${GRNct}DAYS of the MONTH${NOct} [1-31] ${GRNct}${oldSchedDAYM}${NOct}?: " + printf "\nEnter ${GRNct}DAYS of the MONTH${NOct} [1-31] ${GRNct}${oldSchedDAYHR}${NOct}?: " read -r newSchedDAYM if [ -z "$newSchedDAYM" ] then @@ -5154,15 +5164,32 @@ _GetCronScheduleInputDAYofMONTH_() return 0 } -##-------------------------------------## -## Added by Martinski W. [2024-Nov-24] ## -##-------------------------------------## +##----------------------------------------## +## Modified by Martinski W. [2024-Dec-20] ## +##----------------------------------------## _GetCronScheduleInputDAYofWEEK_() { if [ $# -eq 0 ] || [ -z "$1" ] ; then return 1 ; fi - local oldSchedDAYW="$1" newSchedDAYW + local oldSchedDAYW newSchedDAYW oldSchedDAYHR + + _DayOfWeekNumToDayName_() + { echo "$1" | sed 's/0/Sun/;s/1/Mon/;s/2/Tue/;s/3/Wed/;s/4/Thu/;s/5/Fri/;s/6/Sat/;' ; } + + _GetSchedDaysHR_() + { + local cruDAYS="$1" + if [ "$1" = "*" ] + then cruDAYS="Every day" + elif ! echo "$1" | grep -qE "^[*]/.*" + then cruDAYS="$(_DayOfWeekNumToDayName_ "$1")" + fi + echo "$cruDAYS" + } newSchedDAYW="" + oldSchedDAYW="$1" + oldSchedDAYHR="$(_GetSchedDaysHR_ "$1")" + while true do _ShowCronMenuHeader_ @@ -5176,7 +5203,7 @@ _GetCronScheduleInputDAYofWEEK_() printf " ${GRNct}6,0${NOct}=Sat,Sun ${GRNct}1,3,5${NOct}=Mon,Wed,Fri ${GRNct}2,4${NOct}=Tue,Thu\n" printf "\n[${menuCancelAndExitStr}] [${menuSavedThenExitStr}] [${menuReturnToBeginStr}]\n" - printf "\nEnter ${GRNct}DAYS of the WEEK${NOct} [0-6] ${GRNct}${oldSchedDAYW}${NOct}?: " + printf "\nEnter ${GRNct}DAYS of the WEEK${NOct} [0-6] ${GRNct}${oldSchedDAYHR}${NOct}?: " read -r newSchedDAYW if [ -z "$newSchedDAYW" ] then @@ -8529,7 +8556,7 @@ _ShowMainMenu_() } ##----------------------------------------## -## Modified by Martinski W. [2024-Nov-25] ## +## Modified by Martinski W. [2024-Dec-20] ## ##----------------------------------------## _ShowAdvancedOptionsMenu_() { @@ -8545,7 +8572,8 @@ _ShowAdvancedOptionsMenu_() printf "\n${padStr}[Current Path: ${GRNct}${FW_ZIP_DIR}${NOct}]\n" printf "\n ${GRNct}2${NOct}. Set F/W Update Cron Schedule" - printf "\n${padStr}[Current Schedule: ${GRNct}${FW_UpdateCronJobSchedule}${NOct}]\n" + printf "\n${padStr}[Current Schedule: ${GRNct}${FW_UpdateCronJobSchedule}${NOct}]" + printf "\n${padStr}[${GRNct}%s${NOct}]\n" "$(_TranslateCronSchedHR_ "$FW_UpdateCronJobSchedule")" BetaProductionSetting="$(Get_Custom_Setting "FW_Allow_Beta_Production_Up")" printf "\n ${GRNct}3${NOct}. Toggle Beta-to-Release F/W Updates" diff --git a/README.md b/README.md index 26ce4fb9..8e4e1f10 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MerlinAU - AsusWRT-Merlin Firmware Auto Updater -## v1.3.8 -## 2024-Dec-01 +## v1.3.9 +## 2024-Dec-21 ![image](https://github.com/user-attachments/assets/185f9fe4-acdb-419a-8154-ab6fa6e0fd46) ![image](https://github.com/user-attachments/assets/8f22818d-2118-4c47-a54a-e54fb147fd6b) diff --git a/version.txt b/version.txt index e05cb332..d4c4950a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.3.8 +1.3.9