[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: automatic selection which kernel image to install



On Wed, Nov 27, 2002 at 03:22:12PM -0500, sean finney wrote:
> On Wed, Nov 27, 2002 at 08:25:35PM +0100, Thomas Lange wrote:
> > Is there a script, that can automaticly determine the best or correct
> > name of the kernel-image that should be installed?
> > 
> > I think something with grep and sed from /proc/cpuinfo should write
> > k7, k6, 586tsc or someing else to stdout. Has someone created this
> > script already ?
> 
> i don't know of anything that currently does that, but it would be
> totally sweet to have it!  one could create something like a
> kernel-image-2.4.x "task" that then selects the approprate package to
> install based on that.  just take something like
> 
> sed -ne 's/^model name.* //p' < /proc/cpuinfo
> 
> and cross reference it with a list of supported systems for each kernel.

Hmm, something like:

#!/bin/bash

cpuid=sed -ne 's/^model name.*: //p' < /proc/cpuinfo

case "$cpuid" in
    "AMD Athlon"*)
      echo k7
      ;;
    "AMD K6"*)
      echo k6
      ;;
    "Celeron"*)
      echo 686
      ;;
    "Pentium "*)
      echo 586tsc
      ;;
    *)
      echo 386
esac

:)

Of course this is non-exhaustive. Just all the CPUs I had laying
around...

-- 
-><- Nick Rusnov
-><- http://nick.industrialmeats.com
-><- nick@fargus.net/nickrusnov@debian.org 



Reply to: