Skip to content

Commit e5f2aab

Browse files
committed
fix: add resume capability and retry logic to wget downloads
Replace -nc flag with -c to enable resuming partial downloads. Add -t 10 (retries) and -T 30 (timeout) for better stability. Prevents broken partial downloads from blocking subsequent attempts.
1 parent 91a3dbf commit e5f2aab

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

bootstrap-atfe21.1.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ ARCH_SUFFIX="Linux-x86_64"
1212
function downloadAndExtract {
1313
FILE_TO_DOWNLOAD=$1
1414
BASE_URL="https://github.com/arm/arm-toolchain/releases/download/release-${ATFE_VERSION}-ATfE/"
15-
WGET_FLAGS="-q --show-progress"
15+
WGET_FLAGS="-q --show-progress -c -t 10 -T 30"
1616
if [ "$ALLOW_INSECURE_DOWNLOAD" == "true" ]; then
1717
WGET_FLAGS="$WGET_FLAGS --no-check-certificate"
1818
fi
1919

2020
mkdir -p $DOWNLOAD_DIR
2121
echo "Downloading $FILE_TO_DOWNLOAD..."
22-
wget -nc "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
22+
wget "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
2323

2424
if [ $? -ne 0 ]; then
2525
echo "Failed to download $FILE_TO_DOWNLOAD" >&2
@@ -29,7 +29,7 @@ function downloadAndExtract {
2929
# Also download the SHA256 checksum file
3030
SHA256_FILE="${FILE_TO_DOWNLOAD}.sha256"
3131
echo "Downloading checksum file..."
32-
wget -nc "$BASE_URL$SHA256_FILE" -O "$DOWNLOAD_DIR/$SHA256_FILE" $WGET_FLAGS
32+
wget "$BASE_URL$SHA256_FILE" -O "$DOWNLOAD_DIR/$SHA256_FILE" $WGET_FLAGS
3333

3434
if [ $? -ne 0 ]; then
3535
echo "Failed to download $SHA256_FILE" >&2
@@ -58,14 +58,14 @@ function downloadAndExtract {
5858
function downloadAndExtractOverlay {
5959
FILE_TO_DOWNLOAD=$1
6060
BASE_URL="https://github.com/arm/arm-toolchain/releases/download/release-${ATFE_VERSION}-ATfE/"
61-
WGET_FLAGS="-q --show-progress"
61+
WGET_FLAGS="-q --show-progress -c -t 10 -T 30"
6262
if [ "$ALLOW_INSECURE_DOWNLOAD" == "true" ]; then
6363
WGET_FLAGS="$WGET_FLAGS --no-check-certificate"
6464
fi
6565

6666
mkdir -p $DOWNLOAD_DIR
6767
echo "Downloading overlay $FILE_TO_DOWNLOAD..."
68-
wget -nc "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
68+
wget "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
6969

7070
if [ $? -ne 0 ]; then
7171
echo "Failed to download overlay $FILE_TO_DOWNLOAD" >&2
@@ -75,7 +75,7 @@ function downloadAndExtractOverlay {
7575
# Download overlay checksum
7676
SHA256_FILE="${FILE_TO_DOWNLOAD}.sha256"
7777
echo "Downloading overlay checksum file..."
78-
wget -nc "$BASE_URL$SHA256_FILE" -O "$DOWNLOAD_DIR/$SHA256_FILE" $WGET_FLAGS
78+
wget "$BASE_URL$SHA256_FILE" -O "$DOWNLOAD_DIR/$SHA256_FILE" $WGET_FLAGS
7979

8080
if [ $? -ne 0 ]; then
8181
echo "Failed to download overlay $SHA256_FILE" >&2

bootstrap-gnuarm14.3.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ ARCH_SUFFIX="x86_64"
1212
function downloadAndExtract {
1313
FILE_TO_DOWNLOAD=$1
1414
BASE_URL="https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GCC_VERSION}/binrel/"
15-
WGET_FLAGS="-q --show-progress"
15+
WGET_FLAGS="-q --show-progress -c -t 10 -T 30"
1616
if [ "$ALLOW_INSECURE_DOWNLOAD" == "true" ]; then
1717
WGET_FLAGS="$WGET_FLAGS --no-check-certificate"
1818
fi
1919

2020
mkdir -p $DOWNLOAD_DIR
2121
echo "Downloading $FILE_TO_DOWNLOAD..."
22-
wget -nc "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
22+
wget "$BASE_URL$FILE_TO_DOWNLOAD" -O "$DOWNLOAD_DIR/$FILE_TO_DOWNLOAD" $WGET_FLAGS
2323

2424
if [ $? -ne 0 ]; then
2525
echo "Failed to download $FILE_TO_DOWNLOAD" >&2

stm32-tools.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ install_gnu_arm() {
6666
cd "$TEMP_DIR"
6767

6868
print_info "Downloading GNU Arm Toolchain 14.3 (~500MB)..."
69-
wget https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz
70-
wget https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz.sha256asc
69+
wget -c -t 10 -T 30 https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz
70+
wget -c -t 10 -T 30 https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz.sha256asc
7171

7272
print_info "Verifying download..."
7373
sha256sum -c arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz.sha256asc
@@ -99,8 +99,8 @@ install_arm_atfe() {
9999
cd "$TEMP_DIR"
100100

101101
print_info "Downloading ATFE 21.1 (~3GB)..."
102-
wget https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-21.1.1-Linux-x86_64.tar.xz
103-
wget https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-21.1.1-Linux-x86_64.tar.xz.sha256
102+
wget -c -t 10 -T 30 https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-21.1.1-Linux-x86_64.tar.xz
103+
wget -c -t 10 -T 30 https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-21.1.1-Linux-x86_64.tar.xz.sha256
104104

105105
print_info "Verifying download..."
106106
sha256sum -c ATfE-21.1.1-Linux-x86_64.tar.xz.sha256
@@ -109,8 +109,8 @@ install_arm_atfe() {
109109
tar -xf ATfE-21.1.1-Linux-x86_64.tar.xz -C "$TOOLCHAIN_DIR"
110110

111111
print_info "Downloading ATFE newlib overlay..."
112-
wget https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-newlib-overlay-21.1.1.tar.xz
113-
wget https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-newlib-overlay-21.1.1.tar.xz.sha256
112+
wget -c -t 10 -T 30 https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-newlib-overlay-21.1.1.tar.xz
113+
wget -c -t 10 -T 30 https://github.com/arm/arm-toolchain/releases/download/release-21.1.1-ATfE/ATfE-newlib-overlay-21.1.1.tar.xz.sha256
114114

115115
print_info "Verifying overlay..."
116116
sha256sum -c ATfE-newlib-overlay-21.1.1.tar.xz.sha256

0 commit comments

Comments
 (0)