# executed at system start by exploited getsettingsvalue
# we're root, BTW

# just leave a note
touch /yes-sir-we-can-boogie

# create symlink pointing to the additional modules
# that we store in /flash2/modules
ln -s /flash2/modules /lib/

# load usb storage support
insmod scsi_mod > /dev/null
insmod sd_mod > /dev/null
insmod usb-storage > /dev/null

# usb/storage grace period
sleep 5

# check if we have a storage device present
if [ -b /dev/scsi/host0/bus0/target0/lun0/part1  ]; then
	# we do. mount it to newly created /mnt
	mkdir /mnt
	mount -o ro /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
	if [ -f /mnt/plugrc ]; then
		sh /mnt/plugrc > /dev/null
	fi
fi

# whether the above mentioned script on plugged device was not
# found or if it was found _and_ does return, we continue the normal
# boot process.

# but first, we look if we have an overlay directory for /flash
# and if we do, - well, we overlay it :-) this way, you can
# continue to use toish & co.

if [ -d /flash2/flash-overlay ]; then
	mount -o bind /flash2/flash-overlay /flash
fi

