how to detect a debian kernel from `uname -r`
I'm trying to detect a debian kernel from uname -r.
My suggestion would be to add a "-debian" at the end of the localversion
of kernels _patched_/modified by debian, and to leave the localversion
completely _empty_ (or an unchanged localversion compared to the
mainline defconfig) for unmodified mainline kernels shipped by debian
(if you ship them in the first place).
I also wonder how to detect ubuntu kernels, perhaps they're the same as
debian I don't know. If they're the same from a sourcecode standpoint
then I guess it's better to call them "-debian" too at the end of the
Note: I don't care about which userland is running, I only care to
detect the kernel branch that is running (i.e.
mainline/mm/ac/debian/suse/fedora etc..), so trying to detect the distro
in userland is not an option (plus I suspect it would be even less
Currently I'm using this regexp and it still can't detect everything,
plus I hope I'm not marking as "debian" kernels that are identical to
mainline from a sourcecode standpoint (I'm not tracking _who_ compiled
'Debian' : re.compile(r'^(\d+)\.(\d+)\.(\d+)(?:\.?(\d+)?|-rc(\d+))(?:-git(\d+))?-(\d+)-(?:86|k7|generic|amd64-k8)'),
Full GPL'd sourcecode of the regexp is here:
see the branch_regexp in klive/server/web.py.
You can see the results of the current regexp here:
but I can't detect everything, for example in unknown there are still
debian kernels very strangely called -p4-2 (google tells me it comes
from some .deb package):
No idea what the -2 at the end stands for (perhaps it's compiled with
Suggestions are welcome.
PS. I'm off-list so please make sure to include me in CC if the list
software adds a reply-to: to the email.