[Libguestfs] [PATCH 1/4] p2v: use yast2 lan on SUSE distros rather than NM

Richard W.M. Jones rjones at redhat.com
Wed Jun 22 09:58:20 UTC 2016


On Wed, Jun 22, 2016 at 11:45:32AM +0200, Cédric Bosdonnat wrote:
> NetworkManager isn't provided on SLES. As yast2 lan is available on all
> openSUSE / SLE distro, use it instead.
> ---
>  p2v/gui.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/p2v/gui.c b/p2v/gui.c
> index e720002..b50cadf 100644
> --- a/p2v/gui.c
> +++ b/p2v/gui.c
> @@ -51,6 +51,7 @@
>  
>  #include <config.h>
>  
> +#include <sys/stat.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdarg.h>

There's an informal ordering for header files, and putting
<sys/stat.h> at the very top isn't in that tradition!

> @@ -654,7 +655,11 @@ test_connection_ok (gpointer user_data)
>  static void
>  configure_network_button_clicked (GtkWidget *w, gpointer data)
>  {
> -  ignore_value (system ("nm-connection-editor &"));
> +  struct stat statbuf;
> +  if (stat ("/sbin/yast2", &statbuf) >= 0)
> +    ignore_value (system ("yast2 lan &"));
> +  else
> +    ignore_value (system ("nm-connection-editor &"));

How about using access ("/sbin/yast2", X_OK)?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list