diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 3 | ||||
-rw-r--r-- | perl-install/harddrake/autoconf.pm | 25 | ||||
-rwxr-xr-x | perl-install/standalone/service_harddrake | 8 |
3 files changed, 35 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 4c227dd8e..f831183e6 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- service_harddrake: adapt kernel modaliases that are not valid + anymore in modprobe.conf when booting a new kernel, this should fix + migration from e1000 to e1000e and from iwl4965 to iwlagn (#41248) - libDrakX: o make all windows are "dialog", so that gurpmi.addmedia during install displays nicely diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm index 9b16f5d3c..4f234010d 100644 --- a/perl-install/harddrake/autoconf.pm +++ b/perl-install/harddrake/autoconf.pm @@ -83,4 +83,29 @@ sub cpufreq() { modules::set_preload_modules("cpufreq", cpufreq::get_modules()); } +sub fix_aliases { + my ($modules_conf) = @_; + require modalias; + my %new_aliases; + #- first pass: find module targets whose modalias is not valid anymore + foreach my $module ($modules_conf->modules) { + if (my $aliased_to = $modules_conf->get_alias($module)) { + my @valid_modaliases = modalias::get_modules($module, 'skip_config') or next; + my ($found, $others) = partition { $_ eq $aliased_to } @valid_modaliases; + $new_aliases{$aliased_to} = @{$others || []} == 1 && $others->[0] if is_empty_array_ref($found); + } + } + #- second pass: adapt module targets that are not valid anymore + foreach my $module ($modules_conf->modules) { + if (my $aliased_to = $modules_conf->get_alias($module)) { + if (my $new = exists $new_aliases{$aliased_to} && $new_aliases{$aliased_to}) { + $modules_conf->set_alias($module, $new); + } else { + $modules_conf->remove_alias($module); + } + } + } + $modules_conf->write; +} + 1; diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index a9b8fe8d2..fbe854c2b 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -38,7 +38,7 @@ my $modules_conf = modules::any_conf->read; my $isLaptop = detect_devices::isLaptop(); my $curr_kernel = c::kernel_version(); -my ($kernel_major) = $curr_kernel =~ /(^\d+\.\d+).*/; +my ($kernel_major) = $curr_kernel =~ /^(\d+\.\d+)/; my %previous_kernel_config = getVarsFromSh("$hw_sysconfdir/kernel"); setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $kernel_major, IS_LAPTOP => bool2text($isLaptop) }); @@ -50,6 +50,12 @@ if (!exists $previous_kernel_config{IS_LAPTOP} || $force || $isLaptop != text2bo harddrake::autoconf::laptop($isLaptop); } +my $known_kernels = "$hw_sysconfdir/kernels"; +if (!member($curr_kernel, chomp_(cat_($known_kernels)))) { + harddrake::autoconf::fix_aliases($modules_conf) if !$first_run; + append_to_file($known_kernels, "$curr_kernel\n"); +} + my @cards = ( { ldetect_driver_regexp => 'Card:NVIDIA', |