From: Will Woods Date: Wed, 7 Mar 2012 22:21:54 +0000 (-0500) Subject: write-ifcfg.sh: add UUID=.. and save the lease files with the same uuid X-Git-Tag: 018~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66666c670a462548df4ea4c8069d54b8c309ecf4;p=thirdparty%2Fdracut.git write-ifcfg.sh: add UUID=.. and save the lease files with the same uuid As described in https://bugzilla.redhat.com/show_bug.cgi?id=541410#c2, if you want NetworkManager to take over an interface that you're using for NFS root (or other network root device), you need to: a) set UUID= in ifcfg-, and b) save the lease file as /var/lib/dhclient--.lease This patch should make write-ifcfg handle both these things. --- diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh index 0f431e3f2..fe986df43 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -18,11 +18,13 @@ if [ -e /tmp/bridge.info ]; then fi mkdir -m 0755 -p /tmp/ifcfg/ +mkdir -m 0755 -p /tmp/ifcfg-leases/ for netif in $IFACES ; do # bridge? unset bridge unset bond + uuid=$(cat /proc/sys/kernel/random/uuid) if [ "$netif" = "$bridgename" ]; then bridge=yes elif [ "$netif" = "$bondname" ]; then @@ -35,10 +37,12 @@ for netif in $IFACES ; do echo "DEVICE=$netif" echo "ONBOOT=yes" echo "NETBOOT=yes" + echo "UUID=$uuid" if [ -f /tmp/net.$netif.lease ]; then strstr "$ip" '*:*:*' && echo "DHCPV6C=yes" echo "BOOTPROTO=dhcp" + cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease else echo "BOOTPROTO=none" # If we've booted with static ip= lines, the override file is there @@ -135,9 +139,12 @@ done # Pass network opts mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts +mkdir -m 0755 -p /run/initramfs/state/var/lib/dhclient echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab +echo "files /var/lib/dhclient" >> /run/initramfs/rwtab { cp /tmp/net.* /run/initramfs/ cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* + cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient } > /dev/null 2>&1