diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-07-24 00:04:53 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-07-24 00:06:48 +0200 |
commit | e893119949ec1f94b83dc467514dc9ad4495a596 (patch) | |
tree | 74c1f64b8ed37f12753dd2b89468cc22f47a2ebf /eclass | |
parent | dev-perl/Params-Util: Version bump 1.102 (diff) | |
download | gentoo-e893119949ec1f94b83dc467514dc9ad4495a596.tar.gz gentoo-e893119949ec1f94b83dc467514dc9ad4495a596.tar.bz2 gentoo-e893119949ec1f94b83dc467514dc9ad4495a596.zip |
kernel-install.eclass: Add a safety check for mismatched version
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/kernel-install.eclass | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index e6b9cbe45c0e..b80a8d6ea93b 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -388,11 +388,23 @@ kernel-install_src_test() { # @FUNCTION: kernel-install_pkg_preinst # @DESCRIPTION: -# Stub out mount-boot.eclass. +# Verify whether the kernel has been installed correctly. kernel-install_pkg_preinst() { debug-print-function ${FUNCNAME} "${@}" - # (no-op) + local ver="${PV}${KV_LOCALVERSION}" + local kdir="${ED}/usr/src/linux-${ver}" + local relfile="${kdir}/include/config/kernel.release" + [[ ! -d ${kdir} ]] && die "Kernel directory ${kdir} not installed!" + [[ ! -f ${relfile} ]] && die "Release file ${relfile} not installed!" + local release="$(<"${relfile}")" + if [[ ${release} != ${PV}* ]]; then + eerror "Kernel release mismatch!" + eerror " expected (PV): ${PV}*" + eerror " found: ${release}" + eerror "Please verify that you are applying the correct patches." + die "Kernel release mismatch (${release} instead of ${PV}*)" + fi } # @FUNCTION: kernel-install_install_all |