summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-08-30 18:50:40 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-08-30 18:50:40 +0000
commit1defcba73b989b6a28826c563417a7c0fc251052 (patch)
tree1d5bff21637dc8fb4f21fb9846ef6175c045d3f5
parentfb80b8a8984779543f0f0c50d7f6dcb995e0ce96 (diff)
downloaddrakx-backup-do-not-use-1defcba73b989b6a28826c563417a7c0fc251052.tar
drakx-backup-do-not-use-1defcba73b989b6a28826c563417a7c0fc251052.tar.gz
drakx-backup-do-not-use-1defcba73b989b6a28826c563417a7c0fc251052.tar.bz2
drakx-backup-do-not-use-1defcba73b989b6a28826c563417a7c0fc251052.tar.xz
drakx-backup-do-not-use-1defcba73b989b6a28826c563417a7c0fc251052.zip
no_comment
-rw-r--r--docs/TODO6
-rw-r--r--perl-install/common.pm3
-rw-r--r--perl-install/ftp.pm3
-rw-r--r--perl-install/install2.pm40
-rw-r--r--perl-install/install_any.pm15
-rw-r--r--perl-install/install_steps.pm15
-rw-r--r--perl-install/install_steps_interactive.pm42
-rw-r--r--perl-install/keyboard.pm90
-rw-r--r--perl-install/modules.pm2
-rw-r--r--perl-install/network.pm9
10 files changed, 170 insertions, 55 deletions
diff --git a/docs/TODO b/docs/TODO
index 3fc1cd6ee..efdc6ba42 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -5,8 +5,6 @@ timezone using a picture (pb: how to delimit zones)
merge the install(1) of redhat
-fix the bug of rpmlib (the installing size > what was said initially)
-
try detect_devices::floppies (and how are scsi floppies handled?)
have a better time estimation of the remaining time in install packages
@@ -40,7 +38,7 @@ be able to add more than one normal user
loadFont sucks
-trash on the screen when X first start
+trash on the screen when X first starts
finish network configuration
@@ -65,7 +63,7 @@ rewrite mouseconfig in perl?
cleanup /etc/services & /etc/protocols
-maybe removes commented lines in /usr/lib/perl5/... files
+maybe remove commented lines in /usr/lib/perl5/... files
look at the generated /etc/conf.modules (redundancies)
diff --git a/perl-install/common.pm b/perl-install/common.pm
index ee9101f96..4220b06d7 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- common => [ qw(__ min max sum sign product bool ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ],
+ common => [ qw(__ min max sum sign product bool bool2text ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ],
functional => [ qw(fold_left map_index mapn mapn_ difference2 before_leaving catch_cdie cdie) ],
file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh setVarsInSh) ],
@@ -46,6 +46,7 @@ sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
sub dirname { @_ == 1 or die "usage: dirname <name>\n"; local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
sub basename { @_ == 1 or die "usage: basename <name>\n"; local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
sub bool { $_[0] ? 1 : 0 }
+sub bool2text { $_[0] ? "true" : "false" }
sub strcpy { substr($_[0], $_[2] || 0, length $_[1]) = $_[1] }
sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
sub chop_ { map { my $l = $_; chomp $l; $l } @_ }
diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm
index 0879a8b72..c33a53e55 100644
--- a/perl-install/ftp.pm
+++ b/perl-install/ftp.pm
@@ -7,6 +7,8 @@ use log;
# non-rentrant!!
+my $retr;
+
1;
@@ -45,7 +47,6 @@ sub new {
}
-my $retr;
sub getFile($) {
$ftp ||= new();
$retr->close if $retr;
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 5636f0c99..7937251b5 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -26,6 +26,9 @@ my %stepsHelp = (
selectLanguage =>
__("Choose preferred language for install and system usage."),
+selectKeyboard =>
+ __("Choose on the list of keyboards, the one corresponding to yours"),
+
selectPath =>
__("Choose \"Installation\" if there are no previous versions of Linux
installed, or if you wish use to multiple distributions or versions.
@@ -162,15 +165,15 @@ my @installSteps = (
selectLanguage => [ __("Choose your language"), 1, 1 ],
selectPath => [ __("Choose install or upgrade"), 0, 0 ],
selectInstallClass => [ __("Select installation class"), 1, 1, "selectPath" ],
- setupSCSI => [ __("Setup SCSI"), 1, 0 ],
+ setupModules => [ __("Setup SCSI"), 1, 0 ],
partitionDisks => [ __("Setup filesystems"), 1, 0 ],
formatPartitions => [ __("Format partitions"), 1, -1, "partitionDisks" ],
choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
- configureMouse => [ __("Configure mouse"), 1, 1, "formatPartitions" ],
+# configureMouse => [ __("Configure mouse"), 1, 1, "formatPartitions" ],
configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ],
- configureTimezone => [ __("Configure timezone"), 0, 0 ],
- configureServices => [ __("Configure services"), 0, 0 ],
+ configureTimezone => [ __("Configure timezone"), 1, 1, "doInstallStep" ],
+# configureServices => [ __("Configure services"), 0, 0 ],
configurePrinter => [ __("Configure printer"), 0, 0 ],
setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ],
addUser => [ __("Add a user"), 1, 1, "doInstallStep" ],
@@ -207,6 +210,7 @@ my $default = {
# display => "192.168.1.9:0",
bootloader => { onmbr => 1, linear => 0 },
+# keyboard => 'de',
autoSCSI => 0,
mkbootdisk => "fd0", # no mkbootdisk if 0 or undef, find a floppy with 1
packages => [ qw() ],
@@ -239,14 +243,20 @@ $o = $::o = {
sub selectLanguage {
lang::set($o->{lang} = $o->chooseLanguage);
- $o->{keyboard} = keyboard::setup();
+ $o->{keyboard} = keyboard::setup($o->default("keyboard") || keyboard::lang2keyboard($o->{lang}));
addToBeDone {
unless ($o->{isUpgrade}) {
- keyboard::write($o->{prefix}, $o->{keyboard});
lang::write($o->{prefix});
- }
+ keyboard::write($o->{prefix}, $o->{keyboard});
+ }
} 'doInstallStep';
+
+ goto &selectKeyboard if $_[0];
+}
+
+sub selectKeyboard {
+ $o->{keyboard} = keyboard::setup($o->chooseKeyboard);
}
sub selectPath {
@@ -303,21 +313,25 @@ sub formatPartitions {
}
sub choosePackages {
- install_any::setPackages($o) if $o->{steps}{$o->{step}}{entered} == 1;
+ install_any::setPackages($o) if $_[1] == 1;
$o->choosePackages($o->{packages}, $o->{compss});
$o->{packages}{$_}{base} = 1 foreach @{$o->{base}};
}
sub doInstallStep {
- install_any::setPackages($o) unless $o->{steps}{choosePackages}{entered};
+ install_any::setPackages($o) unless $_[1];
$o->beforeInstallPackages;
$o->installPackages($o->{packages});
$o->afterInstallPackages;
}
sub configureMouse { $o->mouseConfig }
-sub configureNetwork { $o->configureNetwork($o->{steps}{$o->{step}}{entered} == 1 && !$_[0]) }
-sub configureTimezone { $o->timeConfig }
+sub configureNetwork { $o->configureNetwork($_[1] == 1 && !$_[0]) }
+sub configureTimezone {
+ my $f = "$o->{prefix}/etc/sysconfig/clock";
+ return if -e $f && $_[1] == 1 && !$_[0];
+ $o->timeConfig($f);
+}
sub configureServices { $o->servicesConfig }
sub configurePrinter { $o->printerConfig }
sub setRootPassword { $o->setRootPassword }
@@ -331,7 +345,7 @@ sub addUser {
sub createBootdisk {
fs::write($o->{prefix}, $o->{fstab}) unless $o->{isUpgrade};
modules::write_conf("$o->{prefix}/etc/conf.modules", 'append');
- $o->createBootdisk($o->{steps}{$o->{step}}{entered} == 1);
+ $o->createBootdisk($_[1] == 1);
}
sub setupBootloader {
@@ -404,7 +418,7 @@ sub main {
$o->enteringStep($o->{step});
$o->{steps}{$o->{step}}{entered}++;
eval {
- &{$install2::{$o->{step}}}($clicked);
+ &{$install2::{$o->{step}}}($clicked, $o->{steps}{$o->{step}}{entered});
};
$clicked = 0;
$@ =~ /^setstep (.*)/ and $o->{step} = $1, $clicked = 1, redo;
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 5dfea7d79..70568a512 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -29,11 +29,8 @@ sub getFile($) {
}
sub versionString {
- my $kernel = $::o->{packages}{kernel};
- $kernel && $kernel->{header} or die "I couldn't find the kernel package!";
-
- c::headerGetEntry($kernel->{header}, 'version') . "-" .
- c::headerGetEntry($kernel->{header}, 'release');
+ local $_ = readlink("$::o->{prefix}/boot/vmlinuz") or die "I couldn't find the kernel package!";
+ first(/vmlinuz-(.*)/);
}
@@ -107,6 +104,14 @@ sub addToBeDone(&$) {
push @{$::o->{steps}{$step}{toBeDone}}, $f;
}
+sub getTimeZones {
+ local *F;
+ open F, "cd /usr/share/zoneinfo && find [A-Z]* -type f |";
+ my @l = sort map { chop; $_ } <F>;
+ close F or die "cannot list the available zoneinfos";
+ @l;
+}
+
sub upgrFindInstall {
# int rc;
#
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 622d14dc9..ce96047e6 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -82,6 +82,9 @@ sub errorInStep($$) {}
sub chooseLanguage($) {
$o->default("lang");
}
+sub chooseKeyboard($) {
+ $o->default("keyboard");
+}
sub selectInstallOrUpgrade($) {
$o->default("isUpgrade") || 0;
}
@@ -165,7 +168,17 @@ sub configureNetwork($) {
#res_init(); # reinit the resolver so DNS changes take affect
}
-sub timeConfig {}
+sub timeConfig {
+ my ($o, $f) = @_;
+ my $t = $o->default("timezone");
+
+ setVarsInSh($f, {
+ ZONE => $t->{timezone},
+ GMT => bool2text($t->{GMT}),
+ ARC => "false",
+ });
+}
+
sub servicesConfig {}
sub printerConfig {}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 52bedcd81..126673c22 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -14,6 +14,7 @@ use detect_devices;
use network;
use modules;
use lang;
+use keyboard;
use fs;
use log;
@@ -28,8 +29,17 @@ sub errorInStep($$) {
sub chooseLanguage($) {
my ($o) = @_;
lang::text2lang($o->ask_from_list("Language",
- __("Which language do you want?"), # the translation may be used for the help
- [ lang::list() ], lang::lang2text($o->default("lang"))));
+ __("Which language do you want?"), # the translation may be used for the help
+ [ lang::list() ],
+ lang::lang2text($o->default("lang"))));
+}
+
+sub chooseKeyboard($) {
+ my ($o) = @_;
+ keyboard::text2keyboard($o->ask_from_list_("Keyboard",
+ _("Which keyboard do you have?"),
+ [ keyboard::list() ],
+ keyboard::keyboard2text($o->default("keyboard"))));
}
sub selectInstallOrUpgrade($) {
@@ -82,7 +92,7 @@ sub rebootNeeded($) {
sub choosePartitionsToFormat($$) {
my ($o, $fstab) = @_;
- $o->SUPER::choosePartitionsToFormat($fstab) if $o->{steps}{$o->{step}}{entered} == 1;
+ $o->SUPER::choosePartitionsToFormat($fstab);
my @l = grep { $_->{mntpoint} && isExt2($_) || isSwap($_) } @$fstab;
my @r = $o->ask_many_from_list_ref('', _("Choose the partitions you want to format"),
@@ -116,24 +126,42 @@ sub configureNetwork($) {
$r = $o->ask_from_list_(_("Network Configuration"),
_("LAN networking has already been configured. Do you want to:"),
[ @l ]);
- !$r || $r =~ /^Don't/ and return;
+ $r ||= "Don't";
}
} else {
$o->ask_yesorno(_("Network Configuration"),
- _("Do you want to configure LAN (not dialup) networking for your installed system?")) or return;
+ _("Do you want to configure LAN (not dialup) networking for your installed system?")) or $r = "Don't";
}
- if ($r !~ /^Keep/) {
+ if ($r =~ /^Don't/) {
+ $o->{netc}{NETWORKING} = "false";
+ } elsif ($r !~ /^Keep/) {
my @l = network::getNet() or return die _("no network card found");
@l = ($l[0]) unless $::expert; # keep only one
- $o->configureNetworkIntf(network::findIntf($o->{intf}, $_)) foreach @l;
+ my $last; foreach (@l) {
+ my $intf = network::findIntf($o->{intf}, $_);
+ add2hash($intf, $last);
+ $o->configureNetworkIntf($intf);
+ $last = $intf;
+ }
+ {
+ my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain..."));
+ network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf});
+ }
$o->configureNetworkNet($o->{netc} ||= {});
}
$o->SUPER::configureNetwork;
}
+sub timeConfig {
+ my ($o, $f) = @_;
+ add2hash($o->{timezone} ||= {}, $o->default("timezone"));
+ $o->{timezone}{GMT} = $o->ask_yesorno('', _("Is your hardware clock set to GMT?"), $o->{timezone}{GMT});
+ $o->{timezone}{timezone} = $o->ask_from_list('', _("In which timezone are you"), [ install_any::getTimeZones() ], $o->{timezone}{timezone});
+ $o->SUPER::timeConfig($f);
+}
sub createBootdisk {
my ($o, $first_time) = @_;
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index 5b59bd2c3..248c095ba 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -2,29 +2,80 @@ package keyboard;
use diagnostics;
use strict;
-use vars qw($KMAP_MAGIC %defaultKeyboards %loadKeymap);
-use common qw(:system :file);
+use common qw(:common :system :file);
use run_program;
use log;
use c;
-$KMAP_MAGIC = 0x8B39C07F;
+my $KMAP_MAGIC = 0x8B39C07F;
-%defaultKeyboards = (
- "de" => "de-latin1",
- "fr" => "fr-latin1",
- "fi" => "fi-latin1",
- "se" => "se-latin1",
- "no" => "no-latin1",
- "cs" => "cz-lat2",
- "tr" => "trq",
+my %lang2keyboard =
+(
+ "en" => "us",
);
1;
+# [1] = name for loadkeys, [2] = extension for Xmodmap
+my @fields =
+my %keyboards = (
+ "be" => [ __("Belgian"), "be-latin1", "be" ],
+ "bg" => [ __("Bulgarian"), "bg", "bg" ],
+ "fr" => [ __("French"), "fr-latin1", "fr" ],
+ "gr" => [ __("Greek"), "gr-8859_7", "gr" ],
+ "pt" => [ __("Portuguese"), "pt-latin1", "pt" ],
+# the xmodmap.pl has to be fixed to use latin2 keymaps
+# "pl" => [ __("Polish"), "pl-latin2", "pl" ],
+ "sk" => [ __("Slovakian"), "sk-latin2", "sk" ],
+ "hu" => [ __("Hungarian"), "hu-latin2", "hu" ],
+ "tr_f" => [ __("Turkish (traditional \"F\" model)"), "tr_f-latin5", "tr_f" ],
+ "tr_q" => [ __("Turkish (modern \"Q\" model)"), "tr_q-latin5", "tr_q" ],
+ "cz" => [ __("Czech"), "cz-latin2", "cz" ],
+ "qc" => [ __("Canadian (Quebec)"), "qc-latin1", "qc" ],
+ "de" => [ __("German"), "de-latin1", "de" ],
+ "il" => [ __("Israelian"), "il-8859_8", "il" ],
+ "ru" => [ __("Russian"), "ru-koi8", "ru" ],
+ "uk" => [ __("UK keyboard"), "uk-latin1", "uk" ],
+ "us" => [ __("US keyboard"), "us-latin", "us" ],
+ "dk" => [ __("Danish"), "dk-latin1", "dk" ],
+ "is" => [ __("Icelandic"), "is-latin1", "is" ],
+"dvorak" => [ __("Dvorak"), "dvorak", "dvorak" ],
+ "la" => [ __("Latin American"), "la-latin1", "la" ],
+ "it" => [ __("Italian"), "it-latin1", "it" ],
+ "sf" => [ __("Swiss (french layout)"), "sf-latin1", "sf" ],
+ "yu" => [ __("Yugoslavian (latin layout)"), "yu-latin2", "yu" ],
+ "fi" => [ __("Finnish"), "fi-latin1", "fi" ],
+ "nl" => [ __("Dutch"), "nl-latin1", "nl" ],
+ "sg" => [ __("Swiss (german layout)"), "sg-latin1", "sg" ],
+ "no" => [ __("Norwegian"), "no-latin1", "no" ],
+ "si" => [ __("Slovenian"), "si-latin1", "si" ],
+# the xmodmap.th has to be fixed to use tis620 keymaps
+# "th" => [ __("Thai keyboard"), "th", "th" ],
+# armenian xmodmap have to be checked...
+# "am" => [ __("Armenian"), "am-armscii8", "am" ],
+# georgian keyboards have to be written...
+#"ge_ru"=>[__("Georgian (\"Russian\" layout)","ge_ru-georgian_academy","ge_ru"],
+#"ge_la"=>[__("Georgian ("\Latin\" layout)","ge_la-georgian_academy","ge_ru"],
+);
+
+sub list { map { $_->[0] } values %keyboards }
+sub keyboard2text { $keyboards{$_[0]} && $keyboards{$_[0]}[0] }
+sub text2keyboard {
+ my ($t) = @_;
+ while (my ($k, $v) = each %keyboards) {
+ lc($v->[0]) eq lc($t) and return $k;
+ }
+ die "unknown keyboard $t";
+}
+
+sub lang2keyboard($) {
+ local ($_) = @_;
+ $keyboards{$_} && $_ || $lang2keyboard{$_} || substr($_, 0, 2);
+}
+
sub load($) {
my ($keymap) = @_;
@@ -54,26 +105,27 @@ sub load($) {
log::l("loaded $count keymap tables");
}
-sub setup(;$) {
+sub setup($) {
my ($keyboard) = @_;
- my $t;
+ my $o = $keyboards{$keyboard} or return;
- $keyboard ||= $defaultKeyboards{$ENV{LANG}} || "us";
-
- my $file = "/usr/share/keymaps/$keyboard.kmap";
+ my $file = "/usr/share/keymaps/$o->[1].kmap";
if (-e $file) {
- log::l("loading keymap $keyboard");
+ log::l("loading keymap $o->[1]");
load(cat_($file));
}
+ eval { run_program::run('xmodmap', "/usr/share/xmodmap/xmodmap.$o->[2]") };
+
$keyboard;
}
sub write($$) {
- my ($prefix, $keymap) = @_;
+ my ($prefix, $keyboard) = @_;
+ my $o = $keyboards{$keyboard} or return;
local *F;
open F, ">$prefix/etc/sysconfig/keyboard" or die "failed to create keyboard configuration: $!";
- print F "KEYTABLE=$keymap\n" or die "failed to write keyboard configuration: $!";
+ print F "KEYTABLE=$o->[1]\n" or die "failed to write keyboard configuration: $!";
run_program::rooted($prefix, "dumpkeys > /etc/sysconfig/console/default.kmap") or die "dumpkeys failed";
}
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index b84401f72..3bf19b943 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -139,7 +139,7 @@ my @drivers_by_category = (
"AM53C974" => "AMD SCSI",
"megaraid" => "AMI MegaRAID",
"BusLogic" => "BusLogic Adapters",
- "cpqarray" => "Compaq Smart Array controller",
+ "cpqarray" => "Compaq Smart-2/P RAID Controller",
"dtc" => "DTC 3180/3280",
"eata_dma" => "EATA DMA Adapters",
"eata_pio" => "EATA PIO Adapters",
diff --git a/perl-install/network.pm b/perl-install/network.pm
index f37012892..15a4cbb02 100644
--- a/perl-install/network.pm
+++ b/perl-install/network.pm
@@ -36,8 +36,8 @@ sub write_conf {
NETWORKING => "yes",
FORWARD_IPV4 => "false",
HOSTNAME => "localhost.localdomain",
- DOMAINNAME => "localdomain",
});
+ add2hash($netc, { DOMAINNAME => $netc->{HOSTNAME} =~ /\.(.*)/ });
setVarsInSh($file, $netc, qw(NETWORKING FORWARD_IPV4 HOSTNAME DOMAINNAME GATEWAY GATEWAYDEV));
}
@@ -109,12 +109,11 @@ sub guessHostname {
write_resolv_conf("$prefix/etc/resolv.conf", $netc);
-# winStatus(40, 3, _("Hostname"), _("Determining host name and domain..."));
my $name = gethostbyaddr(Socket::inet_aton($intf->{IPADDR}), AF_INET) or log::l("reverse name lookup failed"), return 0;
log::l("reverse name lookup worked");
- add2hash($netc, { HOSTNAME => $name, DOMAINNAME => $name =~ /\.(.*)/ });
+ add2hash($netc, { HOSTNAME => $name });
1;
}
@@ -144,3 +143,7 @@ sub findIntf {
push @$intf, $l = { DEVICE => $device } unless $l;
$l;
}
+
+sub is_ip {
+ $_[0] =~ /^(\d{1,3}\.){3}\d{1,3}$/;
+}