From 7429953386071a68023df6c6153a62e95003c71d Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Tue, 12 Sep 2017 04:01:20 +0000 Subject: [PATCH] Fix install.deps Signed-off-by: Lantao Liu --- hack/install-deps.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/hack/install-deps.sh b/hack/install-deps.sh index a66dba164..8746755d3 100755 --- a/hack/install-deps.sh +++ b/hack/install-deps.sh @@ -62,20 +62,34 @@ fi # For multiple GOPATHs, keep the first one only GOPATH=${GOPATH%%:*} +# checkout_repo checks out specified repository +# and switch to specified version. +# Varset: +# 1) Repo name; +# 2) Version. +checkout_repo() { + repo=$1 + version=$2 + path="${GOPATH}/src/${repo}" + if [ ! -d ${path} ]; then + mkdir -p ${path} + git clone https://${repo} ${path} + fi + cd ${path} + git fetch --all + git checkout ${version} +} + # Install runc -go get -d ${RUNC_PKG}/... +checkout_repo ${RUNC_PKG} ${RUNC_VERSION} cd ${GOPATH}/src/${RUNC_PKG} -git fetch --all -git checkout ${RUNC_VERSION} BUILDTAGS=${BUILDTAGS:-seccomp apparmor} make BUILDTAGS="$BUILDTAGS" ${sudo} make install -e DESTDIR=${RUNC_DIR} # Install cni -go get -d ${CNI_PKG}/... +checkout_repo ${CNI_PKG} ${CNI_VERSION} cd ${GOPATH}/src/${CNI_PKG} -git fetch --all -git checkout ${CNI_VERSION} ./build.sh ${sudo} mkdir -p ${CNI_DIR} ${sudo} cp -r ./bin ${CNI_DIR} @@ -107,9 +121,7 @@ ${sudo} bash -c 'cat >'${CNI_CONFIG_DIR}'/10-containerd-net.conflist <