[bootstrap] pipe wget into tar instead of using temporary files (#12833)

Using `/tmp` to store large download files will fail when the system
is under memory pressure. `/tmp` is backed by `tmpfs` in many Linux
distributions.
This commit is contained in:
Maciej Grela
2026-07-06 10:45:25 -07:00
committed by GitHub
parent 8ad056634c
commit 815264e849
2 changed files with 11 additions and 24 deletions
+3 -5
View File
@@ -74,11 +74,9 @@ install_packages_apt()
sudo apt-get --no-install-recommends install -y binutils-arm-none-eabi gcc-arm-none-eabi gdb-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
elif [ "$PLATFORM" = "Ubuntu" ]; then
sudo apt-get --no-install-recommends install -y bzip2 ca-certificates wget
(cd /tmp \
&& wget --tries 4 --no-check-certificate --quiet -c https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-"$ARCH"-linux.tar.bz2 \
&& sudo tar xjf gcc-arm-none-eabi-9-2020-q2-update-"$ARCH"-linux.tar.bz2 -C /opt \
&& rm gcc-arm-none-eabi-9-2020-q2-update-"$ARCH"-linux.tar.bz2 \
&& sudo ln -s -f /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/* /usr/local/bin/.)
(wget --tries 4 --no-check-certificate -O - --quiet https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-"$ARCH"-linux.tar.bz2 \
| sudo tar xj -C /opt) \
&& sudo ln -s -f /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/* /usr/local/bin/.
fi
if [ "$PLATFORM" != "Raspbian" ] && [ "${INSTALL_FORMAT_TOOLS}" = "1" ]; then
+8 -19
View File
@@ -28,7 +28,7 @@
#
# This script downloads and installs a specific version of clang-format and clang-tidy.
set -e
set -e -o pipefail
LLVM_VERSION="19.1.7"
ARCH=$(uname -m)
@@ -42,26 +42,15 @@ fi
LLVM_PACKAGE="LLVM-${LLVM_VERSION}-Linux-X64"
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVM_PACKAGE}.tar.xz"
INSTALL_DIR="/opt/llvm-${LLVM_VERSION}"
TEMP_DIR=$(mktemp -d)
INSTALL_DIR_tmp="$INSTALL_DIR.tmp"
cleanup()
{
rm -rf "${TEMP_DIR}"
}
sudo mkdir -p "${INSTALL_DIR_tmp}"
trap 'sudo rm -rf "${INSTALL_DIR_tmp}"' EXIT
trap cleanup EXIT
cd "${TEMP_DIR}"
echo "Downloading LLVM from ${LLVM_URL}..."
wget -O llvm.tar.xz "${LLVM_URL}"
echo "Uncompressing to ${TEMP_DIR}..."
tar xf llvm.tar.xz
echo "Installing to ${INSTALL_DIR}..."
sudo mkdir -p /opt
sudo mv "${LLVM_PACKAGE}" "${INSTALL_DIR}"
echo "Downloading LLVM from '${LLVM_URL}' into '${INSTALL_DIR}' ..."
wget -O - "${LLVM_URL}" | sudo tar -f - -C "${INSTALL_DIR_tmp}" --strip-components=1 -xJ
sudo rm -rf "${INSTALL_DIR}"
sudo mv "${INSTALL_DIR_tmp}" "${INSTALL_DIR}"
echo "Creating symlinks in /usr/local/bin..."
sudo ln -sf "${INSTALL_DIR}/bin/clang-format" "/usr/local/bin/clang-format-19"