[virt-tools-list] guestfish question

Richard W.M. Jones rjones at redhat.com
Fri Nov 5 13:55:08 UTC 2010

On Thu, Nov 04, 2010 at 11:55:28AM -0400, Kenneth Armstrong wrote:
> rootdisk=$(guestfish --ro -a $diskimage -i inspect-os)
> distribution=$(guestfish --ro -a $diskimage -i inspect-get-distro $rootdisk)
> echo $distribution

By the way it's quicker to do:

  eval $(guestfish --ro -a $diskimage -i --listen)
  rootdisk="$(guestfish --remote inspect-os)"
  distro="$(guestfish --remote inspect-get-distro $rootdisk)"
  guestfish --remote exit

This launches libguestfs once (instead of twice).


Also: Running the 'inspect-os' command is fine, but it does redo the
inspection process that was already done by the '-i' option[*].  In
libguestfs 1.7.3 there is a call 'inspect-get-roots' which returns the
root(s) from the previous inspection, thus avoiding this duplicate



[*] To see how different guestfish command line options translate to
libguestfs API calls, use the guestfish -x option.

Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)

More information about the virt-tools-list mailing list