jesus fucvk fix4es

This commit is contained in:
2025-08-18 22:21:42 -06:00
parent 486efff326
commit c2d5ea79d0
2 changed files with 17 additions and 13 deletions
+11 -7
View File
@@ -2,7 +2,7 @@
# settings # settings
defaultInstallDir="$HOME/esp" defaultInstallDir="$HOME/esp"
echo -e "\n\nBEGINNING AUTOMATED INSTALL WITH DEFAULTS\n\n" echo "\BEGINNING AUTOMATED INSTALL WITH DEFAULTS"
# possible package manager shit for later # possible package manager shit for later
# sudo apt update # sudo apt update
@@ -10,10 +10,10 @@ echo -e "\n\nBEGINNING AUTOMATED INSTALL WITH DEFAULTS\n\n"
# get the installDir or use default # get the installDir or use default
if [ ! -z $ESPIDFTOOLS_INSTALLDIR ]; then if [ ! -z $ESPIDFTOOLS_INSTALLDIR ]; then
echo "envvar ESPIDFTOOLS_INSTALLDIR found! setting install dir to $ESPIDFTOOLS_INSTALLDIR" echo -e "\tenvvar ESPIDFTOOLS_INSTALLDIR found! setting install dir to $ESPIDFTOOLS_INSTALLDIR"
installDir="$ESPIDFTOOLS_INSTALLDIR" installDir="$ESPIDFTOOLS_INSTALLDIR"
else else
echo "envvar ESPIDFTOOLS_INSTALLDIR not found! using default install dir $defaultInstallDir" echo -e "\tenvvar ESPIDFTOOLS_INSTALLDIR not found! using default install dir $defaultInstallDir"
installDir="$defaultInstallDir" installDir="$defaultInstallDir"
fi fi
@@ -21,19 +21,20 @@ fi
# detect shell and act accordingly # detect shell and act accordingly
defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd) defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd)
if [[ "$defShell" =~ zsh$ ]]; then if [[ "$defShell" =~ zsh$ ]]; then
echo -e "\nSelected zsh shell automatically\n" echo -e "\tSelected zsh shell automatically"
rcFile="$HOME/.zshrc" rcFile="$HOME/.zshrc"
elif [[ "$defShell" =~ bash$ ]]; then elif [[ "$defShell" =~ bash$ ]]; then
echo -e "\nSelected bash shell automatically\n" echo -e "\tSelected bash shell automatically"
rcFile="$HOME/.bashrc" rcFile="$HOME/.bashrc"
elif [[ "$defShell" =~ sh$ ]]; then elif [[ "$defShell" =~ sh$ ]]; then
rcFile="" # no need for rcFile var when run as cron rcFile="" # no need for rcFile var when run as cron
else else
echo "unsupported shell $defShell" echo -e "\nFAIL: Unsupported shell $defShell\n"
exit exit 1
fi fi
# unset any esp-idf/-tools envvars # unset any esp-idf/-tools envvars
echo -e "\tUnsetting any esp-idf/-tools environment variables"
unset ESPIDFTOOLS_INSTALLDIR unset ESPIDFTOOLS_INSTALLDIR
unset IDF_PATH unset IDF_PATH
unset ESP_IDF_VERSION unset ESP_IDF_VERSION
@@ -48,13 +49,16 @@ unset ESPBAUD
unset ESPTARGET unset ESPTARGET
# make installDir or fail silently if exists # make installDir or fail silently if exists
echo -e "\tCreating $installDir if it does not exist"
mkdir -p "$installDir" mkdir -p "$installDir"
# download da tools # download da tools
echo -e "\tDownloading esp-idf-tools to $installDir/esp-idf-tools"
git clone --recursive https://github.com/PrincessPi3/esp-idf-tools.git "$installDir/esp-idf-tools" git clone --recursive https://github.com/PrincessPi3/esp-idf-tools.git "$installDir/esp-idf-tools"
# do da install # do da install
## tryan nuke mode for lulz ## tryan nuke mode for lulz
echo -e "\n\nRunning install script!\n\n"
bash -c "$installDir/esp-idf-tools/esp-idf-tools-cmd.sh nuke" bash -c "$installDir/esp-idf-tools/esp-idf-tools-cmd.sh nuke"
echo -e "\n\nINSTALL COMPLETE\n\n" echo -e "\n\nINSTALL COMPLETE\n\n"
+6 -6
View File
@@ -16,16 +16,16 @@ fi
# detect shell and act accordingly # detect shell and act accordingly
defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd) defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd)
if [[ "$defShell" =~ zsh$ ]]; then if [[ "$defShell" =~ zsh$ ]]; then
echo -e "\nSelected zsh shell automatically\n" echo -e "\tSelected zsh shell automatically"
rcFile="$HOME/.zshrc" rcFile="$HOME/.zshrc"
elif [[ "$defShell" =~ bash$ ]]; then elif [[ "$defShell" =~ bash$ ]]; then
echo -e "\nSelected bash shell automatically\n" echo -e "\tSelected bash shell automatically"
rcFile="$HOME/.bashrc" rcFile="$HOME/.bashrc"
elif [[ "$defShell" =~ sh$ ]]; then elif [[ "$defShell" =~ sh$ ]]; then
rcFile="" # no need for rcFile var when run as cron rcFile="" # no need for rcFile var when run as cron
else else
echo "unsupported shell $defShell" echo "FAIL: Unsupported shell $defShell"
exit exit 1
fi fi
# unset any esp-idf/-tools envvars # unset any esp-idf/-tools envvars
@@ -56,11 +56,11 @@ rm -f "$installDir/install.log" 2>/dev/null
rm -f "$installDir/version-data.log" 2>/dev/null rm -f "$installDir/version-data.log" 2>/dev/null
# cleanup $rcFile # cleanup $rcFile
echo -e "\tCleaning up "$rcFile" echo -e "\tCleaning up $rcFile"
sed -i.bak '/# esp-idf-tools/d' "$rcFile" # with first one, maek a backup sed -i.bak '/# esp-idf-tools/d' "$rcFile" # with first one, maek a backup
sed -i '/ESPIDFTOOLS_INSTALLDIR/d' "$rcFile" sed -i '/ESPIDFTOOLS_INSTALLDIR/d' "$rcFile"
sed -i '/get-esp-tools/d' "$rcFile" sed -i '/get-esp-tools/d' "$rcFile"
sed -i '/run-esp-cmd/d' "$rcFile sed -i '/run-esp-cmd/d' "$rcFile"
sed -i '/esp-install-monitor/d' "$rcFile" sed -i '/esp-install-monitor/d' "$rcFile"
sed -i '/esp-install-logs/d' "$rcFile" sed -i '/esp-install-logs/d' "$rcFile"
## remove leading and trailing newlines in $rcFile in place ## remove leading and trailing newlines in $rcFile in place