Add build-containerd.sh to build containerd from existing repo
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
54
hack/install/utils.sh
Executable file
54
hack/install/utils.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The containerd Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/../utils.sh
|
||||
|
||||
# DESTDIR is the dest path to install dependencies.
|
||||
DESTDIR=${DESTDIR:-"/"}
|
||||
# Convert to absolute path if it's relative.
|
||||
if [[ ${DESTDIR} != /* ]]; then
|
||||
DESTDIR=${ROOT}/${DESTDIR}
|
||||
fi
|
||||
|
||||
# NOSUDO indicates not to use sudo during installation.
|
||||
NOSUDO=${NOSUDO:-false}
|
||||
SUDO="sudo"
|
||||
if ${NOSUDO}; then
|
||||
SUDO=""
|
||||
fi
|
||||
|
||||
# BUILDTAGS are bulid tags for runc and containerd.
|
||||
BUILDTAGS=${BUILDTAGS:-seccomp apparmor}
|
||||
|
||||
# checkout_repo checks out specified repository
|
||||
# and switch to specified version.
|
||||
# Varset:
|
||||
# 1) Pkg name;
|
||||
# 2) Version;
|
||||
# 3) Repo name;
|
||||
checkout_repo() {
|
||||
local -r pkg=$1
|
||||
local -r version=$2
|
||||
local -r repo=$3
|
||||
path="${GOPATH}/src/${pkg}"
|
||||
if [ ! -d ${path} ]; then
|
||||
mkdir -p ${path}
|
||||
git clone https://${repo} ${path}
|
||||
fi
|
||||
cd ${path}
|
||||
git fetch --all
|
||||
git checkout ${version}
|
||||
}
|
||||
Reference in New Issue
Block a user