-
Notifications
You must be signed in to change notification settings - Fork 2
/
in-rust-nightly
executable file
·54 lines (46 loc) · 860 Bytes
/
in-rust-nightly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
set -e
# MacOS X
command -v realpath >/dev/null 2>&1 || {
realpath() {
if ! [ "$1" = "${1#/*}" ]
then
echo "$1"
else
echo "${PWD}/${1#./}"
fi
}
}
root="${PWD}"
if [ "$1" = "-k" ]
then
shift
opts="-d"
else
opts="--rm"
fi
if [ "$1" = "-r" ]
then
shift
root="$1"
root="`realpath \"${root}\"`"
shift
fi
if [ "$1" = "-w" ]
then
shift
p="$1"
p="`realpath \"${p}\"`"
shift
else
p="${PWD}"
fi
if [ "$1" = "-r" ]
then
shift
root="$1"
root="`realpath \"${root}\"`"
shift
fi
# /tmp is so that SSH_AUTH_SOCK is found.
exec docker run ${opts} -e HOME -e RUSTC_FORCE_INCREMENTAL -e SSH_AGENT_PID -e SSH_AUTH_SOCK -e RUSTFLAGS -e CARGO_NET_OFFLINE -e RUST_TARGET_PATH -e TARGET_DIR -e PAYLOAD_A -e USER -e RUST_BACKTRACE --user "$(id -u)":"$(id -g)" -v "${root}:${root}" -v /tmp:/tmp -w "${p}" rust-nightly-extra:latest "$@"