From 6f0a15c34ad35af61fe047331a909fbd0cad62e5 Mon Sep 17 00:00:00 2001 From: Justin Kromlinger Date: Thu, 16 Jul 2020 22:54:16 +0200 Subject: 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 ``` --- configs/releng/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configs/releng/build.sh') diff --git a/configs/releng/build.sh b/configs/releng/build.sh index c787d30..7e8321e 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -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 -- cgit v1.2.3-70-g09d2