From fdc89d71aae5d8b7449281fd62a681bf9552b54f Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 8 May 2012 09:04:22 -0400 Subject: functions: move --try logic into add_module Allow add_module to detect trailing ? characters for ignoring errors rather than passing -t or --try to add_module. Signed-off-by: Dave Reisner --- functions | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/functions b/functions index 5d986da..052dced 100644 --- a/functions +++ b/functions @@ -232,11 +232,11 @@ add_module() { # $1: module name local module= path= dep= deps= field= value= - local -i ign_errors=0 + local ign_errors=0 - if [[ $1 = -@(t|-try) ]]; then + if [[ $1 = *\? ]]; then ign_errors=1 - shift + set -- "${1%?}" fi module=${1%.ko*} @@ -274,11 +274,18 @@ add_module() { MODPATHS+=("$path") ADDED_MODULES+=("${module//-/_}") - # explicit module depends - case "$module" in - fat) add_module --try "nls_cp437" ;; - ocfs2) add_module --try "configfs" ;; - libcrc32c) add_module --try "crc32c"; add_module --try "crc32c_intel" ;; + # handle module quirks + case $module in + fat) + add_module "nls_cp437?" + ;; + ocfs2) + add_module "configfs?" + ;; + libcrc32c) + add_module "crc32c_intel?" + add_module "crc32c?" + ;; esac } @@ -422,11 +429,7 @@ parse_hook() { local item= script= for item in $MODULES; do - if [[ ${item:(-1)} = '?' ]]; then - add_module --try "${item%\?}" - else - add_module "$item" - fi + add_module "$item" done for item in $BINARIES; do -- cgit v1.2.3-24-g4f1b