diff --git a/README.md b/README.md index 0e8ecba..51869e6 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,66 @@ installs/reinstalls full esp-idf with my own additions on linux. pulls from master so its the very latest built for debian-like systems +only currently tested on zsh -`git clone https://github.com/PrincessPi3/esp-install-custom.git ~` +## Quick start +`git clone https://github.com/PrincessPi3/esp-install-custom.git ~` `bash ~/reinstall-esp-idf.sh` -scripts added: -`build` idf.py build -`changebaud` prompts to enter a new baud -`changeesp` prompts to type in esp32s3, esp32c6, etc -`changeport` opens a menu to select a serial port -`clean` idf.py clean -`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` -`setup` same as running 'idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build' -`flash` idf.py flash -`monitor` idf.py monitor -`erase-flash` idf.py erase-flash -`save-defconfig` idf.py save-defconfig \ No newline at end of file +## Features +`build` idf.py build +`changebaud` prompts to enter a new baud +`changeesp` prompts to type in esp32s3, esp32c6, etc +`changeport` opens a menu to select a serial port +`clean` idf.py clean +`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` +`setup` same as running `idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build` +`flash` idf.py flash +`monitor` idf.py monitor +`erase-flash` idf.py erase-flash +`save-defconfig` idf.py save-defconfig +`step-flash-monitor` attempt clean, build, flash, then monitor, dying on error + +## Usage +``` +Modes: + default: + reinstalls non-interactively with no delays, logouts, or reboots + bash cron-reinstall-esp-idf.sh + + test: + tests the script. very fast. minimal actions taken. no reinstall is done + bash cron-reinstall-esp-idf.sh test + + retool: + reinstalls bins and export.sh, nothing else + bash cron-reinstall-esp-idf.sh retool + + cron: + runs noninteractively with forced user logout and automatic reboot, plus delays + bash cron-reinstall-esp-idf.sh cron + + interactive: + interactively installs/reinstalls esp-idf + bash cron-reinstall-esp-idf.sh interactive + + help: + display this help text + bash cron-reinstall-esp-idf.sh help + +``` + +## Helpful stuff +``` +cron: + reinstall from master everyday at 8pm, logging out users with warn delays and rebooting after + crontab -e + 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh cron + +manually wipe logs: + rm $ESPIDF_INSTALLDIR/install.log; rm $ESPIDF_INSTALLDIR/version-data.txt; touch $ESPIDF_INSTALLDIR/install.log; touch $ESPIDF_INSTALLDIR/version-data.txt; + +monitor log file during install: + tail -n 75 $ESPIDF_INSTALLDIR/install.log; +``` \ No newline at end of file diff --git a/cron-reinstall-esp-idf.sh b/cron-reinstall-esp-idf.sh index cda9489..155125a 100644 --- a/cron-reinstall-esp-idf.sh +++ b/cron-reinstall-esp-idf.sh @@ -1,42 +1,13 @@ #!/bin/bash -# set -e # for testan, die on error -startTime=$(date '+%s') - -# modes: -# default: -# reinstalls non-interactively with no delays, logouts, or reboots -# bash cron-reinstall-esp-idf.sh -# -# test: -# tests the script. very fast. minimal actions taken. no reinstall is done -# bash cron-reinstall-esp-idf.sh test -# -# retool: -# reinstalls bins and export.sh, nothing else -# bash cron-reinstall-esp-idf.sh retool -# -# cron: -# runs noninteractively with forced user logout and automatic reboot, plus delays -# bash cron-reinstall-esp-idf.sh cron -# -# interactive: -# interactively installs/reinstalls esp-idf -# bash cron-reinstall-esp-idf.sh interactive -# cron: -# crontab -e -# 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh cron -# manually wipe logs: -# rm $ESPIDF_INSTALLDIR/install.log; rm $ESPIDF_INSTALLDIR/version-data.txt; touch $ESPIDF_INSTALLDIR/install.log; touch $ESPIDF_INSTALLDIR/version-data.txt; -# -# monitor log file during install -# tail -n 75 $ESPIDF_INSTALLDIR/install.log; +# set -e # for testan, die on eelrror +startTime=$(date '+%s') # to time the (re)install time for the logs myUser=princesspi # user installing esp-ids gitJobs=5 # number of jobs to download from github with gitBranch=master # branch from github rcFile=$HOME/.zshrc # shell rc file -if [ -z ESPIDF_INSTALLDIR ]; then +if [ -z $ESPIDF_INSTALLDIR ]; then installDir=$HOME/esp else installDir=$ESPIDF_INSTALLDIR @@ -48,6 +19,7 @@ versionData=$installDir/version-data.txt # version data log file idfDir=$installDir/esp-idf # esp-idf path espressifLocation=$HOME/.espressif # espressif tools install location customBinLocation=$installDir/.custom_bin # where custom bin scripts are placed +helpText=$runningDir/help.txt runningDir="$( cd "$( dirname "$0" )" && pwd )" customBinFrom=$runningDir/custom_bin # dir where custom scripts are coming FROM scriptVers=$(cat $runningDir/version.txt) # make sure version.txt does NOT have newline @@ -236,10 +208,9 @@ function handleStart() { fi writeToLog "\n === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new ${action} ===" - writeToLog "Version: ${scriptVers}" + writeToLog "\tVersion: ${scriptVers}\n" - returnStatus - writeToLog "\n$(date '+%d/%m/%Y %H:%M:%S %Z (%s)')\nvars:\n\tmyUser: $myUser\n\tscriptVers: $scriptVers\n\tversionData: $versionData\n\tlog: $log\n\tsleepMins: $sleepMins\n\tinstallDir: $installDir\n\tgitJobs: $gitJobs\n\tgitBranch: $gitBranch\n\tgitCmd: $gitCmd\n\trunningDir: $runningDir\n\tidfDir: $idfDir\n\tespressifLocation: $espressifLocation\n\tcustomBinLocation: $customBinLocation\n\tcustomBinFrom: $customBinFrom\n\tinstallCmd: $installCmd\n\ttoolsInstallCmd: $toolsInstallCmd\n\trcFile: $rcFile\n\t(envvar) ESPIDF_INSTALLDIR: $installdirEnvvar" + writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)')\nvars:\n\tmyUser: $myUser\n\tscriptVers: $scriptVers\n\tversionData: $versionData\n\tlog: $log\n\tsleepMins: $sleepMins\n\tinstallDir: $installDir\n\tgitJobs: $gitJobs\n\tgitBranch: $gitBranch\n\tgitCmd: $gitCmd\n\trunningDir: $runningDir\n\tidfDir: $idfDir\n\tespressifLocation: $espressifLocation\n\tcustomBinLocation: $customBinLocation\n\tcustomBinFrom: $customBinFrom\n\tinstallCmd: $installCmd\n\ttoolsInstallCmd: $toolsInstallCmd\n\trcFile: $rcFile\n\t(envvar) ESPIDF_INSTALLDIR: $installdirEnvvar" } @@ -263,7 +234,12 @@ function handleEnd() { writeToLog " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): finished ===\n\n" } -if [ "$arg" == "test" ]; then # minimal actions taken, echo the given commands and such +if [ "$arg" == "--help" || "$arg" == "help" || "$arg" == "-h" || "$arg" == "h" ]; then + cat $helpText; + + exit + +elif [ "$arg" == "test" ]; then # minimal actions taken, echo the given commands and such action="TEST" gitCmd="echo git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" diff --git a/help.txt b/help.txt new file mode 100644 index 0000000..04da5bb --- /dev/null +++ b/help.txt @@ -0,0 +1,37 @@ +Modes: + default: + reinstalls non-interactively with no delays, logouts, or reboots + bash cron-reinstall-esp-idf.sh + + test: + tests the script. very fast. minimal actions taken. no reinstall is done + bash cron-reinstall-esp-idf.sh test + + retool: + reinstalls bins and export.sh, nothing else + bash cron-reinstall-esp-idf.sh retool + + cron: + runs noninteractively with forced user logout and automatic reboot, plus delays + bash cron-reinstall-esp-idf.sh cron + + interactive: + interactively installs/reinstalls esp-idf + bash cron-reinstall-esp-idf.sh interactive + + help: + display this help text + bash cron-reinstall-esp-idf.sh help + + +Helpful Stuff: +cron: + reinstall from master everyday at 8pm, logging out users with warn delays and rebooting after + crontab -e + 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh cron + +manually wipe logs: + rm $ESPIDF_INSTALLDIR/install.log; rm $ESPIDF_INSTALLDIR/version-data.txt; touch $ESPIDF_INSTALLDIR/install.log; touch $ESPIDF_INSTALLDIR/version-data.txt; + +monitor log file during install: + tail -n 75 $ESPIDF_INSTALLDIR/install.log; \ No newline at end of file diff --git a/version.txt b/version.txt index e882286..ee8a89c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -60-dev.12 \ No newline at end of file +60-beta.0 \ No newline at end of file