#Video Card Detection
echo "Detecting X..."
if [ -f /usr/X11R6/bin/X ]; then 
	echo "X detected, creating XF86Config..."
	/scripts/cardDetect/1.cardDetect.sh
fi

#Local daemons tweak
MDDEVICE=`/sbin/mdconfig -a -t malloc -o compress -s 16m`
/sbin/newfs -U /dev/${MDDEVICE} > /dev/null
/sbin/mount -o noatime /dev/${MDDEVICE} /.usrlocaletc
/sbin/mount_unionfs /.usrlocaletc /usr/local/etc

#Retriving da0s1 data (if present)
if [ -e /dev/da0s1 ]; then
    mount -t msdos /dev/da0s1 /mnt/usb.0 > /dev/null 2>&1
    [ -f /mnt/usb.0/freesbie.tar.bz2 ] && tar jxvf /mnt/usb.0/freesbie.tar.bz2 -C /
    umount /mnt/usb.0 > /dev/null 2>&1
fi
