Skip to content

Commit 783ddd8

Browse files
authored
Merge pull request #1706 from cpu/cpu-run-docker-sh-custom-cargohome
ci: allow overriding run-docker.sh CARGO_HOME.
2 parents d2963c2 + 20cd625 commit 783ddd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ci/run-docker.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
set -ex
77

8+
# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
9+
# subdir) from where the `cargo` binary in `$PATH` lives.
10+
DEFAULT_CARGO_HOME="$(dirname "$(dirname "$(command -v cargo)")")"
11+
# If the CARGO_HOME env var is already set, use that. If it isn't set use the
12+
# default.
13+
CARGO_HOME="${CARGO_HOME:-$DEFAULT_CARGO_HOME}"
14+
815
echo "${HOME}"
916
pwd
1017

@@ -26,7 +33,7 @@ run() {
2633
--env LIBC_CI \
2734
--env CARGO_HOME=/cargo \
2835
--env CARGO_TARGET_DIR=/checkout/target \
29-
--volume "$(dirname "$(dirname "$(command -v cargo)")")":/cargo \
36+
--volume "$CARGO_HOME":/cargo \
3037
--volume "$(rustc --print sysroot)":/rust:ro \
3138
--volume "$(pwd)":/checkout:ro \
3239
--volume "$(pwd)"/target:/checkout/target \

0 commit comments

Comments
 (0)