From 1dbcd1c77bf82306df1d273fcbe0ee48b14d1128 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Wed, 9 Nov 2022 15:17:44 +0100 Subject: [PATCH] tools: allow scripts to run from anywhere Make the `update-cares.sh`, `update-llhttp.sh`, `update-nghttp2.sh`, and `update-npm.sh` scripts work even if they are run outside of the `tools` directory. PR-URL: https://github.com/nodejs/node/pull/45361 Reviewed-By: Darshan Sen Reviewed-By: Yagiz Nizipli Reviewed-By: Rich Trott Reviewed-By: Zeyu "Alex" Yang Reviewed-By: Antoine du Hamel --- tools/update-cares.sh | 2 +- tools/update-llhttp.sh | 2 +- tools/update-nghttp2.sh | 2 +- tools/update-npm.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/update-cares.sh b/tools/update-cares.sh index 470a5d18a4f07f..f20347d88274fe 100755 --- a/tools/update-cares.sh +++ b/tools/update-cares.sh @@ -2,7 +2,7 @@ set -e # Shell script to update c-ares in the source tree to a specific version -BASE_DIR="$( pwd )" +BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) DEPS_DIR="$BASE_DIR/deps" ARES_VERSION=$1 diff --git a/tools/update-llhttp.sh b/tools/update-llhttp.sh index 2e71fcfe6f2a88..b45e106a3b1270 100755 --- a/tools/update-llhttp.sh +++ b/tools/update-llhttp.sh @@ -3,7 +3,7 @@ set -e # Shell script to update llhttp in the source tree to specific version -BASE_DIR="$( pwd )" +BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) DEPS_DIR="${BASE_DIR}/deps" LLHTTP_VERSION="$1" diff --git a/tools/update-nghttp2.sh b/tools/update-nghttp2.sh index 2f5368e3964b1e..dafa872385b005 100755 --- a/tools/update-nghttp2.sh +++ b/tools/update-nghttp2.sh @@ -2,7 +2,7 @@ set -e # Shell script to update nghttp2 in the source tree to specific version -BASE_DIR="$( pwd )" +BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) DEPS_DIR="$BASE_DIR/deps" NGHTTP2_VERSION=$1 diff --git a/tools/update-npm.sh b/tools/update-npm.sh index 9dfb3353bca25f..e4381ecfae0948 100755 --- a/tools/update-npm.sh +++ b/tools/update-npm.sh @@ -2,7 +2,7 @@ set -e # Shell script to update npm in the source tree to a specific version -BASE_DIR="$( pwd )" +BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) DEPS_DIR="$BASE_DIR/deps" NPM_VERSION=$1