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

Tools: Checksum for gcc-arm download on arch prereqs #28547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
31 changes: 28 additions & 3 deletions Tools/environment_install/install-prereqs-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect argparse matplotlib pyparsin
ARM_ROOT="gcc-arm-none-eabi-10-2020-q4-major"
ARM_TARBALL="$ARM_ROOT-x86_64-linux.tar.bz2"
ARM_TARBALL_URL="https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL"
ARM_TARBALL_CHECKSUM="21134caa478bbf5352e239fbc6e2da3038f8d2207e089efc96c3b55f1edcd618"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterbarker that is totally something we will forget to update. Can't we add a checksum file on the server instead ?


# Ardupilot Tools
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
Expand Down Expand Up @@ -85,9 +86,33 @@ pip3 -q install -U $PYTHON_PKGS
if [ ! -d $OPT/$ARM_ROOT ]; then
(
cd $OPT;
sudo wget --progress=dot:giga $ARM_TARBALL_URL;
sudo tar xjf ${ARM_TARBALL};
sudo rm ${ARM_TARBALL};

# Check if file exists and verify checksum
download_required=false
if [ -e "$ARM_TARBALL" ]; then
echo "File exists. Verifying checksum..."

# Calculate the checksum of the existing file
ACTUAL_CHECKSUM=$(sha256sum "$ARM_TARBALL" | awk '{ print $1 }')

# Compare the actual checksum with the expected one
if [ "$ACTUAL_CHECKSUM" == "$ARM_TARBALL_CHECKSUM" ]; then
echo "Checksum valid. No need to redownload."
else
echo "Checksum invalid. Redownloading the file..."
download_required=true
sudo rm $ARM_TARBALL
fi
else
echo "File does not exist. Downloading..."
download_required=true
fi

if $download_required; then
sudo wget -O "$ARM_TARBALL" --progress=dot:giga $ARM_TARBALL_URL
fi

sudo tar xjf ${ARM_TARBALL}
)
fi

Expand Down