forked from evolix/evocheck
check_versions: renamed "IS_VERSIONS_CHECK" to "IS_CHECK_VERSIONS" to match function name logic, and do not run check in cron mode
This commit is contained in:
parent
1281891363
commit
8d460b039d
15
evocheck.sh
15
evocheck.sh
|
@ -397,9 +397,9 @@ download_versions() {
|
||||||
elif command -v GET; then
|
elif command -v GET; then
|
||||||
GET -t ${timeout}s "${versions_url}" > "${versions_file}"
|
GET -t ${timeout}s "${versions_url}" > "${versions_file}"
|
||||||
else
|
else
|
||||||
failed "IS_VERSIONS_CHECK" "failed to find curl, wget or GET"
|
failed "IS_CHECK_VERSIONS" "failed to find curl, wget or GET"
|
||||||
fi
|
fi
|
||||||
test "$?" -eq 0 || failed "IS_VERSIONS_CHECK" "failed to download ${versions_url} to ${versions_file}"
|
test "$?" -eq 0 || failed "IS_CHECK_VERSIONS" "failed to download ${versions_url} to ${versions_file}"
|
||||||
}
|
}
|
||||||
get_command() {
|
get_command() {
|
||||||
local program
|
local program
|
||||||
|
@ -445,13 +445,13 @@ check_version() {
|
||||||
actual_version=$(get_version "${program}" "${command}")
|
actual_version=$(get_version "${program}" "${command}")
|
||||||
# printf "program:%s expected:%s actual:%s\n" "${program}" "${expected_version}" "${actual_version}"
|
# printf "program:%s expected:%s actual:%s\n" "${program}" "${expected_version}" "${actual_version}"
|
||||||
if [ -z "${actual_version}" ]; then
|
if [ -z "${actual_version}" ]; then
|
||||||
failed "IS_VERSIONS_CHECK" "failed to lookup actual version of ${program}"
|
failed "IS_CHECK_VERSIONS" "failed to lookup actual version of ${program}"
|
||||||
elif [ "${actual_version}" = "${expected_version}" ]; then
|
elif [ "${actual_version}" = "${expected_version}" ]; then
|
||||||
: # Version check OK ; to check first because of the way the check works
|
: # Version check OK ; to check first because of the way the check works
|
||||||
elif [ "$(echo ${actual_version}\\n${expected_version} | sort -V | head -n 1)" = "${actual_version}" ]; then
|
elif [ "$(echo ${actual_version}\\n${expected_version} | sort -V | head -n 1)" = "${actual_version}" ]; then
|
||||||
failed "IS_VERSIONS_CHECK" "${program} version ${actual_version} is older than expected version ${expected_version}"
|
failed "IS_CHECK_VERSIONS" "${program} version ${actual_version} is older than expected version ${expected_version}"
|
||||||
elif [ "$(echo ${actual_version}\\n${expected_version} | sort -V | head -n 1)" = "${expected_version}" ]; then
|
elif [ "$(echo ${actual_version}\\n${expected_version} | sort -V | head -n 1)" = "${expected_version}" ]; then
|
||||||
failed "IS_VERSIONS_CHECK" "${program} version ${actual_version} is newer than expected version ${expected_version}, you should update your index."
|
failed "IS_CHECK_VERSIONS" "${program} version ${actual_version} is newer than expected version ${expected_version}, you should update your index."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ check_versions() {
|
||||||
if [ -n "${version}" ]; then
|
if [ -n "${version}" ]; then
|
||||||
check_version "${program}" "${version}"
|
check_version "${program}" "${version}"
|
||||||
else
|
else
|
||||||
failed "IS_VERSIONS_CHECK" "failed to lookup expected version for ${program}"
|
failed "IS_CHECK_VERSIONS" "failed to lookup expected version for ${program}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -537,7 +537,7 @@ main() {
|
||||||
test "${IS_EVOLINUXSUDOGROUP:=1}" = 1 && check_evolinuxsudogroup
|
test "${IS_EVOLINUXSUDOGROUP:=1}" = 1 && check_evolinuxsudogroup
|
||||||
test "${IS_BIND9MUNIN:=1}" = 1 && check_bind9munin
|
test "${IS_BIND9MUNIN:=1}" = 1 && check_bind9munin
|
||||||
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
test "${IS_EVOLIX_USER:=1}" = 1 && check_evolix_user
|
||||||
test "${IS_VERSIONS_CHECK:=1}" = 1 && check_versions
|
test "${IS_CHECK_VERSIONS:=1}" = 1 && check_versions
|
||||||
test "${IS_ROOT_USER:=1}" = 1 && check_root_user
|
test "${IS_ROOT_USER:=1}" = 1 && check_root_user
|
||||||
|
|
||||||
exit ${RC}
|
exit ${RC}
|
||||||
|
@ -565,6 +565,7 @@ while :; do
|
||||||
--cron)
|
--cron)
|
||||||
IS_KERNELUPTODATE=0
|
IS_KERNELUPTODATE=0
|
||||||
IS_UPTIME=0
|
IS_UPTIME=0
|
||||||
|
IS_CHECK_VERSIONS=0
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
VERBOSE=1
|
VERBOSE=1
|
||||||
|
|
Loading…
Reference in a new issue