diff options
-rw-r--r-- | perl-install/install2.pm | 1 | ||||
-rw-r--r-- | perl-install/install_any.pm | 27 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 1 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 27 |
4 files changed, 30 insertions, 26 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 785dd2c56..c4b50986b 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -577,6 +577,7 @@ sub main { install_any::clean_postinstall_rpms(); install_any::log_sizes($o); install_any::ejectCdrom(); + install_any::remove_advertising($o); $::live or fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); modules::write_conf($o->{prefix}); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index b7dc23972..3686893b8 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -3,7 +3,7 @@ package install_any; # $Id$ use diagnostics; use strict; -use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @needToCopy @needToCopyIfRequiresSatisfied $boot_medium); +use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @needToCopy @needToCopyIfRequiresSatisfied $boot_medium @advertising_images); @ISA = qw(Exporter); %EXPORT_TAGS = ( @@ -92,7 +92,7 @@ sub errorOpeningFile($) { $current_medium = $asked_medium; eval { fs::mount($cdrom, "/tmp/image", "iso9660", 'readonly') }; my $getFile = getFile($file); - $getFile and $::o->copy_advertising; + $getFile && @advertising_images and copy_advertising($::o); $getFile and return $getFile; $current_medium = 'unknown'; #- don't know what CD is inserted now. ejectCdrom($cdrom); @@ -760,5 +760,28 @@ sub log_sizes { formatXiB(sum(`rpm --root $o->{prefix}/ -qa --queryformat "%{size}\n"`))) if -x "$o->{prefix}/bin/rpm"; } +sub copy_advertising { + my ($o) = @_; + + return if $::rootwidth < 800; + + my $f = getFile('Mandrake/share/advertising/list'); + if (my @files = <$f>) { + my $dir = "$o->{prefix}/tmp/drakx-images"; + mkdir $dir; + unlink glob_("$dir/*"); + foreach (@files) { + chomp; + getAndSaveFile("Mandrake/share/advertising/$_", "$dir/$_"); + } + @advertising_images = map { "$dir/$_" } @files; + } +} +sub remove_advertising { + my ($o) = @_; + unlink @advertising_images; + rmdir "$o->{prefix}/tmp/drakx-images"; + @advertising_images = (); +} 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 9f119b6e0..73861fea9 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -280,7 +280,6 @@ sub choosePackages { $availableCorrected; } -sub copy_advertising {} sub beforeInstallPackages { my ($o) = @_; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 4687283a7..79012db54 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -481,26 +481,7 @@ sub choosePackagesTree { sub beforeInstallPackages { my ($o) = @_; $o->SUPER::beforeInstallPackages; - $o->copy_advertising; -} - -my @advertising_images; -sub copy_advertising { - my ($o) = @_; - - return if $::rootwidth < 800; - - my $f = install_any::getFile('Mandrake/share/advertising/list'); - if (my @files = <$f>) { - my $dir = "$o->{prefix}/tmp/drakx-images"; - mkdir $dir; - unlink glob_("$dir/*"); - foreach (@files) { - chomp; - install_any::getAndSaveFile("Mandrake/share/advertising/$_", "$dir/$_"); - } - @advertising_images = map { "$dir/$_" } @files; - } + install_any::copy_advertising($o); } #------------------------------------------------------------------------------ @@ -533,7 +514,7 @@ sub installPackages { $cancel->signal_connect(clicked => sub { $pkgs::cancel_install = 1 }); my ($change_time, $i); - if (@advertising_images) { + if (@install_any::advertising_images) { log::l("hiding"); $msg->hide; $progress->hide; @@ -558,9 +539,9 @@ sub installPackages { $last_size = c::headerGetEntry(pkgs::packageHeader($p), 'size'); $text->set((split /\n/, c::headerGetEntry(pkgs::packageHeader($p), 'summary'))[0] || ''); - if (@advertising_images && time() - $change_time > 20) { + if (@install_any::advertising_images && time() - $change_time > 20) { $change_time = time(); - my $f = $advertising_images[$i++ % @advertising_images]; + my $f = $install_any::advertising_images[$i++ % @install_any::advertising_images]; log::l("advertising $f"); gtkdestroy($advertising); gtkpack($box, $advertising = gtkpng($f)); |