diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2014-06-20 12:47:17 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2014-06-20 12:50:36 +0200 |
commit | ece2c10678a8835089b22d3d74e40bbefe495a23 (patch) | |
tree | 6c877df34a8de4c625702c32b9a934f8dcf512fe /bin/ptxdist-auto-version | |
parent | 65fcce610bbe37243bfe32493b0c173075b9a2f9 (diff) | |
download | ptxdist-ece2c10678a8835089b22d3d74e40bbefe495a23.tar.gz ptxdist-ece2c10678a8835089b22d3d74e40bbefe495a23.tar.xz |
ptxdist: add '--auto-version' and helper script
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin/ptxdist-auto-version')
-rwxr-xr-x | bin/ptxdist-auto-version | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/ptxdist-auto-version b/bin/ptxdist-auto-version new file mode 100755 index 000000000..2f6414ae0 --- /dev/null +++ b/bin/ptxdist-auto-version @@ -0,0 +1,24 @@ +#!/bin/bash + +# +# bash implementation of realpath / readlink -f +# arg1 - filename +realpath() +{ + local fname oldfname + + fname="${1%/}" # strips trailing '/' + while [ -L "${fname}" ]; do + oldfname="${fname}" + fname="$(readlink "${fname}")" + if [ "${fname}" = "." ] ; then + fname="$(dirname "${oldfname}")" + elif [ "${fname}" = "${fname#/}" ]; then + fname="$(dirname "${oldfname}")/${fname}" + fi + done + + (cd "$(dirname "${fname}")"; echo $(pwd -P)/$(basename "${fname}")) +} + +exec "$(dirname $(realpath "$0"))/ptxdist" --auto-version "${@}" |