[arch-commits] Commit in klibc-udev/trunk (PKGBUILD load-modules.sh)

Thomas Baechler thomas at archlinux.org
Thu Sep 18 16:28:24 UTC 2008


    Date: Thursday, September 18, 2008 @ 12:28:24
  Author: thomas
Revision: 12692

upgpkg: klibc-udev 128-1

Modified:
  klibc-udev/trunk/PKGBUILD
  klibc-udev/trunk/load-modules.sh

-----------------+
 PKGBUILD        |    2 -
 load-modules.sh |   57 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 39 insertions(+), 20 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2008-09-18 16:27:46 UTC (rev 12691)
+++ PKGBUILD	2008-09-18 16:28:24 UTC (rev 12692)
@@ -29,7 +29,7 @@
          '258fea1c2b024f9755f905a21bd45a01'
          'e20efd69738bbbba35c49e7b63ee0212'
          'd42740d13b6bb5c5d90bfc2062019f58'
-         '1ecfeec15e88485e88f2e37f46861f2e')
+         '5dd248da5d5fa3adfbe87309807ab734')
 
 build() {
   cd ${srcdir}/udev-$pkgver

Modified: load-modules.sh
===================================================================
--- load-modules.sh	2008-09-18 16:27:46 UTC (rev 12691)
+++ load-modules.sh	2008-09-18 16:28:24 UTC (rev 12692)
@@ -4,29 +4,48 @@
 # - Aaron Griffin & Tobias Powalowski for Archlinux
 [ $# -ne 1 ] && exit 1
 
+MODPROBE="/sbin/modprobe"
+RESOLVEALIAS="/bin/resolve-modalias"
+USEBLACKLIST="--use-blacklist"
+REPLACE="/bin/replace"
+MODDEPS="/bin/moddeps"
+
 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
+      disablemodules=*) eval $cmd ;;
+      load_modules=off) exit ;;
+    esac
+  done
+  #parse cmdline entries of the form "disablemodules=x,y,z"
+  if [ -n "${disablemodules}" ]; then
+    BLACKLIST="$(${REPLACE} ${disablemodules} ',')"
+  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}" '-' '_')"
+# sanitize the module names
+BLACKLIST="$(${REPLACE} "${BLACKLIST}" '-' '_')"
 
-if [ "${j}" != "" ] ; then
-	for n in ${i}; do
-        	for o in ${j}; do
-			if [ "$n" = "$o" ]; then
-                		exit 1
-            		fi
-		done
-	done
+if [ -n "${BLACKLIST}" ] ; then
+  # Try to find all modules for the alias
+  mods="$($RESOLVEALIAS /lib/modules/$(uname -r)/modules.alias $1)"
+  # If no modules could be found, try if the alias name is a module name
+  # In that case, omit the --use-blacklist parameter to imitate normal modprobe behaviour
+  [ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST=""
+  [ -z "${mods}" ] && exit
+  for mod in ${mods}; do
+    deps="$(${MODDEPS} ${mod})"
+    [ $? -ne 0 ] && continue
+    # If the module or any of its dependencies is blacklisted, don't load it
+    for dep in $deps; do
+      for blackmod in ${BLACKLIST}; do
+        [ "${blackmod}" = "${dep}" ] && continue 3
+      done
+    done
+    $MODPROBE $USEBLACKLIST ${mod}
+  done
+else
+  $MODPROBE $1
 fi
-/sbin/modprobe $1
 
 # vim: set et ts=4:




More information about the arch-commits mailing list