On Sun, Jul 03, 2011 at 11:41:02AM -0700, Bruce Korb wrote:
> P.S. this check is really for any version below 2.6.27:
>
> - case $LINUXRELEASE in
> - # ext4 was in 2.6.22-2.6.26 but not stable enough to use
> - 2.6.2[0-9]*) enable_ext4='no' ;;
> - *) ..... ;;
>
> and might have been done correctly with a version compare operator.
case $LINUXRELEASE in
# ext4 was in 2.6.22-2.6.26 but not stable enough to use
2.6.2[0-6]*) enable_ext4=no ;;
...
The comment implies [2-6] but [0-6] is probably a safer bet, just in
case someone backported the driver to an older kernel.
See, what's really needed here is a check for the actual file system
*driver version*, not the kernel version. I wouldn't know how to get
that programmatically (perhaps something in /sys) ... OS issue, not
a bash issue.
As far as adding this sort of test to bash -- you're probably assuming
too much. For instance, you may be assuming that all "version strings"
are sequences of base-10 integers separated by periods. This is not
generally the case. Version strings frequently contain a bewildering
variety of barely-human-readable abbreviations, juxtapositions of
letters with numbers, plus signs, minus signs, underscores, alphas,
betas, release candidates, etc. Does version "1.0rc1" come before or
after version "1.0"? How about "1.0b1" -- is that before or after "1.0a"?
Is version "2.6+svn20110604" before or after version "2.6.1"?
The issue is extremely nontrivial.