summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/klibc-udev/load-modules.sh
blob: f0961a7f30c6545aaa21c4fb8fcfe252bcc44df7 (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
#! /bin/sh
# Implement blacklisting for udev-loaded modules
#   Includes module checking
# - Aaron Griffin & Tobias Powalowski for Archlinux
[ $# -ne 1 ] && exit 1

if [ -f /proc/cmdline ]; then 
	for cmd in $(cat /proc/cmdline); do
    		case $cmd in
        		*=*) eval $cmd ;;
    		esac
	done
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 [ "${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

# vim: set et ts=4: