1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00
nixpkgs/maintainers/scripts/copy-tarballs.sh
Eelco Dolstra e7906f26af * Make copy-tarballs.sh work on release.nix.
svn path=/nixpkgs/trunk/; revision=19834
2010-02-05 14:14:43 +00:00

58 lines
1.5 KiB
Bash
Executable file

#! /bin/sh -e
distDir=/data/webserver/tarballs
urls=$(nix-instantiate --eval-only --xml --strict ./eval-release.nix \
| grep -A2 'name="urls"' \
| grep '<string value=' \
| sed 's/.*"\(.*\)".*/\1/' \
| sort | uniq)
for url in $urls; do
if echo "$url" | grep -q -E "www.cs.uu.nl|nixos.org|.stratego-language.org|java.sun.com|ut2004|linuxq3a|RealPlayer|Adbe|belastingdienst|microsoft|armijn/.nix|sun.com|archive.eclipse.org"; then continue; fi
base="$(basename "$url")"
newPath="$distDir/$base"
if ! test -e "$newPath"; then
#if echo $url | grep -q 'mirror://'; then
# echo "$fn: skipping mirrored $url"
# continue
#fi
echo "downloading $url to $newPath"
if test -n "$doCopy"; then
declare -a res
if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then
continue
fi
storePath=${res[1]}
cp $storePath "$newPath.tmp.$$"
mv -f "$newPath.tmp.$$" "$newPath"
fi
fi
if test -n "$doCopy" -a -e "$newPath"; then
echo "hashing $newPath"
md5=$(nix-hash --flat --type md5 "$newPath")
ln -sfn "../$base" $distDir/md5/$md5
sha1=$(nix-hash --flat --type sha1 "$newPath")
ln -sfn "../$base" $distDir/sha1/$sha1
sha256=$(nix-hash --flat --type sha256 "$newPath")
ln -sfn "../$base" $distDir/sha256/$sha256
ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256")
fi
done
echo DONE