nixos/initrd-network: always run postCommands
As outlined in #71447, postCommands should always be run if networking in initrd is enabled. regardless if the configuration actually succeeded.
This commit is contained in:
parent
d25c1a8fdc
commit
589789997f
@ -113,8 +113,7 @@ in
|
|||||||
for o in $(cat /proc/cmdline); do
|
for o in $(cat /proc/cmdline); do
|
||||||
case $o in
|
case $o in
|
||||||
ip=*)
|
ip=*)
|
||||||
ipconfig $o && hasNetwork=1 \
|
ipconfig $o && ifaces="$ifaces $(echo $o | cut -d: -f6)"
|
||||||
&& ifaces="$ifaces $(echo $o | cut -d: -f6)"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -122,28 +121,20 @@ in
|
|||||||
|
|
||||||
# Otherwise, use DHCP.
|
# Otherwise, use DHCP.
|
||||||
+ optionalString doDhcp ''
|
+ optionalString doDhcp ''
|
||||||
if [ -z "$hasNetwork" ]; then
|
# Bring up all interfaces.
|
||||||
|
for iface in ${dhcpIfShellExpr}; do
|
||||||
|
echo "bringing up network interface $iface..."
|
||||||
|
ip link set "$iface" up && ifaces="$ifaces $iface"
|
||||||
|
done
|
||||||
|
|
||||||
# Bring up all interfaces.
|
# Acquire DHCP leases.
|
||||||
for iface in ${dhcpIfShellExpr}; do
|
for iface in ${dhcpIfShellExpr}; do
|
||||||
echo "bringing up network interface $iface..."
|
echo "acquiring IP address via DHCP on $iface..."
|
||||||
ip link set "$iface" up && ifaces="$ifaces $iface"
|
udhcpc --quit --now -i $iface -O staticroutes --script ${udhcpcScript} ${udhcpcArgs}
|
||||||
done
|
done
|
||||||
|
|
||||||
# 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} && hasNetwork=1
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
''
|
''
|
||||||
|
|
||||||
+ ''
|
+ cfg.postCommands);
|
||||||
if [ -n "$hasNetwork" ]; then
|
|
||||||
echo "networking is up!"
|
|
||||||
${cfg.postCommands}
|
|
||||||
fi
|
|
||||||
'');
|
|
||||||
|
|
||||||
boot.initrd.postMountCommands = mkIf cfg.flushBeforeStage2 ''
|
boot.initrd.postMountCommands = mkIf cfg.flushBeforeStage2 ''
|
||||||
for iface in $ifaces; do
|
for iface in $ifaces; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user