From 496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 6 Mar 2003 15:46:00 +0000 Subject: added check_kernel_module_packages with same behaviour expected as for install_any module. --- perl-install/standalone.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'perl-install') diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index 483ef0362..2aaaa50b6 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -195,6 +195,40 @@ sub ensure_is_installed { 1; } +sub check_kernel_module_packages { + my ($do, $base_name, $ext_name) = @_; + my $result; + my (%list, %select); + + eval { + local *_; + require urpm; + my $urpm = new urpm; + $urpm->read_config(nocheck_access => 1); + foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) { + $urpm->parse_synthesis($_); + } + foreach (@{$urpm->{depslist} || []}) { + $_->name eq $ext_name and $list{$_->name} = 1; + $_->name =~ /$base_name/ and $list{$_->name} = 1; + } + }; + if (!$ext_name || $list{$ext_name}) { + eval { + my ($version, $release, $ext) = c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/; + $ext and $ext = "-$ext"; + $list{"$base_name$version-$release$ext"} or die "no NVIDIA kernel for current kernel"; + $select{"$base_name$version-$release$ext"} = 1; + foreach (`rpm -qa kernel*`) { + ($ext, $version, $release) = /kernel[^-]*(-smp|-enterprise|-secure)?(\d+\.\d+\.\d+)\.([^\-]+mdk)$/; + $list{"$base_name$version-$release$ext"} and $select{"$base_name$version-$release$ext"} = 1; + } + $result = [ keys(%select), if_($ext_name, $ext_name) ]; + } + } + return undef; +} + sub what_provides { my ($_o, $name) = @_; my ($what) = split '\n', `urpmq '$name' 2>/dev/null`; -- cgit v1.2.1