dracut-functions: fix check=255 logic and dependencies

master
Harald Hoyer 2010-08-02 09:40:18 +02:00
parent 9c111e59c9
commit f007e84e8e
1 changed files with 16 additions and 8 deletions

View File

@ -482,7 +482,8 @@ inst_opt_decompress() {
check_module_deps() {
local moddir dep ret
# if we are already set to be loaded, we do not have to be checked again.
strstr "$mods_to_load" " $1 " && return
strstr " $mods_to_load " " $1 " && return
strstr " $omit_dracutmodules " " $1 " && return 1
# turn a module name into a directory, if we can.
moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir && -x $moddir/install ]] || return 1
@ -503,13 +504,14 @@ check_module_deps() {

should_source_module() {
local dep
local ret
if [[ $kernel_only = yes ]]; then
[[ -x $1/installkernel ]] && return 0
return 1
fi
[[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
[[ -x $1/check ]] || return 0
"$1/check" $hostonly || return 1
"$1/check" $hostonly || continue
for dep in $("$1/check" -d); do
check_module_deps "$dep" && continue
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
@ -523,13 +525,11 @@ check_modules() {
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr "$mods_to_load" " $mod " && continue
strstr " $mods_to_load " " $mod " && continue
# This should never happen, but...
[[ -d $moddir ]] || continue

strstr "$omit_dracutmodules" "$mod" && continue

if ! strstr "$dracutmodules $add_dracutmodules" "$mod"; then
if ! strstr " $dracutmodules $add_dracutmodules " " $mod "; then
# module not in our list
if [[ $dracutmodules = all ]]; then
# check, if we can install this module
@ -538,6 +538,14 @@ check_modules() {
# skip this module
continue
fi
else
if [ -x "$moddir/check" ] \
&& "$moddir/check" -d > /dev/null 2>&1; then
check_module_deps "$mod" || {
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
continue
}
fi
fi

mods_to_load+=" $mod "
@ -546,8 +554,8 @@ check_modules() {
modcheck=$add_dracutmodules
[[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
for mod in $modcheck; do
strstr "$mods_to_load" "$mod" && continue
strstr "$omit_dracutmodules" "$mod" && continue
strstr " $mods_to_load " " $mod " && continue
strstr " $omit_dracutmodules " " $mod " && continue
dwarning "Dracut module \"$mod\" cannot be found."
done
}