]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(virtfs, virtiofs): auto-add dracut module if qemu included
authorJo Zzsi <jozzsicsataban@gmail.com>
Sat, 7 Feb 2026 22:53:07 +0000 (17:53 -0500)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 8 Feb 2026 13:30:56 +0000 (08:30 -0500)
If qemu dracut module included than automatically include
virtfs and virtiofs dracut modules as well unless
hostonly_mode is set to "strict".

Tested with the following dracut invocation (invoked
from a non-virtualized host).

`dracut --hostonly-mode sloppy -add qemu`

modules.d/74virtfs/module-setup.sh
modules.d/74virtiofs/module-setup.sh

index 47a317f0b9bb06dc823204081d31e9a17db62a16..d8c618f4a33841610baaf6503eb91f8562b32ae5 100755 (executable)
@@ -2,6 +2,10 @@
 
 # called by dracut
 check() {
+    if [[ $hostonly_mode != "strict" ]] && dracut_module_included "qemu"; then
+        return 0
+    fi
+
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
             [[ $fs == "9p" ]] && return 0
index 1ef6c939266147cbf05c8d5537097929044f708d..b9f107e98831945f601f6884320e20c2635fa839 100755 (executable)
@@ -2,6 +2,10 @@
 
 # called by dracut
 check() {
+    if [[ $hostonly_mode != "strict" ]] && dracut_module_included "qemu"; then
+        return 0
+    fi
+
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         is_qemu_virtualized && return 0