Hi,
the attached patch should fix the issue with kernel-* vs. linux-* for the
Debian Linux kernel packages (at least some parts of it).
I have tried to make the pactch as minimally intrusive as possible
by replacing the global variables $kheaders, $ksource, $kimage with
local counterparts depending on the kernel version.
Hope it helps
Peter
--
Peter Marschall
eMail: [EMAIL PROTECTED]
--- module-assistant 2005-07-24 09:21:38.000000000 +0200
+++ module-assistant 2005-07-29 17:24:05.000000000 +0200
@@ -143,12 +143,8 @@
chomp($my_kvers=`uname -r`);
-my $kpackage='kernel';
-$kpackage="linux" if(-e "/etc/lsb-release" && `cat /etc/lsb-release 2>/dev/null` =~ /Ubuntu/i);
+my $distrib_id = get_distrib_id();
-my $kheaders=$kpackage.'-headers';
-my $ksource=$kpackage.'-source';
-my $kimage=$kpackage.'-image';
my $usrc="/usr/src";
my $opt_help;
@@ -388,6 +384,7 @@
# complaing about them, though
my $kvers=$extra_kvers[0];
+ my $kheaders = get_kpackage($kvers)."-headers";
if(!(keys %kerneldirs)) {
printmsg "\n\n" .
wrap('','',gettext("Bad luck, the kernel headers for the target kernel version could not be found and you did not specify other valid kernel headers to use.")) . "
@@ -508,10 +505,49 @@
$ret += system ("rm -f $var/*.apt_policy");
}
+
+# get distrib_id from /etc/lsb-release; default to Debian
+sub get_distrib_id
+{
+ my $LSB;
+ my $distrib_id = "Debian";
+
+ if (open($LSB, "/etc/lsb-release")) {
+ while (defined(my $lsb = <$LSB>)) {
+ return "Ubuntu" if ($lsb =~ /DISTRIB_ID.*Ubuntu/i);
+ return "Debian" if ($lsb =~ /DISTRIB_ID.*Debian/i);
+ }
+ close($LSB);
+ }
+ return "Debian";
+}
+
+
+# get kernel package prefix depending on distribution and kernel version
+sub get_kpackage
+{
+ my $version = shift;
+
+ # normalize version to Linux kernel version
+ $version =~ s/^(2\.\d+\.\d+).*$/$1/;
+
+ return "linux"
+ if (($distrib_id eq "Ubuntu") || # Ubuntu uses "linux"
+ (($distrib_id eq "Debian") && # Debian started using "linux" with 2.6.12
+ ($version !~ /^2\.[0-5]\.\d+$/) && # i.e. not 2.0 - 2.5,
+ ($version !~ /^2\.6\.\d$/) && # ... not 2.6.0 - 2.6.9,
+ ($version !~ /^2\.6\.1[01]$/))); # ... not 2.6.10 or 2.6.11
+
+ # default to "kernel"
+ return "kernel";
+}
+
+
sub prep {
chdir $usrc;
print "chdir $usrc\n" if $opt_debug;
for $todo ($opt_kverslist[0]) {
+ my $kheaders = get_kpackage($todo)."-headers";
$source=$kerneldirs{$todo};
die "Wrong kernel version specification" if ! $todo;
print STDERR sprintf(gettext("%s."), $source) . "\n" if $opt_debug;
@@ -704,6 +740,8 @@
close($chlog);
}
# fallback to -headers oder -image version, may be incorrect but better than nothing
+ my $kheaders = get_kpackage($KVERS)."-headers";
+ my $kimage = get_kpackage($KVERS)."-image";
FROMAPT: for $pb ($kheaders, $kimage) {
last FROMAPT if(defined($KDREV));
if(open($aptpipe,"LANG=C apt-cache policy $pb-$KVERS 2>/dev/null |")) {
@@ -1121,12 +1159,14 @@
}
sub fakesrc {
- my $kpkg = $kimage."-".$_[0];
my $kvers=$_[0];
+ my $kpkg = get_kpackage($kvers)."-image-".$kvers;
my $knmbr=$kvers;
$knmbr=~s/^([\d\.]+)(.*)/$1/;
my $extra=$2;
my $confile="/boot/config-$kvers";
+ my $kheaders=get_kpackage($kvers)."-headers";
+ my $ksource=get_kpackage($kvers)."-source";
my $symverfile="$usrc/$kheaders-$kvers/Module.symvers";
my $compileh="$usrc/$kheaders-$kvers/include/linux/compile.h";
print gettext("Experimental kernel source recreating method...\nGetting source...") . "\n";
@@ -1217,6 +1257,7 @@
HAVEIT: foreach $kvers (@opt_kverslist) {
next HAVEIT if(defined($kerneldirs{$kvers}));
+ my $kheaders=get_kpackage($my_kvers)."-headers";
LOOKUP: foreach $poskdir ("$usrc/linux", "$usrc/$kheaders-$my_kvers", <$usrc/*>, </usr/local/src/*>, "/lib/modules/".$my_kvers."/build") {
if(-e $poskdir && (-d $poskdir || -d readlink($poskdir))) {
if(!-x $poskdir) {