#!/bin/bash

echo ""
echo "Initialize drivers..."
mkdir /usr/share/tcc/
cp -Rf /tmp/td-install/DRIVERS/usb-eth/ /usr/share/tcc/
cp -Rf /tmp/td-install/DRIVERS/compat-wireless/ /usr/share/tcc/
cp -Rpf /tmp/td-install/DRIVERS/endace-dag/ /usr/share/tcc/

echo ""
echo "Install Ethernet drivers..."
(cd /usr/share/tcc/usb-eth && make && make install)

echo ""
echo "Install Wireless drivers..."
(cd /usr/share/tcc/compat-wireless && ./install.sh)

if [ `echo $RELEASE` == 'appliance' ]; then
        echo ""
        echo "Install Endace drivers..."
        (cd /usr/share/tcc/endace-dag && make install)

        if [ `grep -i '/usr/local/lib' /etc/ld.so.conf | wc -l` == '0' ]; then
                (echo "include /usr/local/lib" >> /etc/ld.so.conf && ldconfig)
        else
                (ldconfig)
        fi
else
	echo ""
	echo "Install ExpressCard/34 drivers..."
	echo acpiphp >> /etc/modules
fi
