build: improve kernel version detection again

Apparently people don't just begin the EXTRAVERSION with a dash.
So rewrite it all and throw out /anything/ non-numeric.
This commit is contained in:
Jan Engelhardt
2010-11-23 21:44:21 +01:00
parent 1721b76a0f
commit bf8d44cca4

View File

@@ -50,20 +50,20 @@ if grep -q "CentOS release 5\." /etc/redhat-release 2>/dev/null ||
fi; fi;
AC_MSG_CHECKING([kernel version that we will build against]) AC_MSG_CHECKING([kernel version that we will build against])
krel="$(make -sC ${kbuilddir} kernelrelease)"; krel="$(make -sC ${kbuilddir} kernelrelease)";
krel="${krel%%-*}"; kmajor="${krel%%[[^0-9]]*}";
kmajor="${krel%%.*}"; kmajor="$(($kmajor+0))";
krel="${krel#*.}"; krel="${krel:${#kmajor}}";
kminor="${krel%%.*}"; krel="${krel#.}";
krel="${krel#*.}"; kminor="${krel%%[[^0-9]]*}";
kmicro="${krel%%.*}"; kminor="$(($kminor+0))";
if test "$kmicro" = "$krel"; then krel="${krel:${#kminor}}";
kmicro="$(($kmicro+0))"; # Get rid of non numbers ("2.6.36+" -> "2.6.36") krel="${krel#.}";
kstable=0; kmicro="${krel%%[[^0-9]]*}";
else
kmicro="$(($kmicro+0))"; kmicro="$(($kmicro+0))";
kstable="${krel#*.}"; krel="${krel:${#kmicro}}";
krel="${krel#.}";
kstable="${krel%%[[^0-9]]*}";
kstable="$(($kstable+0))"; kstable="$(($kstable+0))";
fi;
if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then
echo "WARNING: Version detection did not succeed. Continue at own luck."; echo "WARNING: Version detection did not succeed. Continue at own luck.";
else else