summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/Xconfig/card.pm4
-rw-r--r--perl-install/bootloader.pm15
-rw-r--r--perl-install/do_pkgs.pm78
3 files changed, 41 insertions, 56 deletions
diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm
index c926f4551..f20591b76 100644
--- a/perl-install/Xconfig/card.pm
+++ b/perl-install/Xconfig/card.pm
@@ -359,8 +359,8 @@ sub install_server {
}
my %proprietary_Driver2 = (
- nvidia => [ 'NVIDIA_kernel', 'NVIDIA_GLX' ], #- using NVIDIA driver (TNT, TN2 and GeForce cards only).
- fglrx => [ 'ATI_kernel', 'ATI_GLX' ], #- using ATI fglrx driver (Radeon, Fire GL cards only).
+ nvidia => [ 'nvidia-kernel', 'nvidia' ], #- using NVIDIA driver (TNT, TN2 and GeForce cards only).
+ fglrx => [ 'ati-kernel', 'ati' ], #- using ATI fglrx driver (Radeon, Fire GL cards only).
);
if (my $rpms_needed = $proprietary_Driver2{$card->{Driver2}}) {
if (my $proprietary_packages = $do_pkgs->check_kernel_module_packages($rpms_needed->[0], $rpms_needed->[1])) {
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 40c4c78a0..765978360 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -39,6 +39,21 @@ our %vga_modes = (
#-#####################################################################################
#- Functions
#-#####################################################################################
+my $vmlinuz_regexp = 'vmlinuz|win4lin';
+my $decompose_vmlinuz_name = qr/((?:$vmlinuz_regexp).*?)-(\d+\.\d+.*)/;
+
+sub expand_vmlinuz_symlink {
+ my ($vmlinuz) = @_;
+ my $f = $::prefix . ($vmlinuz =~ m!^/! ? $vmlinuz : "/boot/$vmlinuz");
+ -l $f ? readlink($f) : $vmlinuz;
+}
+
+sub installed_vmlinuz_raw() { grep { /^($vmlinuz_regexp)/ } all("$::prefix/boot") }
+sub installed_vmlinuz() { grep { ! -l "$::prefix/boot/$_" } installed_vmlinuz_raw() }
+sub vmlinuz2version {
+ my ($vmlinuz) = @_;
+ expand_vmlinuz_symlink($vmlinuz) =~ /$decompose_vmlinuz_name/ && $2;
+}
sub get {
my ($kernel, $bootloader) = @_;
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index eff29a3dc..a84223f24 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -41,6 +41,20 @@ sub is_installed {
$do->are_installed($name);
}
+sub check_kernel_module_packages {
+ my ($do, $base_name, $o_ext_name) = @_;
+
+ require bootloader;
+ my @l = map { $base_name . '-' . bootloader::vmlinuz2version($_) } bootloader::installed_vmlinuz();
+ my @ext = if_($o_ext_name, $o_ext_name);
+ my @rpms = $do->are_available(@ext, @l);
+
+ log::l("found kernel module packages $_") foreach @rpms;
+
+ #- we want at least a kernel package and the ext package if specified
+ @rpms > @ext && \@rpms;
+}
+
################################################################################
package do_pkgs_during_install;
use run_program;
@@ -65,30 +79,16 @@ sub install {
}
}
-sub check_kernel_module_packages {
- my ($do, $base_name, $o_ext_name) = @_;
-
- if (!$o_ext_name || pkgs::packageByName($do->{o}{packages}, $o_ext_name)) {
- my @rpms = map {
- my $name = $base_name . $_->{ext} . '-' . $_->{version};
- if ($_->{pkg}->flag_available && pkgs::packageByName($do->{o}{packages}, $name)) {
- log::l("found kernel module packages $name");
- $name;
- } else {
- ();
- }
- } pkgs::packages2kernels($do->{o}{packages});
-
- @rpms and return [ @rpms, if_($o_ext_name, $o_ext_name) ];
- }
- return undef;
-}
-
sub what_provides {
my ($do, $name) = @_;
map { $_->name } pkgs::packagesProviding($do->{o}{packages}, $name);
}
+sub are_available {
+ my ($do, @pkgs) = @_;
+ grep { pkgs::packageByName($do->{o}{packages}, $_) } @pkgs;
+}
+
sub are_installed {
my ($do, @l) = @_;
grep {
@@ -148,13 +148,9 @@ sub install {
$ret;
}
-sub check_kernel_module_packages {
- my ($_do, $base_name, $o_ext_name) = @_;
- my ($result, %list, %select);
- my @rpm_qa if 0;
-
- #- initialize only once from rpm -qa output...
- @rpm_qa or @rpm_qa = `rpm -qa`;
+sub are_available {
+ my ($_do, @pkgs) = @_;
+ my %pkgs = map { $_ => 1 } @pkgs;
eval {
local *_;
@@ -164,35 +160,9 @@ sub check_kernel_module_packages {
foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) {
$urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}");
}
- foreach (@{$urpm->{depslist} || []}) {
- $_->name eq $o_ext_name and $list{$_->name} = 1;
- $_->name =~ /$base_name/ and $list{$_->name} = 1;
- }
- foreach (@rpm_qa) {
- my ($name) = /(.*?)-[^-]*-[^-]*$/ or next;
- $name eq $o_ext_name and $list{$name} = 0;
- $name =~ /$base_name/ and $list{$name} = 0;
- }
+ map { $_->name } grep { $pkgs{$_->name} } @{$urpm->{depslist} || []};
};
- if (!$o_ext_name || exists $list{$o_ext_name}) {
- eval {
- my ($version_release, $ext);
- if (c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/) {
- $version_release = "$1.$2";
- $ext = $3 ? "-$3" : "";
- exists $list{"$base_name$ext-$version_release"} or die "no $base_name for current kernel";
- $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1;
- } else {
- #- kernel version is not recognized, what to do ?
- }
- foreach (@rpm_qa) {
- ($ext, $version_release) = /kernel[^\-]*(-smp|-enterprise|-secure)?(?:-([^\-]+))$/;
- $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1;
- }
- $result = [ keys(%select), if_($o_ext_name, $o_ext_name) ];
- }
- }
- return $result;
+
}
sub what_provides {