Message info
 
To:arch-projects@archlinux.org From:Dave Reisner Subject:[arch-projects] [mkinitcpio][PATCH 07/19] functions: move --try logic into add_module Date:Sun, 13 May 2012 13:57:10 -0400
 

Allow add_module to detect trailing ? characters for ignoring errors
rather than passing -t or --try to add_module.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
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
--
1.7.10.2