File: ide.rc

package info (click to toggle)
hotplug 0.0.20040329-22
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 448 kB
  • ctags: 22
  • sloc: sh: 671; makefile: 183
file content (55 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download
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
54
55
#!/bin/sh -e
#
# ide.rc	loads the modules for IDE devices at boot time, if needed
#		it requires a 2.6 kernel
#
# Copyright (C) 2004, 2005 Marco d'Itri <md@linux.it>
#

# only 2.6 kernels are supported
[ -d /sys/block/ ] || exit 0

cd /etc/hotplug
. ./hotplug.functions

ide_boot_events() {
    [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return

    for drive in /proc/ide/*/media; do
	# nothing to do if the device has already been took in charge
	unit=${drive#/proc/ide/}; unit=${unit%/media}
	[ -d /sys/block/$unit ] && continue

	read media < $drive
	case "$media" in
	    disk)     MODULE=ide-disk ;;
	    cdrom)    MODULE=ide-cd ;;
	    tape)     MODULE=ide-tape ;;
	    floppy)   MODULE=ide-floppy ;;
	    *)        MODULE=ide-generic ;;
	esac

	if is_blacklisted $MODULE; then
	    mesg "     $MODULE: blacklisted"
	elif modprobe --quiet $MODULE; then
	    mesg "     $MODULE: loaded sucessfully"
	else
	    mesg "     $MODULE: can't be loaded"
	fi
    done
}   

# See how we were called.
case "$1" in
    start|restart)
        ide_boot_events
        ;;
    stop)
        ;;
    status)
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
esac