grub-devel
[Top][All Lists]
Advanced

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

Re: Scripting and keystrokes


From: Serbinenko Vladimir
Subject: Re: Scripting and keystrokes
Date: Mon, 13 Jun 2005 21:39:00 +0200
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

Yoshinori K. Okuji wrote:

>On Monday 13 June 2005 20:09, Serbinenko Vladimir wrote:
>  
>
>>Other idea: change menu syntax to select like command (see man bash) but
>>instead of prompting for number GRUB will write it to menu. What do you
>>think about it?
>>    
>>
>
>I am too stupid to imagine it. Can you show an example?
>
>
>  
>
I'm sorry that I wrote this letter too fast and w/o examples.
Example
If you write in normal bash:
select x in "Debian Linux" "Gentoo Linux" "Mandrake Linux";
do
    case "$x" in
        ("Debian Linux") 
            echo lets boot debian;
            break;;
       ("Gentoo Linux")
            echo lets boot gentoo;
            break;;
      ("Mandrake Linux")
            echo lets drake;
            break;;
    esac;
done
It will show
1) Debian Linux
2) Gentoo Linux
3) Mandrake Linux
And ask for number and then execute corresponding entry. If GRUB adapts
this syntax it will show menu
Debian Linux
Gentoo Linux
Mandrake Linux
ask use to choose and then boot corresponding entry.
Disadvantages:
    You must write two times the name.
Advantages:
    It's close to bash
    Sub-menus.
    "dynamic" menus (created by scripts)
    Easy creating of similar entries

select x in "Debian Linux" "Gentoo Linux" "Mandrake Linux network1"
"Mandrake Linux network2";
do
    case "$x" in
        ("Debian Linux") 
            echo lets boot debian;
            break;;
      ("Mandrake Linux "* )
            echo lets drake with PROFILE=${x:15};
            break;;
       ("Gentoo Linux")
            echo lets boot gentoo;
            break;;
    esac;
done

In this case script determines which value to pass in PROFILE variable.
Here it's not particularly advantaging but if you have more parameters.
like:
Mandrake Linux network1
Mandrake Linux network2
Mandrake Linux console network1
Mandrake Linux console network2
Mandrake Linux console nonfb network1
Mandrake Linux console nonfb network2
Mandrake Linux console nonfb failsafe network1
Mandrake Linux console nonfb failsafe network2

Script can check if keywords console, network1, network2, nonfb and
failsafe are present and boot corresponding config.
   
                                                                        
                                 Vladimir








reply via email to

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