[Libguestfs] [PATCH v2] appliance init: find NIC name for dhcpcd
Richard W.M. Jones
rjones at redhat.com
Wed Jul 29 16:25:24 UTC 2015
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
> fi
Looks 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
More information about the Libguestfs
mailing list