From 52e73a5e6467ad49775c7b8915826f6d5828d146 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 5 Sep 2005 09:18:51 +0000 Subject: create ->ensure_are_installed (alike ->ensure_is_installed) --- perl-install/do_pkgs.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) = @_; -- cgit v1.2.1