From 5698258d3022dd73045e2ffb279c799a70c3fef9 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Tue, 20 Oct 2020 16:47:41 +0800 Subject: [PATCH] 90qemu-net: in hostonly mode, only install if network is needed Signed-off-by: Kairui Song --- modules.d/40network/module-setup.sh | 3 +++ modules.d/90qemu-net/module-setup.sh | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh index 3ba2f1901..af1535280 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -8,6 +8,9 @@ check() { # called by dracut depends() { echo -n "kernel-network-modules " + + is_qemu_virtualized && echo -n "qemu-net " + if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then echo "network-manager" else diff --git a/modules.d/90qemu-net/module-setup.sh b/modules.d/90qemu-net/module-setup.sh index 0e45a417f..f188eaa23 100755 --- a/modules.d/90qemu-net/module-setup.sh +++ b/modules.d/90qemu-net/module-setup.sh @@ -2,10 +2,15 @@ # called by dracut check() { - if [[ $hostonly ]] || [[ $mount_needs ]]; then + if [[ $hostonly ]]; then + return 255 + fi + + if [[ $mount_needs ]]; then is_qemu_virtualized && return 0 return 255 fi + return 0 } -- 2.47.3