From 26f4283dcfbdcb5305c3e7181c6ae82284d47c02 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 13 Aug 2002 21:08:48 +0000 Subject: add ensure_is_installed (which was network::smbnfs::check_raw and is often useful) --- perl-install/standalone.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'perl-install/standalone.pm') diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index e6142fcbe..54205dc7b 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -50,6 +50,20 @@ sub install { $ret; } +sub ensure_is_installed { + my ($o, $pkg, $file) = @_; + + if (! -e $file) { + $o->{in}->ask_okcancel('', _("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return; + $o->{in}->do_pkgs->install($pkg); + } + if (! -e $file) { + $o->{in}->ask_warn('', _("Mandatory package %s is missing", $pkg)); + return; + } + 1; +} + sub what_provides { my ($o, $name) = @_; my ($what) = split '\n', `urpmq '$name' 2>/dev/null`; -- cgit v1.2.1