#!/bin/sh set -e VERSION="$1" if [ x"$VERSION" = x"" ]; then echo "Usage: $0 " echo echo " Example: $0 arping-2.11" exit 1 fi if [ x"$VERSION" = x"latest" ]; then VERSION="$(git tag | tail -1)" fi if [ x"$VERSION" = x"HEAD" ]; then VERSION="$(git describe)" fi OUTPUT="$VERSION.tar.gz" echo "Writing $OUTPUT" GITDIR="$(realpath .)" TMPDIR="$(mktemp -d)" ( cd "$TMPDIR" mkdir "$VERSION" cd "$VERSION" git init git fetch "$GITDIR" git fetch --tags "$GITDIR" git checkout "$VERSION" rm -fr .git autoreconf -i rm -fr autom4te.cache cd .. tar cfz - "$VERSION" > "$GITDIR/$OUTPUT" ) rm -fr -- "$TMPDIR"