From a91c6a556e380f9534d100357bb7a4321d517e9a Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 21:08:20 -0700 Subject: [PATCH] refactor config file list to all be in one place --- bin/kaleidoscope-builder | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 7973d2a4..2323de5b 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -32,14 +32,11 @@ build_version () { } build_paths() { - - # We need that echo because we\re piping to cksum # shellcheck disable=SC2005 SKETCH_IDENTIFIER="$(echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-${SKETCH_FILE_NAME}" KALEIDOSCOPE_TEMP_PATH="${KALEIDOSCOPE_TEMP_PATH:-${TMPDIR:-/tmp}/kaleidoscope-${USER}}" - KALEIDOSCOPE_BUILD_PATH="${KALEIDOSCOPE_BUILD_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" KALEIDOSCOPE_OUTPUT_PATH="${KALEIDOSCOPE_OUTPUT_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" @@ -665,23 +662,20 @@ KALEIDOSCOPE_BIN_DIR="${KALEIDOSCOPE_DIR}/bin/" # shellcheck disable=SC2155 export SOURCEDIR="$(pwd)" -if [ -e "${HOME}/.kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${HOME}/.kaleidoscope-builder.conf" -fi -if [ -e "${SOURCEDIR}/.kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${SOURCEDIR}/.kaleidoscope-builder.conf" -fi +for conf_file in \ + "${HOME}/.kaleidoscope-builder.conf" \ + "${SOURCEDIR}/.kaleidoscope-builder.conf" \ + "${SOURCEDIR}/kaleidoscope-builder.conf" \ + "${KALEIDOSCOPE_DIR}/etc/kaleidoscope-builder.conf"; do + if [ -e "${conf_file}" ]; then + # shellcheck disable=SC1090 + . "${conf_file}" + fi -if [ -e "${SOURCEDIR}/kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${SOURCEDIR}/kaleidoscope-builder.conf" -fi +done # shellcheck disable=SC1090 -. "${KALEIDOSCOPE_DIR}/etc/kaleidoscope-builder.conf" if [ -n "${VERBOSE}" ] && [[ "${VERBOSE}" -gt 0 ]]; then ARDUINO_VERBOSE="-verbose"