99squash: Check require module earlier, and properly

Let 99squash fail earlier if required modules are not enabled or
missing, using the new added helper.

Signed-off-by: Kairui Song <kasong@redhat.com>
master
Kairui Song 2020-10-12 15:23:30 +08:00 committed by Daniel Molkentin
parent c050190f86
commit 83c65fd3db
2 changed files with 8 additions and 12 deletions

View File

@ -1846,17 +1846,6 @@ fi


if dracut_module_included "squash"; then if dracut_module_included "squash"; then
dinfo "*** Install squash loader ***" dinfo "*** Install squash loader ***"
for config in \
CONFIG_SQUASHFS \
CONFIG_OVERLAY_FS \
CONFIG_DEVTMPFS;
do
if ! check_kernel_config $config; then
dfatal "$config have to be enabled for dracut squash module to work"
exit 1
fi
done

readonly squash_dir="$initdir/squash/root" readonly squash_dir="$initdir/squash/root"
readonly squash_img="$initdir/squash/root.img" readonly squash_img="$initdir/squash/root.img"
readonly squash_candidate=( "usr" "etc" ) readonly squash_candidate=( "usr" "etc" )

View File

@ -11,6 +11,13 @@ check() {
return 1 return 1
fi fi


for i in squashfs loop overlay; do
if ! check_kernel_module $i; then
derror "dracut-squash module requires kernel module $i"
return 1
fi
done

return 255 return 255
} }


@ -20,7 +27,7 @@ depends() {
} }


installkernel() { installkernel() {
hostonly="" instmods -c squashfs loop overlay hostonly="" instmods squashfs loop overlay
} }


install() { install() {