mingw-w64: Parse the SF RSS feed for the latest release, follow redirects
[msysgit.git] / src / mingw-w64 / release-easy.sh
blob7ac33041424a8c53bf17a3af6eda82cec8e8956e
1 #!/bin/sh
3 cd "$(dirname "$0")"
4 srcdir=$(pwd)
6 # Limit the number of RSS feed entries.
7 limit=500
9 link=$(curl -s http://sourceforge.net/api/file/index/project-id/202880/mtime/desc/limit/$limit/rss |
10 sed -nr "s/<link>(.+(mingw-w64-bin_i686-mingw_[0-9]+.zip).+)<\/link>/\2\t\1/p" |
11 head -1)
13 file=$(echo "$link" | cut -f 1)
14 url=$(echo "$link" | cut -f 2)
16 # Trim whitespaces.
17 file=$(echo $file)
18 url=$(echo $url)
20 dir=${file%.zip}
22 # download it
23 test -f $file || curl -L $url -o $file || exit
25 # unpack & install it
26 test -f sysroot/.root.init.marker &&
27 test sysroot/.root.init.marker -nt $file ||
28 (mkdir -p sysroot &&
29 cd sysroot &&
30 unzip ../$file &&
31 touch .root.init.marker