Blame 0053-90qemu-fixed-systemd-detect-virt-output-parsing.patch

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