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