mmc_mount_root=$(nvram get mmc_mount_root) mmc_mount_root=${mmc_mount_root:-/tmp/.mmc} mmc_mount_point=$(nvram get mmc_mount_point) mmc_mount_point=${mmc_mount_point:-/mmc} [ -f /tmp/.mmc-status ] || { echo 0 > /tmp/.mmc-status } [ -d "$mmc_mount_root" ] || { mkdir "$mmc_mount_root" } [ -s "$mmc_mount_point ] || { ln -s /dev/mmc/disc0/part1 $mmc_mount_point } mmc_status=`cat /tmp/.mmc-status` case $1 in insert) [ "$mmc_status" = "1" ] && { echo "MMC Card already present!" } || { insmod -q fat insmod -q vfat insmod -q mmc sleep 1 mount /dev/mmc/disc0/part1 $mmc_mount_root nvram set mmc_status=1 echo "MMC Card mounted at $mmc_mount_point" } ;; eject) [ "$mmc_status" = "0" ] && { echo "MMC Card not present!" } || { umount $mmc_mount_root || exit 1 sleep 1 rmmod mmc rmmod vfat rmmod fat nvram set mmc_status=0 echo "MMC Card unmounted from $mmc_mount_point" } ;; *) echo "Usage: mmc " ;; esac