From 372679e8023f67bc25484a24bb9739086a9c852d Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Thu, 19 Sep 2019 12:00:50 -0500 Subject: [PATCH] kata-deploy: Check that hub is installed Running for the first time the kata-deploy script can fail if hub is not installed it, this will avoid this issue. Fixes #728 Signed-off-by: Gabriela Cervantes --- release/kata-deploy-binaries.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/release/kata-deploy-binaries.sh b/release/kata-deploy-binaries.sh index a7e34aae83..ab9cdef187 100755 --- a/release/kata-deploy-binaries.sh +++ b/release/kata-deploy-binaries.sh @@ -71,6 +71,22 @@ EOT exit "${return_code}" } +#Verify that hub is installed and in case that is not +# install it to avoid issues when we try to push +verify_hub() { + check_command=$(whereis hub | cut -d':' -f2) + # Install hub if is not installed + if [ -z ${check_command} ]; then + hub_repo="github.com/github/hub" + hub_url="https://${hub_repo}" + go get -d ${hub_repo} || true + pushd ${GOPATH}/src/${hub_repo} + make + make install prefix=/usr/local + popd + fi +} + #Install guest image/initrd asset install_image() { image_destdir="${destdir}/${prefix}/share/kata-containers/" @@ -237,6 +253,10 @@ main() { [ -n "${kata_version}" ] || usage 1 info "Requested version: ${kata_version}" + if [[ "$test_local" == "true" ]]; then + verify_hub + fi + destdir="${workdir}/kata-static-${kata_version}-$(uname -m)" info "DESTDIR ${destdir}" mkdir -p "${destdir}"