From 6837d0ecc94c826ea5663ea7e789cc8f9e8e5c10 Mon Sep 17 00:00:00 2001 From: hPrnicessPi3 Date: Fri, 9 May 2025 23:47:13 -0600 Subject: [PATCH] testiung for release 2 --- CHANGELOG.txt | 3 +- add-to-export-sh.txt | 15 +++--- custom_bin/chipinfo | 2 +- custom_bin/flashmonitor | 5 +- custom_bin/install-esp-branch | 12 ----- custom_bin/monitor | 5 +- esp-idf | 1 - esp-idf-tools-cmd.sh | 99 +++++++++++++++++------------------ todo.txt | 16 ++++++ 9 files changed, 84 insertions(+), 74 deletions(-) delete mode 100644 custom_bin/install-esp-branch delete mode 160000 esp-idf diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f42e47d..57bb906 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,4 +5,5 @@ simplified alias for idf-tools-cmd 9-rc-final - fixed and renamed ESPIDF_INSTALLDIR ESPIDFTOOLS_INSTALLDIR \ No newline at end of file + fixed and renamed ESPIDF_INSTALLDIR ESPIDFTOOLS_INSTALLDIR + removed install branch command \ No newline at end of file diff --git a/add-to-export-sh.txt b/add-to-export-sh.txt index 9b993ae..28ad9c1 100644 --- a/add-to-export-sh.txt +++ b/add-to-export-sh.txt @@ -19,14 +19,13 @@ commitHash=commitTAG installDate=installDateTAG branchData=branchDataTAG -if [ -z $ESPIDTOOLS_INSTALLDIR ]; then +if [ -z "$ESPIDTOOLS_INSTALLDIR" ]; then echo -e "\nFAIL: ESPIDFTOOLS_INSTALLDIR environment variable not found!\nReinstall via script or manually add to ~/.zshrc\n" - exit fi binDir="$ESPIDFTOOLS_INSTALLDIR/.custom_bin" -echo -e "\nTTY devices found in dmesg:" +echo -e "\nChecking for Serial Devices in dmesg\n" COUNTER=0 devarr=() for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do @@ -35,9 +34,13 @@ for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); COUNTER=$((COUNTER+1)) done -echo -e "\nEnter TTY Number You'd Like:" -read tty -ttyselect=$devarr[(($tty+1))] +if [ -z "$devArr" ]; then + echo -e "\nNo Serial Devices Found, Select one later with 'changeport'\n" +else + echo -e "\nEnter TTY Number You'd Like:" + read tty + ttyselect=$devarr[(($tty+1))] +fi echo -e "Set esp target:\n\tOne of: $(getTargets)" read esp diff --git a/custom_bin/chipinfo b/custom_bin/chipinfo index 206e409..9deb61a 100644 --- a/custom_bin/chipinfo +++ b/custom_bin/chipinfo @@ -1,5 +1,5 @@ #!/bin/bash -echo -e "Getting ESP Chip Info...\n" +echo -e "\nGetting ESP Chip Info...\n" # echo -e "Base MAC Address:" # esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto read_mac echo -e "\nChip ID:" diff --git a/custom_bin/flashmonitor b/custom_bin/flashmonitor index d7d08d1..e01828c 100644 --- a/custom_bin/flashmonitor +++ b/custom_bin/flashmonitor @@ -1 +1,4 @@ -idf.py flash monitor \ No newline at end of file +#!/bin/bash +echo -e "\nFlashing and Monitoring for $ESPTARGET on $ESPPORT\n" +idf.py flash monitor +echo -e "\nAll done :3\n" \ No newline at end of file diff --git a/custom_bin/install-esp-branch b/custom_bin/install-esp-branch deleted file mode 100644 index b31e189..0000000 --- a/custom_bin/install-esp-branch +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# usage install_esp_branch v5.4.1 -if [ -z "$1" ]; then - echo "usage example: `install_esp_branch v.5.4.1`" - exit -fi - -rm -rf ~/esp/esp-idf -rm -rf ~/.espressif -git clone --recursive https://github.com/espressif/esp-idf.git -b "$1" ~/esp/esp-idf -bash ~/esp/esp-idf/install.sh all -python ~/esp/esp-idf/tools/idf_tools.py install all diff --git a/custom_bin/monitor b/custom_bin/monitor index 6009b14..5fab0f0 100644 --- a/custom_bin/monitor +++ b/custom_bin/monitor @@ -1 +1,4 @@ -idf.py monitor \ No newline at end of file +#!/bin/bash +echo -e "\nMonitoring on $ESPPORT\n" +idf.py monitor +echo -e "\nAll done :3\n" \ No newline at end of file diff --git a/esp-idf b/esp-idf deleted file mode 160000 index 565cca2..0000000 --- a/esp-idf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 565cca2feef765c0a24146b1392eccbf4b3a6276 diff --git a/esp-idf-tools-cmd.sh b/esp-idf-tools-cmd.sh index 5ce9085..b5fbf26 100644 --- a/esp-idf-tools-cmd.sh +++ b/esp-idf-tools-cmd.sh @@ -2,25 +2,55 @@ # set -e # uncomment for die on error startTime=$(date '+%s') # to time the (re)install time for the logs +# full order: +# set action string variable +# set sleepMins int variable +# redefine any other vars needed +# handleStart +# handleClearInstallLog +# handleLogoutAllUsers +# handleSetupEnvironment +# handleCustomBins +# handleDownloadInstall +# handleExport +# handleAliasEnviron +# handleLogoutAllUsers +# handleEnd +# handleReboot +# exit + +# always run globals and boilerplate + +# get us our FUCKING ALIASES HOLY FUCK GOD DAMN SHIT FUCK IT\ +source $rcFile 2>/dev/null # >2?/dev/null is to redirect any errors +rcFile="$HOME/.zshrc" # shell rc file +defaultInstallDir="$HOME/esp" + if [ -z "$2" ]; then gitBranch=master # branch from github else gitBranch=$2 fi -rcFile=$HOME/.zshrc # shell rc file +if [ -z "$ESPIDFTOOLS_INSTALLDIR" ]; then + # cant seem to get this one to use writeToLog + echo "ESPIDFTOOLS_INSTALLDIR environment variable not found, appending to $rcFile" + echo "export ESPIDFTOOLS_INSTALLDIR=\"$defaultInstallDir\"" >> $rcFile + installDir="$defaultInstallDir" + aliasInstallDirChk=$? +else + echo "ESPIDFTOOLS_INSTALLDIR environment variable found, skipping" + installDir="$ESPIDFTOOLS_INSTALLDIR" + aliasInstallDirChk=0 +fi + gitJobs=5 # number of jobs to download from github with -# gitJobs=default # default for no --jobs x arg, integar for a number of jobs rebootMins=3 # minutes of warning before reboot -defaultInstallDir="$HOME/esp" - -# get us our FUCKING ALIASES HOLY FUCK GOD DAMN SHIT FUCK IT\ -source $rcFile 2>/dev/null # >2?/dev/null is to redirect any errors - -log="" # log file -versionData="" # version data log file -idfDir="" # esp-idf path -customBinLocation="" # where custom bin scripts are placed +log=$installDir/install.log # log file +versionData=$installDir/version-data.log # version data log file +idfDir=$installDir/esp-idf # esp-idf path +exportScript=$idfDir/export.sh # export script +customBinLocation=$installDir/.custom_bin # where custom bin scripts are placed espressifLocation=$HOME/.espressif # espressif tools install location runningDir="$( cd "$( dirname "$0" )" && pwd )" customBinFrom=$runningDir/custom_bin # dir where custom scripts are coming FROM @@ -29,7 +59,6 @@ exportBackupScript=$runningDir/export.sh.bak # back up to running dir 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 if [ "$gitJobs" == "default" ]; then gitCloneCmd="git clone --single-branch --depth 1 --recursive --branch $gitBranch https://github.com/espressif/esp-idf $idfDir" else @@ -37,11 +66,8 @@ else fi gitUpdateCmd="git -C $idfDir reset --hard; git -C $idfDir clean -df; git -C $idfDir pull $idfDir" # mayhapsnasst? - installCmd="$idfDir/install.sh all" - toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" - idfGet="update" # default method # default values for retcodes @@ -74,23 +100,6 @@ rmCustomBinChk=0 sleepChk=0 rmExportBackupChk=0 -# full order: -# set action string variable -# set sleepMins int variable -# redefine any other vars needed -# handleStart -# handleClearInstallLog -# handleLogoutAllUsers -# handleSetupEnvironment -# handleCustomBins -# handleDownloadInstall -# handleExport -# handleAliasEnviron -# handleLogoutAllUsers -# handleEnd -# handleReboot -# exit - function returnStatus() { ret=$? strii="\tReturn status: $ret" @@ -356,8 +365,13 @@ function handleDownloadInstall() { } handleReboot() { - messagePTS "\n\nRebooting in $sleepMins minutes\ncancel with 'shutdown -c'!!\n\n" - sudo shutdown -r +$rebootMins + if [ $sleepMins -eq 0 ]; then + messagePTS "Rebooting NOW" + sudo reboot + else + messagePTS "\n\nRebooting in $sleepMins minutes\ncancel with 'shutdown -c'!!\n\n" + sudo shutdown -r +$rebootMins + fi } function handleCheckEspIdf() { @@ -370,23 +384,6 @@ function handleCheckEspIdf() { } function handleStart() { - if [ -z $ESPIDFTOOLS_INSTALLDIR ]; then - writeToLog "ESPIDFTOOLS_INSTALLDIR environment variable not found, appending to $rcFile" - echo "export ESPIDFTOOLS_INSTALLDIR=\"$defaultInstallDir\"" >> $rcFile - installDir="$defaultInstallDir" - aliasInstallDirChk=$? - else - writeToLog "ESPIDFTOOLS_INSTALLDIR environment variable already installed, skipping\n" - installDir="$ESPIDFTOOLS_INSTALLDIR" - aliasInstallDirChk=0 - fi - - log=$installDir/install.log # log file - versionData=$installDir/version-data.log # version data log file - idfDir=$installDir/esp-idf # esp-idf path - exportScript=$idfDir/export.sh # export script - customBinLocation=$installDir/.custom_bin # where custom bin scripts are placed - if [ -z $sleepMins ]; then sleepMins="disabled" fi diff --git a/todo.txt b/todo.txt index b108bee..0c51759 100644 --- a/todo.txt +++ b/todo.txt @@ -1,9 +1,25 @@ +x export +x changeport +x erase-flash +x setup +x espinfo +x changetarget +x changebaud +x clean +x help-esp-tools +x run-esp-cmd [help h -h --help] + +flashmonitor +monitor + text export and changeesp test help on cmd, help-esp-tools test sourced scrips changebaud, changeesp, changeport test menuconfig, monitor, flashmonitor, exit-esp-tools test / fix / remove esp-idf-tools-cmd.sh options +reboot immediately when reset is set to 0 mins remove unneeded code +check header on install version log audit readme maybe pretty up test all for bugs