summaryrefslogtreecommitdiff
path: root/hotplug/files/mmc.agent
blob: 20af4c69ad306318353e77b46d3ce5d44b5fecda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# H3600 Sleeve hotplug policy agent for Linux 2.4 kernels
#
# Kernel NET hotplug params include:
#	
#	ACTION=%s [add or remove]
#	MEDIA=%s
#	SLOT=%d
#

. /etc/hotplug/hotplug.functions
#DEBUG=yes export DEBUG

    echo "Executing $0 action=$ACTION, media=$MEDIA ($SLOT)" > /dev/console

MMC_MOUNT_OPTIONS="-t auto -o sync,noatime"

if [ -f /etc/sysconfig/hotplug ] ; then
    . /etc/sysconfig/hotplug
fi

if [ "$ACTION" = "add" ] ; then
    echo -n add > /dev/console
    if [ "$MEDIA" = "flash" ] ; then 
	for n in 1 2 3 4 ; do
	    device=/dev/mmc/part$n
	    if [ "$n" = "1" ] ; then
  	        card=/mnt/card
	    else
		card=/mnt/card$n
	    fi
	    [ -b $device ] || break
	    echo flash on $device > /dev/console
	    [ -d $card ] || mkdir -p $card
	    mount $MMC_MOUNT_OPTIONS $device $card
	done
    fi

else
    for card in /mnt/card*; do
	umount $card
    done
fi