Oh, FYI, before I forget: For a while we've been working on a boottool
next generation, with a python API wrapping up the C program called
grubby:

http://git.fedorahosted.org/git/?p=grubby.git

So you might need to reproduce your change on this future version
we're working on. See pull request #208:

https://github.com/autotest/autotest/pull/208

On Mon, Feb 27, 2012 at 8:34 PM, Lucas Meneghel Rodrigues
<[email protected]> wrote:
> From: Nishanth Aravamudan <[email protected]>
>
> If no 'default' entry is in yaboot.conf (the only type of bootloader I
> tested on), then boottool --set-default= will fail to change the default
> and reboots will go back to the first listed kernel. Fix this by
> determining if we have found a default line and if not, inserting one at
> the top of the file.
>
> Changes from v1:
>  * Fixed perl syntax error
>
> Signed-off-by: Nishanth Aravamudan <[email protected]>
> ---
>  client/tools/boottool |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/client/tools/boottool b/client/tools/boottool
> index 728e4ef..87c85ab 100755
> --- a/client/tools/boottool
> +++ b/client/tools/boottool
> @@ -298,6 +298,7 @@ sub get_template {
>  sub set_default {
>   my $self=shift;
>   my $newdefault=shift;
> +  my $defaultfound=0;
>
>   print ("Setting default.\n") if $self->debug()>1;
>
> @@ -324,9 +325,13 @@ sub set_default {
>   foreach my $index (0..$#config) {
>     if ($config[$index] =~ /^\s*default/i) {
>       $config[$index] = "default=$newdefault   # set by $0\n";
> +      $defaultfound=1;
>       last;
>     }
>   }
> +  if (!$defaultfound) {
> +    unshift(@config, "default=$newdefault    # set by $0\n");
> +  }
>   @{$self->{config}} = @config;
>  }
>
> --
> 1.7.7.6
>
> _______________________________________________
> Autotest mailing list
> [email protected]
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



-- 
Lucas
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to