i'm trying to do various stuff in grub2 shell but i have a hard time finding proper documentation.
anybody knows where to find a proper exhausive documentation containing namely the supported syntaxes for commands such as regexp and test ? ( which are not available in any of the pages i visited at gnu.org and namely not in http://www.gnu.org/software/grub/manual/html_node/Shell_002dlike-scripting.html
i have a script that detects available kernels and provides a boot entry for each of them with the corresponding initrd.
i have a hard time to sort the kernel by reverse version order :
- i have no idea if a sort command is available and anyway it does not seem like pipes are supported so it probably would be useless
- i tried various shell syntaxes for the test command but i'm only able to sort numerically using "test NUMBER -gt NUMBER" which work for decimal numbers but will not allow version comparison (i'd need to compare stuff such as 3.8.1-11)
- i have no idea what kind of string manipulation functions are available other than "regexp" and i only know the basic usage since i have yet to find where it is documented
- there migh be a way to list files matching a pattern and output them sorted somehow but i have not found it yet
obviously i can parse the major, minor, sub-minor and whatever you would call the last number, store them into as many variables and use a bunch of if-else comparisons to reach this goal
but it is a major pita and it is not generic enough since it will not allow to compare versions such as 11a with 11b (quite useless for linux kernels but i'd like it more generic)
i'd also be interested in a sort based on mtime or ctime for filesystems that handle it but i have no idea if/how that would be supported in grub shell
i am NOT interested by solutions that involve using a shell script to write grub.cfg : this is both trivial and not what i'm looking for
thanks for any hints you can provide