summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/udev/mod-blacklist.sh
blob: 264192a6c04c63672ddbd02bf7502859cfdf446b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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: