mtr/generate-tarball.sh
Michal Sekletar 6b0e9ae5c4 sources: add script for generating tarball
We have to make sure that it is obvious how one can create tarball
included in srpm if it doesn't originate upstream.

generate-tarball.sh will create xz compressed tarball which doesn't
include any object files. This script will be dropped as soon as
creation of upstream tarball works properly again.
2013-08-05 17:03:21 +02:00

33 lines
754 B
Bash
Executable File

#!/usr/bin/env sh
name="mtr"
version=$(grep -e '\s*Version\s*:' $name.spec | head -n 1 | sed -e 's/Version:\s*\(.*\)/\1/')
repo="ftp://ftp.bitwizard.nl/mtr/"
if [ -z $version ]; then
echo "err: couldn't determine version of mtr, spec file must be present in the current directory?"
exit 1
fi
rm -rf $name-$version{,.tar.gz,.tar.xz}
curl -s -O $repo$name-$version.tar.gz >/dev/null 2>&1
if [ $? != 0 ]; then
echo "err: couldn't get upstream tarball"
exit 1
fi
tar -xzf $name-$version.tar.gz >/dev/null 2>&1
rm -f $name-$version.tar.gz
if [ $? != 0 ]; then
echo "err: couldn't extract archive"
exit 1
fi
find $name-$version -type f -name '*.o' -delete
tar -cJf $name-$version.tar.xz $name-$version