2005-02-15 15:32:55 +01:00
|
|
|
#! /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
|
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
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
|
2005-02-15 15:32:55 +01:00
|
|
|
base=$(basename $oldURL)
|
2006-01-30 17:20:35 +01:00
|
|
|
newURL="http://nix.cs.uu.nl/dist/tarballs/$base"
|
|
|
|
newPath="/data/webserver/dist/tarballs/$base"
|
2005-02-15 15:32:55 +01:00
|
|
|
echo "$fn: $oldURL -> $newURL"
|
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
if test -e "$newPath"; then
|
|
|
|
echo "WARNING: $newPath exists!"
|
|
|
|
else
|
2006-01-30 17:20:35 +01:00
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
if test -n "$doMove"; then
|
2006-01-30 17:20:35 +01:00
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
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"
|
2006-01-30 17:20:35 +01:00
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
fi
|
2006-01-30 17:20:35 +01:00
|
|
|
|
2006-10-12 15:50:54 +02:00
|
|
|
fi
|
2005-02-15 15:32:55 +01:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
done
|