Cédric Bosdonnat
2015-Jul-29 08:35 UTC
[Libguestfs] [PATCH v2] 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. --- appliance/init | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appliance/init b/appliance/init index cca62e7..d5a428d 100755 --- a/appliance/init +++ b/appliance/init @@ -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 -- 2.1.4
Richard W.M. Jones
2015-Jul-29 16:25 UTC
Re: [Libguestfs] [PATCH v2] appliance init: find NIC name for dhcpcd
On Wed, Jul 29, 2015 at 10:35:00AM +0200, Cédric Bosdonnat wrote:> 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. > --- > appliance/init | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/appliance/init b/appliance/init > index cca62e7..d5a428d 100755 > --- a/appliance/init > +++ b/appliance/init > @@ -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 > fiLooks good to me, I'll apply it soon. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Seemingly Similar Threads
- [PATCH 0/2] Misc fixes
- [PATCH 1/2] appliance init: find NIC name for dhcpcd
- Re: [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.
- Re: [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.
- [PATCH] appliance: Remove /etc/dhcp/dhclient-enter-hooks.d/resolved.