mirror of https://github.com/ArduPilot/ardupilot
Tools: Checksum for gcc-arm download on arch prereqs
This will check to see if the tar.bz2 file exists and if it does it will run a checksum and skip redownloading the file if its already there. If the checksum fails or the file doesn't exist it will redownload the file. I ran into issues with the download taking so long that my sudo permissions timed out and the install failed to complete. When rerunning the script it would redownload the file even if the file was already there. This change solves this issue.
This commit is contained in:
parent
963095978b
commit
863b6222de
|
@ -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_ROOT="gcc-arm-none-eabi-10-2020-q4-major"
|
||||||
ARM_TARBALL="$ARM_ROOT-x86_64-linux.tar.bz2"
|
ARM_TARBALL="$ARM_ROOT-x86_64-linux.tar.bz2"
|
||||||
ARM_TARBALL_URL="https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL"
|
ARM_TARBALL_URL="https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL"
|
||||||
|
ARM_TARBALL_CHECKSUM="21134caa478bbf5352e239fbc6e2da3038f8d2207e089efc96c3b55f1edcd618"
|
||||||
|
|
||||||
# Ardupilot Tools
|
# Ardupilot Tools
|
||||||
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
||||||
|
@ -85,9 +86,33 @@ pip3 -q install -U $PYTHON_PKGS
|
||||||
if [ ! -d $OPT/$ARM_ROOT ]; then
|
if [ ! -d $OPT/$ARM_ROOT ]; then
|
||||||
(
|
(
|
||||||
cd $OPT;
|
cd $OPT;
|
||||||
sudo wget --progress=dot:giga $ARM_TARBALL_URL;
|
|
||||||
sudo tar xjf ${ARM_TARBALL};
|
# Check if file exists and verify checksum
|
||||||
sudo rm ${ARM_TARBALL};
|
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
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue