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
| #!/bin/bash
| set -eu -o pipefail
|
| quote() {
| local arg
| for arg in "$@"; do
| printf "'"
| printf "%s" "$arg" | sed -e "s/'/'\\\\''/g"
| printf "' "
| done
| }
|
| readonly grpc_java_dir="$(dirname "$(readlink -f "$0")")/.."
| if [[ -t 0 ]]; then
| DOCKER_ARGS="-it"
| else
| # The input device on kokoro is not a TTY, so -it does not work.
| DOCKER_ARGS=
| fi
| # Use a trap function to fix file permissions upon exit, without affecting
| # the original exit code. $DOCKER_ARGS can not be quoted, otherwise it becomes a '' which confuses
| # docker.
| exec docker run $DOCKER_ARGS --rm=true -v "${grpc_java_dir}":/grpc-java -w /grpc-java \
| protoc-artifacts \
| bash -c "function fixFiles() { chown -R $(id -u):$(id -g) /grpc-java; }; trap fixFiles EXIT; $(quote "$@")"
|
|