From df587e7ed6c3f327c6a3b851148d337e99bfeda3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 27 Sep 2005 09:37:22 +0000 Subject: ensure we don't prompt things when we are not interactive --- perl-install/do_pkgs.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'perl-install/do_pkgs.pm') diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index 4d1464bc2..73fa466d1 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -14,7 +14,7 @@ sub ensure_is_installed { if (! $o_file || ! -e "$::prefix$o_file") { $do->in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) - or return if !$b_auto; + or return if !$b_auto && $do->in; if (!$do->install($pkg)) { $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $pkg)); return; @@ -33,7 +33,7 @@ sub ensure_are_installed { 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; + or return if !$b_auto && $do->in; if (!$do->install(@not_installed)) { $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $not_installed[0])); @@ -47,7 +47,7 @@ sub ensure_binary_is_installed { if (!whereis_binary($binary, $::prefix)) { $do->in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) - or return if !$b_auto; + or return if !$b_auto && $do->in; if (!$do->install($pkg)) { $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $pkg)); return; @@ -104,6 +104,9 @@ our @ISA = qw(do_pkgs_common); sub new { my ($type, $in) = @_; + + $in->isa('interactive') or undef $in; + require pkgs; bless { in => $in, o => $::o }, $type; } -- cgit v1.2.1