From 32c35d622bdb64e4f729aea63e2a1153ffd6cd02 Mon Sep 17 00:00:00 2001 From: Martinski <119833648+Martinski4GitHub@users.noreply.github.com> Date: Mon, 20 Jan 2025 00:57:40 -0800 Subject: [PATCH 1/2] Modified Uninstallation Behavior Modified Uninstallation prompt to NOT keep/save configuration file by default when called from the WebGUI. --- MerlinAU.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/MerlinAU.sh b/MerlinAU.sh index b8ff39e5..6c307aa8 100644 --- a/MerlinAU.sh +++ b/MerlinAU.sh @@ -4,7 +4,7 @@ # # Original Creation Date: 2023-Oct-01 by @ExtremeFiretop. # Official Co-Author: @Martinski W. - Date: 2023-Nov-01 -# Last Modified: 2025-Jan-18 +# Last Modified: 2025-Jan-20 ################################################################### set -u @@ -310,15 +310,22 @@ _WaitForEnterKey_() read -rs EnterKEY ; echo } -##----------------------------------## -## Added Martinski W. [2023-Nov-28] ## -##----------------------------------## +##-------------------------------------## +## Modified Martinski W. [2025-Jan-20] ## +##-------------------------------------## _WaitForYESorNO_() { - ! "$isInteractive" && return 0 - local promptStr + local retCode defltAnswer promptStr - if [ $# -eq 0 ] || [ -z "$1" ] + if [ $# -gt 0 ] && [ "$1" = "NO" ] + then retCode=1 ; defltAnswer="NO" + else retCode=0 ; defltAnswer="YES" + fi + + ! "$isInteractive" && return "$retCode" + + if [ $# -eq 0 ] || [ -z "$1" ] || \ + echo "$1" | grep -qE "^(YES|NO)$" then promptStr=" [yY|nN]? " else promptStr="$1 [yY|nN]? " fi @@ -8745,7 +8752,7 @@ _DoInstallation_() } ##----------------------------------------## -## Modified by Martinski W. [2025-Jan-18] ## +## Modified by Martinski W. [2025-Jan-20] ## ##----------------------------------------## _DoUnInstallation_() { @@ -8758,7 +8765,7 @@ _DoUnInstallation_() local savedCFGPath="${SCRIPTS_PATH}/${SCRIPT_NAME}_CFG.SAVED.TXT" printf "\n${BOLDct}Do you want to keep/save the $SCRIPT_NAME configuration file${NOct}" - if _WaitForYESorNO_ + if _WaitForYESorNO_ NO then doSaveConfig=true mv -f "$CONFIG_FILE" "$savedCFGPath" From 705e6ecfb47ed2b25fe07a4386f8702f0168aee4 Mon Sep 17 00:00:00 2001 From: Martinski <119833648+Martinski4GitHub@users.noreply.github.com> Date: Mon, 20 Jan 2025 01:31:48 -0800 Subject: [PATCH 2/2] Update MerlinAU.sh Fine-tuning code to maintain previous behavior of YESorNO prompt except when NO is explicitly provided. --- MerlinAU.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MerlinAU.sh b/MerlinAU.sh index 6c307aa8..8e5e7a7c 100644 --- a/MerlinAU.sh +++ b/MerlinAU.sh @@ -318,8 +318,8 @@ _WaitForYESorNO_() local retCode defltAnswer promptStr if [ $# -gt 0 ] && [ "$1" = "NO" ] - then retCode=1 ; defltAnswer="NO" - else retCode=0 ; defltAnswer="YES" + then retCode=1 ; defltAnswer="YES" + else retCode=0 ; defltAnswer="NO" fi ! "$isInteractive" && return "$retCode" @@ -331,6 +331,7 @@ _WaitForYESorNO_() fi printf "$promptStr" ; read -r YESorNO + [ -z "$YESorNO" ] && YESorNO="$defltAnswer" if echo "$YESorNO" | grep -qE "^([Yy](es)?|YES)$" then echo "OK" ; return 0 else echo "NO" ; return 1