[Libguestfs] [PATCH 2/3] v2v: linux: install packages

Pino Toscano ptoscano at redhat.com
Tue Nov 6 17:13:40 UTC 2018


On Tuesday, 6 November 2018 11:44:14 CET Tomáš Golembiovský wrote:
> Install packages from local files without touching network.
> 
> Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
> ---

In this case, better name it local_install/install_local (or something
along these lines) to make it more clear it is not a "classic install".

> +and do_install g { i_package_format = package_format } packages =
> +  assert (List.length packages > 0);
> +  match package_format with
> +  | "rpm" ->
> +    let cmd = [ "yum"; "--assumeyes"; "install" ] @ packages in
> +    let cmd = Array.of_list cmd in
> +    ignore (g#command cmd)

Note that i_package_format and i_package_management are different
things.  The code above breaks when the system is RPM-based, but does
not use yum, so e.g. Fedora (supported), and ALT Linux (not supported).

So either use i_package_format with low-level package managers
(rpm/dpkg/etc), or use i_package_management with yum/dnf/etc.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20181106/1d128747/attachment.sig>


More information about the Libguestfs mailing list