Blame SOURCES/0353-90qemu-fixed-systemd-detect-virt-output-parsing.patch

64b87c
From 5f24e4340171913248a6965ff2153e2517cb892a Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Fri, 31 Jul 2015 09:05:51 +0200
64b87c
Subject: [PATCH] 90qemu: fixed systemd-detect-virt output parsing
64b87c
64b87c
redirecting systemd-detect-virt to /dev/null doesn't help with parsing
64b87c
the output :-/
64b87c
64b87c
Also, add "Red Hat" as a vendor.
64b87c
64b87c
(cherry picked from commit 4135eea634b20c7f7285d134bd6dfe6b799fe226)
64b87c
---
64b87c
 modules.d/90qemu/module-setup.sh | 7 ++++---
64b87c
 1 file changed, 4 insertions(+), 3 deletions(-)
64b87c
64b87c
diff --git a/modules.d/90qemu/module-setup.sh b/modules.d/90qemu/module-setup.sh
64b87c
index 64eac9e..46b7ae2 100755
64b87c
--- a/modules.d/90qemu/module-setup.sh
64b87c
+++ b/modules.d/90qemu/module-setup.sh
64b87c
@@ -4,7 +4,7 @@
64b87c
 
64b87c
 check() {
64b87c
     if type -P systemd-detect-virt >/dev/null 2>&1; then
64b87c
-        vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
64b87c
+        vm=$(systemd-detect-virt --vm 2>/dev/null)
64b87c
         (($? != 0)) && return 255
64b87c
         [[ $vm = "qemu" ]] && return 0
64b87c
         [[ $vm = "kvm" ]] && return 0
64b87c
@@ -14,8 +14,9 @@ check() {
64b87c
     for i in /sys/class/dmi/id/*_vendor; do
64b87c
         [[ -f $i ]] || continue
64b87c
         read vendor < $i
64b87c
-        [[  "$vendor" == "QEMU" ]] && return 0
64b87c
-        [[  "$vendor" == "Bochs" ]] && return 0
64b87c
+        [[ "$vendor" == "QEMU" ]] && return 0
64b87c
+        [[ "$vendor" == "Red Hat" ]] && return 0
64b87c
+        [[ "$vendor" == "Bochs" ]] && return 0
64b87c
     done
64b87c
     return 255
64b87c
 }