#!/bin/sh

. config/options

$SCRIPTS/install expat
$SCRIPTS/install libdaemon
$SCRIPTS/install gettext-dummy
$SCRIPTS/install dbus
$SCRIPTS/install Python
$SCRIPTS/install dbus-python
$SCRIPTS/install pygtk

PKG_DIR=`find $PACKAGES -type d -name $1`
PYTHON_LIB_DIR=`ls -d $INSTALL/usr/lib/python*`

mkdir -p $INSTALL/usr/sbin
cp -PR $PKG_BUILD/avahi-autoipd/avahi-autoipd $INSTALL/usr/sbin
cp -PR $PKG_BUILD/avahi-daemon/.libs/avahi-daemon $INSTALL/usr/sbin
cp -PR $PKG_BUILD/avahi-dnsconfd/.libs/avahi-dnsconfd $INSTALL/usr/sbin

mkdir -p $INSTALL/usr/lib
cp -PR $PKG_BUILD/avahi-common/.libs/*.so* $INSTALL/usr/lib/
cp -PR $PKG_BUILD/avahi-core/.libs/*.so* $INSTALL/usr/lib/
rm -rf $INSTALL/usr/lib/libavahi*.so*T

mkdir -p $INSTALL/etc/avahi
cp -PR $PKG_BUILD/avahi-autoipd/avahi-autoipd.action $INSTALL/etc/avahi
cp -PR $PKG_BUILD/avahi-daemon/avahi-daemon.conf $INSTALL/etc/avahi

mkdir -p $INSTALL/etc/avahi/services
cp -PR $PKG_BUILD/avahi-daemon/sftp-ssh.service $INSTALL/etc/avahi/services
cp -PR $PKG_BUILD/avahi-daemon/ssh.service $INSTALL/etc/avahi/services

mkdir -p $INSTALL/etc/dbus-1/system.d
cp -PR $PKG_BUILD/avahi-daemon/avahi-dbus.conf $INSTALL/etc/dbus-1/system.d

mkdir -p $PYTHON_LIB_DIR/site-packages/avahi
cp $PKG_BUILD/avahi-python/avahi/*.pyc $PYTHON_LIB_DIR/site-packages/avahi

mkdir -p $INSTALL/usr/share/avahi
cp -PR $PKG_BUILD/service-type-database/service-types $INSTALL/usr/share/avahi
cp -PR $PKG_BUILD/avahi-daemon/avahi-service.dtd $INSTALL/usr/share/avahi

mkdir -p $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/ServiceTypeBrowser.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/HostNameResolver.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/EntryGroup.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/ServiceBrowser.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/Server.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/DomainBrowser.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/ServiceResolver.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/RecordBrowser.introspect $INSTALL/usr/share/avahi/introspection
cp -PR $PKG_BUILD/avahi-daemon/AddressResolver.introspect $INSTALL/usr/share/avahi/introspection

mkdir -p $INSTALL/usr/share/udhcpc
cp $PKG_DIR/scripts/udhcp-avahi.script $INSTALL/usr/share/udhcpc/default.script

