#!/bin/sh -e # Usage: ./getsources.sh [version] # (this produces pymca-[version]-filtered.tar.xz) if [ -n "$1" ]; then version="$1" else version="$(awk '/^Version:/{print $2}' *.spec)" fi fname="pymca-${version}-filtered.tar.xz" if [ -e "$fname" ]; then echo "$fname already exists, not downloading" exit 0 fi echo "Downloading version ${version}" [ -x /bin/pxz ] && xz=pxz || xz=xz curl -sSL https://github.com/vasole/pymca/archive/v${version}/PyMca-${version}.tar.gz | \ zcat | \ tar --delete --wildcards -f - '*/sift/*' | \ $xz -9v > "$fname" echo "$fname is ready"