From f74c3b0afadaa40c9a784321029959a7fffdd0e6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 24 Mar 2000 14:29:56 +0000 Subject: no_comment --- perl-install/detect_devices.pm | 19 +++++++- perl-install/install2.pm | 21 ++++----- perl-install/install_any.pm | 75 +++---------------------------- perl-install/install_steps.pm | 12 +++-- perl-install/install_steps_gtk.pm | 1 + perl-install/install_steps_interactive.pm | 26 ++++++----- perl-install/modules.pm | 6 ++- 7 files changed, 66 insertions(+), 94 deletions(-) (limited to 'perl-install') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 816277cb5..e5ca00ea5 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -7,7 +7,7 @@ use strict; #- misc imports #-###################################################################################### use log; -use common qw(:common :file); +use common qw(:common :file :functional); use devices; use c; @@ -197,6 +197,23 @@ sub syslog { sub hasSMP { c::detectSMP() } +sub hasHPT { + cat_("/proc/cmdline") =~ /(ide2=(\S+)(\s+ide3=(\S+))?)/ and return $1; + + require pci_probing::main; + my @l = map { $_->[0] } grep { $_->[1] =~ /(HPT|Ultra66)/ } pci_probing::main::probe('STORAGE_OTHER', 'more'); + + my $ide = sprintf "ide2=0x%x,0x%x ide3=0x%x,0x%x", map_index { hex($_) + (odd($::i) ? 1 : -1) } do { + if (@l == 2) { + map { (split ' ')[3..4] } @l + } else { + map { (split ' ')[3..6] } @l + } + }; + log::l("HPT|Ultra66: found $ide"); + $ide; +} + sub whatParport() { my @res =(); foreach (0..3) { diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 07095f8b7..8fa163367 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -233,6 +233,14 @@ sub selectMouse { addToBeDone { mouse::write($o->{prefix}, $o->{mouse}) } 'doInstallStep'; } +#------------------------------------------------------------------------------ +sub setupSCSI { + my ($clicked) = $_[0]; + $o->{autoSCSI} ||= $::beginner; + + $o->setupSCSI($o->{autoSCSI} && !$clicked, $clicked); +} + #------------------------------------------------------------------------------ sub selectKeyboard { my ($clicked) = $_[0]; @@ -268,14 +276,6 @@ sub selectInstallClass { } } -#------------------------------------------------------------------------------ -sub setupSCSI { - my ($clicked) = $_[0]; - $o->{autoSCSI} ||= $::beginner; - - $o->setupSCSI($o->{autoSCSI} && !$clicked, $clicked); -} - #------------------------------------------------------------------------------ sub partitionDisks { return @@ -572,7 +572,8 @@ sub main { if ($::auto_install) { require install_steps_auto_install; - eval { $o = $::o = install_any::loadO($o, "floppy") }; + eval { $o = $::o = install_any::loadO($o, "Mandrake/auto_inst.cfg.pl") }; + eval { $o = $::o = install_any::loadO($o, "floppy") } if $@; if ($@) { log::l("error using auto_install, continuing"); undef $::auto_install; @@ -628,7 +629,7 @@ sub main { modules::read_stage1_conf("/tmp/conf.modules"); modules::read_already_loaded(); - modules::load_multi(qw(ide-probe ide-disk ide-cd sd_mod af_packet)); + modules::load("af_packet"); install_any::lnx4win_preinstall() if $o->{lnx4win}; #-the main cycle diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index f9f04da84..08db3ef9a 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -43,11 +43,10 @@ sub changeMedium($$) { } sub relGetFile($) { local $_ = $_[0]; + m|^Mandrake/| and return $_; /\.img$/ and return "images/$_"; my $dir = m|/| ? "mdkinst" : /^(?:compss|compssList|compssUsers|depslist.*|hdlist.*)$/ ? "base/": "RPMS$asked_medium/"; - $_ = "Mandrake/$dir$_"; - #- s/i386/i586/; avoid using such thing as package have to be correctly rebuild - $_; + "Mandrake/$dir$_"; } sub errorOpeningFile($;$) { my ($file, $absent) = @_; @@ -515,14 +514,13 @@ sub loadO { }; $o = loadO($O, $f); } else { - -e $f or $f .= ".pl"; - { - local *F; - open F, $f or die _("Error reading file $f"); + -e "$f.pl" and $f .= ".pl" unless -e $f; + my $fh = -e $f ? do { local *F; open F, $f; *F } : getFile($f) or die _("Error reading file $f"); + { local $/ = "\0"; no strict; - eval ; + eval <$fh>; $@ and log::l("Bad kickstart file $f (failed $@)"); } add2hash_($o ||= {}, $O); @@ -753,66 +751,5 @@ sub move_desktop_file($) { } } -sub ultra66 { - my ($o) = @_; - - if (cat_("/proc/cmdline") !~ /ide2=/) { - require pci_probing::main; - my @l = map { $_->[0] } grep { $_->[1] =~ /(HPT|Ultra66)/ } pci_probing::main::probe('STORAGE_OTHER', 'more'); - if (@l && $o->ask_yesorno('', -_("Linux does not yet fully support ultra dma 66. -As a work-around i can make a custom floppy giving access the hard drive on ide2 and ide3"), 1)) { - log::l("HPT|Ultra66: found"); - my $ide = sprintf "ide2=0x%x,0x%x ide3=0x%x,0x%x", - map_index { hex($_) + (odd($::i) ? 1 : -1) } do { - if (@l == 2) { - map { (split ' ')[3..4] } @l - } else { - map { (split ' ')[3..6] } @l - } - }; - log::l("HPT|Ultra66: gonna add ($ide)"); - - my $dev = devices::make("fd0"); - my $image = $o->{pcmcia} ? "pcmcia" : - ${{ hd => 'hd', cdrom => 'cdrom', - ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}}; - - my $nb_try; - for ($nb_try = 0; $nb_try <= 1; $nb_try++) { - eval { fs::mount($dev, "/floppy", "vfat", 0) }; - last if !$@ && -e "/floppy/syslinux.cfg"; - - eval { fs::umount("/floppy") }; - $o->ask_warn('', -_("Enter a floppy to create an HTP enabled boot -(all data on floppy will be lost)")); - if (my $fd = getFile("$image.img")) { - my $w = $o->wait_message('', _("Creating bootdisk")); - local *OUT; - open OUT, ">$dev" or log::l("failed to write $dev"), return; - local $/ = \ (16 * 1024); - print OUT foreach <$fd>; - } - } - if (-e "/floppy/syslinux.cfg") { - log::l("HTP: modifying syslinux.cfg"); - substInFile { s/(?=$)/ $ide/ if /^\s*append\s/ } "/floppy/syslinux.cfg"; - fs::umount("/floppy"); - log::l("HPT|Ultra66: all done"); - - $o->ask_warn('', $nb_try ? - _("It is necessary to restart installation booting on the floppy") : - _("It is necessary to restart installation with the new parameters")); - install_steps::rebootNeeded ($o); - } else { - $o->ask_warn('', -_("Failed to create an HTP boot floppy. -You may have to restart installation and give ``%s'' at the prompt", $ide)); - } - } - } -} - 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 7d3b00e03..6ba76b965 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -112,7 +112,11 @@ sub selectInstallClass($@) { }}{$o->{installClass}}; } #------------------------------------------------------------------------------ -sub setupSCSI { modules::load_thiskind('scsi') } +sub setupSCSI { + modules::load("ide-mod", 'prereq', 'options="' . detect_devices::hasHPT() . '"'); + modules::load_multi(qw(ide-probe ide-disk ide-cd)); + modules::load_thiskind('scsi'); +} #------------------------------------------------------------------------------ sub doPartitionDisks($$) { my ($o, $hds) = @_; @@ -243,7 +247,7 @@ sub installPackages($$) { #- complete REWORK, TODO and TOCHECK! sub afterInstallPackages($) { my ($o) = @_; - -x "$o->{prefix}/usr/bin/dumpkeys" or die + -x "$o->{prefix}/usr/bin/dumpkeys" or $::testing or die "Some important packages didn't get installed properly. Please switch to console 2 (using ctrl-alt-f2) @@ -742,7 +746,9 @@ sub miscellaneous { $_ .= " " . join(" ", map { "$_=ide-scsi" } @l); } #- keep some given parameters - $_ .= " " . join(" ", grep { /^ide/ } split ' ', cat_("/proc/cmdline")) unless /ide.=/; + if (my $m = modules::get_options("ide-mod")) { + /options="(.*)"/ and $_ .= " $1" if !/ide.=/; + } $o->{bootloader}{perImageAppend} = $_; } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 33b5997de..32a5b73e5 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -16,6 +16,7 @@ use Gtk; #-use Gtk::XmHTML; use devices; use fsedit; +use commands; use modules; use pkgs; use install_steps; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index beb193878..2f8316b33 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -1145,15 +1145,6 @@ sub load_thiskind { !$o->ask_yesorno('', _("Try to find PCMCIA cards?"), 1); $w = $o->wait_message(_("PCMCIA"), _("Configuring PCMCIA cards...")) if modules::pcmcia_need_config($pcmcia); - if ($type =~ /scsi/i) { - #- hey, we're allowed to pci probe :) let's do a lot of probing! - install_any::ultra66($o); - - require pci_probing::main; - if (my ($c) = pci_probing::main::probe('AUDIO')) { - modules::add_alias("sound", $c->[1]) if pci_probing::main::check($c->[1]); - } - } modules::load_thiskind($type, sub { $w = wait_load_module($o, $type, @_) }, $pcmcia); } @@ -1162,7 +1153,22 @@ sub setup_thiskind { my ($o, $type, $auto, $at_least_one) = @_; my @l; - if (!$::expert || $o->ask_yesorno('', _("Try to find PCI devices?"), 1)) { + my $allow_probe = !$::expert || $o->ask_yesorno('', _("Try to find PCI devices?"), 1); + + { + my $w = $o->wait_message(_("IDE"), _("Configuring IDE")); + modules::load("ide-mod", 'prereq', $allow_probe && 'options="' . detect_devices::hasHPT() . '"'); + modules::load_multi(qw(ide-probe ide-disk ide-cd)); + } + + if ($allow_probe && $type =~ /scsi/i) { + #- hey, we're allowed to pci probe :) let's do a lot of probing! + require pci_probing::main; + if (my ($c) = pci_probing::main::probe('AUDIO')) { + modules::add_alias("sound", $c->[1]) if pci_probing::main::check($c->[1]); + } + } + if ($allow_probe) { eval { @l = $o->load_thiskind($type) }; if ($@) { $o->errorInStep($@); diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 59276a3bf..38f9a6428 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -343,6 +343,10 @@ sub get_alias { my ($alias) = @_; $conf{$alias}{alias}; } +sub get_options { + my ($name) = @_; + $conf{$name}{options}; +} sub add_alias($$) { my ($alias, $name) = @_; @@ -415,7 +419,7 @@ sub unload($;$) { sub load_raw($@) { my ($name, @options) = @_; - run_program::run("insmod", $name, @options) or die("insmod $name failed"); + run_program::run("insmod", $name, grep { $_ } @options) or die("insmod $name failed"); #- this is a hack to make plip go if ($name eq "parport_pc") { -- cgit v1.2.1