File: force-load-ide

package info (click to toggle)
drbl 5.7.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,984 kB
  • sloc: sh: 43,522; perl: 8,820; xml: 867; makefile: 131
file content (52 lines) | stat: -rwxr-xr-x 1,396 bytes parent folder | download | duplicates (5)
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
#!/bin/bash
# Author: Steven Shiau <steven _at_ clonezilla org>
# License: GPL
# Force to load the ide devices modules, since in some chip (like piix), the hotplug is unable to load them.
# Some codes are from /etc/hotplug/ide.rc of hotplug

# For SuSE
### BEGIN INIT INFO
# Provides:          force-load-ide
# Required-Start:    boot.coldplug hwscan parse-load-mod-suse
# Should-Start:      
# Required-Stop:
# Default-Start:     B
# Default-Stop:
# Description:       Load IDE storage modules
### END INIT INFO

case "$1" in
    start)
        # first we load ide-generic if necessary so that we have some info in /proc/ide/*/media
	if modinfo ide-generic &>/dev/null; then
	  [ -z "$(lsmod | grep -E "ide[-_]generic")" ] && modprobe ide-generic
        fi

	# if still nothing in /proc/ide/, exit this program.
        [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && exit

        for drive in /proc/ide/*/media; do
	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 modprobe --quiet $MODULE; then
	    echo "     $MODULE: loaded sucessfully"
	else
	    echo "     $MODULE: can't be loaded"
	fi
        done
	;;
    stop)
        # do nothing.
        true
	;;
    *)
	echo "Usage: $0 start" >&2
	exit 1
	;;
esac