From 33512d7f58fab6184ea1dc21930f1d00c0e382c8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 6 Dec 2000 21:51:26 +0000 Subject: adapt to the fact that RPM_INSTALL_LANG is obsoloted. Now rpm uses %_install_langs in /etc/rpm/macros --- perl-install/install2.pm | 12 +++++++++--- perl-install/install_any.pm | 2 +- perl-install/install_steps.pm | 2 +- perl-install/install_steps_interactive.pm | 10 +++++----- perl-install/lang.pm | 27 +++++++++++++++------------ 5 files changed, 31 insertions(+), 22 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install2.pm b/perl-install/install2.pm index d6e172911..c927e0ac1 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -202,7 +202,10 @@ sub selectLanguage { $o->selectLanguage($_[1] == 1); addToBeDone { - lang::write($o->{prefix}); + lang::write_langs($o->{prefix}, $o->{langs}); + } 'formatPartitions' unless $::g_auto_install; + addToBeDone { + lang::write($o->{prefix}, $o->{lang}); keyboard::write($o->{prefix}, $o->{keyboard}, lang::lang2charset($o->{lang})); } 'installPackages' unless $::g_auto_install; } @@ -240,7 +243,10 @@ sub selectKeyboard { #- if we go back to the selectKeyboard, you must rewrite addToBeDone { - lang::write($o->{prefix}); + lang::write_langs($o->{prefix}, $o->{langs}); + } 'formatPartitions' unless $::g_auto_install; + addToBeDone { + lang::write($o->{prefix}, $o->{lang}); keyboard::write($o->{prefix}, $o->{keyboard}, lang::lang2charset($o->{lang})); } 'installPackages' unless $::g_auto_install; } @@ -279,7 +285,7 @@ sub formatPartitions { $o->formatMountPartitions($o->{fstab}) unless $::testing; mkdir "$o->{prefix}/$_", 0755 foreach - qw(dev etc etc/profile.d etc/sysconfig etc/sysconfig/console etc/sysconfig/network-scripts + qw(dev etc etc/profile.d etc/rpm etc/sysconfig etc/sysconfig/console etc/sysconfig/network-scripts home mnt tmp var var/tmp var/lib var/lib/rpm var/lib/urpmi); mkdir "$o->{prefix}/$_", 0700 foreach qw(root root/tmp); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 7a91dcd1c..a9194c0c0 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -303,7 +303,7 @@ sub setPackages($) { $o->{compss} = pkgs::readCompss($o->{prefix}, $o->{packages}); #- must be done after getProvides - $o->{compssListLevels} = pkgs::readCompssList($o->{packages}, lang::get_langs()); + $o->{compssListLevels} = pkgs::readCompssList($o->{packages}, lang::unpack_langs($o->{langs})); ($o->{compssUsers}, $o->{compssUsersSorted}, $o->{compssUsersIcons}, $o->{compssUsersDescr}) = pkgs::readCompssUsers($o->{packages}, $o->{compss}, $o->{meta_class}); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 689a42d6d..01bcc89e1 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -98,7 +98,7 @@ sub selectLanguage { sub selectKeyboard { my ($o) = @_; keyboard::setup($o->{keyboard}); - lang::set_langs($o->{langs} || [ $o->{lang} ]); + $o->{langs} ||= lang::pack_langs([ $o->{lang} ]); } #------------------------------------------------------------------------------ sub selectPath {} diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 6d48e82e1..b0b5fbd78 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -160,18 +160,18 @@ sub selectKeyboard($) { if ($::expert && ref($o) !~ /newt/) { #- newt is buggy with big windows :-( $o->set_help('selectLangs'); - $o->{langs} ||= [ $o->{lang} ]; - my $all = $o->{langs}[0] eq 'all'; - $o->{langs} = $o->ask_many_from_list('', + $o->{langs} ||= substr($o->{lang}, 0, 2); + my $all = $o->{langs} =~ /all/; + my $l = $o->ask_many_from_list('', _("You can choose other languages that will be available after install"), { list => [ lang::list() ], label => sub { lang::lang2text($_) }, - values => $o->{langs}, + values => lang::unpack_langs($o->{langs}), sort => 1, }, { list => ['all'], label => sub { _("All") }, ref => sub { \$all }, shadow => 0 }) or goto &selectKeyboard; - $o->{langs} = [ 'all' ] if $all; + $o->{langs} = $all ? 'all' : lang::pack_langs($l); } install_steps::selectKeyboard($o); } diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 78c8b954e..332f9a88c 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -276,36 +276,39 @@ sub set { delete $ENV{LC_ALL}; delete $ENV{LINGUAGE}; delete $ENV{LINGUAS}; - delete $ENV{RPM_INSTALL_LANG}; } } -sub set_langs { +sub pack_langs { my ($l) = @_; - $l or return; - $ENV{RPM_INSTALL_LANG} = member('all', @$l) ? 'all' : + member('all', @$l) ? 'all' : join ':', uniq(map { substr($languages{$_}[2], 0, 2) } @$l); - log::l("RPM_INSTALL_LANG: $ENV{RPM_INSTALL_LANG}"); } -sub get_langs { +sub unpack_langs { + my ($langs) = @_; [ - $ENV{RPM_INSTALL_LANG} eq 'all' ? + $langs eq 'all' ? map { substr($_->[2], 0, 2) } values %languages : - split(':', $ENV{RPM_INSTALL_LANG}) + split(':', $langs) ]; } +sub write_langs { + my ($prefix, $langs) = @_; + symlink "$prefix/etc/rpm", "/etc/rpm" if $prefix; + substInFile { s/%_install_langs//; $_ .= "%_install_langs $langs\n" if eof } "$prefix/etc/rpm/macros"; +} + sub write { - my ($prefix) = @_; - my $lang = $ENV{LC_ALL}; + my ($prefix, $lang) = @_; $lang or return; - my $h = { RPM_INSTALL_LANG => $ENV{RPM_INSTALL_LANG} }; + my $h = {}; $h->{$_} = $lang foreach qw(LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_MONETARY LC_TIME); if (my $l = $languages{$lang}) { - add2hash $h, { LANG => $l->[2], LANGUAGE => $l->[3], RPM_INSTALL_LANG => $l->[3] }; + add2hash $h, { LANG => $l->[2], LANGUAGE => $l->[3] }; my $c = $charsets{$l->[1] || ''}; if ($c) { -- cgit v1.2.1