Check for the kconfig in /lib/modules/ too

Supporting kernel packages shipping files in /lib/ instead of
/boot.
This commit is contained in:
Luca Boccassi 2022-10-31 00:09:09 +00:00
parent dd16eade69
commit 90addd04bc

View File

@ -179,6 +179,12 @@ if ! command -v "${compress}" >/dev/null 2>&1; then
compress=gzip
fi
# Support packages installing in /lib/ rather than /boot/
kconfig="/lib/modules/${version}/config-${version}"
if [ ! -f "$kconfig" ]; then
kconfig="/boot/config-${version}"
fi
# Check that kernel supports selected compressor, and fall back to gzip.
# Exit if even gzip is not supported.
case "${compress}" in
@ -190,7 +196,7 @@ 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" "/boot/config-${version}"; do
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