summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-02-11 14:24:13 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-02-11 14:24:13 +0000
commit3dddd920e035b909143861e6fd5ab7a522966b24 (patch)
tree9eb5b647394755c3ec53477775f8b06f7bd6f810
parentea3d1d46d0537705ef5771bea985ed0cc63e45c2 (diff)
downloaddrakx-3dddd920e035b909143861e6fd5ab7a522966b24.tar
drakx-3dddd920e035b909143861e6fd5ab7a522966b24.tar.gz
drakx-3dddd920e035b909143861e6fd5ab7a522966b24.tar.bz2
drakx-3dddd920e035b909143861e6fd5ab7a522966b24.tar.xz
drakx-3dddd920e035b909143861e6fd5ab7a522966b24.zip
do_pkgs: add ensure_files_are_installed
-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) {