From: Antonio Alvarez Feijoo Date: Thu, 27 Apr 2023 15:28:44 +0000 (+0200) Subject: fix(dracut-init.sh): correct check in `is_qemu_virtualized` function X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=3e2f685ecb4a968d5cd889803d5a248dab89473a;p=thirdparty%2Fdracut.git fix(dracut-init.sh): correct check in `is_qemu_virtualized` function Do not redirect `systemd-detect-virt` to /dev/null, otherwise, the `vm` variable is always empty. This function was working only thanks to the following /sys check. Reported-by: Raymund Will --- diff --git a/dracut-init.sh b/dracut-init.sh index 699a1d780..41445bb36 100755 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -1190,7 +1190,7 @@ is_qemu_virtualized() { # 1 if a virt environment could not be detected # 255 if any error was encountered if type -P systemd-detect-virt > /dev/null 2>&1; then - if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then + if ! vm=$(systemd-detect-virt --vm 2> /dev/null); then return 255 fi [[ $vm == "qemu" ]] && return 0