#!/bin/sh -x
pkgname=kiten
litepkgname=kiten-stripped
if test "x$1" = x; then
echo "help: $0 <kiten tar ball>"
exit 1
fi
#compute file/path name
tarfile=$1
expandpath=${tarfile%.tar.xz}
newtarfile="$litepkgname${tarfile#$pkgname}"
#prepare tmp directory
rm -f $newtarfile
mkdir ./tmp
pushd "./tmp"
tar xf ../$tarfile
pushd "$expandpath/data"
# remove the skip code from kanjidic
sed -i 's/ P[0-9]*-[0-9]*-[0-9]*//g' kanjidic
popd
tar Jcf ${newtarfile} $expandpath
rm -r $expandpath
popd
mv ./tmp/$newtarfile .
rmdir ./tmp