From 73e98d1c52681827165cf3d471938864be20b6f5 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 20 Oct 2021 20:46:07 +0200 Subject: [PATCH] =?UTF-8?q?plus=20de=20fiabilit=C3=A9=20pour=20la=20r?= =?UTF-8?q?=C3=A9cup=C3=A9ration=20des=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- evocheck.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 15e5943..37c5400 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -1391,11 +1391,10 @@ get_command() { case "${program}" in ## Special cases where the program name is different than the command name evocheck) echo "${0}" ;; - evomaintenance) command -v evomaintenance.sh ;; - listupgrade) command -v evolistupgrade.sh ;; - old-kernel-autoremoval) command -v old-kernel-autoremoval.sh ;; - backup-server-state) command -v backup-server-state ;; - mysql-queries-killer) command -v mysql-queries-killer.sh ;; + evomaintenance) command -v "evomaintenance.sh" ;; + listupgrade) command -v "evolistupgrade.sh" ;; + old-kernel-autoremoval) command -v "old-kernel-autoremoval.sh" ;; + mysql-queries-killer) command -v "mysql-queries-killer.sh" ;; ## General case, where the program name is the same as the command name *) command -v "${program}" ;; @@ -1413,6 +1412,11 @@ get_version() { # /path/to/my_command --get-version # ;; + ## When there is just an internal variable name + kvmstats | add-vm) + grep '^VERSION=' "${command}" | head -1 | cut -d '=' -f 2 + ;; + ## General case to get the version *) ${command} --version 2> /dev/null | head -1 | cut -d ' ' -f 3 ;; esac