appliance init: find NIC name for dhcpcd

dhcpcd requires an interface name as parameter to work. We are now
getting it from /proc/sys/net/ipv4/conf/ folder children. dhclient
on Debian also has the problem, thus use the guessed interface name
for it too.
This commit is contained in:
Cédric Bosdonnat
2015-07-29 10:35:00 +02:00
committed by Richard W.M. Jones
parent 37a0378556
commit 2d2a65504d

View File

@@ -108,10 +108,11 @@ ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
if test "$guestfs_network" = 1; then
iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
if dhclient --version >/dev/null 2>&1; then
dhclient
dhclient $iface
else
dhcpcd
dhcpcd $iface
fi
fi