check for newer versions

This commit is contained in:
Jérémy Lecour 2021-10-22 13:56:16 +02:00 committed by Jérémy Lecour
parent 7990b7924f
commit 0185f661fa

View file

@ -1412,8 +1412,11 @@ get_version() {
# /path/to/my_command --get-version
# ;;
add-vm)
grep '^VERSION=' "${command}" | head -1 | cut -d '=' -f 2
;;
## Let's try the --version flag before falling back to grep for the constant
kvmstats | add-vm)
kvmstats)
if ${command} --version > /dev/null 2> /dev/null; then
${command} --version 2> /dev/null | head -1 | cut -d ' ' -f 3
else
@ -1439,7 +1442,9 @@ check_version() {
if [ -z "${actual_version}" ]; then
failed "IS_VERSIONS_CHECK" "failed to lookup actual version of ${program}"
elif dpkg --compare-versions "${actual_version}" lt "${expected_version}"; then
failed "IS_VERSIONS_CHECK" "${program} version ${expected_version} expected, but ${actual_version} found"
failed "IS_VERSIONS_CHECK" "${program} version ${actual_version} is older than expected version ${expected_version}"
elif dpkg --compare-versions "${actual_version}" gt "${expected_version}"; then
failed "IS_VERSIONS_CHECK" "${program} version ${actual_version} is newer than expected version ${expected_version}, you should update tour index."
else
: # Version check OK
fi