Skip to content

Commit

Permalink
nixos/initrd-network: run DHCP in background
Browse files Browse the repository at this point in the history
  • Loading branch information
presto8 committed Apr 26, 2024
1 parent e07f196 commit 2812c73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nixos/modules/system/boot/initrd-network.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,15 @@ in
# Acquire DHCP leases.
for iface in ${dhcpIfShellExpr}; do
echo "acquiring IP address via DHCP on $iface..."
udhcpc --quit --now -i $iface -O staticroutes --script ${udhcpcScript} ${udhcpcArgs}
# run DHCP in the background until it acquires an address
udhcpc --quit -i $iface -O staticroutes --script ${udhcpcScript} ${udhcpcArgs} &
done
''

+ cfg.postCommands));

boot.initrd.postMountCommands = mkIf (cfg.flushBeforeStage2 && !config.boot.initrd.systemd.enable) ''
pkill udhcpc
for iface in $ifaces; do
ip address flush dev "$iface"
ip link set dev "$iface" down
Expand Down

0 comments on commit 2812c73

Please sign in to comment.