diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2006-10-12 15:59:15 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2006-10-12 15:59:15 +0000 |
commit | 8c0c0b2ad8d98a0a3c38d04d9db75a33902726a1 (patch) | |
tree | 5887ea75f73bdb03be15438a024ca52dca855aa3 | |
parent | 8e08738756f51d095950f177e5d6c4df41ed72c1 (diff) |
* If the file already exists in dist/tarballs, check that the hashes match.
svn path=/nixpkgs/trunk/; revision=6719
-rwxr-xr-x | maintainers/scripts/evacuate-urls.sh | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/maintainers/scripts/evacuate-urls.sh b/maintainers/scripts/evacuate-urls.sh index 8e745f887a8a5..2263cf5115f8c 100755 --- a/maintainers/scripts/evacuate-urls.sh +++ b/maintainers/scripts/evacuate-urls.sh @@ -6,28 +6,33 @@ find . -name "*.nix" | while read fn; do if oldURL=$(echo "$line" | sed 's^url = \(.*\);^\1^'); then - if ! echo "$oldURL" | grep -q -E "www.cs.uu.nl|nix.cs.uu.nl|.stratego-language.org|java.sun.com|ut2004|linuxq3a|RealPlayer|Adbe|belastingdienst|microsoft|armijn/.nix"; then + if ! echo "$oldURL" | grep -q -E "www.cs.uu.nl|nix.cs.uu.nl|.stratego-language.org|java.sun.com|ut2004|linuxq3a|RealPlayer|Adbe|belastingdienst|microsoft|armijn/.nix|sun.com|archive.eclipse.org"; then base=$(basename $oldURL) newURL="http://nix.cs.uu.nl/dist/tarballs/$base" newPath="/data/webserver/dist/tarballs/$base" echo "$fn: $oldURL -> $newURL" - if test -e "$newPath"; then - echo "WARNING: $newPath exists!" - else - - if test -n "$doMove"; then + isSafe=1 - if ! test -e "$newPath"; then - curl --fail --location --max-redirs 20 "$oldURL" > "$newPath".tmp - mv -f "$newPath".tmp "$newPath" - fi + if test -e "$newPath"; then + hash=$(fgrep -A 1 "$oldURL" "$fn" | grep md5 | sed 's^.*md5 = \"\(.*\)\";.*^\1^') + echo "HASH = $hash" + if ! test "$(nix-hash --type md5 --flat "$newPath")" = "$hash"; then + echo "WARNING: $newPath exists and differs!" + isSafe= + fi + fi - sed "s^$oldURL^$newURL^" < "$fn" > "$fn".tmp - mv -f "$fn".tmp "$fn" + if test -n "$doMove" -a -n "$isSafe"; then + if ! test -e "$newPath"; then + curl --disable-epsv --fail --location --max-redirs 20 "$oldURL" > "$newPath".tmp + mv -f "$newPath".tmp "$newPath" fi + sed "s^$oldURL^$newURL^" < "$fn" > "$fn".tmp + mv -f "$fn".tmp "$fn" + fi fi |