All pastes #12651 Raw Edit

Untitled

public text v1 · immutable
#12651 ·published 2005-05-26 03:34 UTC
rendered paste body
mmc_mount=/mmc

[ -f /tmp/mmc-status ] || [ touch /tmp/mmc-status; echo 0 > /tmp/mmc-status ]

mmc_present=`cat /tmp/mmc-status`
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
			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!"$mmc_mount"
		fi
	else
		echo "Usage: mmc <insert|eject>"
	fi
else
	echo "Usage: mmc <insert|eject>"
fi