pkgsrc-Users archive

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

Re: kernel detection in /etc/rc.conf



On Sun, 22 May 2011, Sverre Froyen wrote:
Is there a way to detect kernel version in /etc/rc.conf. I am attempting
something like the following:

if uname -v | grep XEN3_DOM0 > /dev/null
[snip]

My way to do simple substring tests like this before awk, sed, grep, etc. are necessarily available is to use case, e.g.

case $(sysctl -n machdep.booted_kernel) in
*XEN3_DOM0*)
        do stuff
        ;;
*)
        do other stuff
        ;;
esac

For example:
http://ftp.netbsd.org/pub/NetBSD/misc/sborrill/drivecache.sh

--
Stephen



Home | Main Index | Thread Index | Old Index