dracut/0024-write-ifcfg.sh-add-UUID-.-and-save-the-lease-files-w.patch
Harald Hoyer 9e9f8f2f11 dracut-017-43.git20120312
- live image: fixed image uncompression
- live updates for livenet
2012-03-12 15:46:29 +01:00

63 lines
2.3 KiB
Diff

From 66666c670a462548df4ea4c8069d54b8c309ecf4 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Wed, 7 Mar 2012 17:21:54 -0500
Subject: [PATCH] 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=<uuid> in ifcfg-<iface>, and
b) save the lease file as /var/lib/dhclient-<uuid>-<iface>.lease
This patch should make write-ifcfg handle both these things.
---
modules.d/45ifcfg/write-ifcfg.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 0f431e3..fe986df 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