From 149bb85110e0f6de5f16d8acbb636644c4fb114d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 8 Jul 2004 01:21:42 +0000 Subject: - rename add_alias() into set_alias() - create set_sound_slot() and use it --- perl-install/modules.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'perl-install/modules.pm') diff --git a/perl-install/modules.pm b/perl-install/modules.pm index dc71ad5e1..085abf894 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -87,7 +87,7 @@ sub load { sleep 2 if any { /^(usb-storage|mousedev|printer)$/ } @l; if ($network_module) { - add_alias($_, $network_module) foreach difference2([ detect_devices::getNet() ], \@network_devices); + set_alias($_, $network_module) foreach difference2([ detect_devices::getNet() ], \@network_devices); } when_load($_, @{$options{$_}}) foreach @l; } @@ -173,13 +173,12 @@ sub set_options { log::l(qq(set option "$new_option" for module "$name")); $conf{$name}{options} = $new_option; } -sub add_alias { +sub set_alias { my ($alias, $module) = @_; $module =~ /ignore/ and return; /\Q$alias/ && $conf{$_}{alias} && $conf{$_}{alias} eq $module and return $_ foreach keys %conf; log::l("adding alias $alias to $module"); $conf{$alias}{alias} = $module; - $conf{$module}{above} = 'snd-pcm-oss' if $module =~ /^snd-/; $alias; } sub add_probeall { @@ -227,6 +226,15 @@ sub remove_module { 0; } +sub set_sound_slot { + my ($alias, $module) = @_; + if (my $old = $conf{$alias}{alias}) { + $conf{$old} and delete $conf{$old}{above}; + } + set_alias($alias, $module); + $conf{$module}{above} = 'snd-pcm-oss' if $module =~ /^snd-/; +} + sub read_conf { my ($file) = @_; my %c; @@ -396,11 +404,11 @@ sub when_load { } elsif ($category eq 'bus/usb') { add_probeall('usb-interface', $name); } elsif ($category eq 'bus/firewire') { - add_alias('ieee1394-controller', $name); + set_alias('ieee1394-controller', $name); } elsif ($category =~ /sound/) { my $sound_alias = find { /^sound-slot-[0-9]+$/ && $conf{$_}{alias} eq $name } keys %conf; $sound_alias ||= 'sound-slot-0'; - add_alias($sound_alias, $name); + set_sound_slot($sound_alias, $name); } } } -- cgit v1.2.1