]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
90qemu: fixed systemd-detect-virt output parsing
authorHarald Hoyer <harald@redhat.com>
Fri, 31 Jul 2015 07:05:51 +0000 (09:05 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 31 Jul 2015 07:05:51 +0000 (09:05 +0200)
redirecting systemd-detect-virt to /dev/null doesn't help with parsing
the output :-/

Also, add "Red Hat" as a vendor.

modules.d/90qemu/module-setup.sh

index 66ef8848ef1f1ccf1945f7c5efb4a87a563478e1..8cae124ced17a0e29205a7c49587ec43e2a8bd86 100755 (executable)
@@ -3,7 +3,7 @@
 # called by dracut
 check() {
     if type -P systemd-detect-virt >/dev/null 2>&1; then
-        vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
+        vm=$(systemd-detect-virt --vm 2>/dev/null)
         (($? != 0)) && return 255
         [[ $vm = "qemu" ]] && return 0
         [[ $vm = "kvm" ]] && return 0
@@ -13,8 +13,9 @@ check() {
     for i in /sys/class/dmi/id/*_vendor; do
         [[ -f $i ]] || continue
         read vendor < $i
-        [[  "$vendor" == "QEMU" ]] && return 0
-        [[  "$vendor" == "Bochs" ]] && return 0
+        [[ "$vendor" == "QEMU" ]] && return 0
+        [[ "$vendor" == "Red Hat" ]] && return 0
+        [[ "$vendor" == "Bochs" ]] && return 0
     done
     return 255
 }