From 81f4e89a8b4960c7aa8135fcd7e18fb6e272ce5c Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 12 Nov 2024 09:57:04 -0700 Subject: [PATCH] 60-beta2.3 --- README.md | 6 +++++- help.txt | 6 +++++- reinstall-esp-idf.sh | 34 ++++++++++++++++------------------ version.txt | 2 +- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e235fcb..9397ad0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ only currently tested on zsh ``` Modes: default: - reinstalls non-interactively with no delays, logouts, or reboots + reinstalls non-interactively with no delays, logouts, or reboots. run without any argument bash reinstall-esp-idf.sh test: @@ -49,6 +49,10 @@ Modes: interactively installs/reinstalls esp-idf bash reinstall-esp-idf.sh interactive + clearlogs: + clear logs + bash reinstall-esp-idf.sh clearlogs + help: display this help text bash reinstall-esp-idf.sh help diff --git a/help.txt b/help.txt index 3f80413..005b66c 100644 --- a/help.txt +++ b/help.txt @@ -18,7 +18,11 @@ Modes: interactive: interactively installs/reinstalls esp-idf `bash reinstall-esp-idf.sh interactive` - + + clearlogs: + clear logs + `bash reinstall-esp-idf.sh clearlogs` + help: display this help text `bash reinstall-esp-idf.sh help` diff --git a/reinstall-esp-idf.sh b/reinstall-esp-idf.sh index 17e5698..8e729a7 100644 --- a/reinstall-esp-idf.sh +++ b/reinstall-esp-idf.sh @@ -23,6 +23,13 @@ helpText=$runningDir/help.txt scriptVers=$(cat $runningDir/version.txt) # make sure version.txt does NOT have newline arg=$1 # just rename the argument var for clarity with the functions +# commands +gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" + +installCmd="$idfDir/install.sh all" + +toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" + # full order: # handleStart # handleLogoutAllUsers @@ -189,6 +196,8 @@ handleWarnAllUsers() { loggedIn=$(who | awk '{print $1}' | uniq) + writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Warning all logged in users:\n$lggedIn" # make sure dis workan + echo $loggedIn | while read line; do echo -e "$warningString" | sudo write done @@ -202,6 +211,8 @@ function handleLogoutAllUsers() { loggedIn=$(who | awk '{print $1}' | uniq) + writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): logging out all logged in users:\n$lggedIn" # make sure dis workan + echo $loggedIn | while read line; do sudo loginctl terminate-user $line done @@ -315,12 +326,6 @@ elif [ "$arg" == "interactive" ]; then writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Interactive vars set:\n\tinstallDir: $installDir\n\tgitBranch: $gitBranch\n\trcFile: $rcFile\n\tgitJobs: $gitJobs" - gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" - - installCmd="$idfDir/install.sh all" - - toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" - handleStart handleSetupEnvironment handleCustomBins @@ -333,12 +338,6 @@ elif [ "$arg" == "interactive" ]; then elif [ "$arg" == "cron" ]; then # full install with warn, sleep, and reboot action="REINSTALL (CRON)" - - gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" - - installCmd="$idfDir/install.sh all" - - toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" handleStart handleLogoutAllUsers @@ -352,14 +351,13 @@ elif [ "$arg" == "cron" ]; then # full install with warn, sleep, and reboot exit +elif [ "$arg" == "clearlogs" ]; then # clear logs + handleEmptyLogs + + exit + else # full noninteractive (re)install without logout, reboot, or sleeps action="REINSTALL (DEFAULT)" - - gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" - - installCmd="$idfDir/install.sh all" - - toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" handleStart handleSetupEnvironment diff --git a/version.txt b/version.txt index 8f53e6f..70b2731 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -60-beta2.1 \ No newline at end of file +60-beta2.3 \ No newline at end of file