bug fixes pre release version

This commit is contained in:
2025-05-09 14:24:08 -06:00
parent 4579bd6c90
commit baaaf0c0cc
11 changed files with 92 additions and 136 deletions
+34 -35
View File
@@ -20,7 +20,7 @@ Some take optional [branch] paramater
[branch] is the esp-idf branch you desire, defaults to master if not specified. [branch] is the esp-idf branch you desire, defaults to master if not specified.
default: default:
reinstalls non-interactively with no delays, logouts, or reboots reinstalls non-interactively with no delays, logouts, or reboots
* `run-esp-cmd` `run-esp-cmd`
test: test:
tests the script. very fast. minimal actions taken. no reinstall is done tests the script. very fast. minimal actions taken. no reinstall is done
@@ -77,41 +77,40 @@ Some take optional [branch] paramater
``` ```
## Features ## Features
``` * `get-idf-tools` enter esp-idf
`get-idf-tools` enter esp-idf * `help-esp-tools` show this help
`help-esp-tools` show this help * `exit-esp-tools` exit esp-idf and reset terminal
`exit-esp-tools` exit esp-idf and reset terminal * `build` idf.py build
`build` idf.py build * `changebaud` prompts to enter a new baud
`changebaud` prompts to enter a new baud * `changeesp` change esp device
`changeesp` change esp device * `changeesp` alone prompts to enter
`changeesp` alone prompts to enter * `changeesp <esp device>` manually changes to <esp device>
`changeesp <esp device>` manually changes to <esp device> * ex. `changeesp esp32p4`
ex. `changeesp esp32p4` * `changeport` change serial port
`changeport` change serial port * `changeport` alone prompts to select
`changeport` alone prompts to select * `changeport <tty device path>` manually specifies path
`changeport <tty device path>` manually specifies path * ex. `changeport /dev/ttyUSB0` changes to /dev/ttyUSB0
ex. `changeport /dev/ttyUSB0` changes to /dev/ttyUSB0 * `clean` idf.py clean
`clean` idf.py clean * `fullclean` fully resets a project, 'idf.py fullclean' plus remove the build dir and delete some temp and backup files
`fullclean` fully resets a project, 'idf.py fullclean' plus remove the build dir and delete some temp and backup files * `rebuildfull` does a `fullclean` but also an `erase-flash` and also `setup`
`rebuildfull` does a `fullclean` but also an `erase-flash` and also `setup` * `setup` same as running `idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build`
`setup` same as running `idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build` * `flash` idf.py flash
`flash` idf.py flash * `monitor` idf.py monitor
`monitor` idf.py monitor * `erase-flash` idf.py erase-flash
`erase-flash` idf.py erase-flash * `save-defconfig` idf.py save-defconfig
`save-defconfig` idf.py save-defconfig * `step-flash-monitor` attempt clean, build, flash, then monitor, dying on error
`step-flash-monitor` attempt clean, build, flash, then monitor, dying on error * `imagesize` get binary size, broken down in various ways including total, by componant, and by file
`imagesize` get binary size, broken down in various ways including total, by componant, and by file * `chipinfo` get information from the esp chip
`chipinfo` get information from the esp chip * `espinfo` get detailed information from the esp chip
`espinfo` get detailed information from the esp chip * `menuconfig` run `idf.py menuconfig`
`menuconfig` run `idf.py menuconfig` * `create-project <project name>` same as idf.py create-project <proejct name>
`create-project <project name>` same as idf.py create-project <proejct name> * ex. `create-project hello-world`
ex. `create-project hello-world` * `esp-install-monitor` monitors install.log. alias for `tail -n 75 -f $ESPIDF_INSTALLDIR/install.log`
`esp-install-monitor` monitors install.log. alias for `tail -n 75 -f $ESPIDF_INSTALLDIR/install.log` * `esp-install-logs` displays full text of install.log and version-data.txt
`esp-install-logs` displays full text of install.log and version-data.txt
```
### Cronjob ### Cronjob
reinstall from master everyday at 4am, logging out users with warn delays and rebooting after reinstall from master everyday at 4am, logging out users with warn delays and rebooting after
`crontab -e` * `crontab -e`
add below to bottom of file: add below to bottom of file:
`0 4 * * * bash $HOME/esp/esp-install-custom/esp-idf-tools-cmd.sh cron * `0 4 * * * bash $HOME/esp/esp-install-custom/esp-idf-tools-cmd.sh cron`
+2 -5
View File
@@ -64,17 +64,14 @@ echo -e "\nSetting alias"
alias changeport="source $binDir/changeport.sh" alias changeport="source $binDir/changeport.sh"
alias changebaud="source $binDir/changebaud.sh" alias changebaud="source $binDir/changebaud.sh"
alias changeesp="source $binDir/changeesp.sh" alias changeesp="source $binDir/changeesp.sh"
alias exit-esp-tools="source $binDir/exit-idf.sh" alias exit-esp-tools="source $binDir/exit-esp-tools.sh"
alias monitor="idf.py monitor"
alias flashmonitor="idf.py flash monitor"
alias menuconfig="idf.py menuconfig"
# echo -e "Changing dir to $ESPIDF_INSTALLDIR" # echo -e "Changing dir to $ESPIDF_INSTALLDIR"
cd $ESPIDF_INSTALLDIR cd $ESPIDF_INSTALLDIR
echo -e "\nesp-idf version: $ESP_IDF_VERSION commit $commitHash from branch $branchData" echo -e "\nesp-idf version: $ESP_IDF_VERSION commit $commitHash from branch $branchData"
echo -e "\nrun with `run_esp_cmd`" echo -e "\nrun with 'run_esp_cmd'"
echo -e "\nWelcome to esp-idf!\nAll done :3\n" echo -e "\nWelcome to esp-idf!\nAll done :3\n"
+6 -2
View File
@@ -14,8 +14,12 @@ subprocess() {
return $selection return $selection
} }
subprocess if [ ! -z $1 ]; then
ret=$? ret="$1"
else
ret=''
subprocess ret
fi
export ESPBAUD=$ret export ESPBAUD=$ret
echo "\nBaudrate set to $ESPBAUD\n" echo "\nBaudrate set to $ESPBAUD\n"
+6 -5
View File
@@ -1,12 +1,13 @@
echo "esp-idf install dir: $ESPIDF_INSTALLDIR" echo "esp-idf-tools install dir: $ESPIDF_INSTALLDIR"
echo "esp-idf-tools last install: $(tail -1 $ESPIDF_INSTALLDIR/version-data.log)"
echo "esp-idf path: $IDF_PATH" echo "esp-idf path: $IDF_PATH"
echo "esp-idf version: $ESP_IDF_VERSION" echo "esp-idf version: $ESP_IDF_VERSION"
echo "esp-idf python path: $IDF_PYTHON_ENV_PATH echo "esp-idf python path: $IDF_PYTHON_ENV_PATH"
echo "openocd scripts: $OPENOCD_SCRIPTS" echo "openocd scripts: $OPENOCD_SCRIPTS"
echo "esp-idf rom elf dir: $ESP_ROM_ELF_DIR" echo "esp-idf rom elf dir: $ESP_ROM_ELF_DIR"
echo "esp-idf-deactivate file path $IDF_DEACTIVATE_FILE_PATH" echo "esp-idf-deactivate file path $IDF_DEACTIVATE_FILE_PATH"
echo "esp-idf tools install cmd: $IDF_TOOLS_INSTALL_CMD" echo "esp-idf install cmd: $IDF_TOOLS_INSTALL_CMD"
echo "esp-idf-tools export cmd: $IDF_TOOLS_EXPORT_CMD" echo "esp-idf export cmd: $IDF_TOOLS_EXPORT_CMD"
echo "port: $ESPPORT" echo "port: $ESPPORT"
echo "baud: $ESPBAUD" echo "baud: $ESPBAUD"
echo "target device $SPTARGET" echo "target device: $ESPTARGET"
+1
View File
@@ -0,0 +1 @@
idf.py flash monitor
+1
View File
@@ -0,0 +1 @@
idf.py menuconfig
+1
View File
@@ -0,0 +1 @@
idf.py monitor
+15 -51
View File
@@ -114,6 +114,18 @@ function writeToLog() {
echo -e "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): $1" >> $log echo -e "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): $1" >> $log
} }
function messagePTY() {
if [[ ! -z $1 ]]; then
message="$1"
else
message="Something happening! Maybe a shutdown!"
fi
for pts in $(ls -q /dev/pts); do
sudo echo -e "$message" > /dev/pts/$pts # requires passwordless sudo
done
}
# this is not needed so long as warn doesnt god damned fucking work lmfao # this is not needed so long as warn doesnt god damned fucking work lmfao
function handleSleep() { function handleSleep() {
# writeToLog "Handling sleep hold (function ran)\n" # writeToLog "Handling sleep hold (function ran)\n"
@@ -353,57 +365,10 @@ function handleDownloadInstall() {
} }
handleReboot() { handleReboot() {
# writeToLog "Handling reboot: (function ran)\n" messagePTY "\n\nRebooting in $sleepMins minutes!!\n\n"
sudo shutdown -r +$rebootMins sudo shutdown -r +$rebootMins
} }
# warning not work how i make it work fuckin ell
handleWarnAllUsers() {
# writeToLog "Warning all users of impending logout (function called)\n"
warningString="\nWARNING:\n\tReinstalling esp-idf:\n\tForce logut in $sleepMins minutes!!\n\tSave and log out!\n\tmonitor with \`esp+monitor\`\n\tterminate with \`sudo killall esp-idf-tools-cmd.sh\`\n"
writeToLog "$warningString"
loggedIn=$(who | awk '{print $1}' | uniq)
if [ -z $loggedIn ]; then
writeToLog "No users logged in to warn\n"
return
else
writeToLog "Skipping warning all logged in users: $loggedIn\n"
fi
# writeToLog "Warning all logged in users: $loggedIn"
# sudo wall --nobanner "$warningString"
# returnStatus
# warnChk=$?
#
# handleSleep
}
# dis one sure af be workan tho lmfao
function handleLogoutAllUsers() {
# writeToLog "Handling user logout (function ran)\n"
handleWarnAllUsers
loggedIn=$(who | awk '{print $1}' | uniq)
if [ -z $loggedIn ]; then
writeToLog "No logged in users to log out\n"
return
else
writeToLog "Logging out all logged in users: $loggedIn"
echo $loggedIn | while read line; do
writeToLog "\tLogging out $line"
sudo loginctl terminate-user $line
returnStatus
done
returnStatus
logoutChk=$?
fi
}
function handleCheckEspIdf() { function handleCheckEspIdf() {
if [ ! -z $IDF_PYTHON_ENV_PATH ]; then if [ ! -z $IDF_PYTHON_ENV_PATH ]; then
writeToLog "FAIL: Sanity check failed!\n\tesp-idf environment varibles found!\n\tPelase run from a fresh termnal that has not had get_idf ran!\n" writeToLog "FAIL: Sanity check failed!\n\tesp-idf environment varibles found!\n\tPelase run from a fresh termnal that has not had get_idf ran!\n"
@@ -508,7 +473,6 @@ if [[ "$arg" == "--help" || "$arg" == "help" || "$arg" == "-h" || "$arg" == "h"
elif [[ "$arg" == "test" || "$arg" == "t" ]]; then # minimal actions taken, echo the given commands and such elif [[ "$arg" == "test" || "$arg" == "t" ]]; then # minimal actions taken, echo the given commands and such
action="TEST" action="TEST"
sleepMins=0 sleepMins=0
# testExport=1
installCmdTemp="echo $installCmd" installCmdTemp="echo $installCmd"
toolsInstallCmdTemp="echo $toolsInstallCmd" toolsInstallCmdTemp="echo $toolsInstallCmd"
@@ -601,14 +565,13 @@ elif [[ "$arg" == "cron" || "$arg" == "c" ]]; then # full install with warn, sle
idfGet="update" idfGet="update"
sleepMins=0 sleepMins=0
messagePTY "esp-idf-tools action $action started!\nWill reboot with $sleepMins minutes delay when complete!"
handleStart handleStart
handleClearInstallLog handleClearInstallLog
handleLogoutAllUsers
handleSetupEnvironment handleSetupEnvironment
handleCustomBins handleCustomBins
handleDownloadInstall handleDownloadInstall
handleExport handleExport
handleLogoutAllUsers
handleEnd handleEnd
handleReboot handleReboot
@@ -654,6 +617,7 @@ elif [[ "$arg" == "nukereboot" || "$arg" == "nr" ]]; then
sleepMins=1 sleepMins=1
idfGet="download" idfGet="download"
messagePTY "esp-idf-tools action $action started!\nWill reboot with $sleepMins minutes delay when complete!"
handleStart handleStart
handleClearInstallLog handleClearInstallLog
handleSetupEnvironment handleSetupEnvironment
Regular → Executable
+7 -25
View File
@@ -1,28 +1,10 @@
source $HOME/.zshrc #!/bin/bash
if [[ ! -z $1 ]]; then
function checkAlias() { message="$1"
echo "Testing $1"
alias $1 2>/dev/null
ret=$?
echo -e "\tretcode: $ret"
if [ $ret -eq 1 ]; then
echo "$1 not found"
else else
echo "$1: $(alias $1)" message="PTS Default Message"
fi fi
return $ret for pts in $(ls -q /dev/pts); do
} sudo echo "$message" > /dev/pts/$pts
done
checkAlias get_idf
checkAlias run_esp_reinstall
checkAlias esp_monitor
checkAlias esp_logs
checkAlias notarealone
# if [ -z $ESPIDF_INSTALLDIR ]; then
# echo "ESPIDF_INSTALLDIR not found"
# else
# echo "ESPIDF_INSTALLDIR: $ESPIDF_INSTALLDIR"
# fi
+9 -3
View File
@@ -1,9 +1,15 @@
test new pts messaging system
integrate
test espinfo
test all for bugs
audit readme
maybe pretty up
test/fix changebaud/changebaud <baud>
test menuconfig, monitor, flashmonitor
mayhaps support bash? mayhaps support bash?
# mayhaps it already works mayhaps? test # mayhaps it already works mayhaps? test
figure out how to message users properly
x at leastt remove sleeps if cant message ig lol
verbosity levels? verbosity levels?
less verbose on git commands and installers? less verbose on git commands and installers?
esp_install_logs esp_install_logs