network-manager: use mirror://gnome
[nixpkgs-libre.git] / maintainers / scripts / copy-tarballs.sh
blobc8f3571000361f829944257e7fc52b5fe08bc5a2
1 #! /bin/sh -e
3 distDir=/data/webserver/tarballs
5 urls=$(nix-instantiate --eval-only --xml --strict ./eval-release.nix \
6 | grep -A2 'name="urls"' \
7 | grep '<string value=' \
8 | sed 's/.*"\(.*\)".*/\1/' \
9 | sort | uniq)
11 for url in $urls; do
13 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
15 base="$(basename "$url")"
16 newPath="$distDir/$base"
18 if ! test -e "$newPath"; then
20 #if echo $url | grep -q 'mirror://'; then
21 # echo "$fn: skipping mirrored $url"
22 # continue
23 #fi
25 echo "downloading $url to $newPath"
27 if test -n "$doCopy"; then
28 declare -a res
29 if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then
30 continue
32 storePath=${res[1]}
33 cp $storePath "$newPath.tmp.$$"
34 mv -f "$newPath.tmp.$$" "$newPath"
39 if test -n "$doCopy" -a -e "$newPath"; then
41 echo "hashing $newPath"
43 md5=$(nix-hash --flat --type md5 "$newPath")
44 ln -sfn "../$base" $distDir/md5/$md5
46 sha1=$(nix-hash --flat --type sha1 "$newPath")
47 ln -sfn "../$base" $distDir/sha1/$sha1
49 sha256=$(nix-hash --flat --type sha256 "$newPath")
50 ln -sfn "../$base" $distDir/sha256/$sha256
51 ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256")
55 done
57 echo DONE