From e5c1afb9c19aa1df33f8ff77660356df8c40bdd7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 15 Feb 2005 14:32:55 +0000 Subject: [PATCH] * A script to copy fetchurl files to a more stable place (catamaran) and rewrite the Nix expression. svn path=/nixpkgs/trunk/; revision=2236 --- pkgs/maintainers/scripts/evacuate-urls.sh | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 pkgs/maintainers/scripts/evacuate-urls.sh diff --git a/pkgs/maintainers/scripts/evacuate-urls.sh b/pkgs/maintainers/scripts/evacuate-urls.sh new file mode 100755 index 00000000000..8ca72fdf96f --- /dev/null +++ b/pkgs/maintainers/scripts/evacuate-urls.sh @@ -0,0 +1,28 @@ +#! /bin/sh -e + +find . -name "*.nix" | while read fn; do + + grep -E '^ *url = ' "$fn" | while read line; do + + if oldURL=$(echo "$line" | sed 's^url = \(.*\);^\1^'); then + + if ! echo "$oldURL" | grep -q -E ".cs.uu.nl|.stratego-language.org|java.sun.com|ut2004|linuxq3a"; then + base=$(basename $oldURL) + newURL="http://catamaran.labs.cs.uu.nl/dist/tarballs/$base" + newPath="/mnt/scratchy/eelco/public_html/tarballs/$base" + echo "$fn: $oldURL -> $newURL" + + if ! test -e "$newPath"; then + curl --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 + + done + +done \ No newline at end of file