diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-09-12 09:58:42 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-09-12 09:58:42 +0200 |
commit | 023cdbc74b8235740b0cf01b03a994b2f74ea547 (patch) | |
tree | 40b72d2abe4b42a6dba9d19eaadfb0548dbd90d5 /scripts/libptxdist.sh | |
parent | 014b551823d08b7a5a9be8c8bafd648bf48de79e (diff) | |
download | ptxdist-023cdbc74b8235740b0cf01b03a994b2f74ea547.tar.gz ptxdist-023cdbc74b8235740b0cf01b03a994b2f74ea547.tar.xz |
libptxdist: add ptxd_get_kconfig
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r-- | scripts/libptxdist.sh | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 7d7e3b690..0f1f7435e 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -112,36 +112,41 @@ export -f ptxd_source_kconfig # -# get a symbol from the ptx or platformconfig +# get a symbol from the kconfig file +# +# $1: the config file +# $2: the symbol name # # return: # 1: symbol not found # 2: symbol invalid -# 3: config file broken # -ptxd_get_ptxconf() { - unset "${1}" 2>/dev/null || return 2 - - if test -f "${PTXDIST_PLATFORMCONFIG}"; then - source "${PTXDIST_PLATFORMCONFIG}" || \ - ptxd_bailout "unable to source '${PTXDIST_PLATFORMCONFIG}' (maybe git conflict?)" 3 - fi - if [ -n "${!1}" ]; then - echo "${!1}" - return - fi +ptxd_get_kconfig() { + local config="${1}" + unset "${2}" 2>/dev/null || return 2 - if test -f "${PTXDIST_PTXCONFIG}"; then - source "${PTXDIST_PTXCONFIG}" || \ - ptxd_bailout "unable to source '${PTXDIST_PTXCONFIG}' (maybe git conflict?)" 3 + if test -f "${config}"; then + source "${config}" || \ + ptxd_bailout "unable to source '${config}' (maybe git conflict?)" 3 fi - if [ -n "${!1}" ]; then - echo "${!1}" + if [ -n "${!2}" ]; then + echo "${!2}" return fi - return 1; } +export -f ptxd_get_kconfig +# +# get a symbol from the ptx or platformconfig +# +# return: +# 1: symbol not found +# 2: symbol invalid +# +ptxd_get_ptxconf() { + ptxd_get_kconfig "${PTXDIST_PLATFORMCONFIG}" "${1}" || + ptxd_get_kconfig "${PTXDIST_PTXCONFIG}" "${1}" +} export -f ptxd_get_ptxconf |