Use sort -V by the idea of Georgi Georgiev.
* util/grub-mkconfig_lib.in (version_sort): New function. (version_test_numeric): Use version_sort.
This commit is contained in:
parent
0cdc126ca2
commit
93b1cd79c8
2 changed files with 26 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2012-03-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Use sort -V by the idea of Georgi Georgiev.
|
||||||
|
|
||||||
|
* util/grub-mkconfig_lib.in (version_sort): New function.
|
||||||
|
(version_test_numeric): Use version_sort.
|
||||||
|
|
||||||
2012-03-04 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-03-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Use submenus in grub-mkconfig.
|
Use submenus in grub-mkconfig.
|
||||||
|
|
|
@ -185,6 +185,24 @@ grub_file_is_not_garbage ()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version_sort ()
|
||||||
|
{
|
||||||
|
case $version_sort_sort_has_v in
|
||||||
|
yes)
|
||||||
|
LC_ALL=C sort -V;;
|
||||||
|
no)
|
||||||
|
LC_ALL=C sort -n;;
|
||||||
|
*)
|
||||||
|
if sort -v </dev/null > /dev/null 2>&1; then
|
||||||
|
version_sort_sort_has_v=yes
|
||||||
|
LC_ALL=C sort -V
|
||||||
|
else
|
||||||
|
version_sort_sort_has_v=no
|
||||||
|
LC_ALL=C sort -n
|
||||||
|
fi;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
version_test_numeric ()
|
version_test_numeric ()
|
||||||
{
|
{
|
||||||
version_test_numeric_a="$1"
|
version_test_numeric_a="$1"
|
||||||
|
@ -201,7 +219,7 @@ version_test_numeric ()
|
||||||
version_test_numeric_a="$version_test_numeric_b"
|
version_test_numeric_a="$version_test_numeric_b"
|
||||||
version_test_numeric_b="$version_test_numeric_c"
|
version_test_numeric_b="$version_test_numeric_c"
|
||||||
fi
|
fi
|
||||||
if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | sort -n | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue