#!/bin/sh

. config/options

$SCRIPTS/install dbus
$SCRIPTS/install glib
$SCRIPTS/install gettext-dummy
$SCRIPTS/install alsa-lib

PKG_DIR=`find $PACKAGES -type d -name $1`

mkdir -p $INSTALL/usr/sbin
cp $PKG_BUILD/src/.libs/bluetoothd $INSTALL/usr/sbin

if [ $DEVTOOLS = yes ]; then
  mkdir -p $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/avinfo $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/bccmd $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/ciptool $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/hciattach $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/hciconfig $INSTALL/usr/bin
  cp $PKG_BUILD/tools/hcisecfilter $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/hcitool $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/l2ping $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/ppporc $INSTALL/usr/bin
  cp $PKG_BUILD/tools/.libs/sdptool $INSTALL/usr/bin
  cp $PKG_BUILD/test/.libs/hciemu $INSTALL/usr/bin
fi

mkdir -p $INSTALL/usr/lib
cp $PKG_BUILD/lib/.libs/libbluetooth.so* $INSTALL/usr/lib

#mkdir -p $INSTALL/usr/lib/bluetooth/plugins
#cp $PKG_BUILD/plugins/.libs/*.so $INSTALL/usr/lib/bluetooth/plugins

mkdir -p $INSTALL/etc/bluetooth
cp $PKG_BUILD/src/main.conf $INSTALL/etc/bluetooth

mkdir -p $INSTALL/etc/dbus-1/system.d
cp $PKG_BUILD/src/bluetooth.conf $INSTALL/etc/dbus-1/system.d

mkdir -p $INSTALL/etc/udev/rules.d
cp $PKG_BUILD/scripts/97-bluetooth.rules \
  $INSTALL/etc/udev/rules.d
