#!/bin/rc flag e + if(~ $#* 0) { echo 'usage: fetch-curl.rc dir pattern...' >[1=2] exit 2 } cd $1 shift if([ -e src ]) rm -rf src if(! sha256sum -c sha256 >[2]/dev/null) { curl -L -O -K url sha256sum -c sha256 } for(archive in `{awk '{print $2}' sha256}) { switch($archive) { case *.tar.gz tool=zcat case *.tar.bz2 tool=bzcat case *.tar.xz tool=xzcat case * tool=() } pats=() while(! ~ $1 '' ';') { pats=($pats $1) shift } shift if(! ~ $#tool 0) $tool $archive | pax -r -s '/^\.\|[^\/]*/src/' $pats } if([ -d patch ]) { if(prefix=`{git rev-parse --show-prefix >[2]/dev/null}) dir=$prefix^src if not dir=src git apply -v '--whitespace=nowarn' --directory $dir patch/* } status=()