diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-06-21 18:41:23 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-06-21 18:42:48 +0200 |
commit | 3972294e28309fc18baa53999eefe1f937b26b10 (patch) | |
tree | cf28a34fe76b4057734c2c7efa9a609e01189822 /perl-install/do_pkgs.pm | |
parent | d55fa70f6c5e3b2212e2eba7d9d97141efe3a4c4 (diff) | |
download | drakx-3972294e28309fc18baa53999eefe1f937b26b10.tar drakx-3972294e28309fc18baa53999eefe1f937b26b10.tar.gz drakx-3972294e28309fc18baa53999eefe1f937b26b10.tar.bz2 drakx-3972294e28309fc18baa53999eefe1f937b26b10.tar.xz drakx-3972294e28309fc18baa53999eefe1f937b26b10.zip |
(_find_file) introduce it
either file has an absolute path and we check for its existence or it
has not and we assume it's a binary to lookup in $PATH
thus fixing a warning in mousedrake since
commit be1d69418fda6e16422d634c59b54375bfa7a897
Diffstat (limited to 'perl-install/do_pkgs.pm')
-rw-r--r-- | perl-install/do_pkgs.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index 5ca4b24fc..8b56be26c 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -111,6 +111,16 @@ sub ensure_binary_is_installed { 1; } +sub _find_file { + my ($file) = @_; + if ($file =~ m!/!) { + -e "$::prefix$file"; + } else { + # assume it's a binary to search in $PATH: + whereis_binary($file, $prefix); + } +} + =item ensure_files_are_installed($do, $pkgs, $b_auto) Takes a list of [ "package", "file" ] and installs package if file is not there. @@ -121,7 +131,7 @@ If $b_auto is set, (g)urpmi will not ask any questions. sub ensure_files_are_installed { my ($do, $pkgs, $b_auto) = @_; - my @not_installed = map { my ($package, $file) = @$_; if_(!whereis_binary($file, $::prefix), $package) } @$pkgs; + my @not_installed = map { my ($package, $file) = @$_; if_(!_find_file($file), $package) } @$pkgs; return 1 if !@not_installed; $do->in->ask_okcancel(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @not_installed), 1) |