mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3783 d57e44dd-8a1f-0410-8b47-8ef2f437770f
22 lines
605 B
Bash
22 lines
605 B
Bash
# -*- mode: shell-script -*-
|
|
# Shell functions for parsing the Linux kernel version.
|
|
|
|
# Kernel version number.
|
|
function kernel_version {
|
|
if [ "${1#2.}" != "$1" ]; then
|
|
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p'
|
|
else
|
|
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\).*$/\1/p'
|
|
fi
|
|
}
|
|
|
|
# Last component of the kernel version, or the empty string if $1 does
|
|
# not contain a patchlevel.
|
|
function patchlevel {
|
|
if [ "${1#2.}" != "$1" ]; then
|
|
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\)[.-]\(.*\)$/\2/p'
|
|
else
|
|
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\)[.-]\(.*\)$/\2/p'
|
|
fi
|
|
}
|