File: pcmcia.rc

package info (click to toggle)
pcmciautils 014-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 328 kB
  • ctags: 791
  • sloc: ansic: 3,804; sh: 284; makefile: 238; lex: 219; yacc: 104
file content (53 lines) | stat: -rwxr-xr-x 940 bytes parent folder | download | duplicates (9)
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
45
46
47
48
49
50
51
52
53
#!/bin/sh
# vim: syntax=sh
#
# pcmcia.rc	recover lost boot-time pcmcia_socket hotplug events
#
# $Id: $
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
#DEBUG=yes; export DEBUG

cd /etc/hotplug
. ./hotplug.functions

pcmcia_boot_events ()
{
    if [ -d /sys/bus/pcmcia/devices/ ]; then
	# 2.6 kernels
	cd /sys/bus/pcmcia/devices/
	for PCMCIA_DEVICE in *; do
	    if [ $PCMCIA_DEVICE == \* ]; then
		continue;
	    fi;
	    MODALIAS=$(cat $PCMCIA_DEVICE/modalias)
	    debug_mesg $MODALIAS $PCMCIA_DEVICE
	    if [ -z $MODALIAS ]; then
		continue;
	    fi;
	    ACTION=add
	    export MODALIAS ACTION
	    /sbin/hotplug pcmcia
	done;
    fi;

    return 0
}

# See how we were called.
case "$1" in
  start)
	pcmcia_boot_events
        ;;
  stop)
	# echo $"pcmcia stop -- ignored"
        ;;
  restart)
	# always invoke by absolute path, else PATH=$PATH:
	$0 stop && $0 start
	;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac