tools: {export,install}.sh: fix quoting issues

This commit is contained in:
Ivan Grokhotkov 2020-10-09 17:40:57 +02:00
parent 79f2e68bc0
commit a038fb24bd
2 changed files with 12 additions and 8 deletions

View File

@ -111,16 +111,19 @@ __main() {
then then
path_prefix=${PATH%%${old_path}} path_prefix=${PATH%%${old_path}}
# shellcheck disable=SC2169,SC2039 # unreachable with 'dash' # shellcheck disable=SC2169,SC2039 # unreachable with 'dash'
paths="${path_prefix//:/ }" if [ -n "${path_prefix}" ]; then
if [ -n "${paths}" ]; then
__verbose "Added the following directories to PATH:" __verbose "Added the following directories to PATH:"
else else
__verbose "All paths are already set." __verbose "All paths are already set."
fi fi
for path_entry in ${paths} old_ifs="$IFS"
IFS=":"
for path_entry in ${path_prefix}
do do
__verbose " ${path_entry}" __verbose " ${path_entry}"
done done
IFS="$old_ifs"
unset old_ifs
else else
__verbose "Updated PATH variable:" __verbose "Updated PATH variable:"
__verbose " ${PATH}" __verbose " ${PATH}"

View File

@ -3,10 +3,12 @@
set -e set -e
set -u set -u
export IDF_PATH=$(cd $(dirname $0); pwd) basedir=$(dirname "$0")
IDF_PATH=$(cd "${basedir}"; pwd)
export IDF_PATH
echo "Detecting the Python interpreter" echo "Detecting the Python interpreter"
. ${IDF_PATH}/tools/detect_python.sh . "${IDF_PATH}/tools/detect_python.sh"
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
TARGETS="all" TARGETS="all"
@ -14,12 +16,11 @@ else
TARGETS=$1 TARGETS=$1
fi fi
echo "Installing ESP-IDF tools" echo "Installing ESP-IDF tools"
${ESP_PYTHON} ${IDF_PATH}/tools/idf_tools.py install --targets=${TARGETS} "${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install --targets=${TARGETS}
echo "Installing Python environment and packages" echo "Installing Python environment and packages"
${ESP_PYTHON} ${IDF_PATH}/tools/idf_tools.py install-python-env "${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install-python-env
basedir="$(dirname $0)"
echo "All done! You can now run:" echo "All done! You can now run:"
echo "" echo ""
echo " . ${basedir}/export.sh" echo " . ${basedir}/export.sh"