From 0bb1667297eff25add0340af9efdaf97b2979177 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 23 May 2012 18:27:07 +0000 Subject: (init_auto_install) split it out of main() --- perl-install/install/install2.pm | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'perl-install/install') diff --git a/perl-install/install/install2.pm b/perl-install/install/install2.pm index 75a2ebda6..3170d17c4 100644 --- a/perl-install/install/install2.pm +++ b/perl-install/install/install2.pm @@ -352,6 +352,31 @@ sub init_brltty() { run_program::run("brltty"); } +sub init_auto_install() { + if ($::auto_install =~ /-IP(\.pl)?$/) { + my ($ip) = cat_('/tmp/stage1.log') =~ /configuring device (?!lo)\S+ ip: (\S+)/; + my $normalized_ip = join('', map { sprintf "%02X", $_ } split('\.', $ip)); + $::auto_install =~ s/-IP(\.pl)?$/-$normalized_ip$1/; + } + require install::steps_auto_install; + eval { $o = $::o = install::any::loadO($o, $::auto_install) }; + if ($@) { + if ($o->{useless_thing_accepted}) { #- Pixel's hack to be able to fail through + log::l("error using auto_install, continuing"); + undef $::auto_install; + } else { + install::steps_auto_install_non_interactive::errorInStep($o, "Error using auto_install\n" . formatError($@)); + } + } else { + log::l("auto install config file loaded successfully"); + + #- normalize for people not using our special scheme + foreach (@{$o->{manualFstab} || []}) { + $_->{device} =~ s!^/dev/!!; + } + } +} + sub step_init { my ($o) = @_; my $o_; @@ -569,28 +594,7 @@ sub main { #- done after module dependencies are loaded for "vfat depends on fat" if ($::auto_install) { - if ($::auto_install =~ /-IP(\.pl)?$/) { - my ($ip) = cat_('/tmp/stage1.log') =~ /configuring device (?!lo)\S+ ip: (\S+)/; - my $normalized_ip = join('', map { sprintf "%02X", $_ } split('\.', $ip)); - $::auto_install =~ s/-IP(\.pl)?$/-$normalized_ip$1/; - } - require install::steps_auto_install; - eval { $o = $::o = install::any::loadO($o, $::auto_install) }; - if ($@) { - if ($o->{useless_thing_accepted}) { #- Pixel's hack to be able to fail through - log::l("error using auto_install, continuing"); - undef $::auto_install; - } else { - install::steps_auto_install_non_interactive::errorInStep($o, "Error using auto_install\n" . formatError($@)); - } - } else { - log::l("auto install config file loaded successfully"); - - #- normalize for people not using our special scheme - foreach (@{$o->{manualFstab} || []}) { - $_->{device} =~ s!^/dev/!!; - } - } + init_auto_install(); } else { $o->{interactive} ||= 'gtk'; } -- cgit v1.2.1