Last active
August 29, 2015 14:07
-
-
Save k-takata/c40ae5de71a8c29712a1 to your computer and use it in GitHub Desktop.
Download all patches for Vim 7.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
version=7.4 | |
#unstable=unstable/ | |
unstable= | |
patch_url=http://ftp.vim.org/pub/vim/${unstable}patches/${version} | |
# Get start and end version | |
version_esc=${version//./\\.} # Escape dots | |
start=$(gawk '{l = gensub(/'${version_esc}'\.([0-9]+)/, "\\1", 1, $2)} END {printf "%03d", l+1}' README 2> /dev/null || echo 001) | |
wget -nv --no-cache $patch_url/README -N | |
end=$(gawk '{l = gensub(/'${version_esc}'\.([0-9]+)/, "\\1", 1, $2)} END {printf "%03d", l}' README) | |
if [ $start -le $end ]; then | |
echo "$start .. $end start." | |
if [ -e MD5SUMS ]; then cp -p MD5SUMS MD5SUMS.old; fi | |
wget -nv --no-cache $patch_url/MD5SUMS -N | |
for i in `seq -f %03g $start $end`; do echo $patch_url/$version.$i; done | xargs wget -nv | |
if [ -e MD5SUMS.old ]; then diff -U1 MD5SUMS.old MD5SUMS; fi | |
echo "$start .. $end done." | |
else | |
echo "Latest: $end. Up to date." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment