|
Harald Hoyer |
9d5d75 |
From ee18dd2b88d6767902d442baa92c95f7be69c265 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
9d5d75 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
9d5d75 |
Date: Fri, 17 Aug 2018 12:50:29 +0200
|
|
Harald Hoyer |
9d5d75 |
Subject: [PATCH] ifcfg/write-ifcfg.sh: aggregate resolv.conf
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
The old code used /tmp/net.$netif.resolv.conf with $netif being randomly
|
|
Harald Hoyer |
9d5d75 |
chosen.
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
As it is not known which nameserver have which priority, just sort them
|
|
Harald Hoyer |
9d5d75 |
and deduplicate.
|
|
Harald Hoyer |
9d5d75 |
---
|
|
Harald Hoyer |
9d5d75 |
modules.d/45ifcfg/module-setup.sh | 1 +
|
|
Harald Hoyer |
9d5d75 |
modules.d/45ifcfg/write-ifcfg.sh | 5 ++++-
|
|
Harald Hoyer |
9d5d75 |
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/45ifcfg/module-setup.sh b/modules.d/45ifcfg/module-setup.sh
|
|
Harald Hoyer |
9d5d75 |
index 6791985a..c89def3e 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/45ifcfg/module-setup.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/45ifcfg/module-setup.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -14,6 +14,7 @@ depends() {
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
# called by dracut
|
|
Harald Hoyer |
9d5d75 |
install() {
|
|
Harald Hoyer |
9d5d75 |
+ inst_binary sort
|
|
Harald Hoyer |
9d5d75 |
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
|
Harald Hoyer |
9d5d75 |
}
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
9d5d75 |
index 25c81be3..3bf847a5 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -286,7 +286,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
|
|
Harald Hoyer |
9d5d75 |
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
|
|
Harald Hoyer |
9d5d75 |
{
|
|
Harald Hoyer |
9d5d75 |
cp /tmp/net.* /run/initramfs/
|
|
Harald Hoyer |
9d5d75 |
- cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
|
|
Harald Hoyer |
9d5d75 |
+ for i in /tmp/net.*.resolv.conf; do
|
|
Harald Hoyer |
9d5d75 |
+ [ -f "$i" ] && cat "$i"
|
|
Harald Hoyer |
9d5d75 |
+ done | sort -u > /run/initramfs/state/etc/resolv.conf
|
|
Harald Hoyer |
9d5d75 |
+ [ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
|
|
Harald Hoyer |
9d5d75 |
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
|
|
Harald Hoyer |
9d5d75 |
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
|
|
Harald Hoyer |
9d5d75 |
} > /dev/null 2>&1
|
|
Harald Hoyer |
9d5d75 |
|