enhance previous commit logic

This commit is contained in:
Stéphane Lesimple 2019-05-05 20:09:53 +02:00
parent 4edb867def
commit d31a9810e6

View File

@ -3857,14 +3857,17 @@ check_CVE_2018_3646_linux()
# Here, we want to know if we are hosting a hypervisor, and running some VMs on it.
# If we find no evidence that this is the case, assume we're not (to avoid scaring users),
# this can always be overridden with --vmm in any case.
# ... ignore SC2009 as `ps ax` is actually used as a fallback if `pgrep` isn't installed
# shellcheck disable=SC2009
if command -v pgrep >/dev/null 2>&1 && { pgrep qemu >/dev/null || pgrep kvm >/dev/null || pgrep libvirtd >/dev/null; }; then
has_vmm=1
elif ps ax | grep -vw grep | grep -q -e '\<qemu' -e '/qemu' -e '<\kvm' -e '/kvm' -e '/libvirtd'; then
has_vmm=1
has_vmm=0
if command -v pgrep >/dev/null 2>&1; then
if pgrep qemu >/dev/null || pgrep kvm >/dev/null || pgrep libvirtd >/dev/null; then
has_vmm=1
fi
else
has_vmm=0
# ignore SC2009 as `ps ax` is actually used as a fallback if `pgrep` isn't installed
# shellcheck disable=SC2009
if ps ax | grep -vw grep | grep -q -e '\<qemu' -e '/qemu' -e '<\kvm' -e '/kvm' -e '/libvirtd'; then
has_vmm=1
fi
fi
fi
if [ "$has_vmm" = 0 ]; then