Contents of /trunk/udev/modprobe.sh
Parent Directory | Revision Log
Revision 782 -
(show annotations)
(download)
(as text)
Mon May 4 21:51:56 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1024 byte(s)
Mon May 4 21:51:56 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1024 byte(s)
-fixed rc include location
1 | #!/bin/sh |
2 | |
3 | # Do not continue for non-modular kernel |
4 | [ ! -f /proc/modules ] && exit 0 |
5 | |
6 | if [ -e /dev/.udev_populate ] |
7 | then |
8 | # Enable verbose while called from udev-addon-start |
9 | source /dev/.udev_populate |
10 | |
11 | if [ -c "${CONSOLE}" ] |
12 | then |
13 | # redirect stdin/out/err |
14 | exec <${CONSOLE} &>${CONSOLE} |
15 | fi |
16 | fi |
17 | |
18 | source /etc/conf.d/rc |
19 | source $rc_functions |
20 | |
21 | MODPROBE=/sbin/modprobe |
22 | MODLIST=$("${MODPROBE}" -q -i --show-depends "${@}" 2>/dev/null | sed -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" -e 's|-|_|g') |
23 | |
24 | # exit if you have no modules to load |
25 | [ -z "${MODLIST}" ] && exit 0 |
26 | for m in ${MODLIST}; do |
27 | MODNAME=$m |
28 | done |
29 | |
30 | # check for blacklisting |
31 | if [ -f /etc/udev/blacklist ]; then |
32 | if grep -q '^blacklist.*[[:space:]]'"${MODNAME}"'\([[:space:]]\|$\)' /etc/udev/blacklist |
33 | then |
34 | # module blacklisted |
35 | exit 0 |
36 | fi |
37 | fi |
38 | |
39 | # check if loaded |
40 | if ! grep -q "^${MODNAME}[[:space:]]" /proc/modules |
41 | then |
42 | # now do real loading |
43 | echo -e "${COLOREDSTAR} udev loading module ${COLBLUE}${MODNAME}${COLDEFAULT}" |
44 | exec "${MODPROBE}" -q "${@}" &>/dev/null |
45 | fi |