summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/fs.pm2
-rw-r--r--perl-install/install2.pm25
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_steps.pm1
-rw-r--r--perl-install/install_steps_interactive.pm6
-rw-r--r--perl-install/interactive.pm2
-rw-r--r--perl-install/keyboard.pm10
-rw-r--r--perl-install/mouse.pm79
-rw-r--r--perl-install/partition_table_raw.pm32
-rw-r--r--perl-install/pkgs.pm6
-rw-r--r--perl-install/run_program.pm11
11 files changed, 144 insertions, 34 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index d597140a9..df32535b8 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -253,5 +253,3 @@ sub write_fstab($;$$) {
}
print F join(" ", @$_), "\n" foreach @to_add;
}
-
-
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 67c13df6a..fb6e66aae 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -112,7 +112,7 @@ my %suggestedPartitions = (
#-the variable $default)
#-#######################################################################################
$o = $::o = {
- bootloader => { onmbr => 1, linear => 0 },
+ bootloader => { onmbr => 1, linear => 0, message => 1, keytable => 1, timeout => 50 },
autoSCSI => 0,
mkbootdisk => 1, #- no mkbootdisk if 0 or undef, find a floppy with 1
#- packages => [ qw() ],
@@ -202,7 +202,7 @@ sub selectLanguage {
addToBeDone {
lang::write($o->{prefix});
keyboard::write($o->{prefix}, $o->{keyboard});
- } 'doInstallStep' unless $o->{isUpgrade} || $::g_auto_install;
+ } 'doInstallStep' unless $::g_auto_install;
}
#------------------------------------------------------------------------------
@@ -220,16 +220,11 @@ sub selectKeyboard {
#- if we go back to the selectKeyboard, you must rewrite
addToBeDone {
keyboard::write($o->{prefix}, $o->{keyboard});
- } 'doInstallStep' unless $o->{isUpgrade} || $::g_auto_install;
+ } 'doInstallStep' unless $::g_auto_install;
}
#------------------------------------------------------------------------------
-sub selectPath {
- $o->selectPath;
-
- $o->{steps} = $o->{isUpgrade} ? \%upgradeSteps : \%installSteps;
- $o->{orderedSteps} = $o->{isUpgrade} ? \@orderedUpgradeSteps : \@orderedInstallSteps;
-}
+sub selectPath { $o->selectPath; }
#------------------------------------------------------------------------------
sub selectInstallClass {
@@ -270,13 +265,11 @@ I'll try to go on blanking bad partitions"));
die _("An error has occurred - no valid devices were found on which to create new filesystems. Please check your hardware for the cause of this problem");
}
- unless ($o->{isUpgrade}) {
- eval { fsedit::auto_allocate($o->{hds}, $o->{partitions}) } if $o->{partitioning}{auto_allocate};
- $o->doPartitionDisks($o->{hds});
+ eval { fsedit::auto_allocate($o->{hds}, $o->{partitions}) } if $o->{partitioning}{auto_allocate};
+ $o->doPartitionDisks($o->{hds});
- unless ($::testing) {
- $o->rebootNeeded foreach grep { $_->{rebootNeeded} } @{$o->{hds}};
- }
+ unless ($::testing) {
+ $o->rebootNeeded foreach grep { $_->{rebootNeeded} } @{$o->{hds}};
}
$o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}) ];
@@ -437,7 +430,7 @@ sub main {
$ENV{LD_LIBRARY_PATH} = "";
#- needed very early for install_steps_graphical
- $o->{mouse} ||= mouse::detect() unless $::testing;
+ eval { $o->{mouse} ||= mouse::detect() };
$::o = $o = $::auto_install ?
install_steps->new($o) :
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index d0b6c2fa9..86da03058 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -38,7 +38,7 @@ sub getFile($) {
*install_any::getFile = \&ftp::getFile;
} else {
*install_any::getFile = sub($) {
- open getFile, "/tmp/rhimage/" . relGetFile($_[0]) or sleep(1000), return;
+ open getFile, "/tmp/rhimage/" . relGetFile($_[0]) or return;
\*getFile;
};
}
@@ -148,7 +148,7 @@ sub install_cpio {
my $cpio = "$dir.cpio.bz2";
-e $cpio or return;
- eval { commands::rm "-r", $dir };
+ eval { commands::rm("-r", $dir) };
mkdir $dir, 0755;
run_program::run("cd $dir ; bzip2 -cd $cpio | cpio -id $name $name/*");
"$dir/$name";
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index e61e8bba9..a6492836c 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -277,6 +277,7 @@ sub setupBootloader($) {
my ($o) = @_;
return if $::g_auto_install;
my $versionString = versionString();
+ $o->{bootloader}{keytable} = keyboard::kmap($o->{keyboard}) if $o->{bootloader}{keytable} eq "1";
lilo::install($o->{prefix}, $o->{hds}, $o->{fstab}, $versionString, $o->{bootloader});
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index d9800bdea..d642d9383 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -541,7 +541,7 @@ sub setupBootloader($) {
$l[!$o->{bootloader}{onmbr}]
) eq $l[0];
- lilo::proposition($o->{hds}, $o->{fstab});
+ lilo::proposition($o->{hds}, $o->{fstab}, $o->{bootloader});
unless ($::beginner) {
my @entries = grep { $_->{liloLabel} } @{$o->{fstab}};
@@ -555,8 +555,8 @@ and what label you want to use for each of them."),
[map {\$_->{liloLabel}} @entries],
);
}
-
- install_steps::setupBootloader($o);
+ my $w = $o->wait_message('', _("Installing bootloader"));
+ $o->SUPER::setupBootloader;
}
#------------------------------------------------------------------------------
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 4ffb44d71..debbb0aba 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -124,6 +124,8 @@ sub ask_from_entries($$$$;$%) {
#- if you pass a hash with a field hidden -> emulate stty -echo
sub ask_from_entries_ref($$$$;$%) {
my ($o, $title, $message, $l, $val, %callback) = @_;
+
+ return unless @$l;
$message = ref $message ? $message : [ $message ];
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index 44a9fc32a..5f2ee9b14 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -79,6 +79,11 @@ sub text2keyboard {
die "unknown keyboard $t";
}
+sub kmap($) {
+ my ($keyboard) = @_;
+ ($keyboards{$keyboard} || [])->[1];
+}
+
sub lang2keyboard($) {
local ($_) = @_;
$keyboards{$_} && $_ || $lang2keyboard{$_} || substr($_, 0, 2);
@@ -128,11 +133,8 @@ sub setup($) {
sub write($$) {
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=$o->[1]\n" or die "failed to write keyboard configuration: $!";
+ setVarsInSh("$prefix/etc/sysconfig/keyboard", { KEYTABLE => kmap($keyboard) });
run_program::rooted($prefix, "dumpkeys > /etc/sysconfig/console/default.kmap") or die "dumpkeys failed";
}
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
new file mode 100644
index 000000000..3386654db
--- /dev/null
+++ b/perl-install/mouse.pm
@@ -0,0 +1,79 @@
+package mouse;
+
+use diagnostics;
+use strict;
+
+#-######################################################################################
+#- misc imports
+#-######################################################################################
+use common qw(:common :system :functional);
+use log;
+
+my @mouses_fields = qw(nbuttons device MOUSETYPE XMOUSETYPE FULLNAME);
+my @mouses = (
+ [ 0, "none", "none", "Microsoft", __("No Mouse") ],
+ [ 2, "ttyS", "pnp", "Auto", __("Microsoft Rev 2.1A or higher (serial)") ],
+ [ 3, "ttyS", "logim", "MouseMan", __("Logitech CC Series (serial)") ],
+ [ 5, "ttyS", "pnp", "IntelliMouse", __("Logitech MouseMan+/FirstMouse+ (serial)") ],
+ [ 5, "ttyS", "ms3", "IntelliMouse", __("ASCII MieMouse (serial)") ],
+ [ 5, "ttyS", "ms3", "IntelliMouse", __("Genius NetMouse (serial)") ],
+ [ 5, "ttyS", "ms3", "IntelliMouse", __("Microsoft IntelliMouse (serial)") ],
+ [ 2, "ttyS", "MMSeries", "MMSeries", __("MM Series (serial)") ],
+ [ 2, "ttyS", "MMHitTab", "MMHittab", __("MM HitTablet (serial)") ],
+ [ 3, "ttyS", "Logitech", "Logitech", __("Logitech Mouse (serial, old C7 type)") ],
+ [ 3, "ttyS", "MouseMan", "MouseMan", __("Logitech MouseMan/FirstMouse (serial)") ],
+ [ 2, "ttyS", "Microsoft", "Microsoft", __("Generic Mouse (serial)") ],
+ [ 2, "ttyS", "Microsoft", "Microsoft", __("Microsoft compatible (serial)") ],
+ [ 3, "ttyS", "Microsoft", "Microsoft", __("Generic 3 Button Mouse (serial)") ],
+ [ 2, "ttyS", "MouseSystems", "MouseSystems", __("Mouse Systems (serial)") ],
+ [ 2, "psaux", "ps/2", "PS/2", __("Generic Mouse (PS/2)") ],
+ [ 3, "psaux", "ps/2", "PS/2", __("Logitech MouseMan/FirstMouse (ps/2)") ],
+ [ 3, "psaux", "ps/2", "PS/2", __("Generic 3 Button Mouse (PS/2)") ],
+ [ 2, "psaux", "ps/2", "GlidePointPS/2", __("ALPS GlidePoint (PS/2)") ],
+ [ 5, "psaux", "ps/2", "MouseManPlusPS/2", __("Logitech MouseMan+/FirstMouse+ (PS/2)") ],
+ [ 5, "psaux", "ps/2", "ThinkingMousePS/2", __("Kensington Thinking Mouse (PS/2)") ],
+ [ 5, "psaux", "ps/2", "NetMousePS/2", __("ASCII MieMouse (PS/2)") ],
+ [ 5, "psaux", "netmouse", "NetMousePS/2", __("Genius NetMouse (PS/2)") ],
+ [ 5, "psaux", "netmouse", "NetMousePS/2", __("Genius NetMouse Pro (PS/2)") ],
+ [ 5, "psaux", "netmouse", "NetScrollPS/2", __("Genius NetScroll (PS/2)") ],
+ [ 5, "psaux", "imps2", "IMPS/2", __("Microsoft IntelliMouse (PS/2)") ],
+ [ 2, "atibm", "Busmouse", "BusMouse", __("ATI Bus Mouse") ],
+ [ 2, "inportbm", "Busmouse", "BusMouse", __("Microsoft Bus Mouse") ],
+ [ 3, "logibm", "Busmouse", "BusMouse", __("Logitech Bus Mouse") ],
+);
+map_index {
+ my %l; @l{@mouses_fields} = @$_;
+ $mouses[$::i] = \%l;
+} @mouses;
+
+sub names { map { $_->{FULLNAME} } @mouses }
+
+sub name2mouse {
+ my ($name) = @_;
+ foreach (@mouses) {
+ return { %$_ } if $name eq $_->{FULLNAME};
+ }
+ die "$name not found";
+}
+
+sub serial_ports_names {
+ map { "ttyS" . ($_ - 1) . " / COM$_" } 1..4;
+}
+sub serial_ports_names2dev {
+ local ($_) = @_;
+ /(\w+)/;
+}
+
+sub read($) { getVarsFromSh $_[0]; }
+
+sub write($;$) {
+ my ($mouse, $prefix) = @_;
+ setVarsInSh("$prefix/etc/sysconfig/mouse", $mouse, qw(MOUSETYPE XMOUSETYPE FULLNAME XEMU3));
+ symlink $mouse->{device}, "$prefix/dev/mouse" or log::l("creating $prefix/dev/mouse symlink failed");
+}
+
+sub detect() {
+ my %l;
+ @l{qw(FULLNAME nbuttons MOUSETYPE XMOUSETYPE device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed";
+ \%l;
+}
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index c97a8a094..bcb7ca588 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -4,6 +4,7 @@ use diagnostics;
use strict;
use common qw(:common :system);
+use devices;
use c;
my @fields = qw(active start_head start_sec start_cyl type end_head end_sec end_cyl start size);
@@ -13,8 +14,10 @@ my $nb_primary = 4;
my $offset = $common::SECTORSIZE - length($magic) - $nb_primary * common::psizeof($format);
-1;
-
+my @MBR_signatures = (
+ [ 'LILO', 0x6, 'LILO' ],
+ [ 'DOS', 0xa0, '\x25\x03\x4E\x02\x\xCD\x13' ],
+);
sub compute_CHS($$) {
my ($hd, $e) = @_;
@@ -107,3 +110,28 @@ sub zero_MBR($) {
$hd->{primary} = clear_raw();
delete $hd->{extended};
}
+
+sub typeOfMBR($) {
+ my $dev = devices::make($_[0]);
+ local *F; sysopen F, $dev, 0 or return;
+
+ my $tmp
+ foreach (@MBR_signatures) {
+ my ($name, $offset, $signature) = @$_;
+ sysseek F, $offset, 0 or next;
+ sysread(F, $tmp, length $signature) && $tmp eq $signature and return $name;
+ }
+ undef;
+}
+
+sub isFatFormatted($) {
+ my $dev = devices::make($_[0]);
+ local *F; sysopen F, $dev, 0 or return;
+ sysseek F, $common::SECTORSIZE - length($magic), 0;
+
+ #- check magic number
+ my $tmp;
+ sysread(F, $tmp, length $magic) && $tmp eq $magic;
+}
+
+1;
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index de156d498..953e02837 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -236,7 +236,7 @@ sub setSelectedFromCompssList($$$$$) {
sub init_db {
my ($prefix, $isUpgrade) = @_;
- my $f = "$prefix/root/" . ($isUpgrade ? "upgrade" : "install") . ".log";
+ my $f = "$prefix/root/install.log";
open(F, "> $f") ? log::l("opened $f") : log::l("Failed to open $f. No install log will be kept.");
$fd = fileno(F) || log::fd() || 2;
c::rpmErrorSetCallback($fd);
@@ -260,7 +260,7 @@ sub getHeader($) {
}
sub install {
- my ($prefix, $toInstall, $isUpgrade, $force) = @_;
+ my ($prefix, $toInstall, $force) = @_;
return if $::g_auto_install;
@@ -278,7 +278,7 @@ sub install {
$p->{file} ||= sprintf "%s-%s-%s.%s.rpm",
$p->{name}, $p->{version}, $p->{release},
c::headerGetEntry(getHeader($p), 'arch');
- c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, $isUpgrade);
+ c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, $p->{name} !~ /kernel/); #- TODO: replace `named kernel' by `provides kernel'
$nb++;
$total += $p->{size};
}
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm
index 617c6ebd5..b36c8744b 100644
--- a/perl-install/run_program.pm
+++ b/perl-install/run_program.pm
@@ -17,10 +17,17 @@ sub rooted {
fork and wait, return $? == 0;
{
+ my ($stdout, $stdoutm);
+ ($stdoutm, $stdout, @args) = @args if $args[0] eq ">" || $args[0] eq ">>";
+
open STDIN, "/dev/null" or die "can't open /dev/null as stdin";
- open STDERR, ">> /dev/tty7" or open STDERR, ">> /tmp/exec.log" or die "runProgramRoot can't log :(";
- open STDOUT, ">> /dev/tty7" or open STDOUT, ">> /tmp/exec.log" or die "runProgramRoot can't log :(";
+ open STDERR, ">> /dev/tty7" or open STDERR, ">> /tmp/exec.log" or die "run_program can't log :(";
+ if ($stdout) {
+ open STDOUT, "$stdoutm $root$stdout" or die "run_program can't output in $root$stdout (mode `$stdoutm')";
+ } else {
+ open STDOUT, ">> /dev/tty7" or open STDOUT, ">> /tmp/exec.log" or die "run_program can't log :(";
+ }
$root and chroot $root;
chdir "/";