- Notifications
You must be signed in to change notification settings - Fork 3
Code Improvements and Fine-Tuning#573
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4,13 +4,13 @@ | ||
| # | ||
| # Original Creation Date: 2023-Oct-01 by @ExtremeFiretop. | ||
| # Official Co-Author: @Martinski W. - Date: 2023-Nov-01 | ||
| # Last Modified: 2026-May-16 | ||
| # Last Modified: 2026-May-21 | ||
| ################################################################### | ||
| set -u | ||
| ## Set version for each Production Release ## | ||
| readonly SCRIPT_VERSION=1.6.3 | ||
| readonly SCRIPT_VERSTAG="26052100" | ||
| readonly SCRIPT_VERSTAG="26052123" | ||
| readonly SCRIPT_NAME="MerlinAU" | ||
| ## Set to "master" for Production Releases ## | ||
| SCRIPT_BRANCH="dev" | ||
| @@ -173,14 +173,28 @@ fi | ||
| inMenuMode=true | ||
| webguiMode=false | ||
| isVerbose=false | ||
| isInteractive=false | ||
| FlashStarted=false | ||
| MerlinChangeLogURL="" | ||
| GnutonChangeLogURL="" | ||
| keepConfigFile=false | ||
| bypassPostponedDays=false | ||
| runLoginCredentialsTest=false | ||
| if [ -t 0 ] && ! tty | grep -qwi "NOT" | ||
| then | ||
| isVerbose=true | ||
| readonly isInteractive=true | ||
| readonly gSavedSTTY="$(stty -g)" | ||
| else | ||
| readonly isInteractive=false | ||
| fi | ||
| if [ "$isInteractive" = "false" ] && { [ $# -eq 0 ] || [ -z "$1" ] ; } | ||
| then | ||
| logger -st "${SCRIPT_NAME}_[$$]" -p 3 "**ERROR**: CLI Menu is NOT available in a non-interactive shell" | ||
| exit 1 | ||
| fi | ||
| # Main LAN Network Info # | ||
| readonly myLAN_HostName="$(nvram get lan_hostname)" | ||
| readonly mainLAN_IFname="$(nvram get lan_ifname)" | ||
| @@ -277,12 +291,6 @@ routerLoginFailureMsg="Please try the following: | ||
| to restrict access to the router webGUI from the router's IP address [${GRNct}${mainLAN_IPaddr}${NOct}]. | ||
| 3. Confirm your password via the \"Set Router Login Password\" option from the Main Menu." | ||
| if [ -t 0 ] && ! tty | grep -qwi "NOT" | ||
| then | ||
| isInteractive=true ; isVerbose=true | ||
| readonly gSavedSTTY="$(stty -g)" | ||
| fi | ||
| ##----------------------------------------## | ||
| ## Modified by Martinski W. [2023-Dec-23] ## | ||
| ##----------------------------------------## | ||
| @@ -3011,7 +3019,7 @@ _CheckNewScriptMinFWBeforeUpdate_() | ||
| } | ||
| ##----------------------------------------## | ||
| ## Modified by Martinski W. [2026-Feb-22] ## | ||
| ## Modified by Martinski W. [2026-May-21] ## | ||
| ##----------------------------------------## | ||
| _SCRIPT_UPDATE_() | ||
| { | ||
| @@ -3062,18 +3070,14 @@ _SCRIPT_UPDATE_() | ||
| _SendEMailNotification_ SUCCESS_SCRIPT_UPDATE_STATUS | ||
| fi | ||
| sleep 1 | ||
| if [ $# -ge 2 ] && [ "$2" = "unattended" ] | ||
| then | ||
| return 0 | ||
| fi | ||
| if "$isInteractive" && [ -t 0 ] | ||
| if "$isInteractive" && { [ $# -lt 2 ] || [ -z "$2" ] ; } | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| then | ||
| _ReleaseLock_ | ||
| exec "$ScriptFilePath" | ||
| exit 0 | ||
| else | ||
| return 0 #Unattended# | ||
| fi | ||
| return 0 | ||
| else | ||
| if ! "$isInteractive" | ||
| then | ||
| @@ -3200,9 +3204,9 @@ ScriptUpdateFromAMTM() | ||
| return "$retCode" | ||
| } | ||
| ##------------------------------------------## | ||
| ## Modified by ExtremeFiretop [2025-May-10] ## | ||
| ##------------------------------------------## | ||
| ##----------------------------------------## | ||
| ## Modified by Martinski W. [2026-May-21] ## | ||
| ##----------------------------------------## | ||
| _CheckForNewScriptUpdates_() | ||
| { | ||
| local verStr DLScriptVerPath="${SCRIPT_VERPATH}.DL.tmp" | ||
| @@ -3257,14 +3261,14 @@ _CheckForNewScriptUpdates_() | ||
| scriptUpdateNotify="New script update available. | ||
| ${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}" | ||
| _WriteVarDefToHelperJSFile_ "isScriptUpdateAvailable" "$DLRepoVersion" | ||
| if [ $# -gt 0 ] && [ "$1" = "-quietcheck" ] | ||
| then | ||
| return 0 | ||
| then return 0 | ||
| fi | ||
| Say "$myLAN_HostName - A new script version update (v$DLRepoVersion) is available to download." | ||
| if [ "$ScriptAutoUpdateSetting" = "ENABLED" ] | ||
| then | ||
| if "$isInteractive" && [ -t 0 ] | ||
| if "$isInteractive" && { [ $# -eq 0 ] || [ -z "$1" ] ; } | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| then | ||
| _SCRIPT_UPDATE_ force | ||
| else | ||
| @@ -4640,6 +4644,12 @@ _GetKeypressInput_() | ||
| local offlineUpdKeyFlag execReloadKeyFlag | ||
| local specialKeyCharCodes="12 16 18 24 25 27" | ||
| if [ "$isInteractive" = "false" ] | ||
| then | ||
| theUserInputStr="exit" | ||
| return 0 #Defensive Exit# | ||
| fi | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if [ -n "${offlineUpdTrigger:+xSETx}" ] | ||
| then | ||
| offlineUpdKeyFlag=true | ||
| @@ -12093,13 +12103,9 @@ FW_NewUpdateVerInit=TBD | ||
| if [ $# -eq 0 ] || [ -z "$1" ] || \ | ||
| { [ $# -gt 1 ] && [ "$1" = "reload" ] ; } | ||
| then | ||
| if [ ! -t 0 ]; then | ||
| printf "MerlinAU: refusing to open menu without a TTY.\n" >&2 | ||
| _DoExit_ 1 | ||
| fi | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if ! _AcquireLock_ cliMenuLock | ||
| then Say "Exiting..." ; exit 1 ; fi | ||
| then Say "Exiting..." ; exit 1 | ||
| fi | ||
| inMenuMode=true | ||
| _DoInitializationStartup_ | ||
| @@ -12161,7 +12167,7 @@ then | ||
| checkupdates) | ||
| if _AcquireLock_ cliFileLock | ||
| then | ||
| _CheckForNewScriptUpdates_ | ||
| _CheckForNewScriptUpdates_ unattended | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| _ReleaseLock_ cliFileLock | ||
| fi | ||
| ;; | ||
| @@ -12248,8 +12254,8 @@ then | ||
| if _AcquireLock_ cliFileLock | ||
| then | ||
| if [ "$3" = "${SCRIPT_NAME}scrptupdate_force" ] | ||
| then _SCRIPT_UPDATE_ force | ||
| else _CheckForNewScriptUpdates_ | ||
| then _SCRIPT_UPDATE_ force unattended | ||
| else _CheckForNewScriptUpdates_ unattended | ||
ExtremeFiretop marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fi | ||
| _ReleaseLock_ cliFileLock | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.