build: switch_to.sh: enable idf automatically if installed
What changed, and why it matters
This commit changes a build helper script so that, if the ESP-IDF development tools are not already active, it automatically loads them from a standard install location (/opt/esp/idf) instead of immediately failing with an error. It is a developer convenience improvement with no apparent security relevance.
No security action needed; treat as routine build tooling improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
tools/switch_to.sh previously exited with an error when idf.py was not in PATH. The patch checks for /opt/esp/idf and sources its export.sh to activate the toolchain before continuing. This is purely a build-environment setup change.
Changed components
tools/switch_to.shInspect captured patch +7 / −3
diff --git a/tools/switch_to.sh b/tools/switch_to.sh
index 9774cad..1907b5e 100755
--- a/tools/switch_to.sh
+++ b/tools/switch_to.sh
@@ -132,9 +132,13 @@ if [ ! -f "$CONFIG_FILE" ]; then
fi
if ! have_cmd idf.py; then
- echo "error: idf.py not found. Please install idf" >&2
- echo "\(or run export.sh from the idf install\) and try again" >&2
- exit 1
+ if [ -d /opt/esp/idf ]; then
+ pushd /opt/esp/idf && . ./export.sh && popd
+ else
+ echo "error: idf.py not found. Please install idf" >&2
+ echo "\(or run export.sh from the idf install\) and try again" >&2
+ exit 1
+ fi
fi
idf.py clean && \
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.