[arch-commits] CVS update of core/base/klibc-udev (load-modules.sh)
Aaron Griffin
aaron at archlinux.org
Fri Mar 7 21:47:20 UTC 2008
Date: Friday, March 7, 2008 @ 16:47:20
Author: aaron
Path: /home/cvs-core/core/base/klibc-udev
Modified: load-modules.sh (1.2 -> 1.3)
Bump this to be comparable to the changes in the master udev package
-----------------+
load-modules.sh | 54 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 22 deletions(-)
Index: core/base/klibc-udev/load-modules.sh
diff -u core/base/klibc-udev/load-modules.sh:1.2 core/base/klibc-udev/load-modules.sh:1.3
--- core/base/klibc-udev/load-modules.sh:1.2 Sat May 12 13:10:48 2007
+++ core/base/klibc-udev/load-modules.sh Fri Mar 7 16:47:20 2008
@@ -1,32 +1,42 @@
#! /bin/sh
# Implement blacklisting for udev-loaded modules
-# Includes module checking
-# - Aaron Griffin & Tobias Powalowski for Archlinux
+# Mini version for early userspace
+
[ $# -ne 1 ] && exit 1
if [ -f /proc/cmdline ]; then
- for cmd in $(cat /proc/cmdline); do
- case $cmd in
- *=*) eval $cmd ;;
- esac
- done
+ for cmd in $(cat /proc/cmdline); do
+ case $cmd in
+ *=*) eval $cmd ;;
+ esac
+ done
+ #parse cmdline entries of the form "disablemodules=x,y,z"
+ if [ -n "$disablemodules" ]; then
+ BLACKLIST="$BLACKLIST $(echo $disablemodules | /bin/sed 's|,| |g')"
+ fi
+ if [ "$load_modules" == "off" ]; then
+ MOD_AUTOLOAD="no"
+ fi
fi
-# get the real names from modaliases
-i="$(/bin/moddeps $1)"
-# add disablemodules= from commandline to blacklist
-k="$(/bin/replace "${disablemodules}" ',')"
-j="$(/bin/replace "${k}" '-' '_')"
+if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
+ if [ -n "$BLACKLIST" ]; then
+ depmods="$(/sbin/modprobe -i --show-depends $1)"
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
-if [ "${j}" != "" ] ; then
- for n in ${i}; do
- for o in ${j}; do
- if [ "$n" = "$o" ]; then
- exit 1
- fi
- done
- done
-fi
-/sbin/modprobe $1
+ #sanitize our module names
+ depmods="$(echo $depmods | /bin/sed \
+ -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" \
+ -e 's|-|_|g')"
+ for mod in $depmods; do
+ if echo $BLACKLIST | /bin/grep "\<$mod\>" 2>&1 >/dev/null; then
+ exit 1
+ fi
+ done
+ fi
+ /sbin/modprobe $1
+fi
# vim: set et ts=4:
More information about the arch-commits
mailing list