summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/do_pkgs.pm20
2 files changed, 22 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index cf190d1b7..ff9ec1a31 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -7,6 +7,8 @@
- drakboot:
o when installing to a removable device, put boot sector there, else
put it into first non removable drive (#47106)
+- do_pkgs:
+ o add ensure_files_are_installed
Version 11.81 - 3 February 2009
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index 1667d5cf5..a40eb66a7 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -68,6 +68,26 @@ sub ensure_binary_is_installed {
1;
}
+# takes a list of [ "package", "file" ] and installs package if file is not there
+sub ensure_files_are_installed {
+ my ($do, $pkgs, $b_auto) = @_;
+
+ my @not_installed = map { my ($package, $file) = @{$_}; -e "$::prefix$file"?():$package } @{$pkgs};
+
+ $do->in->ask_okcancel(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @not_installed), 1)
+ or return if !$b_auto && $do->in;
+
+ if (!$do->install(@not_installed)) {
+ if ($do->in) {
+ $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $not_installed[0]));
+ } else {
+ log::l("Could not install packages: " . join(' ', @not_installed));
+ }
+ return;
+ }
+ 1;
+}
+
sub ensure_is_installed_if_available {
my ($do, $pkg, $file) = @_;
if (-e "$::prefix$file" || $::testing) {