Hi Andrei,
I'm sorry for the late reply but I never received your email which I
just found on the help-grub archive.
On 11.11.2021 22:00, Andrei Borzenkov wrote:
On 11.11.2021 12:36, Federico Vaga wrote:
> Hello,
>
> I'm trying to get the hostname in `grub.cfg` to point then to
> different rootnfs, or network live images.
>
> From the manual page:
>
> https://www.gnu.org/software/grub/manual/grub/grub.html
>
> I've noticed the existence of `net_<interface>_hostname` but this
> requires to know the `<interface>` name in advance and this is
> platform dependent (as the documentation says).
>
> Since these systems have only one network connection I thought about
> using `net_default_interface` to ignore the specific name. Here
> problems strarts because neasting variables seems not working and
> doing: `${net_${net_default_interface}_hostname}`
>
eval "set myhostname=\${net_${net_default_interface}_hostname}"
and use $myhostname in following code
How this is different from just using `set` or the variable directly?
Why `eval` should help? (It doesn't)
Plus, why are you escaping the first dollar, but not the second?
> However, in the documentation variables like `net_default_ip` are
> described as the result of ‘net_${net_default_interface}_ip’.
>
> Am I doing something wrong? Do you have any suggestion?
>
> Thanks
>