Messages in this thread | | | Date | Fri, 23 Apr 1999 10:55:16 +0100 (GMT) | From | Riley Williams <> | Subject | Re: Kernel build automation help |
| |
Hi Mike.
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?
Enclosed is the bash script I use for this purpose. It deals with all the formats I've seen for storing the said details...
Best wishes from Riley.
+----------------------------------------------------------------------+ | There is something frustrating about the quality and speed of Linux | | development, ie., the quality is too high and the speed is too high, | | in other words, I can implement this XXXX feature, but I bet someone | | else has already done so and is just about to release their patch. | +----------------------------------------------------------------------+ * ftp://ftp.MemAlpha.cx/pub/rhw/Linux * http://www.MemAlpha.cx/kernel.versions.html #!/bin/bash if [ $# -eq 0 ]; then echo "Usage: `basename $0` directory..." exit 255 fi function grab() { head $1/Makefile \ | grep ' = ' \ | grep -v -i arch \ | cut -d '=' -f 2 \ | sed 's/ //g' \ | tr '\n' ' ' echo } function format() { local MAJOR MINOR PATCH EXTRA while read MAJOR MINOR PATCH EXTRA ; do if [ -z "$EXTRA" ]; then printf '%s.%s.%s\n' $MAJOR $MINOR $PATCH else printf '%s.%s.%s-%s\n' $MAJOR $MINOR $PATCH $EXTRA fi EXTRA='' done } for DIR do grab $DIR | format done
| |