summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-07 01:50:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-07 01:50:15 +0000
commit191416f9181dccc281abf717503e401fa7db3d17 (patch)
tree58013c0a08aba3f6e4836a22cc64b5bd212230e4
parent0ed40946c1ce1fc0be10e7401f2c686ebab790c9 (diff)
downloaddrakx-191416f9181dccc281abf717503e401fa7db3d17.tar
drakx-191416f9181dccc281abf717503e401fa7db3d17.tar.gz
drakx-191416f9181dccc281abf717503e401fa7db3d17.tar.bz2
drakx-191416f9181dccc281abf717503e401fa7db3d17.tar.xz
drakx-191416f9181dccc281abf717503e401fa7db3d17.zip
- backport "add language selection"
- add keyboard selection
-rwxr-xr-xperl-install/standalone/finish-install83
1 files 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);
+ }
+ }
+}