appliance: only wait for resolv.conf update if dhcpcd succeeded

In case network was requested, but the host lacks both dhclient and
dhcpcd, skip the loop which waits for a resolv.conf update.

This reduces boot time by 10 seconds.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
(cherry picked from commit 4ef645778a)
This commit is contained in:
Olaf Hering
2024-05-15 09:11:49 +02:00
committed by Richard W.M. Jones
parent 06205bdf30
commit c4b256cebf

View File

@@ -119,8 +119,7 @@ if test "$guestfs_network" = 1; then
rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved
if dhclient --version >/dev/null 2>&1; then
dhclient $iface
else
dhcpcd $iface
elif dhcpcd $iface; then
# https://github.com/NetworkConfiguration/dhcpcd/issues/258
for i in `seq 0 10`; do
if grep nameserver /etc/resolv.conf; then break; fi