From: Beniamino Galvani Date: Mon, 27 Sep 2021 11:08:34 +0000 (+0200) Subject: fix(network-manager): show output on console only with rd.debug enabled X-Git-Tag: 056~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e07b7ad0e7f5dbb8024336f3075610b3b74ffb2e;p=thirdparty%2Fdracut.git fix(network-manager): show output on console only with rd.debug enabled The module should show the output on console only when initrd debugging is enabled. --- diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh index 74b6db54a..85f89cb03 100755 --- a/modules.d/35network-manager/nm-config.sh +++ b/modules.d/35network-manager/nm-config.sh @@ -16,6 +16,15 @@ if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then echo '[logging]' echo 'level=TRACE' ) > /run/NetworkManager/conf.d/initrd-logging.conf + + if [ -n "$DRACUT_SYSTEMD" ]; then + mkdir -p /run/systemd/system/nm-initrd.service.d + cat << EOF > /run/systemd/system/nm-initrd.service.d/tty-output.conf +[Service] +StandardOutput=tty +EOF + systemctl --no-block daemon-reload + fi fi nm_generate_connections diff --git a/modules.d/35network-manager/nm-initrd.service b/modules.d/35network-manager/nm-initrd.service index b9806de08..ad14e91ad 100644 --- a/modules.d/35network-manager/nm-initrd.service +++ b/modules.d/35network-manager/nm-initrd.service @@ -17,7 +17,9 @@ BusName=org.freedesktop.NetworkManager ExecReload=/usr/bin/busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Reload u 0 ExecStart=/usr/sbin/NetworkManager --debug KillMode=process -StandardOutput=tty +# The following gets changed to StandardOutput=tty by nm-config.sh +# when debug is enabled. +StandardOutput=null Environment=NM_CONFIG_ENABLE_TAG=initrd Restart=on-failure ProtectSystem=true