summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-08-18 04:32:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-08-18 04:32:24 +0000
commit94f257d030c1fd411ec48e438db18c657cd97e40 (patch)
treea4537ad6b19dde305ee0422c7b6a8c4ce104dd9b
parent3441ffe13a56f8b565e950b1c8e40c70b2acd97a (diff)
downloaddrakx-backup-do-not-use-94f257d030c1fd411ec48e438db18c657cd97e40.tar
drakx-backup-do-not-use-94f257d030c1fd411ec48e438db18c657cd97e40.tar.gz
drakx-backup-do-not-use-94f257d030c1fd411ec48e438db18c657cd97e40.tar.bz2
drakx-backup-do-not-use-94f257d030c1fd411ec48e438db18c657cd97e40.tar.xz
drakx-backup-do-not-use-94f257d030c1fd411ec48e438db18c657cd97e40.zip
no_comment
-rw-r--r--perl-install/Xconfigurator.pm3
-rw-r--r--perl-install/any.pm26
-rw-r--r--perl-install/bootloader.pm3
-rw-r--r--perl-install/common.pm2
-rw-r--r--perl-install/detect_devices.pm9
-rw-r--r--perl-install/fs.pm6
-rw-r--r--perl-install/fsedit.pm25
-rw-r--r--perl-install/install2.pm8
-rw-r--r--perl-install/install_any.pm49
-rw-r--r--perl-install/install_interactive.pm50
-rw-r--r--perl-install/install_steps.pm12
-rw-r--r--perl-install/install_steps_auto_install.pm2
-rw-r--r--perl-install/install_steps_interactive.pm122
-rw-r--r--perl-install/loopback.pm25
-rw-r--r--perl-install/modules.pm104
-rw-r--r--perl-install/printerdrake.pm2
16 files changed, 216 insertions, 232 deletions
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm
index 4fd969ef4..5c61322c0 100644
--- a/perl-install/Xconfigurator.pm
+++ b/perl-install/Xconfigurator.pm
@@ -148,8 +148,9 @@ sub keepOnlyLegalModes {
sub cardConfigurationAuto() {
my $card;
- if (my ($c) = (detect_devices::matching_type("DISPLAY"))) {
+ if (my ($c) = detect_devices::probeall()) {
local $_ = $c->{driver};
+ /(Card|Server):/ or next;
$card->{type} = $1 if /Card:(.*)/;
$card->{server} = $1 if /Server:(.*)/;
$card->{flags}{needVideoRam} &&= /86c368/;
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 1c0d9c368..68f7ac515 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -10,7 +10,9 @@ use vars qw(@users);
use common qw(:common :system :file :functional);
use commands;
use detect_devices;
+use partition_table qw(:types);
use fsedit;
+use fs;
use run_program;
use log;
@@ -253,6 +255,30 @@ sub shells {
grep { -x "$prefix$_" } map { chomp; $_ } cat_("$prefix/etc/shells");
}
+sub inspect {
+ my ($part, $prefix, $rw) = @_;
+
+ isMountableRW($part) or return;
+
+ my $dir = "/tmp/inspect_tmp_dir";
+
+ if ($part->{isMounted}) {
+ $dir = ($prefix || '') . $part->{mntpoint};
+ } elsif ($part->{notFormatted} && !$part->{isFormatted}) {
+ $dir = '';
+ } else {
+ mkdir $dir, 0700;
+ fs::mount($part->{device}, $dir, type2fs($part->{type}), !$rw);
+ }
+ my $h = before_leaving {
+ if (!$part->{isMounted} && $dir) {
+ fs::umount($dir);
+ unlink($dir)
+ }
+ };
+ $h->{dir} = $dir;
+ $h;
+}
1;
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index f3fe2cd59..97e3ecd04 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -10,6 +10,7 @@ use vars qw(%vga_modes);
use common qw(:common :file :functional :system);
use partition_table qw(:types);
use log;
+use any;
use fsedit;
use loopback;
use commands;
@@ -632,7 +633,7 @@ sub install_loadlin {
my ($winpart) = grep { $_->{device_windobe} eq 'C' } @$fstab;
log::l("winpart is $winpart->{device}");
- my $winhandle = loopback::inspect($winpart, $prefix, 'rw');
+ my $winhandle = any::inspect($winpart, $prefix, 'rw');
my $windrive = $winhandle->{dir};
log::l("windrive is $windrive");
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 779cec099..89d41b516 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -337,7 +337,7 @@ sub list_home() {
}
sub list_skels {
my ($prefix, $suffix) = @_;
- map { "$prefix$_$suffix" } '/etc/skel', '/root', list_home() }
+ map { "$prefix$_/$suffix" } '/etc/skel', '/root', list_home() }
sub translate {
my ($s) = @_;
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 5aa50aeeb..54893ade3 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -192,21 +192,12 @@ sub hasNetDevice($) { c::hasNetDevice($_[0]) }
# pci_probing::main::probe with $probe_type is unsafe for pci! (bug in kernel&hardware)
# get_pcmcia_devices provides field "device", used in network.pm
# => probeall with $probe_type is unsafe
-# => matching_type is unsafe
sub probeall {
my ($probe_type, $pcic) = @_;
require pci_probing::main;
require sbus_probing::main;
pci_probing::main::probe($probe_type), sbus_probing::main::probe(), modules::get_pcmcia_devices($pcic);
}
-sub matching_type {
- my ($type, $pcic) = @_;
- grep {
- my $ok = $_->{driver} !~ /(unknown|ignore)/;
- $ok or log::l("skipping $_->{description}, no module available (if you know one, please mail pixel\@linux-mandrake.com)");
- $ok
- } grep { $_->{type} =~ /$type/i } probeall($type, $pcic);
-}
sub matching_desc {
my ($regexp) = @_;
grep { $_->{description} =~ /$regexp/i } probeall();
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 3d9628071..c23ee948f 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -60,10 +60,10 @@ sub check_mounted($) {
}
}
-sub get_mntpoints_from_fstab($) {
- my ($fstab) = @_;
+sub get_mntpoints_from_fstab {
+ my ($fstab, $prefix) = @_;
- foreach (read_fstab('/etc/fstab')) {
+ foreach (read_fstab("$prefix/etc/fstab")) {
foreach my $p (@$fstab) {
$p->{device} eq $_->{device} or next;
$p->{mntpoint} ||= $_->{mntpoint};
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index edaadab88..813eb37e8 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -44,12 +44,12 @@ arch() !~ /^sparc/ ? (
) : (),
);
-sub typeOfPart($) { typeFromMagic(devices::make($_[0]), @partitions_signatures) }
+sub typeOfPart { typeFromMagic(devices::make($_[0]), @partitions_signatures) }
#-######################################################################################
#- Functions
#-######################################################################################
-sub hds($$) {
+sub hds {
my ($drives, $flags) = @_;
my @hds;
my $rc;
@@ -98,16 +98,16 @@ sub readProcPartitions {
}
#- get all normal partition including special ones as found on sparc.
-sub get_fstab(@) {
+sub get_fstab {
loopback::loopbacks(@_), map { partition_table::get_normal_parts($_) } @_
}
#- get normal partition that should be visible for working on.
-sub get_visible_fstab(@) {
+sub get_visible_fstab {
grep { $_ && !partition_table::isWholedisk($_) && !partition_table::isHiddenMacPart($_) } map { partition_table::get_normal_parts($_) } @_;
}
-sub free_space(@) {
+sub free_space {
sum map { $_->{size} } map { partition_table::get_holes($_) } @_;
}
@@ -117,7 +117,7 @@ sub hasRAID {
$b;
}
-sub get_root($;$) {
+sub get_root {
my ($fstab, $boot) = @_;
if ($boot) { $_->{mntpoint} eq "/boot" and return $_ foreach @$fstab; }
$_->{mntpoint} eq "/" and return $_ foreach @$fstab;
@@ -134,7 +134,7 @@ sub is_one_big_fat {
}
-sub computeSize($$$$) {
+sub computeSize {
my ($part, $best, $hds, $suggestions) = @_;
my $max = $part->{maxsize} || $part->{size};
return min($max, $best->{size}) unless $best->{ratio};
@@ -170,8 +170,8 @@ sub computeSize($$$$) {
if (grep { $_->{size} < $max - $size } @L) { $size } else { $max }
}
-sub suggest_part($$$;$) {
- my ($hd, $part, $hds, $suggestions) = @_;
+sub suggest_part {
+ my ($part, $hds, $suggestions) = @_;
$suggestions ||= \@suggestions;
@@ -181,7 +181,7 @@ sub suggest_part($$$;$) {
grep { !$_->{maxsize} || $part->{size} <= $_->{maxsize} }
grep { $_->{size} <= ($part->{maxsize} || $part->{size}) }
grep { !has_mntpoint($_->{mntpoint}, $hds) || isSwap($_) && !$has_swap }
- grep { !$_->{hd} || $_->{hd} eq $hd->{device} }
+ grep { !$_->{hd} || $_->{hd} eq $part->{rootDevice} }
grep { !$part->{type} || $part->{type} == $_->{type} || isTrueFS($part) && isTrueFS($_) }
@$suggestions or return;
@@ -199,7 +199,7 @@ sub suggest_part($$$;$) {
1;
}
-sub suggestions_mntpoint($) {
+sub suggestions_mntpoint {
my ($hds) = @_;
sort grep { !/swap/ && !has_mntpoint($_, $hds) }
(@suggestions_mntpoints, map { $_->{mntpoint} } @suggestions);
@@ -291,8 +291,7 @@ sub allocatePartitions($$) {
foreach (partition_table::get_holes($hd)) {
my ($start, $size) = @$_{"start", "size"};
my $part;
- while (suggest_part($hd,
- $part = { start => $start, size => 0, maxsize => $size },
+ while (suggest_part($part = { start => $start, size => 0, maxsize => $size, rootDevice => $hd->{device} },
$hds, $to_add)) {
add($hd, $part, $hds);
$size -= $part->{size} + $part->{start} - $start;
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 41824979c..9fa20092c 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -294,8 +294,6 @@ sub selectInstallClass {
#------------------------------------------------------------------------------
sub doPartitionDisks {
- return $o->searchAndMount4Upgrade if $o->{isUpgrade};
-
$o->{steps}{formatPartitions}{done} = 0;
$o->doPartitionDisksBefore;
$o->doPartitionDisks;
@@ -445,10 +443,8 @@ sub addUser {
}
#------------------------------------------------------------------------------
-#-PADTODO
sub createBootdisk {
modules::write_conf($o->{prefix});
-
$o->createBootdisk($_[1] == 1);
}
@@ -662,6 +658,10 @@ sub main {
eval { modules::load("af_packet") };
+ map_index {
+ modules::add_alias("snd-slot-$::i", $_->{driver});
+ } modules::get_that_type('sound');
+
lang::set($o->{lang});
#-the main cycle
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 25fbdbf79..596f5191a 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -535,10 +535,9 @@ sub g_auto_install(;$) {
$_ = { %{$_ || {}} }, delete @$_{qw(oldu oldg password password2)} foreach $o->{superuser}, @{$o->{users} || []};
- local *F;
- open F, ">$f" or log::l("can't output the auto_install script in $f"), return;
- print F "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl' before testing\n";
- print F Data::Dumper->Dump([$o], ['$o']), "\0";
+ output($f,
+ "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl' before testing\n",
+ Data::Dumper->Dump([$o], ['$o']), "\0");
}
sub loadO {
@@ -597,4 +596,46 @@ sub generate_ks_cfg {
$ks;
}
+sub suggest_mount_points {
+ my ($hds, $prefix) = @_;
+ my @parts = grep { isTrueFS($_) } fsedit::get_fstab(@$hds);
+
+ my (%mntpoints, $user);
+
+ my %l = (
+ '/' => 'etc/fstab',
+ '/boot' => 'vmlinuz',
+ '/tmp' => '.X11-unix',
+ '/usr' => 'X11R6',
+ '/var' => 'catman',
+ );
+
+ foreach my $part (@parts) {
+ $part->{mntpoint} and next; #- if already found via an fstab
+
+ my $handle = any::inspect($part, $prefix) or return;
+ my $d = $handle->{dir};
+ my ($mnt) = grep { -e "$d/$l{$_}" } keys %l;
+ $mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$user if -e "$d/.bashrc";
+
+ $part->{mntpoint} = $mnt;
+
+ # try to find other mount points via fstab
+ fs::get_mntpoints_from_fstab(\@parts, $d) if $mnt eq '/';
+ }
+ $_->{mntpoint} and fsedit::suggest_part($_, $hds) foreach @parts;
+}
+
+#- mainly for finding the root partitions for upgrade
+sub find_root_parts {
+ my ($hds, $prefix) = @_;
+ suggest_mount_points($hds, $prefix);
+ grep { delete($_->{mntpoint}) eq '/' } fsedit::get_fstab(@$hds);
+}
+sub use_root_part {
+ my ($fstab, $part, $prefix) = @_;
+ my $handle = any::inspect($part, $prefix) or die;
+ fs::get_mntpoints_from_fstab($fstab, $handle->{dir});
+}
+
1;
diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm
index d6eeae823..6e60b8f6f 100644
--- a/perl-install/install_interactive.pm
+++ b/perl-install/install_interactive.pm
@@ -13,6 +13,7 @@ use partition_table qw(:types);
use partition_table_raw;
use detect_devices;
use devices;
+use modules;
sub getHds {
@@ -270,4 +271,53 @@ When you are done, don't forget to save using `w'", partition_table_raw::descrip
%solutions;
}
+#------------------------------------------------------------------------------
+sub load_thiskind {
+ my ($o, $type) = @_;
+ my $w; #- needed to make the wait_message stay alive
+ my $pcmcia = $o->{pcmcia}
+ unless !$::beginner && modules::pcmcia_need_config($o->{pcmcia}) &&
+ !$o->ask_yesorno('', _("Try to find PCMCIA cards?"), 1);
+ $w = $o->wait_message(_("PCMCIA"), _("Configuring PCMCIA cards...")) if modules::pcmcia_need_config($pcmcia);
+
+ modules::load_thiskind($type, $pcmcia, sub { $w = $o->wait_load_module($type, @_) });
+}
+
+#------------------------------------------------------------------------------
+sub setup_thiskind {
+ my ($o, $type, $auto, $at_least_one) = @_;
+
+ return if arch() eq "ppc";
+
+ my @l;
+ my $allow_probe = !$::expert || $o->ask_yesorno('', _("Try to find %s devices?", "PCI" . (arch() =~ /sparc/ && "/SBUS")), 1);
+
+ if ($allow_probe) {
+ @l = $o->load_thiskind($type);
+ if (my @err = grep { $_->{error} } map { $_->{error} } @l) {
+ $o->ask_warn('', join("\n", @err));
+ }
+ return if $auto && (@l || !$at_least_one);
+ }
+ @l = map { $_->{driver} } @l;
+ while (1) {
+ my $msg = @l ?
+ [ _("Found %s %s interfaces", join(", ", @l), $type),
+ _("Do you have another one?") ] :
+ _("Do you have any %s interfaces?", $type);
+
+ my $opt = [ __("Yes"), __("No") ];
+ push @$opt, __("See hardware info") if $::expert;
+ my $r = "Yes";
+ $r = $o->ask_from_list_('', $msg, $opt, "No") unless $at_least_one && @l == 0;
+ if ($r eq "No") { return }
+ if ($r eq "Yes") {
+ push @l, $o->load_module($type) || next;
+ } else {
+ #-eval { commands::modprobe("isapnp") };
+ $o->ask_warn('', [ detect_devices::stringlist() ]); #-, scalar cat_("/proc/isapnp") ]);
+ }
+ }
+}
+
1;
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 709764a1e..fb7d24f4c 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -127,7 +127,7 @@ sub setupSCSI {
sub doPartitionDisksBefore {
my ($o) = @_;
- if (cat_("/proc/mounts") =~ m|/\w+/(\S+)\s+/tmp/hdimage\s+(\S+)|) {
+ if (cat_("/proc/mounts") =~ m|/\w+/(\S+)\s+/tmp/hdimage\s+(\S+)| && !$o->{partitioning}{readonly}) {
$o->{stage1_hd} = { dev => $1, fs => $2 };
install_any::getFile("XXX"); #- close still opened filehandle
eval { fs::umount("/tmp/hdimage") };
@@ -159,7 +159,15 @@ sub doPartitionDisksAfter {
#------------------------------------------------------------------------------
sub doPartitionDisks {
- my ($o, $hds) = @_;
+ my ($o) = @_;
+
+ if ($o->{isUpgrade}) {
+ # either one root is defined (and all is ok), or we take the first one we find
+ my $p = fsedit::get_root($o->{fstab}) || first(install_any::find_root_parts($o->{hds}, $o->{prefix})) or die;
+ install_any::use_root_part($o->{fstab}, $p, $o->{prefix});
+ } else {
+ #TODO;
+ }
}
#------------------------------------------------------------------------------
diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm
index 19a4358d9..3fc5fcd09 100644
--- a/perl-install/install_steps_auto_install.pm
+++ b/perl-install/install_steps_auto_install.pm
@@ -33,7 +33,7 @@ sub new {
sub configureNetwork {
my ($o) = @_;
- modules::load_thiskind('net', sub {}, $o->{pcmcia});
+ modules::load_thiskind('net', $o->{pcmcia});
install_steps::configureNetwork($o);
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 20a23e7cc..ca54f9d87 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -86,16 +86,6 @@ sub selectKeyboard($) {
install_steps::selectKeyboard($o);
}
#------------------------------------------------------------------------------
-sub selectRootPartition($@) {
- my ($o, @parts) = @_;
- $o->{upgradeRootPartition} =
- $o->ask_from_list(_("Root Partition"),
- _("What is the root partition (/) of your system?"),
- [ @parts ], $o->{upgradeRootPartition});
-#- TODO check choice, then mount partition in $o->{prefix} and autodetect.
-#- install_steps::selectRootPartition($o);
-}
-
sub selectInstallClass1 {
my ($o, $verif, $l, $def, $l2, $def2) = @_;
$verif->($o->ask_from_list(_("Install Class"), _("Which installation class do you want?"), $l, $def));
@@ -182,9 +172,11 @@ sub selectMouse {
#------------------------------------------------------------------------------
sub setupSCSI {
my ($o) = @_;
- { my $w = $o->wait_message(_("IDE"), _("Configuring IDE"));
- modules::load_ide() }
- setup_thiskind($_[0], 'scsi|raid', $_[1], $_[2]);
+ {
+ my $w = $o->wait_message(_("IDE"), _("Configuring IDE"));
+ modules::load_ide();
+ }
+ install_interactive::setup_thiskind($o, 'scsi|raid', $_[1], $_[2]);
}
sub ask_mntpoint_s {
@@ -216,18 +208,28 @@ sub ask_mntpoint_s {
#------------------------------------------------------------------------------
sub doPartitionDisks {
my ($o) = @_;
- my %solutions = install_interactive::partitionWizard($o, $o->{hds}, $o->{fstab}, $o->{partitioning}{readonly});
- my @solutions = sort { $b->[0] <=> $a->[0] } values %solutions;
-
- my $level = $::beginner ? 2 : -9999;
- my @sol = grep { $_->[0] >= $level } @solutions;
- @solutions = @sol if @sol > 1;
-
- my $ok; while (!$ok) {
- my $sol = $o->ask_from_listf('', _("The DrakX Partitioning wizard found the following solutions:"), sub { $_->[1] }, \@solutions) or redo;
- eval { $ok = $sol->[2]->() };
- $ok &&= !$@;
- $@ and $o->ask_warn('', _("Partitioning failed: %s", $@));
+ if ($o->{isUpgrade}) {
+ # either one root is defined (and all is ok), or we take the first one we find
+ my @p = fsedit::get_root($o->{fstab});
+ @p = install_any::find_root_parts($o->{hds}, $o->{prefix}) if !@p;
+ my $p = $o->ask_from_listf(_("Root Partition"),
+ _("What is the root partition (/) of your system?"),
+ \&partition_table_raw::description, [ @p ]) or die "setstep exitInstall\n";
+ install_any::use_root_part($o->{fstab}, $p, $o->{prefix});
+ } else {
+ my %solutions = install_interactive::partitionWizard($o, $o->{hds}, $o->{fstab}, $o->{partitioning}{readonly});
+ my @solutions = sort { $b->[0] <=> $a->[0] } values %solutions;
+
+ my $level = $::beginner ? 2 : -9999;
+ my @sol = grep { $_->[0] >= $level } @solutions;
+ @solutions = @sol if @sol > 1;
+
+ my $ok; while (!$ok) {
+ my $sol = $o->ask_from_listf('', _("The DrakX Partitioning wizard found the following solutions:"), sub { $_->[1] }, \@solutions) or redo;
+ eval { $ok = $sol->[2]->() };
+ $ok &&= !$@;
+ $@ and $o->ask_warn('', _("Partitioning failed: %s", $@));
+ }
}
}
@@ -1158,75 +1160,7 @@ 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);
- modules::load_thiskind($type, sub { $w = wait_load_module($o, $type, @_) }, $pcmcia);
-}
-
-#------------------------------------------------------------------------------
-# (dam's) is not anymore used by setupSCSI
-sub setup_thiskind {
- my ($o, $type, $auto, $at_least_one) = @_;
-
- return if arch() eq "ppc";
-
- my @l;
- my $allow_probe = !$::expert || $o->ask_yesorno('', _("Try to find %s devices?", "PCI" . (arch() =~ /sparc/ && "/SBUS")), 1);
-
- if ($allow_probe) {
- eval { @l = grep { !/ide-/ } $o->load_thiskind($type) };
- $o->ask_warn('', $@) if $@;
- return if $auto && (@l || !$at_least_one);
- }
- while (1) {
- my $msg = @l ?
- [ _("Found %s %s interfaces", join(", ", @l), $type),
- _("Do you have another one?") ] :
- _("Do you have any %s interfaces?", $type);
-
- my $opt = [ __("Yes"), __("No") ];
- push @$opt, __("See hardware info") if $::expert;
- my $r = "Yes";
- $r = $o->ask_from_list_('', $msg, $opt, "No") unless $at_least_one && @l == 0;
- if ($r eq "No") { return }
- if ($r eq "Yes") {
- push @l, $o->load_module($type) || next;
- } else {
- #-eval { commands::modprobe("isapnp") };
- $o->ask_warn('', [ detect_devices::stringlist() ]); #-, scalar cat_("/proc/isapnp") ]);
- }
- }
-}
-
-sub setup_scsi_raid {
- my ($o, $type, $auto, $at_least_one) = @_;
-
- return if arch() eq "ppc";
-
- my @l;
- my $allow_probe = !$::expert || $o->ask_yesorno('', _("Try to find %s devices?", "PCI" . (arch() =~ /sparc/ && "/SBUS")), 1);
-
- if ($allow_probe) {
- eval { @l = grep { !/ide-/ } $o->load_thiskind($type) };
- $o->ask_warn('', $@) if $@;
- return if $auto && (@l || !$at_least_one);
- }
- while (1) {
- my $msg = @l ?
- [ _("Found %s %s interfaces", join(", ", @l), $type),
- _("Do you have another one?") ] :
- _("Do you have any %s interfaces?", $type);
-
- my $opt = [ __("Yes"), __("No") ];
- push @$opt, __("See hardware info") if $::expert;
- my $r = "Yes";
- $r = $o->ask_from_list_('', $msg, $opt, "No") unless $at_least_one && @l == 0;
- if ($r eq "No") { return }
- if ($r eq "Yes") {
- push @l, $o->load_module($type) || next;
- } else {
- #-eval { commands::modprobe("isapnp") };
- $o->ask_warn('', [ detect_devices::stringlist() ]); #-, scalar cat_("/proc/isapnp") ]);
- }
- }
+ modules::load_thiskind($type, $pcmcia, sub { $w = wait_load_module($o, $type, @_) });
}
sub upNetwork {
diff --git a/perl-install/loopback.pm b/perl-install/loopback.pm
index 1a90e1091..4eb14a9dc 100644
--- a/perl-install/loopback.pm
+++ b/perl-install/loopback.pm
@@ -72,31 +72,6 @@ sub create {
$f;
}
-sub inspect {
- my ($part, $prefix, $rw) = @_;
-
- isMountableRW($part) or return;
-
- my $dir = "/tmp/loopback_tmp";
-
- if ($part->{isMounted}) {
- $dir = ($prefix || '') . $part->{mntpoint};
- } elsif ($part->{notFormatted} && !$part->{isFormatted}) {
- $dir = '';
- } else {
- mkdir $dir, 0700;
- fs::mount($part->{device}, $dir, type2fs($part->{type}), !$rw);
- }
- my $h = before_leaving {
- if (!$part->{isMounted} && $dir) {
- fs::umount($dir);
- unlink($dir)
- }
- };
- $h->{dir} = $dir;
- $h;
-}
-
sub getFree {
my ($dir, $part) = @_;
my $freespace = $dir ?
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index b4a6206f6..facef09c9 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -1,6 +1,6 @@
package modules;
-use vars qw(%loaded %drivers);
+use vars qw(%drivers);
use common qw(:common :file :system);
use detect_devices;
@@ -9,7 +9,6 @@ use log;
my %conf;
-my %loaded; #- array of loaded modules for each types (scsi/net/...)
my $scsi = 0;
my %deps = ();
@@ -322,9 +321,6 @@ while (my ($k, $v) = each %drivers) {
$drivers{$k} = \%l;
}
-
-1;
-
sub module_of_type__4update_kernel {
my ($type) = @_;
my %skip; @skip{@skip_modules_on_stage1} = ();
@@ -380,8 +376,10 @@ sub load {
eval { load($_, 'prereq') } foreach @{$deps{$name}};
load_raw([ $name, @options ]);
}
- push @{$loaded{$type}}, $name;
-
+ if ($name eq "usb-storage") {
+ sleep(2);
+ -d "/proc/scsi/usb" or return;
+ }
if ($type) {
add_alias('usb-interface', $name) if $type =~ /SERIAL_USB/i;
add_alias('scsi_hostadapter', $name), load('sd_mod') if $type =~ /scsi/ || $type eq $type_aliases{scsi};
@@ -409,9 +407,6 @@ sub unload($;$) {
delete $conf{$m}{loaded};
}
}
- foreach (keys %loaded) {
- @{$loaded{$_}} = grep { $m ne $_ } @{$loaded{$_}};
- }
remove_alias($m) if $remove_alias;
}
@@ -431,11 +426,15 @@ sub load_raw {
}
} @l;
- #- this is a hack to make plip go
foreach (@l) {
- $_->[0] eq "parport_pc" or next;
- foreach (@{$_->[1]}) {
- /^irq=(\d+)/ and eval { output "/proc/parport/0/irq", $1 };
+ if ($_->[0] eq "parport_pc") {
+ #- this is a hack to make plip go
+ foreach (@{$_->[1]}) {
+ /^irq=(\d+)/ and eval { output "/proc/parport/0/irq", $1 };
+ }
+ } elsif ($_->[0] =~ /usb-[uo]hci/) {
+ #- ensure keyboard is working, the kernel must do the job the BIOS was doing
+ load_multi("usbkbd", "keybdev");
}
}
die "insmod'ing module " . join(", ", map { $_->[0] } @failed) . " failed" if @failed;
@@ -445,7 +444,6 @@ sub read_already_loaded() {
foreach (cat_("/proc/modules")) {
my ($name) = split;
$conf{$name}{loaded} = 1;
- my $l = $loaded{($drivers{$name} || next)->{type}} ||= [];
push @$l, $name unless member($name, @$l);
}
}
@@ -524,48 +522,26 @@ sub read_stage1_conf {
}
sub load_thiskind {
- my ($type, $f, $pcic) = @_;
- show_load_thiskind($type, $f, $pcic, 1);
-}
-
-sub show_load_thiskind {
- my ($type, $f, $pcic, $load) = @_;
- my %loaded_text;
-
- my @devs = grep { my $l = $drivers{$_->{driver}}; $l && $l->{type} eq $type } detect_devices::probeall('', $pcip);
- log::l("probe found " . scalar @devs . " $type devices");
+ my ($type, $pcic, $f) = @_;
- my %devs; foreach (@devs) {
- my ($text, $mod) = ($_->{description}, $_->{driver});
- $devs{$mod}++ and log::l("multiple $mod devices found"), next;
- log::l("found driver for $mod");
- &$f($text, $mod) if $f;
- $load ? load($mod, $type) : push @{$loaded{$type}}, $mod;
- $loaded_text{$mod} = $text;
- }
- if ($load && $type =~ /scsi/) {
- #- hey, we're allowed to pci probe :) let's do a lot of probing!
+ grep {
+ $f->($_->{description}, $_->{driver}) if $f;
+ eval { load($_->{driver}) };
+ $_->{error} = $@;
- #- probe for USB SCSI.
- if (detect_devices::probeUSB()) {
- eval { load("usb-storage", $type); sleep(2); };
- -d "/proc/scsi/usb" or unload("usb-storage");
- }
- #- probe for parport SCSI.
- if (arch() !~ /sparc/) {
- foreach ("imm", "ppa") {
- eval { load($_, $type) };
- last if !$@;
- }
- }
- if (my ($c) = (show_load_thiskind ('audio'))) { #detect_devices::matching_type('AUDIO'))) {
- add_alias("sound", $c->{driver}); #- (dam's) this should be changed, we shouldn't use alias sound
- }
- }
+ !($@ && $_->{try});
+ } get_that_type($type, $pcic),
+ $type =~ /scsi/ && arch() !~ /sparc/ ?
+ (map { +{ driver => $_, description => $_, try => 1 } } "usb-storage", "imm", "ppa") : ();
+}
- my @loaded = map { $loaded_text{$_} || $_ } @{$loaded{$type} || []};
- $type =~ /scsi/ and @loaded and $load and eval { load("sd_mod") };
- @loaded;
+sub get_that_type {
+ my ($type, $pcic) = @_;
+
+ grep {
+ my $l = $drivers{$_->{driver}};
+ $l && $l->{type} eq $type && detect_devices::check($_);
+ } detect_devices::probeall('', $pcic);
}
sub pcmcia_need_config($) {
@@ -617,23 +593,5 @@ sub load_ide {
}
-sub load_bordel {
-
- #- probe for USB SCSI.
- if (detect_devices::probeUSB()) {
- eval { load("usb-storage", $type); sleep(2); };
- -d "/proc/scsi/usb" or unload("usb-storage");
- }
- #- probe for parport SCSI.
- if (arch() !~ /sparc/) {
- foreach ("imm", "ppa") {
- eval { load($_, $type) };
- last if !$@;
- }
- }
-# if (my ($c) = (show_load_thiskind ('audio'))) { #detect_devices::matching_type('AUDIO'))) {
-# add_alias("sound", $c->{driver}); #- (dam's) this should be changed, we shouldn't use alias sound
- }
- }
-}
+1;
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index 9d7349740..d1cfabc0d 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -18,7 +18,7 @@ sub auto_detect {
{
my $w = $in->wait_message(_("Test ports"), _("Detecting devices..."));
detect_devices::probeUSB() and eval { modules::load("printer"); sleep(1); };
- eval { modules::load("parport_pc"); modules::load("parport_probe"); modules::load("lp"); };
+ eval { modules::load_multi("parport_pc", "parport_probe", "lp"); };
}
my $b = before_leaving { eval { modules::unload("parport_probe") } };
detect_devices::whatPrinter();