Install packages from local files without touching network.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/linux.ml | 14 ++++++++++++++
v2v/linux.mli | 3 +++
2 files changed, 17 insertions(+)
diff --git a/v2v/linux.ml b/v2v/linux.ml
index 177724e39..966170cdd 100644
--- a/v2v/linux.ml
+++ b/v2v/linux.ml
@@ -31,6 +31,20 @@ let augeas_reload g =
g#aug_load ();
debug_augeas_errors g
+let rec install_local g { i_package_format = package_format } packages =
+ if packages <> [] then (
+ match package_format with
+ | "rpm" ->
+ let cmd = [ "rpm"; "--upgrade"; "-v" ] @ packages in
+ let cmd = Array.of_list cmd in
+ ignore (g#command cmd)
+ | format ->
+ error (f_"don’t know how to install packages using %s: packages: %s")
+ format (String.concat " " packages)
+ (* Reload Augeas in case anything changed. *)
+ augeas_reload g
+ )
+
let rec remove g inspect packages =
if packages <> [] then (
do_remove g inspect packages;
diff --git a/v2v/linux.mli b/v2v/linux.mli
index 1c604665e..80593cebc 100644
--- a/v2v/linux.mli
+++ b/v2v/linux.mli
@@ -23,6 +23,9 @@ val augeas_reload : Guestfs.guestfs -> unit
additional debugging information about parsing problems
that augeas found. *)
+val install_local: Guestfs.guestfs -> Types.inspect -> string list -> unit
+(** Install pacakge(s). *)
+
val remove : Guestfs.guestfs -> Types.inspect -> string list -> unit
(** Uninstall package(s). *)
--
2.19.0