From 49059486958c2f43a134ec08210c10cee209f596 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Apr 2014 12:46:06 +0200 Subject: genenv: fix tempdir creation when target is a relative path when $target is a path relative to $objtree the script fails. This is because we cd to $basedir and then copy to $tempdir which then is no longer valid. Fix this by converting $tempdir to an absolute path first. Signed-off-by: Sascha Hauer Tested-by: Christoph Fritz --- scripts/genenv | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/genenv b/scripts/genenv index d0b0ffd47f..9f22adea5c 100755 --- a/scripts/genenv +++ b/scripts/genenv @@ -10,7 +10,26 @@ basedir=$1 target=$3 shift 3 -tempdir="${target}.genenv.tmp" +abspath() { + local fn dn + if [ $# -ne 1 ]; then + echo "usage: ptxd_abspath " + exit 1 + fi + if [ -d "${1}" ]; then + fn="" + dn="${1}" + else + fn="/$(basename "${1}")" + dn="$(dirname "${1}")" + fi + + [ ! -d "${dn}" ] && exit 1 + echo "$(cd "${dn}" && pwd)${fn}" +} +export -f abspath + +tempdir=$(abspath "${target}.genenv.tmp") tmpfile="$(mktemp)" mkdir -p "$tempdir" -- cgit v1.2.3