/[gentoo-x86]/eclass/linux-info.eclass
Gentoo

Diff of /eclass/linux-info.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.4 Revision 1.5
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.4 2004/11/28 09:47:31 johnm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.5 2004/12/01 18:08:57 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
18 18
19# getfilevar accepts 2 vars as follows: 19# getfilevar accepts 2 vars as follows:
20# getfilevar <VARIABLE> <CONFIGFILE> 20# getfilevar <VARIABLE> <CONFIGFILE>
21 21
22getfilevar() { 22getfilevar() {
23local ERROR 23local ERROR curpwd
24 ERROR=0 24 ERROR=0
25 25
26 [ -z "${1}" ] && ERROR=1 26 [ -z "${1}" ] && ERROR=1
27 [ -z "${2}" ] && ERROR=1
28 [ ! -f "${2}" ] && ERROR=1 27 [ ! -f "${2}" ] && ERROR=1
29 28
30 if [ "${ERROR}" = 1 ] 29 if [ "${ERROR}" = 1 ]
31 then 30 then
32 eerror "getfilevar requires 2 variables, with the second a valid file." 31 eerror "getfilevar requires 2 variables, with the second a valid file."
33 eerror " getfilevar <VARIABLE> <CONFIGFILE>" 32 eerror " getfilevar <VARIABLE> <CONFIGFILE>"
34 else 33 else
34 curpwd="${PWD}"
35 cd $(dirname ${2})
36 echo $(echo -e "include $(basename ${2})\ne:\n\t@echo \$(${1})" | make -f - e)
37 cd ${curpwd}
35 grep -e "^$1[= ]" $2 | sed 's: = :=:' | cut -d= -f2- 38 # grep -e "^$1[= ]" $2 | sed 's: = :=:' | cut -d= -f2-
36 fi 39 fi
37} 40}
38 41
39getfilevar_isset() { 42getfilevar_isset() {
40local RESULT 43local RESULT

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20