On Tue, Nov 06, 2018 at 06:13:40PM +0100, Pino Toscano wrote:
> 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ý <tgole...@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.

FWIW virt-customize does something similar:

https://github.com/libguestfs/libguestfs/blob/c7343a29dd52a1264785292ca71dd8f629aa6dfa/customize/customize_run.ml#L105-L135

It's probably too much effort to combine this right now, and in any
case you [Tomáš] only need the yum and maybe dnf cases.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to