From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S6hKa-0007xp-6H for mharc-grub-devel@gnu.org; Sun, 11 Mar 2012 07:52:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6hKX-0007xI-1Q for grub-devel@gnu.org; Sun, 11 Mar 2012 07:52:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6hKU-0003Ws-MC for grub-devel@gnu.org; Sun, 11 Mar 2012 07:52:52 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:36543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6hKU-0003We-DL for grub-devel@gnu.org; Sun, 11 Mar 2012 07:52:50 -0400 Received: by wibhj13 with SMTP id hj13so1947421wib.12 for ; Sun, 11 Mar 2012 04:52:48 -0700 (PDT) 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:references :in-reply-to:content-type:content-transfer-encoding; bh=06HuX3MVhmZ/gn5/1egzpBwgViKoZ+bsnoqnL+M/z7o=; b=svtAeQZmjRRdS14Q1vV6M6LAfTPgTcbBAGK0Txw7GFgztRRpV6KZOe3xbemggHSzBy c5SUr0oKWFXxUoH+UNuSsiYFlDHaVaRGeYGU9lqlxNOIfrYuG6OgazxnePlzp6BRYrev 4YNBLFB1aHwbZm9UT2HXJ6wR6qzqlTlT3/iX826NtFHqJTmRuh7uTfbaPPA+qd43AR3Z a9a8TY8+sZQOU8VU0CVqqz/VZuCv2ElehzH4RRI2j5JE3RYd83IT4JvkzUdDrVSbs6E0 G2Oc28CrXKKhm0pXIeKIpJ8y+bQosPguDqDCI3QXAOzzURvrlslwB6t9OdflNr9k2mFY 1FSA== Received: by 10.216.139.140 with SMTP id c12mr4645016wej.43.1331466768144; Sun, 11 Mar 2012 04:52:48 -0700 (PDT) Received: from [192.168.178.55] (p5091C0D0.dip.t-dialin.net. [80.145.192.208]) by mx.google.com with ESMTPS id fl2sm41279371wib.4.2012.03.11.04.52.46 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Mar 2012 04:52:47 -0700 (PDT) Message-ID: <4F5C920D.7070808@googlemail.com> Date: Sun, 11 Mar 2012 12:52:45 +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: The development of GNU GRUB Subject: Re: Grub version variable in shell References: <4F5C10A0.1060802@googlemail.com> <4F5C1321.1050403@gmail.com> In-Reply-To: <4F5C1321.1050403@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.171 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 11:52:54 -0000 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. Maybe something like a grub_version_min command? And possibly *_max? Apart from that I guess it would be nice to have such a variable to display the version someplace or to check it. Yes, I know it is already displayed in multiple places, but I don't think in gfxmenus. Did those feature variables even exist in 1.99? > >> 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 >> >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel