]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut-init.sh): correct check in `is_qemu_virtualized` function
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Thu, 27 Apr 2023 15:28:44 +0000 (17:28 +0200)
committerAntonio Álvarez Feijoo <antonio.feijoo@suse.com>
Thu, 22 Jun 2023 15:08:06 +0000 (17:08 +0200)
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 <rw@suse.com>
dracut-init.sh

index 699a1d780e6a69ae209aa26d0f283660ebb7e82d..41445bb3689786db31fbc0be39f9f29b45f8c9dd 100755 (executable)
@@ -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