bf41b3a120c8314cc34115e4bf53789b15805efb
[msysgit.git] / src / mingw-w64 / release-easy.sh
blobbf41b3a120c8314cc34115e4bf53789b15805efb
1 #!/bin/sh
3 cd "$(dirname "$0")"
4 srcdir=$(pwd)
6 # Limit the number of RSS feed entries.
7 limit=500
9 rss="$(curl -s http://sourceforge.net/api/file/index/project-id/202880/mtime/desc/limit/$limit/rss)"
10 if test $? -ne 0
11 then
12 file="$(ls -1 mingw-w64-bin_i686-mingw_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].zip 2>/dev/null)"
13 if test $? -ne 0
14 then
15 site=http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/
17 echo "Could not download mingw-w64-bin_i686-mingw_\$date.zip"
18 echo "If you do not have a direct network connection please go to"
19 echo " $site"
20 echo "download the latest file, place it in $srcdir"
21 echo "and restart this script"
22 exit 1
23 else
24 file=$(echo "$file" | tail -n 1)
26 else
27 link=$(echo "$rss" |
28 sed -nr "s/<link>(.+(mingw-w64-bin_i686-mingw_[0-9]+.zip).+)<\/link>/\2\t\1/p" |
29 head -1)
30 file=$(echo "$link" | cut -f 1)
31 url=$(echo "$link" | cut -f 2)
33 # Trim whitespaces.
34 file=$(echo $file)
35 url=$(echo $url)
37 # download it
38 test -f $file || curl -L $url -o $file || exit
41 # unpack & install it
42 test -f sysroot/.root.init.marker &&
43 test sysroot/.root.init.marker -nt $file ||
44 (mkdir -p sysroot &&
45 cd sysroot &&
46 unzip ../$file &&
47 touch .root.init.marker