Fix unexpected script_path behaviour

When one calls the `build.sh` scripts with bash instead of the shebang
`$script_path` contains the filepath, not the parent dir:

```
% cd /path
% grep -A2 script_path= build.sh
script_path=$(readlink -f "${0%/*}")
echo "$script_path"
exit 0
% ./build.sh
/path
% bash build.sh
/path/build.sh
```

This commit fixes that:

```
% grep -A2 script_path= build.sh
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
echo "$script_path"
exit 0
% ./build.sh
/path
% bash build.sh
/path
```
This commit is contained in:
Justin Kromlinger 2020-07-16 22:54:16 +02:00
parent 7acea696e4
commit 6f0a15c34a
No known key found for this signature in database
GPG Key ID: 69EF6D9E49A64EB8
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ arch=$(uname -m)
work_dir=work
out_dir=out
script_path=$(readlink -f "${0%/*}")
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
umask 0022

View File

@ -13,7 +13,7 @@ out_dir=out
gpg_key=""
verbose=""
script_path=$(readlink -f "${0%/*}")
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
umask 0022