initrd-network: call postCommands only if network is up
This commit is contained in:
parent
20b54bd989
commit
b4528a696a
@ -63,9 +63,9 @@ in
|
|||||||
copy_bin_and_libs ${pkgs.mkinitcpio-nfs-utils}/bin/ipconfig
|
copy_bin_and_libs ${pkgs.mkinitcpio-nfs-utils}/bin/ipconfig
|
||||||
'';
|
'';
|
||||||
|
|
||||||
boot.initrd.preLVMCommands =
|
boot.initrd.preLVMCommands = mkBefore (
|
||||||
# Search for interface definitions in command line.
|
# Search for interface definitions in command line.
|
||||||
mkBefore ''
|
''
|
||||||
for o in $(cat /proc/cmdline); do
|
for o in $(cat /proc/cmdline); do
|
||||||
case $o in
|
case $o in
|
||||||
ip=*)
|
ip=*)
|
||||||
@ -87,11 +87,16 @@ in
|
|||||||
|
|
||||||
# Acquire a DHCP lease.
|
# Acquire a DHCP lease.
|
||||||
echo "acquiring IP address via DHCP..."
|
echo "acquiring IP address via DHCP..."
|
||||||
udhcpc --quit --now --script ${udhcpcScript}
|
udhcpc --quit --now --script ${udhcpcScript} && hasNetwork=1
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
|
|
||||||
+ cfg.postCommands;
|
+ ''
|
||||||
|
if [ -n "$hasNetwork" ]; then
|
||||||
|
echo "networking is up!"
|
||||||
|
${cfg.postCommands}
|
||||||
|
fi
|
||||||
|
'');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user