So what needs to be done is place an image back once in a while.  It
should be possible to create a GRUB command for that, I guess. :-)
Why a command? A better way, IMO, is using some variables stored in file.
It could be presented as array SAVED_INTEGER of integers and SAVED_FLAGS of flags.
Then with command
initsaved <file>
where <file> must be created from OS (what about a tool or shell script?)
then

initsaved /grub2/savedvars

if [[ SAVED_INTEGER[0] -ge 10]]; then
   defwin = "";
   defrest="--default";
else
   defwin = "--default";
   defrest="";
fi
menu $defwin windows
{
   ... # Load windows
   ((SAVED_INTEGER[0]++));
}

menu $defrest restore windows
{
   ... # Restore windows
   SAVED_INTEGER[0]=0;
}

menu reset counter
{
   SAVED_INTEGER[0]=0;
}

timeout=10;

In this way first 10 times $defwin expands to --default and "Load windows" becomes default. Afterwards $defrest expands to --default and "restore windows" becomes default

Vladimir 'phcoder' Serbinenko


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to