summaryrefslogtreecommitdiffstats
path: root/scripts/libptxdist.sh
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2012-04-07 18:55:33 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-06-13 19:49:06 +0200
commit3de306cf13a69a6792192a4a995aff0e44e54f72 (patch)
treeac1fa5c1e33db67da9efa9642667aac37bc78c43 /scripts/libptxdist.sh
parent04e2d38507d6e69d7b54835b56760bc0ac38e207 (diff)
downloadptxdist-3de306cf13a69a6792192a4a995aff0e44e54f72.tar.gz
ptxdist-3de306cf13a69a6792192a4a995aff0e44e54f72.tar.xz
ptxd_abspath: fix for directories ending with '..'
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r--scripts/libptxdist.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index b4bb939d2..c030bcd45 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -563,14 +563,21 @@ export -f ptxd_in_path
# convert a relative or absolute path into an absolute path
#
ptxd_abspath() {
+ local fn dn
if [ $# -ne 1 ]; then
echo "usage: ptxd_abspath <path>"
exit 1
fi
+ if [ -d "${1}" ]; then
+ fn=""
+ dn="${1}"
+ else
+ fn="/$(basename "${1}")"
+ dn="$(dirname "${1}")"
+ fi
- local dn="$(dirname "${1}")"
[ ! -d "${dn}" ] && ptxd_bailout "directory '${dn}' does not exist"
- echo "$(cd "${dn}" && pwd)/$(basename "${1}")"
+ echo "$(cd "${dn}" && pwd)${fn}"
}
export -f ptxd_abspath