/[baselayout]/trunk/init.d/modules
Gentoo

Diff of /trunk/init.d/modules

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 333 Revision 334
5 5
6 6
7depend() { 7depend() {
8 need checkroot hostname 8 need checkroot hostname
9 use isapnp 9 use isapnp
10}
11
12load_modules() {
13 [ -z "$1" ] && return 0
14 [ ! -r "$1" ] && return 0
15
16 # Loop over every line in $1
17 (egrep -v "^#|^$" "$1"; echo) | # make sure there is a LF at the end
18 while read module args
19 do
20 [ -z "${module}" ] && continue
21 ebegin " Loading module ${module}"
22 modprobe ${module} ${args} &>/dev/null
23 eend $? " Failed to load ${module}"
24 done
25 echo
26
27 return 0
10} 28}
11 29
12start() { 30start() {
13 # Should not fail if kernel do not have module 31 # Should not fail if kernel do not have module
14 # support compiled in ... 32 # support compiled in ...
24 42
25 ebegin "Calculating module dependencies" 43 ebegin "Calculating module dependencies"
26 /sbin/modules-update &>/dev/null 44 /sbin/modules-update &>/dev/null
27 eend $? "Failed to calculate dependencies" 45 eend $? "Failed to calculate dependencies"
28 46
47 if [ -f /etc/modules.autoload -a ! -L /etc/modules.autoload ]
48 then
49 einfo "Using /etc/modules.autoload:"
29 # Loop over every line in /etc/modules.autoload. 50 # Loop over every line in /etc/modules.autoload.
30 (egrep -v "^#|^$" /etc/modules.autoload; echo) | # make sure there is a LF at the end 51 load_modules /etc/modules.autoload
31 while read module args 52 else
32 do 53 local KV="`uname -r 2> /dev/null`"
33 [ -z "${module}" ] && continue 54 local KV_MAJOR="`KV_major "${KV}"`"
34 ebegin " Loading module ${module}" 55 local KV_MINOR="`KV_minor "${KV}"`"
35 modprobe ${module} ${args} &>/dev/null 56
36 eend $? " Failed to load ${module}" 57 # New support for /etc/modules.autoload/kernel-$KV
37 done 58 if [ "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ] && \
38 echo 59 [ -f /etc/modules.autoload.d/kernel-"${KV_MAJOR}.${KV_MINOR}" ]
60 then
61 einfo "Using /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}:"
62 load_modules /etc/modules.autoload.d/kernel-"${KV_MAJOR}.${KV_MINOR}"
63 else
64 einfo "Using /etc/modules.autoload.d/kernel-2.4:"
65 load_modules /etc/modules.autoload.d/kernel-2.4
66 fi
67 fi
39 68
40 # 69 #
41 # Just in case a sysadmin prefers generic symbolic links in 70 # Just in case a sysadmin prefers generic symbolic links in
42 # /lib/modules/boot for boot time modules we will load these modules 71 # /lib/modules/boot for boot time modules we will load these modules
43 # 72 #

Legend:
Removed from v.333  
changed lines
  Added in v.334

  ViewVC Help
Powered by ViewVC 1.1.20