diff options
author | Justin Kromlinger <hashworks@archlinux.org> | 2020-07-16 22:54:16 +0200 |
---|---|---|
committer | Justin Kromlinger <hashworks@archlinux.org> | 2020-07-16 22:54:16 +0200 |
commit | 6f0a15c34ad35af61fe047331a909fbd0cad62e5 (patch) | |
tree | b3610f8bf05a9be6e6a5e1316c6cc2898d651bc5 /configs/baseline | |
parent | 7acea696e4eb27479842c6b5defae2de8e366b19 (diff) | |
download | archiso32-6f0a15c34ad35af61fe047331a909fbd0cad62e5.tar.xz |
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
```
Diffstat (limited to 'configs/baseline')
-rwxr-xr-x | configs/baseline/build.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 45e76cf..b86c7c8 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -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 |