summaryrefslogtreecommitdiffstats
path: root/modules.d/01systemd-networkd/networkd-config.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:33:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:33:11 +0000
commit203af7302854f453fa4a05ecefd4403b6c8a4f8d (patch)
tree967fdacafe332baabd12b57725505c138d0f3bbf /modules.d/01systemd-networkd/networkd-config.sh
parentAdding upstream version 102. (diff)
downloaddracut-87aa6639b3cd2285afa2ea598366934b1a158354.tar.xz
dracut-87aa6639b3cd2285afa2ea598366934b1a158354.zip
Adding upstream version 103.upstream/103upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/01systemd-networkd/networkd-config.sh')
-rwxr-xr-xmodules.d/01systemd-networkd/networkd-config.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules.d/01systemd-networkd/networkd-config.sh b/modules.d/01systemd-networkd/networkd-config.sh
new file mode 100755
index 0000000..eb450c6
--- /dev/null
+++ b/modules.d/01systemd-networkd/networkd-config.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+# Just in case we're running before it
+systemctl start systemd-network-generator.service
+
+# Customizations for systemd-network-generator generated networks.
+# We need to request certain DHCP options, and there is no way to
+# tell the generator to add those.
+for f in /run/systemd/network/*.network; do
+ [ -f "$f" ] || continue
+
+ {
+ echo "[DHCPv4]"
+ echo "ClientIdentifier=mac"
+ echo "RequestOptions=17"
+ echo "[DHCPv6]"
+ echo "RequestOptions=59 60"
+ } >> "$f"
+
+ # Remove the default network if at least one was generated
+ rm -f "$systemdnetworkconfdir"/99-dracut-default.network
+done
+
+# Just in case networkd was already running
+systemctl try-reload-or-restart systemd-networkd.service
+
+if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
+ echo rd.neednet >> /etc/cmdline.d/networkd.conf
+fi
+
+if getargbool 0 rd.neednet; then
+ mkdir -p /run/networkd/initrd
+ : > /run/networkd/initrd/neednet
+fi