Annotation of /trunk/udev/modprobe.sh
Parent Directory | Revision Log
Revision 121 -
(hide annotations)
(download)
(as text)
Wed Mar 21 16:48:37 2007 UTC (17 years, 6 months ago) by niro
File MIME type: application/x-sh
File size: 1027 byte(s)
Wed Mar 21 16:48:37 2007 UTC (17 years, 6 months ago) by niro
File MIME type: application/x-sh
File size: 1027 byte(s)
- moved to udev root. manage versions with tags now
1 | niro | 121 | #!/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/sysconfig/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 |