sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
[SM-Discuss] grimoire function to check minimum kernel ver
- From: Juuso Alasuutari <iuso AT sourcemage.org>
- To: sm-discuss AT lists.ibiblio.org
- Subject: [SM-Discuss] grimoire function to check minimum kernel ver
- Date: Sun, 2 Apr 2006 15:22:28 +0300
I wrote a function that checks if current kernel version is equal or newer
than a given one. It checks the version in any scale, whether >=2.6 or
>=2.6.15 or >=2.6.15.4, etc., and it strips chars beginning from -
(2.6.16-some_norse_god --> 2.6.16).
It could be used to selectively apply patches that fix kernel update issues.
At the moment at least two spells do that kind of checking (in a rudimentary
way), svgalib and nvidia_driver. (They're in diff grimoires, though, so I
don't know if the definition "needed by several spells" is fulfilled for this
to go into FUNCTIONS...)
Of course it could also be used to negatively check whether kernel ver is too
recent.
Here's the code, tell me what's wrong with it.
function is_kernel_minimum() {
local MIN CUR a b n=1
MIN=`expr $1 : '\(^[^-]*\)'`
MIN=${MIN//\./\ }
CUR=`get_kernel_version`
CUR=`expr $CUR : '\(^[^-]*\)'`
CUR=${CUR//\./\ }
for a in $MIN; do
b=`echo $CUR | cut -d" " -f$n`
if (( a < b )); then
return 0
elif (( a > b )); then
return 1
fi
(( n += 1 ))
done
}
Juuso
-
[SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/02/2006
- <Possible follow-up(s)>
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
sqweek, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Eric Sandall, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Andrew, 04/04/2006
- Re: [SM-Discuss] grimoire function to check minimum kernel ver, Jeremy Blosser (emrys), 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Jaka Kranjc, 04/04/2006
- Re: [SM-Discuss] grimoire function to check minimum kernel ver, Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Andrew, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Eric Sandall, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
Juuso Alasuutari, 04/04/2006
-
Re: [SM-Discuss] grimoire function to check minimum kernel ver,
sqweek, 04/04/2006
Archive powered by MHonArc 2.6.24.