grub-devel
[Top][All Lists]
Advanced

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

Re: Automatic backup with grub


From: Vladimir Serbinenko
Subject: Re: Automatic backup with grub
Date: Thu, 27 Oct 2005 19:35:54 +0200
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050804)



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




reply via email to

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