help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Probing for the existence of a device.


From: João Ricardo Sares Teles de Matos
Subject: Re: Probing for the existence of a device.
Date: Tue, 25 Jun 2013 11:04:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12


On 06/24/2013 03:18 AM, Andrey Borzenkov wrote:
> Pass value of $drive as parameter into menuentry. grub implicitly adds
> "setparams arg1 arg2 ..." for every non-option argument as the very
> first menuentry body statement.
>
> for drive in (hd0) (hd1) (hd2); do
>   menuentry "Echo the value of \$drive (it should be $drive)" $drive {
>        echo "The value of \$drive is $2"
>        sleep 5
>   }
> done
>

That enabled me to do what I wanted. Thank you!

I didn't know menuentry accepted parameters; that's an elegant and lightweight 
solution to the problem.

I'll leave my final configuration here for people doing web searches on the 
subject:

submenu "Chainload other devices." {
  insmod regexp
  for drive in *; do
    menuentry "Chainload device: $drive" "$drive" {
      set root="$2"
      chainloader +1
      boot
    }
  done
}

Thank you, again, to everyone who replied.

-- 
João Ricardo Sares Teles de Matos
address@hidden

Administração de Sistemas da Rede das Novas Licenciaturas
Instituto Superior Técnico

web: https://www.rnl.ist.utl.pt
email: address@hidden
telefone: +351 218 41 77 71


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]