File tree Expand file tree Collapse file tree 1 file changed +32
-8
lines changed Expand file tree Collapse file tree 1 file changed +32
-8
lines changed Original file line number Diff line number Diff line change 22
33set -e
44
5- VERSION=${VERSION:- 5.3}
6- TARGETS=${TARGETS:- all}
7- ESP_DIR=" /opt/esp"
8- IDF_PATH=" ${ESP_DIR} /esp-idf"
5+ VERSION=" 5.3"
6+ IDF_DIR=" /embedded/esp"
7+ IDF_PY=" ${IDF_DIR} /tools/idf.py"
98
10- echo " 📥 Installing ESP-IDF v${VERSION} for targets: ${TARGETS} "
9+ echo " 📥 Installing ESP-IDF v${VERSION} for all targets"
10+
11+ # Check if already installed and version matches
12+ if [ -x " $IDF_PY " ]; then
13+ INSTALLED_VERSION=$( " $IDF_PY " --version 2> /dev/null || echo " " )
14+ if [[ " $INSTALLED_VERSION " == * " v$VERSION " * ]]; then
15+ echo " ✔ ESP-IDF v${VERSION} already installed!"
16+ exit 0
17+ else
18+ echo " ❗️ ESP IDF version doesn't match: ${INSTALLED_VERSION} "
19+ exho " 🚀 Let's install v${VERSION} "
20+ fi
21+ fi
1122
1223# Install dependencies
13- apt-get update
14- apt-get install -y \
24+ apt-get update && apt-get install -y \
1525 git wget flex bison gperf python3 python3-pip cmake ninja-build ccache \
1626 libffi-dev libssl-dev dfu-util libusb-1.0-0
1727
18- echo " ✅ ESP-IDF v${VERSION} installed!"
28+ # Clean esp directory
29+ rm -rf " ${IDF_DIR:? } /" * " ${IDF_DIR:? } " /.[! .]* 2> /dev/null || true
30+
31+ # Clone ESP-IDF
32+ git clone -b " release/${VERSION} " --recursive https://github.com/espressif/esp-idf.git " $IDF_DIR "
33+
34+ # Install the tools for all targets
35+ " $IDF_DIR /install.sh" all
36+
37+ # Configure login shell environment
38+ echo " export IDF_PATH=${IDF_DIR} " >> /etc/profile.d/esp-idf.sh
39+ echo " source ${IDF_DIR} /export.sh" >> /etc/profile.d/esp-idf.sh
40+ chmod +x /etc/profile.d/esp-idf.sh
41+
42+ echo " ✅ ESP-IDF v${VERSION} installed!"
You can’t perform that action at this time.
0 commit comments