From 0e8c8254db9eb7334b190afe23d64ea3c3844f11 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 23 May 2012 18:26:47 +0000 Subject: (step_init) split it out of main() --- perl-install/install/install2.pm | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/perl-install/install/install2.pm b/perl-install/install/install2.pm index b58cba988..d8594b8db 100644 --- a/perl-install/install/install2.pm +++ b/perl-install/install/install2.pm @@ -341,6 +341,28 @@ sub init_brltty() { run_program::run("brltty"); } +sub step_init { + my ($o) = @_; + my $o_; + while (1) { + $o_ = $::auto_install ? + install::steps_auto_install->new($o) : + $o->{interactive} eq "stdio" ? + install::steps_stdio->new($o) : + $o->{interactive} eq "curses" ? + install::steps_curses->new($o) : + $o->{interactive} eq "gtk" ? + install::steps_gtk->new($o) : + die "unknown install type"; + $o_ and last; + + log::l("$o->{interactive} failed, trying again with curses"); + $o->{interactive} = "curses"; + require install::steps_curses; + } + $o; +} + sub read_product_id() { my $product_id = cat__(install::any::getFile_($o->{stage2_phys_medium}, "product.id")); log::l('product_id: ' . chomp_($product_id)); @@ -610,26 +632,9 @@ sub main { } } - my $o_; $ENV{COLUMNS} ||= 80; $ENV{LINES} ||= 25; - while (1) { - $o_ = $::auto_install ? - install::steps_auto_install->new($o) : - $o->{interactive} eq "stdio" ? - install::steps_stdio->new($o) : - $o->{interactive} eq "curses" ? - install::steps_curses->new($o) : - $o->{interactive} eq "gtk" ? - install::steps_gtk->new($o) : - die "unknown install type"; - $o_ and last; - - log::l("$o->{interactive} failed, trying again with curses"); - $o->{interactive} = "curses"; - require install::steps_curses; - } - $::o = $o = $o_; + $::o = $o = step_init($o); eval { output('/proc/splash', "verbose\n") }; -- cgit v1.2.1