From 9f36e94ee065873b1b42637a6d332c39c9923451 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Tue, 8 Mar 2005 17:06:49 +0000 Subject: Disable progress bar when copying rpms from CDs. (The change CD dialog clashes with it) --- perl-install/install_any.pm | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'perl-install/install_any.pm') diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 40b7b41de..5cf994aee 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -642,25 +642,29 @@ Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when done.", }; my $total = $o->{mediumsize}; log::l("totalsize=$total"); - my $pid = fork(); - if (!$pid && defined $pid) { #- child - my ($wait_w, $wait_message) = fs::format::wait_message($o); #- nb, this is only called when interactive - $wait_message->(N("Copying in progress")); - #- from commands.pm. TODO: factorize, possibly in MDK::Common. - my $f; $f = sub { - my ($e) = @_; - my $s = (lstat($e))[12]; - $s += sum(map { &$f($_) } glob_("$e/*")) if !-l _ && -d _; - $s; - }; - while (1) { - my $s = $f->("$o->{prefix}/var/ftp/pub/Mandrakelinux/media") / 1024; - $wait_message->('', $s, $total); - sleep 1; - last if $s > $total - 100; + my $pid; + if (!method_allows_medium_change($o->{method}) || $o->{method} =~ /-iso$/) { + #- display the progress bar only for non-cdrom installation methods + $pid = fork(); + if (!$pid && defined $pid) { #- child + my ($wait_w, $wait_message) = fs::format::wait_message($o); #- nb, this is only called when interactive + $wait_message->(N("Copying in progress")); + #- from commands.pm. TODO: factorize, possibly in MDK::Common. + my $f; $f = sub { + my ($e) = @_; + my $s = (lstat($e))[12]; + $s += sum(map { &$f($_) } glob_("$e/*")) if !-l _ && -d _; + $s; + }; + while (1) { + my $s = $f->("$o->{prefix}/var/ftp/pub/Mandrakelinux/media") / 1024; + $wait_message->('', $s, $total); + sleep 1; + last if $s > $total - 100; + } + undef $wait_w; + c::_exit(0); } - undef $wait_w; - c::_exit(0); } foreach my $k (pkgs::allMediums($o->{packages})) { my $m = $o->{packages}{mediums}{$k}; @@ -681,7 +685,7 @@ Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when done.", $m->{method} = 'disk'; $m->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi } - kill 15, $pid; + kill 15, $pid if defined $pid; #- now the install will continue as 'disk' $o->{method} = 'disk'; #- shoud be enough to fool errorOpeningFile -- cgit v1.2.1