summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-09-05 09:18:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-09-05 09:18:51 +0000
commit52e73a5e6467ad49775c7b8915826f6d5828d146 (patch)
tree4981e41f9cfc32de6ebf79801aae77809a141f37
parentdc402e6b8dbd41072f2ecd8f3b95ae2b44bdd0c0 (diff)
downloaddrakx-52e73a5e6467ad49775c7b8915826f6d5828d146.tar
drakx-52e73a5e6467ad49775c7b8915826f6d5828d146.tar.gz
drakx-52e73a5e6467ad49775c7b8915826f6d5828d146.tar.bz2
drakx-52e73a5e6467ad49775c7b8915826f6d5828d146.tar.xz
drakx-52e73a5e6467ad49775c7b8915826f6d5828d146.zip
create ->ensure_are_installed (alike ->ensure_is_installed)
-rw-r--r--perl-install/do_pkgs.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index cd0c4b40a..c98019062 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -27,6 +27,21 @@ sub ensure_is_installed {
1;
}
+sub ensure_are_installed {
+ my ($do, $pkgs, $b_auto) = @_;
+
+ my @not_installed = difference2($pkgs, [ $do->are_installed(@$pkgs) ]) or return 1;
+
+ $do->in->ask_okcancel(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @not_installed), 1)
+ or return if !$b_auto;
+
+ if (!$do->install(@not_installed)) {
+ $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $not_installed[0]));
+ return;
+ }
+ 1;
+}
+
sub ensure_binary_is_installed {
my ($do, $pkg, $binary, $b_auto) = @_;