Skip to content

Instantly share code, notes, and snippets.

@themactep
Created December 26, 2023 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themactep/b84d85468f9c53e91eff45dac71ed78e to your computer and use it in GitHub Desktop.
Save themactep/b84d85468f9c53e91eff45dac71ed78e to your computer and use it in GitHub Desktop.
Script to retrieve the latest toolchains for building OpenIPC firmware.
#!/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 <paul@themactep.com>
#
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