diff --git a/init b/init index 3a34a45..0ff99f3 100644 --- a/init +++ b/init @@ -18,17 +18,6 @@ echo "/sbin/modprobe" > /proc/sys/kernel/modprobe # set default mount handler mount_handler="default_mount_handler" -# if available, start udevd at this stage -if [ -x /sbin/udevd ]; then - msg ":: Starting udevd..." - echo > /proc/sys/kernel/hotplug - /sbin/udevd --daemon --resolve-names=never - export udevd_running=1 - msg "done." -else - export udevd_running=0 -fi - for cmd in ${CMDLINE}; do case "${cmd}" in \#*) break ;; # ignore everything after a # in the commandline @@ -57,12 +46,28 @@ if [ -n "${disablehooks}" ]; then done fi +# build module blacklist +mkdir -p /etc/modprobe.d +touch /dev/.blacklist.sys.conf +ln -sf /dev/.blacklist.sys.conf /etc/modprobe.d/blacklist.sys.conf if [ -n "${disablemodules}" ]; then for d in $(echo "${disablemodules}" | sed 's|,| |g'); do export "mod_${d}=disabled" + echo "install ${d} /bin/false" >>/dev/.blacklist.sys.conf done fi +# if available, start udevd at this stage +if [ -x /sbin/udevd ]; then + msg ":: Starting udevd..." + echo > /proc/sys/kernel/hotplug + /sbin/udevd --daemon --resolve-names=never + export udevd_running=1 + msg "done." +else + export udevd_running=0 +fi + if [ -n "${earlymodules}" ]; then for m in $(echo "${earlymodules}" | sed 's|,| |g'); do /sbin/modprobe -q ${m} > /dev/null 2>&1 diff --git a/install/udev b/install/udev index 17a82c9..d261c48 100644 --- a/install/udev +++ b/install/udev @@ -14,7 +14,6 @@ install () for tool in firmware; do add_file /lib/udev/${tool} done - add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh } help () diff --git a/load-modules.sh b/load-modules.sh deleted file mode 100755 index 1824e5e..0000000 --- a/load-modules.sh +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh -# Implement blacklisting for udev-loaded modules -# Includes module checking -# - Aaron Griffin, Tobias Powalowski & Thomas Bächler for Arch Linux -[ $# -ne 1 ] && exit 1 - -MODPROBE="/sbin/modprobe" -RESOLVEALIAS="${MODPROBE} --resolve-alias" -USEBLACKLIST="--use-blacklist" -SED="/bin/sed" - -if [ -f /proc/cmdline ]; then - 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="$(echo "${disablemodules}" | ${SED} 's|,| |g')" - fi -fi - -# sanitize the module names -BLACKLIST="$(echo "${BLACKLIST}" | ${SED} 's|-|_|g')" - -if [ -n "${BLACKLIST}" ] ; then - # Try to find all modules for the alias - mods="$($RESOLVEALIAS $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 - # Find the module and all its dependencies - deps="$($MODPROBE -i --show-depends ${mod})" - [ $? -ne 0 ] && continue - - #sanitize the module names - deps="$(echo "$deps" | ${SED} \ - -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" \ - -e 's|-|_|g')" - # 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 $USEBLACKLIST $1 -fi - -# vim: set et ts=4: