summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJohn Mylchreest <johnm@gentoo.org>2004-12-28 20:14:44 +0000
committerJohn Mylchreest <johnm@gentoo.org>2004-12-28 20:14:44 +0000
commit81f7fa96c5a1c1ed3409cd57f1e808778a10f1ca (patch)
tree6d1f4e130b20c668bf427571d69f901665c3c2f3 /eclass
parentManifest recommit (diff)
downloadhistorical-81f7fa96c5a1c1ed3409cd57f1e808778a10f1ca.tar.gz
historical-81f7fa96c5a1c1ed3409cd57f1e808778a10f1ca.tar.bz2
historical-81f7fa96c5a1c1ed3409cd57f1e808778a10f1ca.zip
adding support for operators to kernel_is
Diffstat (limited to 'eclass')
-rw-r--r--eclass/kernel-2.eclass39
1 files changed, 29 insertions, 10 deletions
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 190768fa3b39..cc0f45a35261 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.63 2004/12/27 13:31:48 johnm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.64 2004/12/28 20:14:44 johnm Exp $
# Description: kernel.eclass rewrite for a clean base regarding the 2.6
# series of kernel with back-compatibility for 2.4
@@ -60,28 +60,47 @@ SLOT="${PVR}"
#Eclass functions only from here onwards ...
#==============================================================
kernel_is() {
- local RESULT
- RESULT=1
+ # if we haven't determined the version yet, we need too.
+ get_version;
+
+ local RESULT operator value test
+ RESULT=0
+
+ operator="-eq"
+ if [ "${1}" == "lt" ]
+ then
+ operator="-lt"
+ shift
+ elif [ "${1}" == "gt" ]
+ then
+ operator="-gt"
+ shift
+ elif [ "${1}" == "le" ]
+ then
+ operator="-le"
+ shift
+ elif [ "${1}" == "ge" ]
+ then
+ operator="-ge"
+ shift
+ fi
if [ -n "${1}" ]
then
- [ "${1}" = "${KV_MAJOR}" ] && RESULT=0
+ [ ${KV_MAJOR} ${operator} ${1} ] || RESULT=1
fi
-
if [ -n "${2}" ]
then
- RESULT=1
- [ "${2}" = "${KV_MINOR}" ] && RESULT=0
+ [ ${KV_MINOR} ${operator} ${2} -a ${RESULT} -eq 0 ] || RESULT=1
fi
-
if [ -n "${3}" ]
then
- RESULT=1
- [ "${3}" = "${KV_PATCH}" ] && RESULT=0
+ [ ${KV_PATCH} ${operator} ${3} -a ${RESULT} -eq 0 ] || RESULT=1
fi
return ${RESULT}
}
+
kernel_is_2_4() {
kernel_is 2 4
return $?