From f83545cabfa4cc23b333bce333be938d91ab2309 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 1 Jun 2005 03:44:24 +0000 Subject: add language selection to finish-install --- perl-install/any.pm | 25 +++++++++++++++++++++++++ perl-install/standalone/finish-install | 27 +++++++++++++++++++++++---- perl-install/standalone/localedrake | 27 +-------------------------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/perl-install/any.pm b/perl-install/any.pm index 085b3abe7..03b1171be 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -776,6 +776,31 @@ when your installation is complete and you restart your system.")), } } +sub selectLanguage_and_more_standalone { + my ($in, $locale) = @_; + eval { + local $::isWizard = 1; + language: + # keep around previous settings so that selectLanguage can keep UTF-8 flag: + local $::Wizard_no_previous = 1; + my $old_lang = $locale->{lang}; + $in->{locale} = $locale; + $locale->{lang} = selectLanguage($in, $locale->{lang}); + $locale->{IM} = lang::get_default_im($locale->{lang}) if $old_lang ne $locale->{lang}; + undef $::Wizard_no_previous; + selectCountry($in, $locale) or goto language; + }; + if ($@) { + if ($@ =~ /^one lang only/) { + selectCountry($in, $locale) or $in->exit(0); + } elsif ($@ !~ /wizcancel/) { + die; + } else { + $in->exit(0); + } + } +} + sub selectCountry { my ($in, $locale) = @_; diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install index c3140d8f5..653ddf24a 100755 --- a/perl-install/standalone/finish-install +++ b/perl-install/standalone/finish-install @@ -9,6 +9,7 @@ use authentication; use network::netconnect; use security::level; +$ENV{SHARE_PATH} ||= "/usr/share"; my $authentication = authentication::get(); my $security = security::level::get(); network::netconnect::read_net_conf(my $netcnx = {}, my $netc = {}, my $intf = {}); @@ -16,10 +17,19 @@ network::netconnect::read_net_conf(my $netcnx = {}, my $netc = {}, my $intf = {} $::isWizard = 1; my $in = 'interactive'->vnew; +sub ask_language() { + require lang; + my $locale = lang::read(); + any::selectLanguage_and_more_standalone($in, $locale); + lang::write($locale); + lang::set($locale); + Gtk2->set_locale; +} + sub ask_network() { my $modules_conf = modules::any_conf->read; require network::netconnect; - network::netconnect::real_main('', $netcnx, $in, $modules_conf, $netc, undef, $intf); + network::netconnect::real_main($netcnx, $in, $modules_conf, $netc, undef, $intf); } sub ask_authentication() { @@ -45,11 +55,20 @@ sub ask_users() { any::add_users($users, $authentication); } -eval { ask_network() }; +sub call { + my ($f_name) = @_; + log::l("calling $f_name"); + my $f = $::{$f_name} or internal_error "bad function $f_name"; + eval { $f->() }; + log::l("$f_name failed: $@") if $@; +} + +call('ask_language'); +call('ask_network'); $::WizardWindow->destroy; undef $::WizardWindow; $::Wizard_pix_up = 'redhat-config-users'; -eval { ask_authentication() }; -eval { ask_users() }; +call('ask_authentication'); +call('ask_users'); setVarsInSh('/etc/sysconfig/finish-install', { FINISH_INSTALL => 'no' }); $in->exit(0); diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake index 6f311e019..3c379c763 100644 --- a/perl-install/standalone/localedrake +++ b/perl-install/standalone/localedrake @@ -37,32 +37,7 @@ my $in = 'interactive'->vnew; $ugtk2::wm_icon = "localedrake"; $::Wizard_title = N("LocaleDrake"); -sub select_country() { - any::selectCountry($in, $locale); -} - -eval { - local $::isWizard = 1; - language: - # keep around previous settings so that any::selectLanguage can keep UTF-8 flag: - local $::Wizard_no_previous = 1; - my $old_lang = $locale->{lang}; - $in->{locale} = $locale; - $locale->{lang} = any::selectLanguage($in, $locale->{lang}); - $locale->{IM} = lang::get_default_im($locale->{lang}) if $old_lang ne $locale->{lang}; - undef $::Wizard_no_previous; - select_country() or goto language; -}; -if ($@) { - if ($@ =~ /^one lang only/) { - select_country() or $in->exit(0); - } elsif ($@ !~ /wizcancel/) { - die; - } else { - $in->exit(0); - } -} - +any::selectLanguage_and_more_standalone($in, $locale); lang::write($locale, $>); my $msg = N("The change is done, but to be effective you must logout"); -- cgit v1.2.1