From ca271892c8951f9c7da63a380e7ec674d0061158 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 22:33:42 +0000 Subject: [PATCH] Fix solana docker image (#20550) The docker image fails with: /usr/bin/solana-run.sh: line 66: ./fetch-spl.sh: No such file or directory In the solana docker image, scripts/run.sh is copied to /usr/bin/solana-run.sh and fetch-spl.sh to /usr/bin/fetch-spl.sh. This means that the line: cd "$(dirname "$0")/.." means we're doing a "cd /usr", which means we can't find fetch-spl.sh or spl-genesis-args.sh (i.e., the error above). (cherry picked from commit 2762f6f96f28271f02f05f0f438a870fae3bb660) Co-authored-by: Sean Young --- scripts/run.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/run.sh b/scripts/run.sh index 1754a9ad8c..64ba1803a1 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,7 +8,13 @@ set -e # Prefer possible `cargo build` binaries over PATH binaries -cd "$(dirname "$0")/.." +script_dir="$(readlink -f "$(dirname "$0")")" +if [[ "$script_dir" =~ /scripts$ ]]; then + cd "$script_dir/.." +else + cd "$script_dir" +fi + profile=debug if [[ -n $NDEBUG ]]; then