NAME

Linux::Bootloader::Grub - Parse and modify GRUB configuration files.

SYNOPSIS

	use Linux::Bootloader;
	use Linux::Bootloader::Grub;

        my $config_file='/boot/grub/menu.lst';
	$bootloader = Linux::Bootloader::Grub->new($config_file);

        $bootloader->read();

	# add a kernel	
	$bootloader->add(%hash)

	# remove a kernel
	$bootloader->remove(2)

	# print config info
	$bootloader->print_info('all')

	# set new default
	$bootloader->set_default(1)

        $bootloader->write();

DESCRIPTION

This module provides functions for working with GRUB configuration files.

Adding a kernel:
- add kernel at start, end, or any index position.
- kernel path and title are required.
- root, kernel args, initrd, savedefault, module are optional.
- any options not specified are copied from default.
- remove any conflicting kernels first if force is specified.

Removing a kernel:
- remove by index position
- or by title/label

FUNCTIONS

Also see Linux::Bootloader for functions available from the base class.

new()

Creates a new Linux::Bootloader::Grub object.

_info()

	Parse config into array of hashes.
	Takes: nothing.
	Returns: array of hashes containing config file options and boot entries,
                 undef on error.

set_default()

Set new default kernel.
Takes: integer or string, boot menu position or title.
Returns: undef on error.

add()

Add new kernel to config.
Takes: hash containing kernel path, title, etc.
Returns: undef on error.

update()

Update args of an existing kernel entry.
Takes: hash containing args and entry to update.
Returns: undef on error.

install()

Prints message on how to re-install grub.
Takes: nothing.
Returns: nothing.

update_main_options()

This updates or adds a general line anywhere before the first 'title' line.
it is called with the 'update' and 'option' options, when no 'update-kernel'
is specified.

boot_once()

This is a special case of using 'fallback'.   This function makes the current 
default the fallback kernel and sets the passed argument to be the default 
kernel which saves to the fallback kernel after booting.  The file 
'/boot/grub/default' is created if it does not exist.

This only works with grub versions 0.97 or better.

_get_bootloader_version()

Prints detected grub version.
Takes: nothing.
Returns: nothing.

AUTHOR

Open Source Development Labs, Engineering Department <eng@osdl.org>

COPYRIGHT

Copyright (C) 2006 Open Source Development Labs All Rights Reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Linux::Bootloader