diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh
index 45e76cf23084812dc46293bff061477877e86c9f..b86c7c83b07e3cbe647fab6bdad0e964beb48093 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
 
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index c787d308cef2cfcbd9eefa9eaed4ee937750355f..7e8321e596be58e16d321fccd7766864dfc19d08 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