]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux-hotplug/files/mmc.agent
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux-hotplug / files / mmc.agent
1 #!/bin/sh
2 #
3 # H3600 Sleeve hotplug policy agent for Linux 2.4 kernels
4 #
5 # Kernel NET hotplug params include:
6 #       
7 #       ACTION=%s [add or remove]
8 #       MEDIA=%s
9 #       SLOT=%d
10 #
11
12 . /etc/hotplug/hotplug.functions
13 #DEBUG=yes export DEBUG
14
15     echo "Executing $0 action=$ACTION, media=$MEDIA ($SLOT)" > /dev/console
16
17 MMC_MOUNT_OPTIONS="-t auto -o sync,noatime"
18
19 if [ -f /etc/sysconfig/hotplug ] ; then
20     . /etc/sysconfig/hotplug
21 fi
22
23 case `uname -r` in
24 2.4*)
25     devpath=mmc/part
26     ;;
27 *)
28     devpath=mmcblk0p
29     ;;
30 esac
31
32 if [ "$ACTION" = "add" ] ; then
33     sleep 4
34     echo -n add > /dev/console
35     for n in 1 2 3 4 ; do
36         device=/dev/$devpath$n
37         if [ "$n" = "1" ] ; then
38             card=/mnt/card
39         else
40             card=/mnt/card$n
41         fi
42         [ -b $device ] || break
43         echo " flash on $device" > /dev/console
44         [ -d $card ] || mkdir -p $card
45         mount $MMC_MOUNT_OPTIONS $device $card
46     done
47
48 else
49     for card in /mnt/card*; do
50         umount $card
51     done
52 fi