]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network: configure NetworkManager to use dhclient
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 18 Sep 2018 09:17:54 +0000 (11:17 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 21 Sep 2018 08:40:55 +0000 (10:40 +0200)
If the network module obtained a lease using dhclient, NetworkManager
must be configured to use it too, otherwise it would obtain a different
lease (and could potentially break a connection to the network volume).

modules.d/40network/ifup.sh

index 54981386cc6624461b7efd585eb7f8b7b09fcbdf..ea2a67ff0ad28a74031e8404165e19a03de8d1d2 100755 (executable)
@@ -41,6 +41,12 @@ do_dhcp() {
         return 1
     fi
 
+    if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
+        mkdir -p /run/NetworkManager/conf.d
+        echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
+        echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
+    fi
+
     while [ $_COUNT -lt $_DHCPRETRY ]; do
         info "Starting dhcp for interface $netif"
         dhclient "$@" \