66 lines
2.1 KiB
Bash
66 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Change the version numbers in the toolvers file and then run this
|
|
# script to update the hashes
|
|
|
|
ARCHIVES=archives
|
|
GNU_MIRROR=https://mirrors.kernel.org/gnu
|
|
TOOLVERS_FILE="toolvers"
|
|
. "$TOOLVERS_FILE"
|
|
|
|
function verify_sig() {
|
|
SIGFILE="$1"
|
|
ARCHIVE="$2"
|
|
|
|
if ! gpg -q --verify "$SIGFILE" "$ARCHIVE"; then
|
|
echo "Failed to verify $ARCHIVE, aborting"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
function fetch_and_verify() {
|
|
PKG_URI_DIR="$1"
|
|
FILENAME="$2"
|
|
|
|
if [ ! -f "$ARCHIVES/$FILENAME" ]; then
|
|
wget -P "$ARCHIVES" -N "$PKG_URI_DIR/$FILENAME"
|
|
fi
|
|
if [ ! -f "$ARCHIVES/$FILENAME.sig" ]; then
|
|
wget -P "$ARCHIVES" -N "$PKG_URI_DIR/$FILENAME.sig"
|
|
fi
|
|
|
|
verify_sig "$ARCHIVES/$FILENAME.sig" "$ARCHIVES/$FILENAME"
|
|
}
|
|
|
|
|
|
fetch_and_verify "$GNU_MIRROR/binutils/" "binutils-$BINVER.tar.bz2"
|
|
fetch_and_verify "$GNU_MIRROR/gcc/gcc-$GCCVER/" "gcc-$GCCVER.tar.bz2"
|
|
fetch_and_verify "$GNU_MIRROR/gdb/" "gdb-$GDBVER.tar.xz"
|
|
fetch_and_verify "$GNU_MIRROR/mpfr/" "mpfr-$MPFRVER.tar.bz2"
|
|
fetch_and_verify "$GNU_MIRROR/mpc/" "mpc-$MPCVER.tar.gz"
|
|
fetch_and_verify "$GNU_MIRROR/gmp/" "gmp-$GMPVER.tar.bz2"
|
|
|
|
BINHASH=$(shasum -a 256 -b "$ARCHIVES/binutils-$BINVER.tar.bz2" | cut -f1 -d' ')
|
|
GCCHASH=$(shasum -a 256 -b "$ARCHIVES/gcc-$GCCVER.tar.bz2" | cut -f1 -d' ')
|
|
GDBHASH=$(shasum -a 256 -b "$ARCHIVES/gdb-$GDBVER.tar.xz" | cut -f1 -d' ')
|
|
MPFRHASH=$(shasum -a 256 -b "$ARCHIVES/mpfr-$MPFRVER.tar.bz2" | cut -f1 -d' ')
|
|
MPCHASH=$(shasum -a 256 -b "$ARCHIVES/mpc-$MPCVER.tar.gz" | cut -f1 -d' ')
|
|
GMPHASH=$(shasum -a 256 -b "$ARCHIVES/gmp-$GMPVER.tar.bz2" | cut -f1 -d' ')
|
|
|
|
tmp=$(mktemp)
|
|
echo "# Rerun updatetoolvers after modifying this file" > "$tmp"
|
|
echo "GCCVER=$GCCVER" >> "$tmp"
|
|
echo "BINVER=$BINVER" >> "$tmp"
|
|
echo "GDBVER=$GDBVER" >> "$tmp"
|
|
echo "GMPVER=$GMPVER" >> "$tmp"
|
|
echo "MPCVER=$MPCVER" >> "$tmp"
|
|
echo "MPFRVER=$MPFRVER" >> "$tmp"
|
|
|
|
echo "# Below is autogenerated by updatetoolvers" >> "$tmp"
|
|
echo "GCCHASH=$GCCHASH" >> "$tmp"
|
|
echo "BINHASH=$BINHASH" >> "$tmp"
|
|
echo "GDBHASH=$GDBHASH" >> "$tmp"
|
|
echo "GMPHASH=$GMPHASH" >> "$tmp"
|
|
echo "MPCHASH=$MPCHASH" >> "$tmp"
|
|
echo "MPFRHASH=$MPFRHASH" >> "$tmp"
|
|
mv "$tmp" "$TOOLVERS_FILE"
|