IPB
>  Man Pages > Linux > openSUSE 10.2 > Section 3 > Bootloader::Tools man page

Bootloader::Tools man page

Section 3 - openSUSE 10.2 Man Pages

Other operating system man pages available here


Advanced Search

Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!


Bootloader::Tools(3)  User Contributed Perl Documentation Bootloader::Tools(3)



NAME
       Bootloader::Tools - set of high-level bootloader configuration func-
       tions

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);"

       "$dm_dev = Bootloader::Udev2DMDev($udevdevice);"

       "$udev_dev = Bootloader::Tools::DMDev2Udev($dmdev);"

       "$majmin = Bootloader::Tools::DMDev2MajMin($dmdev);"

       "$majmin = Bootloader::Tools::Udev2MajMin($udev);"

       "$udev_dev = Bootloader::Tools::MajMin2Udev($majmin);"

       "$dm_dev = Bootloader::Tools::MajMin2DMDev($majmin);"

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

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

       "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);"

       "$exec_with_path = Bootloader::Tools::AddPathToExecutable($exe-
       cutable);"

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::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: dmraid-<strange name>

         DMRaid Partitions look like: partX-dmraid-<strange name>

       "$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.
         =cut

         sub IsDMDevice {
             my $dev = shift;

             unless (-e $dmsetup) {
                 return 0;
             }

             my $cmd = "$dmsetup info -c --noheadings -oname $dev";
             if (my $test = qx{$cmd 2>/dev/null}){
                 chomp $test;

                 if ($dev =~ m/$test/){
                     return 1;
                 }
             }
             return 0;
         }

       "$dm_dev = Bootloader::Tools::Udev2DMDev($udevdevice);"
         takes a udev device (dm-X) returns the devicemapper device like
         dmsetup returns

       "$udev_dev = Bootloader::Tools::DMDev2Udev($dmdev);"
         takes a devicemapper device as reported from dmsetup returns a udev
         device (dm-X)

       "$majmin = Bootloader::Tools::DMDev2MajMin($dmdev);"
         takes a devicemapper device as reported from dmsetup returns a string
         containing major:minor

       "$majmin = Bootloader::Tools::Udev2MajMin($udev);" takes a udev device
       as reported from udevinfo returns a string containing major:minor
       "$udev_dev = Bootloader::Tools::MajMin2Udev($majmin);" takes a string
       major:minor as reported from udevinfo returns a string containing the
       udev device as reported by udevinfo
       "$dm_dev = Bootloader::Tools::DMDev2MajMin($majmin);" takes a string
       major:minor as reported from udevinfo returns a string containing the
       device as reported by dmsetup
       "$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.

       "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 =cut

         sub CountSections {
             return scalar GetSectionList(@_); }

       " 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{"kernel"}; =cut

         sub GetDefaultSection {
            #Get global Settings
            my $glob_ref = $lib_ref->GetGlobalSettings ();

            if (! defined ($glob_ref))
            {
               die ("GetDefaultSection(): Getting global data failed");
            }

            # This doesn't return the index of the default section, but the title of it.
            # All other keys have their real value (eg timeout has 8)
            my $def = $glob_ref->{"default"};

            # $section_ref is a reference to a list of hashes, where the section data is stored
            my $section_ref = $lib_ref->GetSections ();

            if (! defined ($section_ref))
            {
               die ("GetDefaultSection(): Getting sections failed");
            }

            # get the hash of the default section, identified by key 'name'
            my @default_sect = grep {$_->{"name"} eq $def} @{$section_ref};

            return $default_sect[0];
         }

       "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();" =cut
         sub GetGlobals() {
             return $lib_ref->GetGlobals(); }

       "Bootloader::Tools::SetGlobals(@params);"
         # FIXME: Add documentation =cut sub SetGlobals {
             my %option = @_;
             my $glob_ref = $lib_ref->GetGlobalSettings();

             # merge with current, undef values delete options
             foreach (keys %option) {
                 if (defined $option{$_}) {
                     $glob_ref->{$_} = $option{$_};
                 } else {
                     delete $glob_ref->{$_};
                 }
             }
             $glob_ref->{"__modified"} = 1;
             $lib_ref->SetGlobalSettings ($glob_ref);
             $lib_ref->WriteSettings (1);
             $lib_ref->UpdateBootloader (1); # avoid initialization but write config to
                                             # the right place
             DumpLog ();
         }

       "Bootloader::Tools::GetSectionList(@selectors);"
         # FIXME: Add documentation =cut

         sub GetSectionList {
             my %option = @_;
             my $loader = GetBootloader ();

         # FIXME: Maybe activate this part of code later if - against all
         expectations # - still needed, but this shouldn't happen.
             # Examines if image and initrd strings already contain a grub
         device
             # prefix. If it is not the case, attach it.  =cut
             if ($loader eq "grub") {      foreach my $key (sort keys %option)
         {          unless ($option{$key} =~ /^\(hd\d+,\d+\).*$/) {
                   # In case /boot is resided on an own partition, the func-
         tion           # UnixPath2GrubPath (in GRUB.pm) doesn't substitute
         "/boot"           # with the corresponding grub device, but keeps it.
                   #           # So the image, kernel and initrd values in the
         @sections           # array don't contain such a grub device prefix.
         Thus, to           # match sections to be deleted, a grub device pre-
         fix must not           # be attached to the given @option elements.
                   if ($lib_ref->UnixFile2GrubDev ("/boot") eq $lib_ref->Unix-
         File2GrubDev ("/")){               if ($key eq "image" ││ $key eq
         "initrd" ││ $key eq "kernel") {                my $grub_dev =
         $lib_ref->UnixFile2GrubDev ("/boot");                $option{$key} =
         $grub_dev . $option{$key};               }           }          }
              }
             } =cut

             normalize_options(\%option);
             my @sections = @{$lib_ref->GetSections ()};
             my @section_names = map {
                 match_section($_, \%option) ? $_->{"name"} : ();
             } @sections;

             DumpLog ();
             return @section_names;
         }

       "Bootloader::Tools::GetSection($name);"
         # FIXME: Add documentation =cut

         sub GetSection {
             my $name = shift or return undef;

             foreach (@{$lib_ref->GetSections ()}) {
                 return $_ if $_->{"name"} eq $name;
             }
             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 speci-
         fied kernel.

         EXAMPLE:

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

       "Bootloader::Tools::RemoveSection($name);"
       "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");
           }



perl v5.8.8                       2007-04-25              Bootloader::Tools(3)


Man(1) output converted with man2html and wrapped by fishsponge

This page was generated on Sat Sep 8 16:38:37 GMT 2007

Your favourite pages:

No pages logged yet.
Trying to save cookie...

Top 10 most popular pages:

svn man page (6161 hits)
(FreeBSD 6.2)

sqlite3 man page (5598 hits)
(openSUSE 10.2)

adv_cap_autoneg man page (5045 hits)
(Solaris 10 11_06)

CPAN man page (4791 hits)
(Suse Linux 10.1)

ssh man page (4439 hits)
(Suse Linux 10.1)

ssh-socks5-proxy-connect man page (3525 hits)
(Solaris 10 11_06)

signal man page (3394 hits)
(Suse Linux 10.1)

netcat man page (3373 hits)
(Suse Linux 10.1)

pprosetup man page (2886 hits)
(Solaris 10 11_06)

startproc man page (2738 hits)
(Suse Linux 10.1)

Useful Links

Go Back

Visitor Statistics


Valid XHTML 1.0 Transitional     Valid CSS!

Partners: Cambridge Plus :: Pyrenees Mountain Holidays :: Backlit Touch Sensitive Pad :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum