| 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.2 2004/11/25 19:47:18 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.3 2004/11/27 11:26:52 johnm Exp $ |
| 4 | # |
4 | # |
| 5 | # This eclass provides functions for querying the installed kernel |
5 | # This eclass provides functions for querying the installed kernel |
| 6 | # source version, selected kernel options etc. |
6 | # source version, selected kernel options etc. |
| 7 | # |
7 | # |
| 8 | |
8 | |
| … | |
… | |
| 10 | INHERITED="$INHERITED $ECLASS" |
10 | INHERITED="$INHERITED $ECLASS" |
| 11 | |
11 | |
| 12 | # Overwritable environment Var's |
12 | # Overwritable environment Var's |
| 13 | # --------------------------------------- |
13 | # --------------------------------------- |
| 14 | KERNEL_DIR="${KERNEL_DIR:-/usr/src/linux}" |
14 | KERNEL_DIR="${KERNEL_DIR:-/usr/src/linux}" |
|
|
15 | |
| 15 | |
16 | |
| 16 | |
17 | |
| 17 | # File Functions |
18 | # File Functions |
| 18 | # --------------------------------------- |
19 | # --------------------------------------- |
| 19 | |
20 | |
| … | |
… | |
| 31 | if [ "${ERROR}" = 1 ] |
32 | if [ "${ERROR}" = 1 ] |
| 32 | then |
33 | then |
| 33 | eerror "getfilevar requires 2 variables, with the second a valid file." |
34 | eerror "getfilevar requires 2 variables, with the second a valid file." |
| 34 | eerror " getfilevar <VARIABLE> <CONFIGFILE>" |
35 | eerror " getfilevar <VARIABLE> <CONFIGFILE>" |
| 35 | else |
36 | else |
| 36 | grep -e "^$1" $2 | sed 's: = :=:' | cut -d= -f2- |
37 | grep -e "^$1[= ]" $2 | sed 's: = :=:' | cut -d= -f2- |
| 37 | fi |
38 | fi |
| 38 | } |
39 | } |
| 39 | |
40 | |
| 40 | getfilevar_isset() { |
41 | getfilevar_isset() { |
| 41 | local RESULT |
42 | local RESULT |
| … | |
… | |
| 64 | # kernel_is 2 4 returns false |
65 | # kernel_is 2 4 returns false |
| 65 | # kernel_is 2 returns true |
66 | # kernel_is 2 returns true |
| 66 | # kernel_is 2 6 returns true |
67 | # kernel_is 2 6 returns true |
| 67 | # kernel_is 2 6 8 returns false |
68 | # kernel_is 2 6 8 returns false |
| 68 | # kernel_is 2 6 9 returns true |
69 | # kernel_is 2 6 9 returns true |
|
|
70 | # |
| 69 | # got the jist yet? |
71 | # got the jist yet? |
| 70 | |
72 | |
| 71 | kernel_is() { |
73 | kernel_is() { |
| 72 | # if we haven't determined the version yet, we need too. |
74 | # if we haven't determined the version yet, we need too. |
| 73 | get_version; |
75 | get_version; |
| … | |
… | |
| 178 | if [ "$?" != 0 ] |
180 | if [ "$?" != 0 ] |
| 179 | then |
181 | then |
| 180 | eerror "These sources do not support loading external modules." |
182 | eerror "These sources do not support loading external modules." |
| 181 | eerror "to be able to use this module please enable \"Loadable modules support\"" |
183 | eerror "to be able to use this module please enable \"Loadable modules support\"" |
| 182 | eerror "in your kernel, recompile and then try merging this module again." |
184 | eerror "in your kernel, recompile and then try merging this module again." |
|
|
185 | die No support for external modules in ${KV_FUll} config |
|
|
186 | fi |
|
|
187 | } |
|
|
188 | |
|
|
189 | check_extra_config() { |
|
|
190 | local config negate error |
|
|
191 | |
|
|
192 | # if we haven't determined the version yet, we need too. |
|
|
193 | get_version; |
|
|
194 | |
|
|
195 | einfo "Checking for suitable kernel configuration options" |
|
|
196 | for config in ${CONFIG_CHECK} |
|
|
197 | do |
|
|
198 | negate="${config:0:1}" |
|
|
199 | if [ "${negate}" == "!" ]; |
|
|
200 | then |
|
|
201 | config="${config:1}" |
|
|
202 | if getfilevar_isset ${config} ${KV_DIR}/.config ; |
|
|
203 | then |
|
|
204 | eerror " ${config}:\tshould not be set in the kernel configuration, but it is." |
|
|
205 | error=1 |
|
|
206 | fi |
|
|
207 | else |
|
|
208 | if ! getfilevar_isset ${config} ${KV_DIR}/.config ; |
|
|
209 | then |
|
|
210 | eerror " ${config}:\tshould be set in the kernel configuration, but isn't" |
|
|
211 | error=1 |
|
|
212 | fi |
|
|
213 | fi |
|
|
214 | done |
|
|
215 | |
|
|
216 | if [ -n "${error}" ] ; |
|
|
217 | then |
|
|
218 | eerror "Please check to make sure these options are set correctly." |
|
|
219 | eerror "Once you have satisfied these options, please try merging" |
|
|
220 | eerror "this package again." |
|
|
221 | die Incorrect kernel configuration options |
| 183 | fi |
222 | fi |
| 184 | } |
223 | } |
| 185 | |
224 | |
| 186 | check_zlibinflate() { |
225 | check_zlibinflate() { |
| 187 | # if we haven't determined the version yet, we need too. |
226 | # if we haven't determined the version yet, we need too. |