From: Harald Hoyer Date: Wed, 22 Feb 2012 15:12:10 +0000 (+0100) Subject: change omit_drivers to support regexp expressions X-Git-Tag: 017~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34248c926cef4adeb0c73b2f89c1ba992edccd19;p=thirdparty%2Fdracut.git change omit_drivers to support regexp expressions --- diff --git a/dracut-functions.sh b/dracut-functions.sh index 3f3667f48..95d7cbba2 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -1005,7 +1005,11 @@ install_kmod_with_fw() { local _kmod=${1##*/} _kmod=${_kmod%.ko} _kmod=${_kmod/-/_} - if strstr " $omit_drivers " " $_kmod " ; then + if [[ "$_kmod" =~ $omit_drivers ]]; then + dinfo "Omitting driver $_kmod" + return 1 + fi + if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then dinfo "Omitting driver $_kmod" return 1 fi @@ -1141,12 +1145,17 @@ instmods() { ;; --*) _mpargs+=" $_mod" ;; i2o_scsi) return ;; # Do not load this diagnostic-only module - *) _mod=${_mod##*/} - + *) # if we are already installed, skip this module and go on # to the next one. [[ -f $initdir/$1 ]] && return + if [[ $omit_drivers ]] && [[ "$1" =~ $omit_drivers ]]; then + dinfo "Omitting driver ${_mod##$srcmods}" + return + fi + + _mod=${_mod##*/} # If we are building a host-specific initramfs and this # module is not already loaded, move on to the next one. [[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc/modules \ diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example index 539e2639d..efec77eb0 100644 --- a/dracut.conf.d/fedora.conf.example +++ b/dracut.conf.d/fedora.conf.example @@ -4,7 +4,7 @@ i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP" add_dracutmodules+=" rpmversion " omit_dracutmodules+=" dash " -omit_drivers+=" ocfs2 " +omit_drivers+=" .*/fs/ocfs/.* " stdloglvl=3 realinitpath="/usr/lib/systemd/systemd" install_items+=" vi /etc/virc ps grep cat rm openvt " diff --git a/dracut.sh b/dracut.sh index 8208c926e..38543beb6 100755 --- a/dracut.sh +++ b/dracut.sh @@ -477,12 +477,12 @@ if (( ${#omit_drivers_l[@]} )); then fi omit_drivers=${omit_drivers/-/_} -unset omit_drivers_corrected +omit_drivers_corrected="" for d in $omit_drivers; do strstr " $drivers $add_drivers " " $d " && continue - omit_drivers_corrected+=" $d " + omit_drivers_corrected+="$d|" done -omit_drivers=$omit_drivers_corrected +omit_drivers="${omit_drivers_corrected%|}" unset omit_drivers_corrected