Blob Blame History Raw
#!/bin/bash

# $1 - revision number to checkout.
: ${1?"You must either provide desired revision number \"X\" to checkout: `basename $0` X
                                or fetch the latest revision by: `basename $0` HEAD"}

set -e

tmp=$(mktemp -d)

trap cleanup EXIT
cleanup() {
    set +e
    [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}

unset CDPATH
pwd=$(pwd)
name=fedora-jam-kde-theme
version=1.0.0

pushd "$tmp" >/dev/null
echo "Fetching git revision: $1"
git clone git://git.fedorahosted.org/music-creation.git/ $name-$version |tee $name.stdout
pushd $name-$version
git reset --hard $1
rm -rf fedora-jam-backgrounds spin-kickstarts
popd
echo "Fetched git revision: $1"
rm -f $name.stdout
cd $name-$version/$name/
mv src $name-$version
tar -c --xz -f "$pwd"/$name-$version-git$1.tar.xz $name-$version
cd ../..
echo "Written: $name-$version-git$1.tar.xz"