#! /bin/bash
#
# repackage kbd source tar ball, 
# to remove fonts that forbid commercial distribution.
#
# 2005-07-11, jw@suse.de

tmpdir=`mktemp -d`

in="$1"
name="${in%.tar.*}"

# recent gnu tar can autodetect gzip / bzip2
if ! tar xf "$in" -C $tmpdir; then
	rm -rf $tmpdir
	exit 1
fi
 
echo removing files...
find $tmpdir -iname \*agafari\* | tee /dev/tty | xargs rm
tar jcf $name-repack.tar.bz2 -C $tmpdir $name

rm -rf $tmpdir
