--- mkinitrd.orig 2008-11-30 15:35:58.000000000 +0100 +++ mkinitrd 2008-12-11 11:16:37.000000000 +0100 @@ -277,6 +277,12 @@ esac done +# If kernel modules are needed but the kernel version is absent, exit now: +if [ ! -d /lib/modules/$KERNEL_VERSION ]; then + echo "No modules tree found for kernel \"$KERNEL_VERSION\"" + exit 1 +fi + # If clearing source tree was requested, do that first if [ "$CLEAR_TREE" = "1" ]; then clear_source_tree