All of lore.kernel.org
 help / color / mirror / Atom feed
* Grub version variable in shell
@ 2012-03-11  2:40 Andreas Born
  2012-03-11  2:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Born @ 2012-03-11  2:40 UTC (permalink / raw)
  To: GRUB2 Devel

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

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. 
Currently, I'm doing a check like 'if keymap' to show a minimal menu to 
pre-1.99 users with a warning that they're version is too old instead of 
giving them garbage if at all. But that check does not feel really 
reliable nor clean. ;)
Especially given the recent discussion regarding backwards incompatible 
changes, this would be a really big help even if they're only small 
changes. But I imagine there are other uses too. The early there is such 
a variable the more useful it is, but I wouldn't consider it critical.

On the other hand it's quite hard to parse a version string on the grub 
shell, especially if distributions choose to change it to some Brainf**k 
imitation. Or they give the code a major revamp and then don't change 
it. Well, maybe grub could get a Brainf**k parser at least. :D

For completeness two-line patch attached. (Untested)

Andreas Born

[-- Attachment #2: grub-version.patch --]
[-- Type: text/plain, Size: 402 bytes --]

=== modified file 'grub-core/normal/main.c'
--- grub-core/normal/main.c	2012-03-04 23:41:37 +0000
+++ grub-core/normal/main.c	2012-03-11 02:29:53 +0000
@@ -552,6 +552,8 @@
   grub_env_export ("grub_cpu");
   grub_env_set ("grub_platform", GRUB_PLATFORM);
   grub_env_export ("grub_platform");
+  grub_env_set ("grub_version", VERSION);
+  grub_env_export ("grub_version");
 }
 
 GRUB_MOD_FINI(normal)


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-03-11 21:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11  2:40 Grub version variable in shell Andreas Born
2012-03-11  2:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11 11:52   ` Andreas Born
2012-03-11 12:47     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11 13:55       ` Andreas Born
2012-03-11 14:07         ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11 14:17           ` Andreas Born
2012-03-11 14:20             ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11 14:58               ` Andreas Vogel
2012-03-11 21:13                 ` Seth Goldberg
2012-03-11 12:52     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-11 14:39       ` Andreas Vogel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.