Debian Codegraph @

script/setup/install-runhcs-shim

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # Copyright The containerd Authors.
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8
9 # http://www.apache.org/licenses/LICENSE-2.0
10
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 scripts_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
19 : ${RUNHCS_VERSION:="$(cat $scripts_path/runhcs-version)"}
20 : ${RUNHCS_REPO:="https://github.com/Microsoft/hcsshim.git"}
21 : ${HCSSHIM_SRC:=''}
22 : ${DESTDIR:=''}
23 : ${GOOS:="windows"}
24
25 tmpdir="$(mktemp -d)"
26
27 cleanup() {
28 rm -rf "$tmpdir"
29 }
30
31 trap 'cleanup' EXIT
32
33 export GOOS
34 if [ "$HCSSHIM_SRC" == "" ]
35 then
36 set -e -x
37 cd "$tmpdir"
38 git init .
39 git remote add origin "$RUNHCS_REPO"
40 git fetch --depth 1 origin ${RUNHCS_VERSION}
41 git checkout FETCH_HEAD
42 else
43 cd "${HCSSHIM_SRC}"
44 git checkout "refs/tags/${RUNHCS_VERSION}" || git checkout "refs/heads/${RUNHCS_VERSION}" || git checkout "${RUNHCS_VERSION}"
45 fi
46 GO111MODULE=on go build -mod=vendor -o "${DESTDIR}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1