]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-init): do not detect virt environment in non-hostonly mode
authorJo Zzsi <jozzsicsataban@gmail.com>
Wed, 23 Apr 2025 20:39:03 +0000 (16:39 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Thu, 24 Apr 2025 23:00:36 +0000 (19:00 -0400)
Follow-up to bb7425b .
.

dracut-init.sh

index 00f5ff65971ba8a0a64d3e5fe2ab2c3fd42aef56..9be00c5649129166b3656af51c17028c00f90eb5 100755 (executable)
@@ -1147,6 +1147,10 @@ is_qemu_virtualized() {
     # 0 if a virt environment was detected
     # 1 if a virt environment could not be detected
     # 255 if any error was encountered
+
+    # do not consult /sys and do not detect virt environment in non-hostonly mode
+    ! [[ $hostonly ]] && return 1
+
     if type -P systemd-detect-virt > /dev/null 2>&1; then
         if ! vm=$(systemd-detect-virt --vm 2> /dev/null); then
             return 255