Skip to content

Commit

Permalink
kata-manager: Check for dependencies earlier
Browse files Browse the repository at this point in the history
The `kata-manager` script needs to download `git` repos. But if `git`
isn't available, it can fall back to using `curl` or `wget`. However, if
none of these tools are available, it should exit before any changes are
made to the system.

Note: The script _could_ install one of the tools of course. However,
all known Linux distro "default installs" provide at least one of these
tools, so this scenario should only be hit on very minimal systems. In
that case, install one of the tools the error mentions and re-run
`kata-manager`.

Fixes kata-containers#1502.

Signed-off-by: James O. D. Hunt <[email protected]>
(cherry picked from commit cfa9c82)
Signed-off-by: Ganesh Maharaj Mahalingam <[email protected]>
  • Loading branch information
jodh-intel authored and Ganesh Maharaj Mahalingam committed Apr 30, 2019
1 parent 87b6527 commit 189a3b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/kata-manager/kata-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ get_git_repo()
local -r repo_url="https://${repo_path}"

if ! command -v git >/dev/null; then
info "getting repo $1 using http downloader"
detect_downloader
$downloader "${repo_url}/${tarball_suffix}" | tar xz -C "$local_dest" --strip-components=1
return
fi
Expand Down Expand Up @@ -437,6 +435,11 @@ setup()
if [ -z "$kata_repos_base" ]; then
kata_repos_base="$HOME/go"
fi

if ! command -v git >/dev/null; then
info "git not installed - trying to use a downloader instead"
detect_downloader
fi
}

parse_args()
Expand Down

0 comments on commit 189a3b3

Please sign in to comment.