nixpkgs/pkgs/development/tools/misc/coreboot-toolchain/update.sh
Felix Singer 28383a922e coreboot-toolchain: Introduce script for generating sources file
Add and adjust update script from
https://git.petabyte.dev/petabyteboy/corenix.

The script is meant to be run from the package directory of the
coreboot-toolchain. The script generates a sources.nix files, which
contains all sources used for the coreboot toolchain and some other
tools. Thus, it needs to be stripped down to the necessary sources.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2021-10-09 22:19:46 +02:00

31 lines
582 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p nix cacert git getopt
rootdir="../../../../../"
src="$(nix-build $rootdir --no-out-link -A coreboot-toolchain.src)"
urls=$($src/util/crossgcc/buildgcc -u)
tmp=$(mktemp)
echo '{ fetchurl }: [' > $tmp
for url in $urls; do
name="$(basename $url)"
hash="$(nix-prefetch-url "$url")"
cat << EOF >> $tmp
{
name = "$name";
archive = fetchurl {
sha256 = "$hash";
url = "$url";
};
}
EOF
done
echo ']' >> $tmp
sed -ie 's/https\:\/\/ftpmirror\.gnu\.org/mirror\:\/\/gnu/g' $tmp
mv $tmp sources.nix