#!/bin/sh
# Heavily based on the Slackware 12.0 SlackBuild
# Requirements: Kommander, bluez utils, hcidump, btsco
# http://www.kde-apps.org/content/show.php?content=45427
# Packager Vincenzi Loris - slacky@slacky.it

CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package
NAME=kbtsco6
VERSION=1.6
ARCH=${ARCH:-noarch}
BUILD=1sl

if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

cd $TMP
tar xjvf $CWD/kbtsco6.kmdr.tar.bz2
mkdir -p $PKG/usr/bin
cp kbtsco6.kmdr $PKG/usr/bin
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
mkdir -p $PKG/usr/doc/$NAME-$VERSION
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
chown -R root:root $PKG
cd $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

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