#!/bin/sh
TMP=/tmp/.wlan

echo "successfully installed"

[ -z "`grep wlan= /var/etc/autostart/start-config`" ] && echo "wlan=y" >> /var/etc/autostart/start-config
sed -e 's/wlan=.*/wlan=y/' /var/etc/autostart/start-config > /tmp/start-config
mv /tmp/start-config /var/etc/autostart/start-config
echo "start-config updated"
echo

echo "syncing disk"
sync

if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
	FREE=`expr $SPACE - 100`
	echo new freespace size $FREE kb
fi
echo "please plug your wifi adapter in a free usb port and reboot your box"
exit 0
