Debian Codegraph @

setup/files/misc/force-load-ide

raw symbols SCIP
1 #!/bin/bash
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 # Force to load the ide devices modules, since in some chip (like piix), the hotplug is unable to load them.
5 # Some codes are from /etc/hotplug/ide.rc of hotplug
6
7 # For SuSE
8 ### BEGIN INIT INFO
9 # Provides: force-load-ide
10 # Required-Start: boot.coldplug hwscan parse-load-mod-suse
11 # Should-Start:
12 # Required-Stop:
13 # Default-Start: B
14 # Default-Stop:
15 # Description: Load IDE storage modules
16 ### END INIT INFO
17
18 case "$1" in
19 start)
20 # first we load ide-generic if necessary so that we have some info in /proc/ide/*/media
21 if modinfo ide-generic &>/dev/null; then
22 [ -z "$(lsmod | grep -E "ide[-_]generic")" ] && modprobe ide-generic
23 fi
24
25 # if still nothing in /proc/ide/, exit this program.
26 [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && exit
27
28 for drive in /proc/ide/*/media; do
29 read media < $drive
30 case "$media" in
31 disk) MODULE=ide-disk ;;
32 cdrom) MODULE=ide-cd ;;
33 tape) MODULE=ide-tape ;;
34 floppy) MODULE=ide-floppy ;;
35 *) MODULE=ide-generic ;;
36 esac
37 if modprobe --quiet $MODULE; then
38 echo " $MODULE: loaded sucessfully"
39 else
40 echo " $MODULE: can't be loaded"
41 fi
42 done
43 ;;
44 stop)
45 # do nothing.
46 true
47 ;;
48 *)
49 echo "Usage: $0 start" >&2
50 exit 1
51 ;;
52 esac