2 # Change the version numbers in the toolvers file and then run this
3 # script to update the hashes
6 GNU_MIRROR
=https
://mirrors.kernel.org
/gnu
7 TOOLVERS_FILE
="toolvers"
8 KEYRING_FILE
=.
/gnu-keyring.gpg
11 function verify_sig
() {
15 if ! gpg
-q --verify --keyring "$KEYRING_FILE" "$SIGFILE" "$ARCHIVE"; then
16 echo "Failed to verify $ARCHIVE, aborting"
21 function fetch_and_verify
() {
25 if [ ! -f "$ARCHIVES/$FILENAME" ]; then
26 wget
-P "$ARCHIVES" -N "$PKG_URI_DIR/$FILENAME"
28 if [ ! -f "$ARCHIVES/$FILENAME.sig" ]; then
29 wget
-P "$ARCHIVES" -N "$PKG_URI_DIR/$FILENAME.sig"
32 verify_sig
"$ARCHIVES/$FILENAME.sig" "$ARCHIVES/$FILENAME"
36 fetch_and_verify
"$GNU_MIRROR/binutils/" "binutils-$BINVER.tar.xz"
37 fetch_and_verify
"$GNU_MIRROR/gcc/gcc-$GCCVER/" "gcc-$GCCVER.tar.xz"
38 fetch_and_verify
"$GNU_MIRROR/gdb/" "gdb-$GDBVER.tar.xz"
39 fetch_and_verify
"$GNU_MIRROR/gmp/" "gmp-$GMPVER.tar.xz"
40 fetch_and_verify
"$GNU_MIRROR/mpc/" "mpc-$MPCVER.tar.gz"
41 fetch_and_verify
"$GNU_MIRROR/mpfr/" "mpfr-$MPFRVER.tar.xz"
43 BINHASH
=$
(shasum
-a 256 -b "$ARCHIVES/binutils-$BINVER.tar.xz" | cut
-f1 -d' ')
44 GCCHASH
=$
(shasum
-a 256 -b "$ARCHIVES/gcc-$GCCVER.tar.xz" | cut
-f1 -d' ')
45 GDBHASH
=$
(shasum
-a 256 -b "$ARCHIVES/gdb-$GDBVER.tar.xz" | cut
-f1 -d' ')
46 GMPHASH
=$
(shasum
-a 256 -b "$ARCHIVES/gmp-$GMPVER.tar.xz" | cut
-f1 -d' ')
47 MPCHASH
=$
(shasum
-a 256 -b "$ARCHIVES/mpc-$MPCVER.tar.gz" | cut
-f1 -d' ')
48 MPFRHASH
=$
(shasum
-a 256 -b "$ARCHIVES/mpfr-$MPFRVER.tar.xz" | cut
-f1 -d' ')
51 echo "# Rerun updatetoolvers after modifying this file" > "$tmp"
52 echo "GCCVER=$GCCVER" >> "$tmp"
53 echo "BINVER=$BINVER" >> "$tmp"
54 echo "GDBVER=$GDBVER" >> "$tmp"
55 echo "GMPVER=$GMPVER" >> "$tmp"
56 echo "MPCVER=$MPCVER" >> "$tmp"
57 echo "MPFRVER=$MPFRVER" >> "$tmp"
59 echo "# Below is autogenerated by updatetoolvers" >> "$tmp"
60 echo "GCCHASH=$GCCHASH" >> "$tmp"
61 echo "BINHASH=$BINHASH" >> "$tmp"
62 echo "GDBHASH=$GDBHASH" >> "$tmp"
63 echo "GMPHASH=$GMPHASH" >> "$tmp"
64 echo "MPCHASH=$MPCHASH" >> "$tmp"
65 echo "MPFRHASH=$MPFRHASH" >> "$tmp"
66 mv "$tmp" "$TOOLVERS_FILE"