Re: Kernel build automation help

William Stearns (wstearns@pobox.com)
Thu, 22 Apr 1999 21:54:53 -0400 (EDT)


On Thu, 22 Apr 1999, Mike A. Harris wrote:

> Assuming that kernel sources are properly installed in /usr/src/linux
> from a clean tarball, and are unmodified, what is the easiest way to
> grab the kernel version number of the installed source?
>
> I've been trying to grab it from the top level makefile, but my script
> writing abilities seem to be lacking.
>
> Anyone have a few lines of simple bash code to get the kernel source
> version?

From Buildkernel, slightly modified:

eval `cat /usr/src/linux/Makefile | \
grep -E '^VERSION|^PATCHLEVEL|^SUBLEVEL' | \
tr a-z A-Z | \
sed -e 's/\ //g'`

This places these variables in the shell environment table where
they can get used like any other variables. Example:

echo The installed version is ${VERSION}.${PATCHLEVEL}.${SUBLEVEL}

Cheers,
- Bill

---------------------------------------------------------------------------
"Put down those Windows disks, Dave..."
-- HAL
--------------------------------------------------------------------------
William Stearns (wstearns@pobox.com)
Mason, Buildkernel, and named2hosts are at: http://www.pobox.com/~wstearns
--------------------------------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/