###############################################
# If rc_startup is being run at some point after bootup
# (later than 2 minutes after uptime)
# then we quit immediately. This should ONLY run at bootup.
# Get uptime and round it to nearest integer
uptime=`cat /proc/uptime | awk -F\. '{print $1}'`
if [ $uptime -gt 120 ]
then
echo "Did not run because uptime is $uptime." >> /tmp/rc_startup.log
exit
fi
# Loop until drive is detected
while [ 1 -eq 1 ]
do
insmod /lib/modules/2.4.30/usbcore.o
insmod /lib/modules/2.4.30/ehci-hcd.o
insmod /lib/modules/2.4.30/scsi_mod.o
insmod /lib/modules/2.4.30/usb-storage.o
insmod /lib/modules/2.4.30/sd_mod.o
insmod /lib/modules/2.4.30/vfat.o
insmod /lib/modules/2.4.30/fat.o
insmod /lib/modules/2.4.30/hfsplus.o
insmod /lib/modules/2.4.35/ext2.o
sleep 4
if dmesg | tail -n10 | grep 'Attached scsi disk' 2>/dev/null 1>/dev/null
then
break
else
rmmod ext2
rmmod hfsplus
rmmod fat
rmmod vfat
rmmod sd_mod
rmmod usb-storage
rmmod scsi_mod
rmmod ehci-hcd
rmmod usbcore
gpio disable 4
sleep 2
gpio enable 4
fi
done
###############################################