This commit is contained in:
2024-11-09 08:00:22 -07:00
parent fd3e094361
commit 3a7aa522c2
+24 -23
View File
@@ -1,18 +1,31 @@
#!/bin/bash #!/bin/bash
startTime=$(date '+%s')
# testing: # testing:
# bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh test # bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh test
# tail -f -n 50 $HOME/esp/install.log # tail -f -n 50 $HOME/esp/install.log
# ls $HOME/esp # ls $HOME/esp; echo "install.log"; cat $HOME/esp/install.log; echo "version-data.txt"; cat $HOME/esp/version-data.txt
# cat $HOME/esp/install.log
# cat $HOME/esp/version-data.txt # delete logs:
# rm -f $HOME/esp/install.log; rm -f $HOME/esp/version-data.txt
# cron: # cron:
# crontab -e # crontab -e
# 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh # 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh
startTime=$(date '+%s') cronVers=53-rc3 # version of this script
cronVers=53-rc2.2 # version of this script myUser=princesspi
log=$HOME/esp/install.log
gitJobs=5
installDir=$HOME/esp
log=$installDir/esp/install.log
versionData=$installDir/version-data.txt
gitBranch=master
runningDir="$( cd "$( dirname "$0" )" && pwd )"
idfDir=$installDir/esp-idf
espressifLocation=$HOME/.espressif
customBinLocation=$installDir/.custom_bin
customBinFrom=$runningDir/custom_bin
function return_status() { function return_status() {
strii="\treturn status: ${?}" strii="\treturn status: ${?}"
@@ -25,21 +38,13 @@ function write_to_log() {
echo -e "$1" >> $log echo -e "$1" >> $log
} }
# function warn_all_users() {
# who | sudo awk '$1 !~ /root/{ cmd="echo '$1' | /usr/bin/write " $1; system(cmd)}'
# }
write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new reinstall ===" write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new reinstall ==="
write_to_log "Cron version: ${cronVers}" write_to_log "Cron version: ${cronVers}"
myUser=$USER
gitJobs=5
installDir=$HOME/esp
gitBranch=master
runningDir="$( cd "$( dirname "$0" )" && pwd )"
idfDir=$installDir/esp-idf
espressifLocation=$HOME/.espressif
customBinLocation=$installDir/.custom_bin
customBinFrom=$runningDir/custom_bin
versionData=$installDir/version-data.txt
if [ "$1" == "test" ]; then if [ "$1" == "test" ]; then
write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): test mode" write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): test mode"
gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir"
@@ -47,9 +52,6 @@ if [ "$1" == "test" ]; then
toolsInstallCmd="echo python $idfDir/tools/idf_tools.py install all" toolsInstallCmd="echo python $idfDir/tools/idf_tools.py install all"
sleepMins=0 sleepMins=0
# ls $HOME/esp; echo "install.log"; cat $HOME/esp/install.log; echo "version-data.txt"; cat $HOME/esp/version-data.txt
# rm -f $HOME/esp/install.log; rm -f $HOME/esp/version-data.txt; ls $HOME/esp;
# bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh
ls $HOME/esp ls $HOME/esp
rm -f $HOME/esp/install.log rm -f $HOME/esp/install.log
rm -f $HOME/esp/version-data.txt rm -f $HOME/esp/version-data.txt
@@ -68,7 +70,7 @@ else
toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" toolsInstallCmd="python $idfDir/tools/idf_tools.py install all"
function logout_all_users() { function logout_all_users() {
who | sudo awk '$1 !~ /root/{ cmd="/usr/bin/loginctl terminate-user " $1; system(cmd)}' who | sudo awk "\$1 !~ /root/{ cmd'echo ${1} | /usr/bin/write ' \$1; system(cmd)}"
return $? return $?
} }
fi fi
@@ -182,4 +184,3 @@ if [ "$1" == "test" ]; then
else else
sudo reboot sudo reboot
fi fi