Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/fetch-{libc++,newlib}: exit on error #477

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/fetch-libc++.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

# Exit on error:
set -e

GCC_VERSION=$1

if [ $GCC_VERSION = "14.1.0" ]; then
Expand Down Expand Up @@ -27,7 +30,7 @@ else
CHECK_SHA_CMD="sha256sum -c"
fi

let FOUND=0
FOUND=0

# Try from each mirror until we successfully download a .zip file.
for MIRROR in ${MIRRORS[@]}; do
Expand All @@ -39,14 +42,15 @@ for MIRROR in ${MIRRORS[@]}; do
if [ $? -ne 0 ]; then
echo " WARNING: Fetching libc++ from mirror $MIRROR failed!" >&2
else
let FOUND=1
FOUND=1
break
fi
done

if [[ $FOUND -ne 0 ]]; then
echo "Unpacking $ZIP_FILE..."
unzip -q $ZIP_FILE
# -n: never overwrite existing files, -q: quiet mode
unzip -n -q $ZIP_FILE
echo "Done upacking $ZIP_FILE..."
else
echo "ERROR: Unable to find tock-libc++"
Expand Down
10 changes: 7 additions & 3 deletions lib/fetch-newlib.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

# Exit on error:
set -e

NEWLIB_VERSION=$1

if [ $NEWLIB_VERSION = "4.4.0.20231231" ]; then
Expand All @@ -25,7 +28,7 @@ else
CHECK_SHA_CMD="sha256sum -c"
fi

let FOUND=0
FOUND=0

# Try from each mirror until we successfully download a .zip file.
for MIRROR in ${MIRRORS[@]}; do
Expand All @@ -37,14 +40,15 @@ for MIRROR in ${MIRRORS[@]}; do
if [ $? -ne 0 ]; then
echo " WARNING: Fetching newlib from mirror $MIRROR failed!" >&2
else
let FOUND=1
FOUND=1
break
fi
done

if [[ $FOUND -ne 0 ]]; then
echo "Unpacking $ZIP_FILE..."
unzip -q $ZIP_FILE
# -n: never overwrite existing files, -q: quiet mode
unzip -n -q $ZIP_FILE
echo "Done upacking $ZIP_FILE..."
else
echo "ERROR: Unable to find tock-newlib"
Expand Down
Loading