Files
oasis-linux-mirror/scripts/fetch-curl.rc
2017-10-10 03:22:25 -07:00

46 lines
751 B
Plaintext

flag e +
if(~ $#* 0) {
echo 'usage: fetch-curl.rc dir [paxflags...]' >[1=2]
exit 2
}
cd $1
shift
if([ -e src ]) rm -rf src
if(! sha256sum -c sha256 >[2]/dev/null) {
curl -L -K url -O
sha256sum -c sha256
}
for(archive in `{awk '{print $2}' sha256}) {
switch($archive) {
case *.tar.gz *.tgz
tool=zcat
case *.tar.bz2
tool=bzcat
case *.tar.xz
tool=xzcat
case *
tool=()
}
flags=()
while(! ~ $1 '' ';') {
flags=($flags $1)
shift
}
if(~ $#flags 0)
flags=(-s '/^\.\|[^\/]*/src/' '*/*')
shift
if(! ~ $#tool 0) $tool $archive | pax -r $flags
}
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=()