All pastes #12658 Raw Edit

Miscellany

public text v1 · immutable
#12658 ·published 2005-05-26 04:12 UTC
rendered paste body
mmc_mount=$(nvram get mmc_mount)
mmc_mount=${mmc_mount:-/mnt}
echo $mmc_mount
mmc_present=`cat /tmp/mmc-status`
mmc_present=${mmc_present:-0}
case $1 in
  insert)
        [ "$mmc_present" = "1" ] && {
        	 echo 'MMC Card already present!'
	} || {
		insmod -q fat.o
		insmod -q vfat.o
		insmod -q mmc.o
		mkdir -p /$mmc_mount
		sleep 1
		mount /dev/mmc/disc0/part1  $mmc_mount
		echo $mmc_present
		mmc_present=1
		echo $mmc_present > /tmp/mmc-status
		echo $mmc_present
		echo "MMC Card mounted at $mmc_mount"

	}
  ;;
  eject)
	[ "$mmc_present" = "0" ] && {
		echo 'MMC Card not present!'
	} || {
		umount $mmc_mount && rmdir $mmc_mount
		rmmod mmc.o
		rmmod vfat.o
		rmmod fat.o
		echo $mmc_present
		mmc_present=0
		echo $mmc_present > /tmp/mmc-status
		echo $mmc_present
		echo 'MMC Card unmounted from'
	}
  ;;
  *)
	echo 'Usage: mmc <insert|eject>'
  ;;
esac