From 9602001c7823079a8e8ca0e737a8fe2f6c0db0d2 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 4 Jul 2002 22:25:15 +0000 Subject: adapt to new modules.pm --- perl-install/bootloader.pm | 2 +- perl-install/commands.pm | 4 ++-- perl-install/detect_devices.pm | 13 ++----------- perl-install/install2.pm | 12 ++++++------ perl-install/install_any.pm | 4 ++-- perl-install/install_steps.pm | 6 +++--- perl-install/install_steps_auto_install.pm | 2 +- perl-install/install_steps_interactive.pm | 10 +++++----- perl-install/mouse.pm | 10 +++++----- perl-install/network/ethernet.pm | 6 +++--- perl-install/network/isdn.pm | 2 +- perl-install/network/netconnect.pm | 6 +++--- perl-install/printerdrake.pm | 10 +++------- 13 files changed, 37 insertions(+), 50 deletions(-) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index a5b7638d3..df290424d 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -69,7 +69,7 @@ sub mkinitrd($$$) { sub mkbootdisk($$$;$) { my ($prefix, $kernelVersion, $dev, $append) = @_; - modules::load_multi(arch() =~ /sparc/ ? 'romfs' : (), 'loop'); + modules::load(if_(arch() =~ /sparc/, 'romfs'), 'loop'); my @l = qw(mkbootdisk --noprompt); push @l, "--appendargs", $append if $append; eval { modules::load('vfat') }; diff --git a/perl-install/commands.pm b/perl-install/commands.pm index ecbe7774b..f5b83aa10 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -78,7 +78,7 @@ sub mount { require fs; require modules; - modules::load_deps("/modules/modules.dep"); + modules::load_dependencies("/modules/modules.dep"); fs::mount($dev, $where, $fs, $r); } @@ -442,7 +442,7 @@ sub modprobe { $h || @_ == 0 and die "usage: modprobe [options]\n"; my $name = shift; require modules; - modules::load_deps("/modules/modules.dep"); + modules::load_dependencies("/modules/modules.dep"); modules::load($name, '', @_); } diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index e9d13ea63..4bb3b7f18 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -239,15 +239,6 @@ sub getATARAID { } sub getNet() { -# my @a; -# foreach (@netdevices) { -# $::isStandalone && /plip/ and next; -# print (" hhhhh $_ \n"); -# /ippp/ and run_program::rooted("", "/sbin/isdnctrl addif $_"); -# c::hasNetDevice($_) and push @a, $_; -# } -# /ippp/ and run_program::rooted("", "/sbin/isdnctrl delif $_") foreach @netdevices; -# @a; grep { !(($::isStandalone || $::live) && /plip/) && c::hasNetDevice($_) } @netdevices; } @@ -344,7 +335,7 @@ sub stringlist { sub check { my ($l) = @_; my $ok = $l->{driver} !~ /(unknown|ignore)/; - $ok or log::l("skipping $l->{description}, no module available (if you know one, please mail install\@mandrakesoft.com)"); + $ok or log::l("skipping $l->{description}, no module available (if you know one, please mail cooker\@mandrakesoft.com)"); $ok } @@ -579,7 +570,7 @@ sub raidAutoStart { my %personalities = ( '1' => 'linear', '2' => 'raid0', '3' => 'raid1', '4' => 'raid5' ); raidAutoStartIoctl() or log::l("warning, RAID_AUTORUN not supported by kernel"), return; if (my @needed_perso = map { if_(/^kmod: failed.*md-personality-(.)/, $personalities{$1}) } syslog()) { - log::l("RAID: autostart needs personality from $_"), eval { modules::load($_) } foreach @needed_perso; + log::l("RAID: autostart needs personality from $_"), eval { modules::load(@needed_perso) }; return raidAutoStartIoctl(); } else { 1; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index afc81bdd8..0b5c58b92 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -327,9 +327,9 @@ sub start_i810fb { log::l("trying to load i810fb module with xres <$xres> (vga was <$vga>)"); eval { any::ddcxinfos(); # keep the result otherwise ddcxinfos doesn't return good results afterwards - modules::load('i810fb', undef, - ("xres=$xres", 'hsync1=32', 'hsync2=48', 'vsync1=50', 'vsync2=70', #- this sucking i810fb does not accept floating point numbers in hsync! - 'vram=2', 'bpp=16', 'accel=1', 'mtrr=1', 'hwcur=1', 'xcon=4')); + modules::load([ 'i810fb', + "xres=$xres", 'hsync1=32', 'hsync2=48', 'vsync1=50', 'vsync2=70', #- this sucking i810fb does not accept floating point numbers in hsync! + 'vram=2', 'bpp=16', 'accel=1', 'mtrr=1', 'hwcur=1', 'xcon=4' ]); }; } @@ -452,7 +452,7 @@ sub main { $o->{prefix} = $::testing ? "/tmp/test-perl-install" : $::live ? "" : "/mnt"; mkdir $o->{prefix}, 0755; - modules::load_deps(($::testing ? ".." : "") . "/modules/modules.dep"); + modules::load_dependencies(($::testing ? ".." : "") . "/modules/modules.dep"); modules::read_stage1_conf($_) foreach "/tmp/conf.modules", "/etc/modules.conf"; modules::read_already_loaded(); @@ -504,7 +504,7 @@ sub main { require"install_steps_$o->{interactive}.pm" if $o->{interactive}; #- no space to skip perl2fcalls #- needed before accessing floppy (in case of usb floppy) - $::noauto or modules::load_thiskind("usb"); + $::noauto or modules::load_category('bus/usb'); #- patch should be read after defcfg in order to take precedance. eval { $o = $::o = install_any::loadO($o, $cfg) } if $cfg; @@ -514,7 +514,7 @@ sub main { map_index { modules::add_alias("sound-slot-$::i", $_->{driver}); - } modules::get_that_type('sound'); + } modules::probe_category('multimedia/sound'); #- needed very early for install_steps_gtk eval { ($o->{mouse}, @{$o->{wacom} = []}) = mouse::detect() } unless $o->{nomouseprobe} || $o->{mouse}; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index ea2639dd3..241c56da9 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -359,7 +359,7 @@ sub setDefaultPackages { } } } - $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::get_that_type($_) } ('tv', 'scanner', 'photo', 'sound'); + $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia'); $o->{compssUsersChoice}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall(); $o->{compssUsersChoice}{SYSTEM} = 1; $o->{compssUsersChoice}{DOCS} = !$o->{excludedocs}; @@ -823,7 +823,7 @@ sub loadO { my $b = before_leaving { fs::umount("/mnt") unless $::testing; - modules::unload($_) foreach qw(vfat fat); + modules::unload(qw(vfat fat)); }; $o = loadO($O, $f); } else { diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index a43b374fe..cea22abfc 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -125,7 +125,7 @@ sub setupSCSI { my ($o) = @_; modules::configure_pcmcia($o->{pcmcia}) if $o->{pcmcia}; modules::load_ide(); - modules::load_thiskind('scsi|disk'); + modules::load_category('disk/scsi|hardware_raid'); } #------------------------------------------------------------------------------ @@ -1013,7 +1013,7 @@ sub upNetwork { network::netconnect::start_internet($o); return 1; } elsif (!$pppAvoided) { - eval { modules::load_multi(qw(serial ppp bsd_comp ppp_deflate)) }; + eval { modules::load(qw(serial ppp bsd_comp ppp_deflate)) }; run_program::rooted($o->{prefix}, "/etc/rc.d/init.d/syslog", "start"); require network::netconnect; network::netconnect::start_internet($o); @@ -1038,7 +1038,7 @@ sub downNetwork { require network::netconnect; network::netconnect::stop_internet($o); run_program::rooted($o->{prefix}, "/etc/rc.d/init.d/syslog", "stop"); - eval { modules::unload($_) foreach qw(ppp_deflate bsd_comp ppp serial) }; + eval { modules::unload(qw(ppp_deflate bsd_comp ppp serial)) }; return 1; } } diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index bb30e6b20..cd0282800 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -67,7 +67,7 @@ use log; sub configureNetwork { my ($o) = @_; - modules::load_thiskind('net'); + modules::load_category('network/main|usb'); goto &install_steps::configureNetwork; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 9788ef93b..74be30c3e 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -290,10 +290,10 @@ sub selectMouse { } if ($o->{mouse}{device} eq "usbmouse") { - any::setup_thiskind($o, 'usb', !$::expert, 1, $o->{pcmcia}); + any::load_category($o, 'bus/usb', !$::expert, 1, $o->{pcmcia}); eval { devices::make("usbmouse"); - modules::load($_) foreach qw(hid mousedev usbmouse); + modules::load(qw(hid mousedev usbmouse)); }; } @@ -314,9 +314,9 @@ sub setupSCSI { } { my $w = $o->wait_message(_("IDE"), _("Configuring IDE")); - modules::load_ide(); + modules::load_category('disk/cdrom'); } - any::setup_thiskind($o, 'scsi|disk', !$::expert && !$clicked, 0, $o->{pcmcia}); + any::load_category($o, 'disk/scsi|hardware_raid', !$::expert && !$clicked, 0, $o->{pcmcia}); install_interactive::tellAboutProprietaryModules($o) if !$clicked; } @@ -998,7 +998,7 @@ sub summary { return _("Remote CUPS server"); #- fall back in case of something wrong. }; - my @sound_cards = arch() !~ /ppc/ ? modules::get_that_type('sound') : modules::load_thiskind('sound'); + my @sound_cards = (arch() =~ /ppc/ ? \&modules::load_category : \&modules::probe_category)->('multimedia/sound'); #- if no sound card are detected AND the user selected things needing a sound card, #- propose a special case for ISA cards diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index b7d56fb6b..1ff8c106b 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -266,13 +266,13 @@ sub detect() { if (modules::get_alias("usb-interface")) { if (my (@l) = detect_devices::usbMice()) { log::l("found usb mouse $_->{driver} $_->{description} ($_->{type})") foreach @l; - eval { modules::load($_) foreach qw(hid mousedev usbmouse) }; + eval { modules::load(qw(hid mousedev usbmouse)) }; if (!$@ && detect_devices::tryOpen("usbmouse")) { my $mouse = fullname2mouse($l[0]{driver} =~ /Mouse:(.*)/ ? $1 : "USB|Generic"); $auxmouse and $mouse->{auxmouse} = $auxmouse; #- for laptop, we kept the PS/2 as secondary (symbolic). return $mouse; } - eval { modules::unload($_) foreach qw(usbmouse mousedev hid) }; + eval { modules::unload(qw(usbmouse mousedev hid)) }; } } $auxmouse; @@ -282,13 +282,13 @@ sub detect() { my $keep_mouse; if (my (@l) = detect_devices::usbWacom()) { log::l("found usb wacom $_->{driver} $_->{description} ($_->{type})") foreach @l; - eval { modules::load("wacom"); modules::load("evdev"); }; + eval { modules::load("wacom", "evdev"); }; unless ($@) { foreach (0..$#l) { detect_devices::tryOpen("input/event$_") and $keep_mouse = 1, push @wacom, "input/event$_"; } } - $keep_mouse or eval { modules::unload("evdev"); modules::unload("wacom"); }; + $keep_mouse or eval { modules::unload("evdev", "wacom"); }; } } @@ -324,7 +324,7 @@ sub detect() { #- we *must* find out if there really is no usb, otherwise the box may #- not be accessible via the keyboard (if the keyboard is USB) #- the only way to know this is to make a full pci probe - modules::load_thiskind("usb", '', 'unsafe'); + modules::load_category('bus/usb', '', 'unsafe'); if (my $mouse = $fast_mouse_probe->()) { return $mouse; } diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 7c2afc405..e25cb7e68 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -82,7 +82,7 @@ qq( sub conf_network_card { my ($netc, $intf, $type, $ipadr, $netadr) = @_; #-type =static or dhcp - any::setup_thiskind($in, 'net', !$::expert, 1); + any::load_category($in, 'network/main|usb', !$::expert, 1); my @all_cards=conf_network_card_backend($netc, $intf, $type, undef, $ipadr, $netadr); my $interface; @all_cards == () and $in->ask_warn('', _("No ethernet network adapter has been detected on your system. @@ -105,7 +105,7 @@ I cannot set up this connection type.")) and return; 1; } -#- conf_network_card_backend : configure the network cards and return the list of them, or configure one specified interface : WARNING, you have to setup the ethernet cards, by calling setup_thiskind($in, 'net', !$::expert, 1) or setup_thiskind_backend before calling this function. Basically, you call this function in 2 times. +#- conf_network_card_backend : configure the network cards and return the list of them, or configure one specified interface : WARNING, you have to setup the ethernet cards, by calling load_category($in, 'network/main|usb', !$::expert, 1) or load_category_backend before calling this function. Basically, you call this function in 2 times. #- input #- $prefix #- $netc @@ -174,7 +174,7 @@ sub go_ethernet { sub configureNetwork { my ($netc, $intf, $first_time) = @_; local $_; - any::setup_thiskind($in, 'net', !$::expert, 1); + any::load_category($in, 'network/main|usb', !$::expert, 1); my @l = detect_devices::getNet() or die _("no network card found"); my @all_cards = conf_network_card_backend ($netc, $intf, undef, undef, undef, undef); diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index a6ac063d1..4b081274e 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -249,7 +249,7 @@ sub isdn_detect { sub isdn_detect_backend { my ($isdn) = @_; - if (my ($c) = (modules::get_that_type('isdn'))) { + if (my ($c) = (modules::probe_category('network/isdn'))) { $isdn->{$_} = $c->{$_} foreach qw(description vendor id driver options firmware); $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach ('vendor', 'id'); $isdn->{card_type} = 'pci'; diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 835a09e6f..4998124a1 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -69,7 +69,7 @@ sub detect { $auto_detect->{isdn}{$_}=$isdn->{$_} foreach qw(description vendor id driver card_type type); $auto_detect->{isdn}{description} =~ s/.*\|//; - any::setup_thiskind_backend('net', undef); + modules::load_category('network/main|usb'); require network::ethernet; network::ethernet->import; my @all_cards = conf_network_card_backend (undef, undef, undef, undef, undef, undef); @@ -334,7 +334,7 @@ fi #- if ($netc->{NET_DEVICE} and $netc->{NETWORKING} ne 'no' and $::isStandalone and $::expert) { #- exists $netc->{nb_cards} or do { -#- any::setup_thiskind($in, 'net', !$::expert, 1); +#- any::load_category($in, 'network/main|usb', !$::expert, 1); #- $netc->{nb_cards} = listlength(detect_devices::getNet()); #- }; #- ($netc->{nb_cards} - $netc->{minus_one} - (get_net_device($prefix) =~ /eth.+/ ? 1 : 0) > 0) and $in->ask_okcancel(_("Network Configuration"), @@ -355,7 +355,7 @@ sub save_conf { $netcnx->{type} =~ /adsl/ and $adsl=$netcnx->{$netcnx->{type}}; $netcnx->{type} eq 'isdn_external' || $netcnx->{type} eq 'modem' and $modem=$netcnx->{$netcnx->{type}}; $netcnx->{type} eq 'isdn_internal' and $isdn=$netcnx->{$netcnx->{type}}; - any::setup_thiskind_backend('net', undef); + modules::load_category('network/main|usb'); require network::ethernet; network::ethernet->import; my @all_cards = conf_network_card_backend ($netc, $intf, undef, undef, undef, undef); diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 82b7c11df..b5a15c178 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -143,13 +143,9 @@ sub auto_detect { my ($in) = @_; { my $w = $in->wait_message(_("Test ports"), _("Detecting devices...")); - modules::get_alias("usb-interface") and eval { modules::load("printer"); sleep(2); }; - foreach (qw(lp parport_pc parport_probe parport)) { - eval { modules::unload($_); }; #- on kernel 2.4 parport has to be unloaded to probe again - } - foreach (qw(parport_pc lp parport_probe)) { - eval { modules::load($_); }; #- take care as not available on 2.4 kernel (silent error). - } + modules::get_alias("usb-interface") and eval { modules::load("printer") }; + eval { modules::unload(qw(lp parport_pc parport_probe parport)) }; #- on kernel 2.4 parport has to be unloaded to probe again + eval { modules::load(qw(parport_pc lp parport_probe)); }; #- take care as not available on 2.4 kernel (silent error). } my $b = before_leaving { eval { modules::unload("parport_probe") } }; detect_devices::whatPrinter(); -- cgit v1.2.1