github.com/containerd/Containerd@v1.4.13/script/setup/install-runc (about) 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 # 18 # Builds and installs runc to /usr/local/go/bin based off 19 # the commit defined in vendor.conf 20 # 21 set -eu -o pipefail 22 23 function install_runc() { 24 script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)" 25 26 # When updating runc-version, consider updating the runc module in go.mod as well 27 : "${RUNC_VERSION:=$(cat "${script_dir}/runc-version")}" 28 29 TMPROOT=$(mktemp -d) 30 git clone https://github.com/opencontainers/runc.git "${TMPROOT}"/src/github.com/opencontainers/runc 31 pushd "${TMPROOT}"/src/github.com/opencontainers/runc 32 git checkout "${RUNC_VERSION}" 33 GOPATH="${TMPROOT}" GO111MODULE=off make BUILDTAGS='seccomp' runc 34 35 USESUDO=${USESUDO:-false} 36 if ${USESUDO}; then 37 SUDO='sudo -E' 38 else 39 SUDO='' 40 fi 41 ${SUDO} make install 42 popd 43 rm -fR "${TMPROOT}" 44 } 45 46 function install_crun() { 47 CRUN_VERSION=0.14 48 curl -o /usr/local/sbin/runc -L https://github.com/containers/crun/releases/download/${CRUN_VERSION}/crun-${CRUN_VERSION}-static-$(uname -m) 49 chmod +x /usr/local/sbin/runc 50 } 51 52 : "${RUNC_FLAVOR:=runc}" 53 case ${RUNC_FLAVOR} in 54 runc) install_runc ;; 55 crun) install_crun ;; 56 *) 57 echo >&2 "unknown runc flavor: ${RUNC_FLAVOR}" 58 exit 1 59 ;; 60 esac