diff --git a/mkinitramfs b/mkinitramfs index d6ce859..a5a6470 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -196,15 +196,20 @@ lzop) kconfig_sym=CONFIG_RD_LZO ;; lz4) kconfig_sym=CONFIG_RD_LZ4 ;; zstd) kconfig_sym=CONFIG_RD_ZSTD ;; esac -while ! grep -q "^$kconfig_sym=y" "${kconfig}"; do - if [ "${compress}" = gzip ]; then - echo "E: gzip compression ($kconfig_sym) not supported by kernel" >&2 - exit 1 - fi - echo "W: ${compress} compression ($kconfig_sym) not supported by kernel, using gzip" >&2 - compress=gzip - kconfig_sym=CONFIG_RD_GZIP -done +if [ -e "${kconfig}" ]; then + while ! grep -q "^$kconfig_sym=y" "${kconfig}"; do + if [ "${compress}" = gzip ]; then + echo "E: gzip compression ($kconfig_sym) not supported by kernel" >&2 + exit 1 + fi + echo "W: ${compress} compression ($kconfig_sym) not supported by kernel, using gzip" >&2 + compress=gzip + kconfig_sym=CONFIG_RD_GZIP + done +else + echo "W: Kernel configuration ${kconfig} is missing, ${compress} compression" \ + "support ($kconfig_sym) cannot be checked and is assumed to be available" >&2 +fi if [ -z "${compresslevel:-}" ]; then compresslevel=${COMPRESSLEVEL:-}