#!/bin/bash set -e name=junit version="$(sed -n 's/Version:\s*//p' *.spec)" upstream_version="$(echo ${version} | echo ${version} | sed 's/~\|\(alpha\.\|beta\)\./\1-/g')" # RETRIEVE wget "https://github.com/${name}-team/${name}/archive/r${upstream_version}.tar.gz" rm -rf tarball-tmp mkdir tarball-tmp pushd tarball-tmp tar xf "../r${upstream_version}.tar.gz" mv * ${name}-${version} # CLEAN TARBALL find -name '*.jar' -delete find -name '*.class' -delete tar czf "../${name}-${version}.tar.gz" * popd rm -r tarball-tmp "r${upstream_version}.tar.gz"