[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] version: add a module to get GRUB version
From: |
Daniel Kiper |
Subject: |
Re: [PATCH v2] version: add a module to get GRUB version |
Date: |
Thu, 16 Apr 2020 16:53:21 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Wed, Apr 15, 2020 at 02:04:36PM +0200, Flavio Suligoi wrote:
> Sometimes, writing a custom grub.cfg configuration file,
> especially with embedded systems, it is indispensable
> to know the version of the running GRUB.
> This is essential for every automatic sw update procedure.
>
> Additionally to the standard GRUB version, I added a
> supplementary "OEM" version, to keep track of the OEM
> custom GRUB version.
>
> For further script test and processing, the version
> can be also saved in an environment variable.
>
> Command syntax:
>
> grub> help version
> Usage: version [OPTIONS]
>
> Print GRUB or GRUB+OEM version.
> If --set is specified, the version is assigned to variable.
>
> -s, --set=VARNAME Assign return value to variable VARNAME.
> -o, --oem Add OEM version.
> -h, --help Display this help and exit.
> -u, --usage Display the usage of this command and exit.
> grub>
Do we really need a module for that? I do not think so. I would prefer
if the GRUB sets a number of variables immediately after load. Please
take a look at grub_cpu or grub_platform variables currently available
in the GRUB. They are good examples. Going that way we should have, e.g.
grub_ver variable. Additionally, I would add for convenience grub_major,
grub_minor, grub_commit and grub_oem. So, let's assume that we have 2.06
version. Then grub_major should be "2" and grub_minor "06". grub_commit
and grub_oem should not exists. If we have 2.06.d5a32255d then
grub_major should be "2", grub_minor "06" and grub_commit "d5a32255d".
grub_oem should not exists. If we have 2.06.d5a32255d_1.0.0, then ...
and grub_oem should be "1.0.0". There should not be any requirement to
have grub_commit nor grub_oem. So, e.g. 2.06_1.0.0 would be a valid
version too.
grub_commit and grub_oem should be enabled at ./configure call. By
default grub_major and grub_minor should be set only. I think that
AC_DEFINE() autoconf macro could be useful for you.
Last but not, version displayed at the GRUB load have to be consistent
with what is set in the variables.
If you have any questions drop me a line.
Daniel