From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S6YiO-0007rM-2n for mharc-grub-devel@gnu.org; Sat, 10 Mar 2012 21:40:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6YiG-0007rA-Tz for grub-devel@gnu.org; Sat, 10 Mar 2012 21:40:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6Yi5-0001lh-UB for grub-devel@gnu.org; Sat, 10 Mar 2012 21:40:48 -0500 Received: from mail-we0-f169.google.com ([74.125.82.169]:44999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6Yi5-0001lL-KD for grub-devel@gnu.org; Sat, 10 Mar 2012 21:40:37 -0500 Received: by werj55 with SMTP id j55so2729447wer.0 for ; Sat, 10 Mar 2012 18:40:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=ect4nfsXFg/cUV+z4fDEF+P736l+/MXVINS2Mp6zHRg=; b=ZYbzBHXYe7vJaq2ZHNLs0bSSLyO+IiQSH25IWSYulw+SiPhDpdoto8Nsh9Hr5C9PXK 2IvH+BKzYmHGuvEydnvLztGaHYS3dd4pvcjlwGjx7P2UkNafRoXVDSy4k5RRJ1XVP+8U JeD5jxDG2Wzvazmnlem+QeEVIUdwzevxhKDpJ/hEFS40eMshK0wX/uiZBNDuDD9pPGp5 DBiXUTo6GN+V63VaUK3YSxZDFUvERynYJcrJnbvhL3nj/GAgzBJz6XsGK9thbIC4rjcq 6hmpTjhfbROWSmFFNBJtW+fYTdDGdpPcrQdeQPF1oLdKLexM0PGQ71vi2jn/UL3w7YkY MXCw== Received: by 10.180.105.194 with SMTP id go2mr16380019wib.22.1331433634751; Sat, 10 Mar 2012 18:40:34 -0800 (PST) Received: from [192.168.178.55] (p5091C993.dip.t-dialin.net. [80.145.201.147]) by mx.google.com with ESMTPS id w10sm35281318wiy.3.2012.03.10.18.40.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Mar 2012 18:40:33 -0800 (PST) Message-ID: <4F5C10A0.1060802@googlemail.com> Date: Sun, 11 Mar 2012 03:40:32 +0100 From: Andreas Born User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120220 Thunderbird/10.0.2 MIME-Version: 1.0 To: GRUB2 Devel Subject: Grub version variable in shell Content-Type: multipart/mixed; boundary="------------050208030505020804090808" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Mar 2012 02:40:55 -0000 This is a multi-part message in MIME format. --------------050208030505020804090808 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050208030505020804090808 Content-Type: text/plain; name="grub-version.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grub-version.patch" === 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) --------------050208030505020804090808--