summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-07-21 01:36:36 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-07-21 01:36:36 +0000
commitfcf2dda77899ae72517d0d24b911039b96a000b8 (patch)
treea0cd40864ed27b2ad288a6604dadec1a2ab34ef7
parent576d77f8a54bcbf0607a3b9c937d5a56248cb078 (diff)
downloaddrakx-backup-do-not-use-fcf2dda77899ae72517d0d24b911039b96a000b8.tar
drakx-backup-do-not-use-fcf2dda77899ae72517d0d24b911039b96a000b8.tar.gz
drakx-backup-do-not-use-fcf2dda77899ae72517d0d24b911039b96a000b8.tar.bz2
drakx-backup-do-not-use-fcf2dda77899ae72517d0d24b911039b96a000b8.tar.xz
drakx-backup-do-not-use-fcf2dda77899ae72517d0d24b911039b96a000b8.zip
- do_pkgs_standalone->new doesn't *need* a $in anymore
- ->in replace ->{in} so that it can be created on demand (ugly, but...)
-rw-r--r--perl-install/do_pkgs.pm40
1 files changed, 27 insertions, 13 deletions
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index f9dd64a1c..005e61c9a 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -9,21 +9,16 @@ sub do_pkgs {
package do_pkgs_common;
use common;
-sub new {
- my ($type, $in) = @_;
- bless { in => $in }, $type;
-}
-
sub ensure_is_installed {
my ($do, $pkg, $o_file, $b_auto) = @_;
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)
+ $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;
$do->install($pkg) or return;
}
if ($o_file && ! -e "$::prefix$o_file") {
- $do->{in}->ask_warn('', N("Mandatory package %s is missing", $pkg));
+ $do->in->ask_warn('', N("Mandatory package %s is missing", $pkg));
return;
}
1;
@@ -54,6 +49,11 @@ sub new {
bless { in => $in, o => $::o }, $type;
}
+sub in {
+ my ($do) = @_;
+ $do->{in};
+}
+
sub install {
my ($do, @l) = @_;
log::l("do_pkgs_during_install::install");
@@ -130,6 +130,20 @@ use log;
our @ISA = qw(do_pkgs_common);
+sub new {
+ my ($type, $o_in) = @_;
+ bless { in => $o_in }, $type;
+}
+
+sub in {
+ my ($do) = @_;
+ $do->{in} ||= do {
+ require interactive;
+ interactive->vnew;
+ };
+ $do->{in};
+}
+
sub install {
my ($do, @l) = @_;
@@ -140,11 +154,11 @@ sub install {
return 1;
}
- my $_wait = $do->{in}->wait_message('', N("Installing packages..."));
- $do->{in}->suspend;
+ my $_wait = $do->in->wait_message('', N("Installing packages..."));
+ $do->in->suspend;
log::explanations("installed packages @l");
my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', '--no-verify-rpm', @l) == 0;
- $do->{in}->resume;
+ $do->in->resume;
$ret;
}
@@ -214,11 +228,11 @@ sub are_installed {
sub remove {
my ($do, @l) = @_;
- my $_wait = $do->{in}->wait_message('', N("Removing packages..."));
- $do->{in}->suspend;
+ my $_wait = $do->in->wait_message('', N("Removing packages..."));
+ $do->in->suspend;
log::explanations("removed packages @l");
my $ret = system('rpm', '-e', @l) == 0;
- $do->{in}->resume;
+ $do->in->resume;
$ret;
}