]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(network-manager): show output on console only with rd.debug enabled
authorBeniamino Galvani <bgalvani@redhat.com>
Mon, 27 Sep 2021 11:08:34 +0000 (13:08 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 21 Oct 2021 13:38:41 +0000 (13:38 +0000)
The module should show the output on console only when initrd debugging is
enabled.

modules.d/35network-manager/nm-config.sh
modules.d/35network-manager/nm-initrd.service

index 74b6db54a47c4e7b2e418713782104fa2be003eb..85f89cb03d2c27660731f24a09b22d273faf6491 100755 (executable)
@@ -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
index b9806de084bc759e56c945993fedd06c35d2fd0c..ad14e91ad1cb44324defc0bde3d0754be6d873f6 100644 (file)
@@ -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