2023-12-04 05:55:08 -04:00
|
|
|
#!/usr/bin/env bash
|
2021-11-01 23:07:10 -03:00
|
|
|
# if you have modules/esp_idf setup as a submodule, then leave it as a submodule and switch branches
|
2024-09-25 07:10:08 -03:00
|
|
|
|
|
|
|
COMMIT="cc3203dc4f087ab41b434afff1ed7520c6d90993"
|
|
|
|
|
2021-11-01 23:07:10 -03:00
|
|
|
if [ ! -d modules ]; then
|
|
|
|
echo "this script needs to be run from the root of your repo, sorry, giving up."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo `ls modules`
|
|
|
|
cd modules
|
|
|
|
|
|
|
|
if [ ! -d esp_idf ]; then
|
|
|
|
echo 'did not find modules/esp_idf folder, making it.' ;
|
|
|
|
mkdir -p -v esp_idf
|
|
|
|
else
|
|
|
|
echo 'found modules/esp_idf folder' ;
|
|
|
|
fi
|
2024-09-25 07:10:08 -03:00
|
|
|
|
2021-11-01 23:07:10 -03:00
|
|
|
echo "looking for submodule or repo..."
|
|
|
|
if [ `git submodule | grep esp_idf | wc | cut -c1-7` == '1' ]; then
|
|
|
|
echo "found real submodule, syncing"
|
|
|
|
../Tools/gittools/submodule-sync.sh >/dev/null
|
|
|
|
else
|
|
|
|
echo "esp_idf is NOT a submodule"
|
|
|
|
|
|
|
|
if [ ! `ls esp_idf/install.sh 2>/dev/null` ]; then
|
|
|
|
echo "found empty IDF, cloning"
|
|
|
|
# add esp_idf as almost submodule, depths uses less space
|
2024-09-25 07:10:08 -03:00
|
|
|
git clone -b 'release/v5.3' https://github.com/espressif/esp-idf.git esp_idf
|
|
|
|
git checkout $COMMIT
|
2021-11-01 23:07:10 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "inspecting possible IDF... "
|
|
|
|
cd esp_idf
|
|
|
|
echo `git rev-parse HEAD`
|
2024-09-25 07:10:08 -03:00
|
|
|
# these are a selection of possible specific commit/s that represent v5.3 branch of the esp_idf
|
|
|
|
if [ `git rev-parse HEAD` == '$COMMIT' ]; then
|
|
|
|
echo "IDF version 'release/5.3' found OK, great.";
|
2021-11-01 23:07:10 -03:00
|
|
|
else
|
2024-09-25 07:10:08 -03:00
|
|
|
echo "looks like an idf, but not v5.3 branch, or wrong commit , trying to switch branch and reflect upstream";
|
2021-11-01 23:07:10 -03:00
|
|
|
../../Tools/gittools/submodule-sync.sh >/dev/null
|
2024-09-25 07:10:08 -03:00
|
|
|
git fetch ; git checkout -f release/v5.3
|
|
|
|
git checkout $COMMIT
|
2021-11-01 23:07:10 -03:00
|
|
|
|
|
|
|
# retry same as above
|
|
|
|
echo `git rev-parse HEAD`
|
2024-09-25 07:10:08 -03:00
|
|
|
if [ `git rev-parse HEAD` == '$COMMIT' ]; then
|
|
|
|
echo "IDF version 'release/5.3' found OK, great.";
|
|
|
|
git checkout $COMMIT
|
2021-11-01 23:07:10 -03:00
|
|
|
fi
|
|
|
|
fi
|
2023-05-01 21:11:49 -03:00
|
|
|
cd ../..
|
2021-11-01 23:07:10 -03:00
|
|
|
|
2024-09-25 07:10:08 -03:00
|
|
|
cd modules/esp_idf
|
2023-05-01 21:11:49 -03:00
|
|
|
git submodule update --init --recursive
|
2024-09-25 07:10:08 -03:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "installing missing python modules"
|
|
|
|
python -m pip install empy==3.3.4
|
|
|
|
python -m pip install pexpect
|
|
|
|
python -m pip install future
|
|
|
|
|
2023-05-01 21:11:49 -03:00
|
|
|
cd ../..
|
2024-09-25 07:10:08 -03:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "after changing IDF versions [ such as between 4.4 and 5.3 ] you should re-run these in your console:"
|
2023-05-01 21:11:49 -03:00
|
|
|
echo "./modules/esp_idf/install.sh"
|
2023-12-04 05:55:08 -04:00
|
|
|
echo "source ./modules/esp_idf/export.sh"
|