summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorDonnie Berkholz <spyderous@gentoo.org>2003-09-30 06:08:35 +0000
committerDonnie Berkholz <spyderous@gentoo.org>2003-09-30 06:08:35 +0000
commit29e7a8e10839abbe96bea1eae27783c362b5cfb5 (patch)
tree5466735d66a8a7b1ffe60905cf74641a35ad0523 /eclass
parentgnubg-0.13.0-r1 escaped before it was ready. (diff)
downloadgentoo-2-29e7a8e10839abbe96bea1eae27783c362b5cfb5.tar.gz
gentoo-2-29e7a8e10839abbe96bea1eae27783c362b5cfb5.tar.bz2
gentoo-2-29e7a8e10839abbe96bea1eae27783c362b5cfb5.zip
Adding kernel version checking.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/xfree.eclass33
1 files changed, 28 insertions, 5 deletions
diff --git a/eclass/xfree.eclass b/eclass/xfree.eclass
index b899dc0cb86e..9e366e3a313a 100644
--- a/eclass/xfree.eclass
+++ b/eclass/xfree.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/xfree.eclass,v 1.5 2003/09/16 07:45:10 spyderous Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/xfree.eclass,v 1.6 2003/09/30 06:08:35 spyderous Exp $
#
# Author: Seemant Kulleen <seemant@gentoo.org>
#
@@ -13,11 +13,9 @@
ECLASS=xfree
INHERITED="${INHERITED} ${ECLASS}"
-EXPORT_FUNCTIONS vcards
+EXPORT_FUNCTIONS vcards is_kernel
-
-vcards() {
-
+vcards() {
has "$1" ${VIDEO_CARDS} && return 0
return 1
}
@@ -25,3 +23,28 @@ vcards() {
filter-patch() {
mv ${PATCH_DIR}/"*${1}*" ${PATCH_DIR}/excluded
}
+
+# This is to ease kernel checks for patching and other things. (spyderous)
+# Kernel checker is_kernel $1 $2 where $1 is KV_major and $2 is KV_minor.
+# is_kernel "2" "4" should map to a 2.4 kernel, etc.
+
+get_KV_info() {
+ check_KV
+
+ # 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_kernel() {
+ get_KV_info
+
+ if [ "${KV_major}" -eq ${1} -a "${KV_minor}" -eq ${2} ]
+ then
+ return 0
+ else
+ return 1
+ fi
+}