diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-06-12 16:50:25 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-06-13 19:49:06 +0200 |
commit | 3e78961a61cca6170e819a371c52eaa907d934c0 (patch) | |
tree | 79535e6702c6e5740fb23d343f5c9667b178ca0b /scripts/libptxdist.sh | |
parent | bd2d84ae00eba7ef521923a2b55eb3f69f3f75b7 (diff) | |
download | ptxdist-3e78961a61cca6170e819a371c52eaa907d934c0.tar.gz ptxdist-3e78961a61cca6170e819a371c52eaa907d934c0.tar.xz |
libptxdist: define ptxd_get_alternative
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r-- | scripts/libptxdist.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 6373439e0..0851edb18 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -489,6 +489,36 @@ ptxd_dumpstack() { # +# ptxd_get_alternative - look for files in platform, BSP and ptxdist +# +# $1 path prefix (relative to ptxdist etc.) +# $2 filename +# +# return: +# 0 if files/dirs are found +# 1 if no files/dirs are found +# +# array "ptxd_reply" containing the found files +# +ptxd_get_alternative() { + local prefix="${1%/}" + local file="${2}" + [ -n "${prefix}" -a -n "${file}" ] || return + + list=( \ + "${PTXDIST_WORKSPACE}/${prefix}${PTXDIST_PLATFORMSUFFIX}/${file}" \ + "${PTXDIST_WORKSPACE}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \ + "${PTXDIST_PLATFORMCONFIGDIR}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \ + "${PTXDIST_WORKSPACE}/${prefix}/${file}" \ + "${PTXDIST_PLATFORMCONFIGDIR}/${prefix}/${file}" \ + "${PTXDIST_TOPDIR}/${prefix}/${file}" \ + ) + + ptxd_get_path "${list[@]}" +} +export -f ptxd_get_alternative + +# # ptxd_get_path - look for files and/or dirs # # return: |