1#!/bin/bash 2# Copyright 2016 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16# This script is invoked by build_docker_* inside a docker 17# container. You should never need to call this script on your own. 18 19set -ex 20 21if [ "$RELATIVE_COPY_PATH" == "" ] 22then 23 mkdir -p /var/local/git 24 git clone "$EXTERNAL_GIT_ROOT" /var/local/git/grpc 25 # clone gRPC submodules, use data from locally cloned submodules where possible 26 # TODO: figure out a way to eliminate this following shellcheck suppressions 27 # shellcheck disable=SC2016,SC1004 28 (cd "${EXTERNAL_GIT_ROOT}" && git submodule foreach 'git clone ${EXTERNAL_GIT_ROOT}/${name} /var/local/git/grpc/${name}') 29 (cd /var/local/git/grpc && git submodule init) 30else 31 mkdir -p "/var/local/git/grpc/$RELATIVE_COPY_PATH" 32 cp -r "$EXTERNAL_GIT_ROOT/$RELATIVE_COPY_PATH"/* "/var/local/git/grpc/$RELATIVE_COPY_PATH" 33fi 34 35$POST_GIT_STEP 36 37if [ -x "$(command -v rvm)" ] 38then 39 rvm use ruby-2.1 40fi 41 42cd /var/local/git/grpc 43 44$RUN_COMMAND 45