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 <s.hauer@pengutronix.de> Tested-by: Christoph Fritz <chf.fritz@googlemail.com>
This commit is contained in:
parent
0af79fbb67
commit
4905948695
|
@ -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 <path>"
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue