#!/bin/sh
# Heavily based on Slackware 12.0 SlackBuild
# http://www.goteamspeak.com
# Packager==>Sidereus
CWD=`pwd`
if ["$TMP" = ""]; then
TMP=/tmp
fi
PKG=$TMP/package-ts2_client
NAME=ts2_client
VERSION=2.0.32.60
ARCH=i386
BUILD=1sid
if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi
cd $TMP
tar xjvf $CWD/ts2_client_rc2_2032.tar.bz2
cd ts2_client_rc2_2032/setup.data/image
chown -R root:root .
mkdir -p $PKG/opt/TeamSpeak2
cp -a * $PKG/opt/TeamSpeak2
mkdir -p $PKG/usr/bin
echo -e "#!/bin/sh
#
# This startup script will set the correct library path
# and then startup the teamspeak binary.
#

export LD_LIBRARY_PATH=/opt/TeamSpeak2
/opt/TeamSpeak2/TeamSpeak.bin" > $PKG/opt/TeamSpeak2/TeamSpeak
mkdir -p $PKG/install
mkdir -p $PKG/usr/doc/$NAME-$VERSION
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/ts2_client_rc2_2032
rm -rf $PKG
fi

