diff options
author | Seemant Kulleen <seemant@gentoo.org> | 2003-08-02 20:48:24 +0000 |
---|---|---|
committer | Seemant Kulleen <seemant@gentoo.org> | 2003-08-02 20:48:24 +0000 |
commit | c558affd8aaac9500c92277e6b885695cd74064d (patch) | |
tree | 1c6c909a28c4ddc1dcb2a37fd7a789045f4f6c12 /eclass | |
parent | masked icky versions of openafs (diff) | |
download | historical-c558affd8aaac9500c92277e6b885695cd74064d.tar.gz historical-c558affd8aaac9500c92277e6b885695cd74064d.tar.bz2 historical-c558affd8aaac9500c92277e6b885695cd74064d.zip |
kernel checking functions, extracted from the nvidia-kernel ebuilds that Azarah wrote
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/check-kernel.eclass | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/eclass/check-kernel.eclass b/eclass/check-kernel.eclass new file mode 100644 index 000000000000..f7b04a9585d9 --- /dev/null +++ b/eclass/check-kernel.eclass @@ -0,0 +1,72 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/check-kernel.eclass,v 1.1 2003/08/02 20:48:24 seemant Exp $ + +# Author: Martin Schlemmer <azarah@gentoo.org> +# Eclass'd by: Seemant Kulleen <seemant@gentoo.org> +# +# The check-kernel eclass is designed to detect the kernel sources and +# report info on the versions + +ECLASS=check-kernel +INHERITED="${INHERITED} ${ECLASS}" + +EXPORT_FUNCTIONS check_version_h get_KV_info \ + is_2_4_kernel is_2_5_kernel is_2_6_kernel + +newdepend "sys-apps/gawk" + +check_version_h() { + if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ] + then + eerror "Please verify that your /usr/src/linux symlink is pointing" + eerror "to your current kernel sources, and that you did run:" + eerror + eerror " # make dep" + die "/usr/src/linux symlink not setup!" + fi +} + +get_KV_info() { + check_version_h + + # Get the kernel version of sources in /usr/src/linux ... + export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \ + "${ROOT}/usr/src/linux/include/linux/version.h")" + export KV_major="$(echo "${KV_full}" | cut -d. -f1)" + export KV_minor="$(echo "${KV_full}" | cut -d. -f2)" + export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')" +} + +is_2_4_kernel() { + get_KV_info + + if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 4 ] + then + return 0 + else + return 1 + fi +} + +is_2_5_kernel() { + get_KV_info + + if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ] + then + return 0 + else + return 1 + fi +} + +is_2_6_kernel() { + get_KV_info + + if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 6 ] + then + return 0 + else + return 1 + fi +} |