Bootloader::Tools



Bootloader::Tools

NAME
PREFACE
SYNOPSIS
DESCRIPTION

NAME

Bootloader::Tools − set of high−level bootloader configuration functions

PREFACE

This package contains a set of high-level bootloader configuration functions

SYNOPSIS

"use Bootloader::Tools;"

"$mp_ref = Bootloader::Tools::ReadMountPoints ();"

"$part_ref = Bootloader::Tools::ReadPartitions ();"

"$numDM = Bootloader::Tools::DMRaidAvailable ();"

"$part_ref = Bootloader::Tools::ReadDMRaidPartitions ();"

"$part_ref = Bootloader::Tools::ReadDMRaidDisks ();"

"Bootloader::Tools::IsDMRaidSlave ($kernel_disk);"

"Bootloader::Tools::IsDMDevice($dev);"

"$md_ref = Bootloader::Tools::ReadRAID1Arrays ();"

"$loader = Bootloader::Tools::GetBootloader ();"

"$value = Bootloader::Tools::GetSysconfigValue ();"

"Bootloader::Tools::InitLibrary ();"

"Bootloader::Tools::CountImageSections ($image);"

"Bootloader::Tools::RemoveImageSections ($image);"

"Bootloader::Tools::GetSystemLanguage ();"

"Bootloader::Tools::GetDefaultSection ();"

"Bootloader::Tools::GetDefaultImage ();"

"Bootloader::Tools::GetDefaultInitrd ();"

"Bootloader::Tools::GetGlobals();"

"Bootloader::Tools::SetGlobals(@params);"

"Bootloader::Tools::GetSectionList(@selectors);"

"Bootloader::Tools::GetSection($name);"

"Bootloader::Tools::AddSection($name, @params);"

"Bootloader::Tools::RemoveSections($name);"

"Bootloader::Tools::AdjustSectionNameAppendix ($mode, $sect_ref_new, $sect_ref_old);"

"$exec_with_path = Bootloader::Tools::AddPathToExecutable($executable);"

"Bootloader::Tools::DeviceMapperActive ();"

DESCRIPTION

"$mp_ref = Bootloader::Tools::ReadMountPoints ();"

reads the information about mountpoints in the system. The returned data is needed to initialize the bootloader library properly.

See InitLibrary function for example.

"$part_ref = Bootloader::Tools::ReadPartitions ();"

reads the information about disk partitions. This data is needed to initialize the bootloader library properly.

See InitLibrary function for example.

"Bootloader::Tools::GetMultipath ();"

Gets multipath configuration. Return reference to hash map, empty if system doesn’t contain multipath.

"Bootloader::Tools::GetMultipath ();"

Gets multipath configuration. Return reference to hash map, empty if system doesn’t contain multipath.

"$numDM = Bootloader::Tools::DMRaidAvailable ();"

Tests wether DMRAID is available. Return 0 if no device, 1 if there are any.

"$part_ref = Bootloader::Tools::ReadDMRaidPartitions ();"

reads partitions belonging to a Devicemapper RAID device. needed to be able to put get the correct translation into Grub notation DMRaid Devices look like: <strange name>

DMRaid Partitions look like: <strange name>_part\d

"$part_ref = Bootloader::Tools::ReadDMRaidDisks ();"

returns a refenrence to a list of DMRaid devices

"Bootloader::Tools::IsDMRaidSlave ($kernel_disk);"

checks wether a kernel_device is part of a DMRAID returns 1 if yes, 0 if no

"Bootloader::Tools:IsDMDevice ($device);"

returns 1 if $device is a Devicemapper device, otherwise 0.

"$md_ref = Bootloader::Tools::ReadRAID1Arrays ();"

reads the information about disk MD RAID1 arrays. This data is needed to initialize the bootloader library properly.

"$loader = Bootloader::Tools::GetBootloader ();"

returns the used bootloader. Reads the value from sysconfig. Returns the string − bootloader type.

See InitLibrary function for example.

"$value = Bootloader::Tools::GetSysconfigValue ();"

returns specified option from the /etc/sysconfig/bootloader file or undef if variable is not set.

See AddSection for example

"Bootloader::Tools::InitLibrary ();"

initializes the bootloader configuration library. Fills its internal structures needed for it to run properly.

"Bootloader::Tools::CountImageSections ($image);"

counts sections in the bootolader menu reffering to the specified kernel.

EXAMPLE:

  Bootloader::Tools::InitLibrary();
  my $count = Bootloader::Tools::CountImageSections ("/boot/vmlinuz−2.6.11");
  print "Sections: $count\n";

"Bootloader::Tools::CountSections (@selections);"

# FIXME: add documentation

"Bootloader::Tools::UpdateBootloader ();"

Updates the bootloader settings meaning do whatever it takes for the actual bootloader to use the current configuration

"$lang = Bootloader::Tools::GetSystemLanguage ();"

Read the System Language from /etc/sysconfig/language:RC_LANG

EXAMPLE:
my $Lang;
$Lang
= Bootloader::Tools::GetSystemLanguage ();

  setlocale(LC_MESSAGES, $Lang);

"%defaultSelection = Bootloader::Tools::GetDefaultSection ();"

Get the default section, returns a hash reference

EXAMPLE:
my %section;
%section
= Bootloader::Tools::GetDefaultSection ();
my $default_kernel = $section{"image"};

"Bootloader::Tools::GetDefaultImage ();"

Get the kernel name of the default section

EXAMPLE:
my $kernel;
$kernel
= Bootloader::Tools::GetDefaultImage ();

  print("Default Kernel Name: $kernel\n");

"Bootloader::Tools::GetDefaultInitrd ();"

Get the initrd of the default section

EXAMPLE:
my $initrd;
$initrd
= Bootloader::Tools::GetDefaultInitrd ();

  print("Default initrd  Name: $initrd\n");

"Bootloader::Tools::GetGlobals();"
"Bootloader::Tools::SetGlobals(@params);"

# FIXME: Add documentation

"Bootloader::Tools::GetSectionList(@selectors);"

# FIXME: Add documentation

"Bootloader::Tools::GetSection($name);"

# FIXME: Add documentation

"Bootloader::Tools::GetFittingSection($name, $image, $type,
\@sections);"

Fing fitting section for given name and image type. If not find return undef.

"Bootloader::Tools::AddSection($name, @params);"

Add a new section (boot entry) to config file, e.g. to /boot/grub/menu.lst

EXAMPLE:

  my $opt_name = "LabelOfSection";
  my @params = (type   => $type,
                image  => $opt_image,
                initrd => $opt_initrd,
  );
  Bootloader::Tools::AddSection ($opt_name, @params);

"Bootloader::Tools::RemoveImageSections ($image);"

removes all sections in the bootloader menu referring to the specified kernel.

EXAMPLE:

  Bootloader::Tools::InitLibrary ();
  Bootloader::Tools::RemoveImageSections ("/boot/vmlinuz−2.6.11");
  Bootloader::Tools::UpdateBootloader();

"Bootloader::Tools::RemoveSections($name);"
"Bootloader::Tools::AdjustSectionNameAppendix ($mode, $sect_ref_new,
$sect_ref_old);"

Adds and respectively removes a potential appendix of a section name.

In case of mode "add", it adjusts labels which only differ in their corresponding flavors in the following way, e.g.:

  SUSE Linux Enterprise Server 10 − 2.6.16.54−0.2.3 (default) and
  SUSE Linux Enterprise Server 10 − 2.6.16.54−0.2.3 (smp)

Thus, the corresponding flavors will be appended in brackets.

In case of mode "remove", an appended flavor will be removed from the section label if the corresponding section is the only one left referring to a kernel with it’s specific version.

EXAMPLE:

  my $mode = "add";
  my $sect_ref_new = \%new_section;
  Bootloader::Tools::AdjustSectionNameAppendix ($mode, $sect_ref_new);
  or
  my $mode = "remove"
  my $sect_ref_new = \@section_naems_after_removal;
  my $sect_ref_old = \@section_names_before_removal;
  Bootloader::Tools::AdjustSectionNameAppendix ($mode, $sect_ref_new, $sect_ref_old);

"Bootloader::Tools::AddPathToExecutable ($executable);"

Prepends the corresponding (absolute) path to the given executable and returns the result. If not found in path, function returns undef.

EXAMPLE:

  my $executable = "dmsetup";
  my $exec_with_path = Bootloader::Tools::AddPathToExecutable ($executable);
  if (−e $exec_with_path) {
      print ("The desired executable is located here: $exec_with_path");
  }






Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.