2017-11-27 19:40:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
########
|
|
|
|
# Install checks
|
|
|
|
########
|
|
|
|
|
2019-06-04 17:00:19 +00:00
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
2019-01-21 15:29:33 +00:00
|
|
|
|
2017-11-27 19:40:21 +00:00
|
|
|
function program_exists() {
|
|
|
|
local program=$1
|
|
|
|
command -v "$program" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
2019-01-10 18:32:30 +00: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)
|
|
|
|
}
|