#!/bin/sh # Do we even have the driver installed? if [ ! -f /proc/driver/pikasd ] ; then logger "No pikasd driver" svc -d . exit 1 fi # Is there a card preset? while true; do CARD_PRESENT=`cat /proc/driver/pikasd` [ "$CARD_PRESENT" != 0 ] && break sleep 5 done # Wait for the card to be initialized while ! ls /sys/bus/mmc/devices/mmc* >/dev/null 2>/dev/null ; do sleep 1 done # Is it already mounted? # For autoflash the autorun *must* be in the first partition and # the mount point must be /mnt/sd mount | fgrep -q mmcblk0p1 if [ $? -ne 0 ] ; then # Mount the partition mkdir -p /mnt/sd mount /dev/mmcblk0p1 /mnt/sd if [ $? -ne 0 ] ; then logger "Unable to mount /dev/mmcblk0p1 /mnt/sd" svc -d . exit 1 fi fi # Run the script [ -x /mnt/sd/autorun ] && sh /mnt/sd/autorun # Shut ourself down svc -d .