On 11.03.2012 12:52, Andreas Born wrote: > Am 11.03.2012 03:51, schrieb Vladimir 'φ-coder/phcoder' Serbinenko: >> On 11.03.2012 03:40, Andreas Born wrote: >>> Hi, >>> >>> it would be great to have a variable like version or grub_version in >>> the shell. Sorry, if there is already such an option and I didn't find >>> it. But I only saw cpu and platform as well as the feature variables. >>> >>> This is useful, if you want to use some new feature or don't want to >>> use some ugly workaround anymore, which you needed for an older >>> version. >> We don't use grub_version because it would give only very approximate >> idea of features supported and so only marginally useful and is likely >> to make devs use suboptimal method. Instead we define variables like >> feature_foo. Good example is from root setting code: >> if [ x$feature_platform_search_hint = xy ]; then >> search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt10 >> --hint-efi=hd0,gpt10 --hint-baremetal=ahci0,gpt10 UUID >> else >> search --no-floppy --fs-uuid --set=root UUID >> fi > Thank you, I get your point. > Still I think version can be useful to exclude versions with bugs (or > features) they do/(don't) have. For example on 1.98 I had to reexport > all variables in every configfile. This was dirty and hard to maintain > so I do not want to maintain this anymore. Instead of silently > failing, I'd like to provide users of older versions with a very > simple menu combined with a warning. (Usually in normal boot scenarios > they're using my grub build anyway.) I don't see how this should be > possible without my 'if keymap' hack. I think neither checking for a > command existence nor a feature is a reliable method to always ensure > a minimum version. Of course if you have a better idea, that's even > more welcome. Why not define "feature_bugXYZ_fixed" for bugs? Which ones are missing in 2.00~beta1? Then if [ x$feature_bug_XYZ = xy ]; then <normal version> else <bug-workaround version> fi
>Did those feature variables even exist in 1.99? They didn't but a missing variable is expanded to empty string so this check works exactly as intended > Maybe something like a grub_version_min command? And possibly *_max? > I don't see why you need it when you can check for features directly. Distros often distribute older versions but with backported bugfixes and check for exact features is better. -- Regards Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
