From 65c4cf5a5db0dc5e8900256960960a54fdec0b69 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 19 Jul 2001 00:05:25 +0000 Subject: based on Michael Brown patch: - enables graphical steps in auto_installs for more than gtk - various cleanup --- perl-install/install2.pm | 17 +++++------- perl-install/install_steps_auto_install.pm | 42 ++++++++++++++++++++---------- perl-install/install_steps_newt.pm | 1 + 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/perl-install/install2.pm b/perl-install/install2.pm index e75dcc57c..d8009c523 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -451,12 +451,6 @@ sub main { modules::read_stage1_conf($_) foreach "/tmp/conf.modules", "/etc/modules.conf"; modules::read_already_loaded(); - $o->{interactive} ||= 'gtk'; - if ($o->{interactive} eq "gtk" && availableMemory < 22 * 1024) { - log::l("switching to newt install cuz not enough memory"); - $o->{interactive} = "newt"; - } - #- done after module dependencies are loaded for "vfat depends on fat" if ($::auto_install) { require install_steps_auto_install; @@ -473,11 +467,15 @@ sub main { log::l("auto install config file loaded successfully"); } } - unless ($::auto_install) { - $o->{interactive} ||= 'gtk'; - require"install_steps_$o->{interactive}.pm"; + $o->{interactive} ||= 'gtk' if !$::auto_install; + + if ($o->{interactive} eq "gtk" && availableMemory < 22 * 1024) { + log::l("switching to newt install cuz not enough memory"); + $o->{interactive} = "newt"; } + require"install_steps_$o->{interactive}.pm" if $o->{interactive}; #- no space to skip perl2fcalls + eval { $o = $::o = install_any::loadO($o, "patch") } if $patch; eval { $o = $::o = install_any::loadO($o, $cfg) } if $cfg; @@ -514,7 +512,6 @@ sub main { my $o_; while (1) { - require"install_steps_$o->{interactive}.pm"; $o_ = $::auto_install ? install_steps_auto_install->new($o) : $o->{interactive} eq "stdio" ? diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index f72565fd4..256f19ed2 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -7,8 +7,6 @@ use vars qw(@ISA $graphical @graphical_steps); @ISA = qw(install_steps); -@graphical_steps = qw(enteringStep beforeInstallPackages installPackages); - use modules; @@ -22,19 +20,35 @@ use log; sub new { my ($type, $o) = @_; - if ($graphical) { - require install_steps_gtk; - push @ISA, 'interactive_gtk'; - foreach my $f (@graphical_steps) { - no strict 'refs'; - my $pkg = $install_steps_gtk::{$f} ? 'install_steps_gtk' : 'install_steps_interactive'; - log::l("install_steps_auto_install: adding function ", $pkg, "::", $f); - *{"install_steps_auto_install::$f"} = sub { - local @ISA = ('install_steps_gtk', @ISA); - &{$pkg . '::' . $f}; - }; + # Handle legacy options + $o->{interactive} ||= 'gtk' if $graphical; + $o->{interactiveSteps} ||= [ @graphical_steps ]; + push @{$o->{interactiveSteps}}, qw(enteringStep formatMountPartitions beforeInstallPackages installPackages); + + if ($o->{interactive}) { + push @ISA, "interactive_$o->{interactive}"; + + my $interactiveClass = "install_steps_$o->{interactive}"; + require"$interactiveClass.pm"; #- no space to skip perl2fcalls + + #- remove the empty wait_message + undef *wait_message; + + foreach my $f (@{$o->{interactiveSteps}}) { + foreach my $pkg ($interactiveClass, 'install_steps_interactive') { + if ($::{$pkg . "::"}{$f}) { + log::l("install_steps_auto_install: adding function ", $pkg, "::", $f); + + no strict 'refs'; + *{"install_steps_auto_install::$f"} = sub { + local @ISA = ($interactiveClass, @ISA); + &{$::{$pkg . "::"}{$f}}; + }; + last; + } + } } - goto &install_steps_gtk::new; + goto &{$::{$interactiveClass . "::"}{new}}; } else { (bless {}, ref $type || $type)->SUPER::new($o); } diff --git a/perl-install/install_steps_newt.pm b/perl-install/install_steps_newt.pm index 20e0293e6..34710782e 100644 --- a/perl-install/install_steps_newt.pm +++ b/perl-install/install_steps_newt.pm @@ -22,6 +22,7 @@ sub banner { my $banner = translate(__("Mandrake Linux Installation %s")); my $l = first(Newt::GetScreenSize) - length($banner) - length($_[0]) + 1; Newt::DrawRootText(0, 0, sprintf($banner, ' ' x $l . $_[0])); + Newt::Refresh; } sub new($$) { -- cgit v1.2.1