From 191416f9181dccc281abf717503e401fa7db3d17 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 7 Jun 2005 01:50:15 +0000 Subject: - backport "add language selection" - add keyboard selection --- perl-install/standalone/finish-install | 83 ++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install index 212032e9f..4d615762e 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,6 +17,40 @@ 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_keyboard() { + require keyboard; + my $keyboard = keyboard::read(); + + choose: + $keyboard->{KEYBOARD} = $in->ask_from_listf(N("Keyboard"), + N("Please, choose your keyboard layout."), + sub { translate(keyboard::KEYBOARD2text($_[0])) }, + [ keyboard::KEYBOARDs() ], + $keyboard->{KEYBOARD}) or return; + + keyboard::group_toggle_choose($in, $keyboard) or goto choose; + + keyboard::setxkbmap($keyboard); + eval { + my $xfree_conf = Xconfig::xfree->read; + my $xkb = keyboard::keyboard2full_xkb($keyboard); + $xfree_conf->set_keyboard($xkb); + $xfree_conf->write; + }; + + keyboard::write($keyboard); + system('/etc/init.d/keytable', 'restart'); +} + sub ask_network() { my $modules_conf = modules::any_conf->read; modules::load_category($modules_conf, 'net'); @@ -47,11 +82,53 @@ 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_keyboard'); +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); + + +sub lang__set { + my ($locale) = @_; + put_in_hash(\%ENV, lang::i18n_env($locale)); + lang::bindtextdomain(); +} + +sub any__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} = any::selectLanguage($in, $locale->{lang}); + $locale->{IM} = lang::get_default_im($locale->{lang}) if $old_lang ne $locale->{lang}; + undef $::Wizard_no_previous; + any::selectCountry($in, $locale) or goto language; + }; + if ($@) { + if ($@ =~ /^one lang only/) { + any::selectCountry($in, $locale) or $in->exit(0); + } elsif ($@ !~ /wizcancel/) { + die; + } else { + $in->exit(0); + } + } +} -- cgit v1.2.1