From 99d64f5789f01243903be4b32078ec38bdce75fa Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Mon, 9 May 2011 22:15:43 +0200 Subject: udev: generate blacklist on boot udev will read /etc/modprobe.d/*.conf and blacklist all modules that are listed as blacklist We parse rc.conf at boot and generate such a .conf file. It cannot be written to /etc this early, so we save it to /run. A symlink exists in /etc to get the desired functionality. With this patch (and an analogous one in mkinitcpio) load-modules.sh can be removed from the udev package without loss of significant functionality. Setting MOD_AUTOLOAD will then no longer take effect, nor will kernel parameters. Thouhgh, kernel parameters might still affect the initramfs as the implementation is independent. Original-idea-by: Benjamen Richer Based-on-patch-by: David Reisner Signed-off-by: Tom Gundersen --- modprobe-blacklist | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 modprobe-blacklist (limited to 'modprobe-blacklist') diff --git a/modprobe-blacklist b/modprobe-blacklist new file mode 100755 index 0000000..8af5d90 --- /dev/null +++ b/modprobe-blacklist @@ -0,0 +1,25 @@ +#!/bin/bash +# +# /etc/rc.gen-modules-list +# + +. /etc/rc.conf + +declare -a blacklist +for mod in "${MODULES[@]}"; do + case $mod in + !*) blacklist+=("${mod:1}") ;; + *) ;; + esac +done + +# create new module blacklist in /run/initscripts, there should be a symlink in /etc/modprobe.d/ pointing here +if [[ $blacklist ]]; then + /bin/mkdir -p /run/initscripts + echo "# Autogenerated from rc.conf at boot, do not edit" > /run/initscripts/modprobe-blacklist.conf + (( ${#blacklist[@]} )) && printf 'blacklist %s\n' "${blacklist[@]}" >> /run/initscripts/modprobe-blacklist.conf +fi + +unset blacklist + +# vim: set noet ts=2 sw=2: -- cgit v1.2.3