2017-11-27 11:40:21 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
########
|
|
|
|
# Install checks
|
|
|
|
########
|
|
|
|
|
2019-06-04 19:00:19 +02:00
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
2019-01-21 16:29:33 +01:00
|
|
|
|
2017-11-27 11:40:21 -08:00
|
|
|
function program_exists() {
|
|
|
|
local program=$1
|
|
|
|
command -v "$program" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
2019-01-10 19:32:30 +01:00
|
|
|
function program_version_exists() {
|
|
|
|
local program=$1
|
|
|
|
if ! program_exists "$program"; then
|
|
|
|
$(exit 1)
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
local required_version=$2
|
|
|
|
if echo "$($program --version)" | grep -q -wo "$required_version\|$required_version[^\.]"; then
|
|
|
|
$(exit 0)
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
$(exit 1)
|
|
|
|
}
|
|
|
|
|
2019-01-18 15:09:23 +01:00
|
|
|
function toolversion() {
|
2019-01-21 16:29:33 +01:00
|
|
|
${GIT_ROOT}/scripts/toolversion "${1}"
|
2019-01-10 19:32:30 +01:00
|
|
|
}
|