From 0185f661fa4e04d0c27a733782ecc333c1853ddf Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 22 Oct 2021 13:56:16 +0200 Subject: [PATCH] check for newer versions --- evocheck.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 8a5719a..e4d554b 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -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