summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2021-07-09 14:43:39 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2021-07-16 21:24:43 +0200
commit23c16ce0af08610ddf99a5450627590d575ed775 (patch)
tree9ea898c43256e05b37e4d44505625e68e4e71646 /bin
parent17c29de35e37f47fdb365815ec2dcafdb6ba1bd9 (diff)
downloadptxdist-23c16ce0af08610ddf99a5450627590d575ed775.tar.gz
ptxdist-23c16ce0af08610ddf99a5450627590d575ed775.tar.xz
ptxdist: use the actual realpath as soon as possible
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ptxdist15
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index 503c2093e..d57bf2c0a 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2013,10 +2013,15 @@ EOF
#
# bash implementation of realpath / readlink -f
# arg1 - filename
-realpath()
+_realpath()
{
local fname oldfname
+ if type -p realpath > /dev/null; then
+ realpath "${@}"
+ return
+ fi
+
fname="${1%/}" # strips trailing '/'
while [ -L "${fname}" ]; do
oldfname="${fname}"
@@ -2046,7 +2051,7 @@ realpath()
setup_topdir() {
local ptxdist topdir
- ptxdist="$(realpath "${0}")" &&
+ ptxdist="$(_realpath "${0}")" &&
topdir="$(cd "$(dirname "${ptxdist}")"/.. && pwd)" || return
#
@@ -2067,6 +2072,9 @@ setup_topdir() {
eval PTXDIST_PLATFORMCONFIG_DEFAULT="${PTXDIST_PLATFORMCONFIG_DEFAULT}"
eval PTXDIST_COLLECTIONCONFIG_DEFAULT="${PTXDIST_COLLECTIONCONFIG_DEFAULT}"
eval PTXDIST_TOOLCHAIN_DEFAULT="${PTXDIST_TOOLCHAIN_DEFAULT}"
+
+ # ${PTXDIST_TOPDIR}/bin contains links to sane tools found by configure
+ export PATH="${PTXDIST_TOPDIR}/bin:${PATH}"
}
@@ -2158,9 +2166,6 @@ setup_env() {
export LANG=C
export LC_ALL=POSIX
-
- # ${PTXDIST_TOPDIR}/bin contains links to sane tools found by configure
- export PATH="${PTXDIST_TOPDIR}/bin:${PATH}"
}