All pastes #12657 Raw Edit

Something

public text v1 · immutable
#12657 ·published 2005-05-26 04:06 UTC
rendered paste body
mmc_mount=$(nvram get mmc_mount)
mmc_mount=${mmc_mount:-/mmc}

mmc_present=`cat /tmp/mmc-status`
mmc_present=${mmc_present:-0}

if (test $1) then	
	if (test $1 = "insert") then 
		if (test "$mmc_present" != "1") then
			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'
		else 
			 echo 'MMC Card already present!'
		fi
	elif (test $1 = "eject") then 
		if (test "$mmc_present" != "0") then
			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'
		else 
 			echo 'MMC Card not present!'
		fi
	else
		echo 'Usage: mmc <insert|eject>'
	fi
else
	echo 'Usage: mmc <insert|eject>'
fi