Created
December 26, 2023 05:45
-
-
Save themactep/b84d85468f9c53e91eff45dac71ed78e to your computer and use it in GitHub Desktop.
Script to retrieve the latest toolchains for building OpenIPC firmware.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# OpenIPC Toolchains Updater | |
# | |
# This script retrieves the latest toolchains for building OpenIPC firmware. | |
# Execute the script in the directory where you want to store the toolchains | |
# locally, for example, /opt/toolchains/openipc/. You can re-run the script | |
# to update the toolchains. | |
# | |
# 2021, Paul Philippov <[email protected]> | |
# | |
repo=openipc/firmware | |
all_toolchains=$(curl --header "X-GitHub-Api-Version: 2022-11-28" \ | |
--header "Accept: application/vnd.github+json" \ | |
--url https://api.github.com/repos/${repo}/releases | \ | |
jq '.[].assets[].name' | grep -vE '^"(openipc|u-boot)' | \ | |
sed "s/\.tgz\b//" | sed 's/"//g') | |
for tc in $all_toolchains; do | |
if [ -d "./${tc}" ]; then | |
echo "${tc} already exists. Skip." | |
else | |
echo "Retrieving ${tc}" | |
mkdir -p "/tmp/${tc}" | |
curl --location https://github.com/${repo}/releases/download/latest/${tc}.tgz | \ | |
tar xfz - -C "/tmp/${tc}/" | |
mv "/tmp/${tc}/*" "./${tc}" | |
rm -r "/tmp/${tc}" | |
ln -sf "$tc" "${tc%-*}" | |
fi | |
done | |
echo "Done" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment