tvheadend/support/tarball
Andrew C. Martin 9b385a78c5 allow build path spaces in support scripts
- allow build path spaces in configure & support scripts
- use the same die function for all scripts
2013-03-07 20:44:55 -07:00

53 lines
945 B
Bash
Executable file

#!/bin/bash
#
# Build tarball of the current directory
#
# Terminate
function die
{
echo >&2 "ERROR: $@"
exit 1
}
# Switch dir
SRCDIR=$(dirname "$0")/..
cd "$SRCDIR"
# Arguments
REL=$1
# Checkout
if [ ! -z "$REL" ]; then
git checkout $REL || die "could not checkout $REL"
fi
git clean -dfx || die "could not clean git tree"
# Version
VER=$(./support/version)
echo $VER | grep -q dirty && die "git tree is not clean"
VER1=$(echo $VER | sed 's/~.*//')
echo $VER1
# Temp directory
TMPDIR=/tmp/tvhtar-$$
mkdir -p $TMPDIR
trap "rm -rf $TMPDIR" EXIT
# Copy
DSTDIR=$TMPDIR/tvheadend-$VER1
mkdir $DSTDIR
git archive HEAD | tar -x -C $DSTDIR
# Remove stuff we don't need
rm -rf $DSTDIR/.gitignore
# Fix changelog (store version)
$DSTDIR/support/changelog $DSTDIR/debian/changelog "" $VER
# Build tarball
TARFILE=$(cd "$SRCDIR"/..; pwd)/tvheadend-$VER1.tar.gz
tar -C $TMPDIR -zcf "$TARFILE" tvheadend-$VER1
# Done
echo "Created $TARFILE"