If you would like to replace boottool I'd be happy to see it go...I seem to remember having a discussions about replacing it as far back as 2008. It's just hard to find a significant amount of time to allocate to replacing something that mostly-works, at least well enough to get by...
-- John On Sat, Oct 16, 2010 at 10:38 AM, Lucas Meneghel Rodrigues <[email protected]>wrote: > Instead of resorting to the horrible 2 hacks I had submitted > before, take a little more time and write support in boottool > to handle OS specific exceptions. This way we supersede the > 2 previous patches and provide a better and more integrated > approach to solve the problem: > > Geez, why isn't boottool --boot-once working for Fedora/RHEL ? > > Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> > --- > client/tools/boottool | 53 > ++++++++++++++++++++++++++++++++++++++++++++---- > 1 files changed, 48 insertions(+), 5 deletions(-) > > diff --git a/client/tools/boottool b/client/tools/boottool > index 4dafbab..728e4ef 100755 > --- a/client/tools/boottool > +++ b/client/tools/boottool > @@ -791,6 +791,38 @@ sub detect_architecture { > return $arch; > } > > +=head3 detect_os_vendor() > + > +Input: > +Output: string > + > +This function determines the OS vendor (linux distribution breed). > + > +Return values: "Red Hat", "Fedora", "SUSE", "Ubuntu", "Debian", or > +"Unknown" if none of the predefined patterns could be found on the > +issue file. > + > +=cut > + > +sub detect_os_vendor { > + my $vendor = ""; > + my $issue_file = '/etc/issue'; > + if ( not system("egrep 'Red Hat' $issue_file") ){ > + $vendor = 'Red Hat'; > + } elsif ( not system("egrep 'Fedora' $issue_file") ){ > + $vendor = 'Fedora'; > + } elsif ( not system("egrep 'SUSE' $issue_file") ){ > + $vendor = 'SUSE'; > + } elsif ( not system("egrep 'Ubuntu' $issue_file") ){ > + $vendor = 'Ubuntu'; > + } elsif ( not system("egrep 'Debian' $issue_file") ){ > + $vendor = 'Debian'; > + } else { > + $vendor = 'Unknown'; > + } > + return $vendor; > +} > + > =head3 detect_bootloader(['device1', 'device2', ...]) > > Input: devices to detect against (optional) > @@ -1595,20 +1627,31 @@ sub update_main_options{ > sub boot_once { > my $self=shift; > my $entry_to_boot_once = shift; > + my $detected_os_vendor = Linux::Bootloader::Detect::detect_os_vendor(); > > unless ( $entry_to_boot_once ) { print "No kernel\n"; return undef;} > $self->read(); > my $default=$self->get_default(); > > - if ( $default == $self->_lookup($entry_to_boot_once)){ > - warn "The default and once-boot kernels are the same. No action > taken. \nSet default to something else, then re-try.\n"; > - return undef; > - } > if ( $self->_get_bootloader_version() < 0.97 ){ > warn "This function works for grub version 0.97 and up. No action > taken. \nUpgrade, then re-try.\n"; > return undef; > } > > + if ( $detected_os_vendor eq "Red Hat" or $detected_os_vendor eq "Fedora" > ) { > + # if not a number, do title lookup > + if ( $entry_to_boot_once !~ /^\d+$/ ) { > + $entry_to_boot_once = $self->_lookup($entry_to_boot_once); > + return undef unless ( defined $entry_to_boot_once ); > + } > + > + return `echo "savedefault --default=$entry_to_boot_once" --once | grub > --batch`; > + } else { > + if ( $default == $self->_lookup($entry_to_boot_once)){ > + warn "The default and once-boot kernels are the same. No action > taken. \nSet default to something else, then re-try.\n"; > + return undef; > + } > + > $self->set_default('saved'); > if ( ! -f '/boot/grub/default' ){ > open FH, '>/boot/grub/default'; > @@ -1635,7 +1678,7 @@ sub boot_once { > $self->update( > 'update-kernel'=>"$entry_to_boot_once",'option'=>'','savedefault' => > 'fallback' ); > $self->update( 'update-kernel'=>"$default",'option'=>'', 'savedefault' => > '' ); > $self->write(); > - > + } > } > > sub _get_bootloader_version { > -- > 1.7.2.3 > >
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
