summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-11 04:20:28 +0200
committerDave Reisner <dreisner@archlinux.org>2011-09-27 12:18:04 +0200
commit5a0f7ebc8d2cede7532539268e0ffc0bd6816572 (patch)
tree1709a7c58504db390f0161977af581e32da394fc /functions
parentff557b25937b3511dd04e009a4735b73d1279d4c (diff)
downloadmkinitcpio-5a0f7ebc8d2cede7532539268e0ffc0bd6816572.tar.gz
mkinitcpio-5a0f7ebc8d2cede7532539268e0ffc0bd6816572.tar.xz
functions: allow ignoring errors on module addition
We conditionally, but naively, add modules in some of our install hooks, but the kernel may not have these. Note that these modules can fail silently by detecting a '?' suffix on the module name. In conjunction with this, the add_module function now takes a flag, -t or --try, which will ignore module not found errors from modinfo. The config file will also support this syntax. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'functions')
-rw-r--r--functions20
1 files changed, 16 insertions, 4 deletions
diff --git a/functions b/functions
index 3c0cd89..c7e167e 100644
--- a/functions
+++ b/functions
@@ -137,6 +137,13 @@ add_module() {
# $1: module name
local module path dep deps field value
+ local -i ign_errors=0
+
+ if [[ $1 = -@(t|-try) ]]; then
+ ign_errors=1
+ shift
+ fi
+
module=${1%.ko*}
# skip expensive stuff if this module has already been added
@@ -162,6 +169,7 @@ add_module() {
done < <(modinfo -b "$BASEDIR" -k "$KERNELVERSION" -0 "$module" 2>/dev/null)
if [[ -z $path ]]; then
+ (( ign_errors )) && return 0
error "module not found: \`%s'" "$module"
return 1
fi
@@ -173,9 +181,9 @@ add_module() {
# explicit module depends
case "$module" in
- fat) add_module "nls_cp437" ;;
- ocfs2) add_module "configfs" ;;
- libcrc32c) add_module "crc32c"; add_module "crc32c_intel" ;;
+ fat) add_module --try "nls_cp437" ;;
+ ocfs2) add_module --try "configfs" ;;
+ libcrc32c) add_module --try "crc32c"; add_module --try "crc32c_intel" ;;
esac
}
@@ -291,7 +299,11 @@ parse_hook() {
local item
for item in $MODULES; do
- add_module "$item"
+ if [[ ${item:(-1)} = '?' ]]; then
+ try=--try
+ item=${item%\?}
+ fi
+ add_module $try "$item"
done
for item in $BINARIES; do