| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.13 2004/12/28 21:00:10 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.14 2004/12/29 11:22:41 johnm Exp $ |
| 4 | # |
4 | # |
| 5 | # Description: This eclass is used as a central eclass for accessing kernel |
5 | # Description: This eclass is used as a central eclass for accessing kernel |
| 6 | # related information for sources already installed. |
6 | # related information for sources already installed. |
| 7 | # It is vital for linux-mod to function correctly, and is split |
7 | # It is vital for linux-mod to function correctly, and is split |
| 8 | # out so that any ebuild behaviour "templates" are abstracted out |
8 | # out so that any ebuild behaviour "templates" are abstracted out |
| … | |
… | |
| 180 | |
180 | |
| 181 | kernel_is() { |
181 | kernel_is() { |
| 182 | # if we haven't determined the version yet, we need too. |
182 | # if we haven't determined the version yet, we need too. |
| 183 | get_version; |
183 | get_version; |
| 184 | |
184 | |
| 185 | local RESULT operator value test |
185 | local RESULT operator test value |
| 186 | RESULT=0 |
186 | RESULT=0 |
| 187 | |
187 | |
| 188 | operator="=" |
188 | operator="=" |
| 189 | if [ "${1}" == "lt" ] |
189 | if [ "${1}" == "lt" ] |
| 190 | then |
190 | then |
| … | |
… | |
| 204 | shift |
204 | shift |
| 205 | fi |
205 | fi |
| 206 | |
206 | |
| 207 | if [ -n "${1}" ] |
207 | if [ -n "${1}" ] |
| 208 | then |
208 | then |
| 209 | [ ${KV_MAJOR} ${operator} ${1} ] || RESULT=1 |
209 | value="${value}${1}" |
|
|
210 | test="${test}${KV_MAJOR}" |
| 210 | fi |
211 | fi |
| 211 | if [ -n "${2}" ] |
212 | if [ -n "${2}" ] |
| 212 | then |
213 | then |
| 213 | [ ${KV_MINOR} ${operator} ${2} -a ${RESULT} -eq 0 ] || RESULT=1 |
214 | value="${value}${2}" |
|
|
215 | test="${test}${KV_MINOR}" |
| 214 | fi |
216 | fi |
| 215 | if [ -n "${3}" ] |
217 | if [ -n "${3}" ] |
| 216 | then |
218 | then |
| 217 | [ ${KV_PATCH} ${operator} ${3} -a ${RESULT} -eq 0 ] || RESULT=1 |
219 | value="${value}${3}" |
|
|
220 | test="${test}${KV_PATCH}" |
| 218 | fi |
221 | fi |
| 219 | return ${RESULT} |
222 | |
|
|
223 | [ ${test} ${operator} ${value} ] && return 0 || return 1 |
| 220 | } |
224 | } |
| 221 | |
225 | |
| 222 | get_version() { |
226 | get_version() { |
| 223 | local kbuild_output |
227 | local kbuild_output |
| 224 | |
228 | |