diff --git a/install.sh b/install.sh index a060734..188e2ad 100644 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # settings 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 # sudo apt update @@ -10,10 +10,10 @@ echo -e "\n\nBEGINNING AUTOMATED INSTALL WITH DEFAULTS\n\n" # get the installDir or use default 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" 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" fi @@ -21,19 +21,20 @@ fi # detect shell and act accordingly defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd) if [[ "$defShell" =~ zsh$ ]]; then - echo -e "\nSelected zsh shell automatically\n" + echo -e "\tSelected zsh shell automatically" rcFile="$HOME/.zshrc" elif [[ "$defShell" =~ bash$ ]]; then - echo -e "\nSelected bash shell automatically\n" + echo -e "\tSelected bash shell automatically" rcFile="$HOME/.bashrc" elif [[ "$defShell" =~ sh$ ]]; then rcFile="" # no need for rcFile var when run as cron else - echo "unsupported shell $defShell" - exit + echo -e "\nFAIL: Unsupported shell $defShell\n" + exit 1 fi # unset any esp-idf/-tools envvars +echo -e "\tUnsetting any esp-idf/-tools environment variables" unset ESPIDFTOOLS_INSTALLDIR unset IDF_PATH unset ESP_IDF_VERSION @@ -48,13 +49,16 @@ unset ESPBAUD unset ESPTARGET # make installDir or fail silently if exists +echo -e "\tCreating $installDir if it does not exist" mkdir -p "$installDir" # 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" # do da install ## 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" echo -e "\n\nINSTALL COMPLETE\n\n" \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh index 31355c2..705d277 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -16,16 +16,16 @@ fi # detect shell and act accordingly defShell=$(awk -F: -v user="$(whoami)" '$1 == user {print $NF}' /etc/passwd) if [[ "$defShell" =~ zsh$ ]]; then - echo -e "\nSelected zsh shell automatically\n" + echo -e "\tSelected zsh shell automatically" rcFile="$HOME/.zshrc" elif [[ "$defShell" =~ bash$ ]]; then - echo -e "\nSelected bash shell automatically\n" + echo -e "\tSelected bash shell automatically" rcFile="$HOME/.bashrc" elif [[ "$defShell" =~ sh$ ]]; then rcFile="" # no need for rcFile var when run as cron else - echo "unsupported shell $defShell" - exit + echo "FAIL: Unsupported shell $defShell" + exit 1 fi # 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 # 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 '/ESPIDFTOOLS_INSTALLDIR/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-logs/d' "$rcFile" ## remove leading and trailing newlines in $rcFile in place