summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/udev/mod-blacklist.sh
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/udev/mod-blacklist.sh')
-rwxr-xr-xabs/core-testing/udev/mod-blacklist.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/abs/core-testing/udev/mod-blacklist.sh b/abs/core-testing/udev/mod-blacklist.sh
new file mode 100755
index 0000000..264192a
--- /dev/null
+++ b/abs/core-testing/udev/mod-blacklist.sh
@@ -0,0 +1,47 @@
+#! /bin/bash
+# Export a combined blacklist of all modules
+# for use by the load-modules script
+#
+# NOTE: we only need bash because of rc.conf, but this
+# is a one-time use script, so we're good
+
+. /etc/rc.conf
+
+# grab modules from rc.conf
+BLACKLIST="${MOD_BLACKLIST[@]}"
+
+if [ -f /proc/cmdline ]; then
+ 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 | sed 's|,| |g')"
+ fi
+ if [ "$load_modules" == "off" ]; then
+ MOD_AUTOLOAD="no"
+ fi
+fi
+
+# blacklist framebuffer modules
+DRIVER_DIR="/lib/modules/$(uname -r)/kernel/drivers/"
+for x in $DRIVER_DIR/video/*/*fb*; do
+ BLACKLIST="$BLACKLIST $(basename $x .ko)"
+done
+for x in $DRIVER_DIR/video/*fb*; do
+ BLACKLIST="$BLACKLIST $(basename $x .ko)"
+done
+
+#MODULES entries in rc.conf that begin with ! are blacklisted
+for mod in ${MODULES[@]}; do
+ if [ "${mod}" != "${mod#!}" ]; then
+ BLACKLIST="$BLACKLIST ${mod#!}"
+ fi
+done
+
+echo "MOD_AUTOLOAD=\"$MOD_AUTOLOAD\""
+echo "BLACKLIST=\"$BLACKLIST\""
+
+# vim: set et ts=4: