diff options
author | Thierry.Vignaud <thierry.vignaud@gmail.com> | 2014-05-26 10:56:06 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-05-26 22:02:05 +0200 |
commit | 834fb155e4e931f49cf5a016e23625cc2e9836fa (patch) | |
tree | f3bc6bed72d910302573b1aacd3717b759279dcc /perl-install | |
parent | 5968436be73bc9d69f275be546b4ed289150dbc3 (diff) | |
download | drakx-834fb155e4e931f49cf5a016e23625cc2e9836fa.tar drakx-834fb155e4e931f49cf5a016e23625cc2e9836fa.tar.gz drakx-834fb155e4e931f49cf5a016e23625cc2e9836fa.tar.bz2 drakx-834fb155e4e931f49cf5a016e23625cc2e9836fa.tar.xz drakx-834fb155e4e931f49cf5a016e23625cc2e9836fa.zip |
podify++ bootloader
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/bootloader.pm | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 200d8fd33..ce39ac12d 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -23,6 +23,16 @@ use modules; B<bootloader> enables to configure various boot loaders (LILO, GRUB Legacy, GRUB2, ...) +Example of usage: + + $all_hds = fsedit::get_hds(); + fs::get_raw_hds('', $all_hds); + fs::get_info_from_fstab($all_hds); + $fstab = [ fs::get::fstab($all_hds) ]; + $bootloader = bootloader::read($all_hds); + (...) + bootloader::action($bootloader, 'write', $all_hds); + =head1 Functions =over @@ -113,6 +123,12 @@ sub get_label { undef; } +=item mkinitrd($kernel_version, $bootloader, $entry, $initrd) + +Regenerates kernel's initrd. + +=cut + sub mkinitrd { my ($kernel_version, $bootloader, $entry, $initrd) = @_; @@ -150,6 +166,13 @@ sub mkinitrd { -e "$::prefix/$initrd" && $initrd; } +=item rebuild_initrd($kernel_version, $bootloader, $entry, $initrd) + +Saves the old initrd then regenerate it. +If it fails, restore the old initrd. + +=cut + sub rebuild_initrd { my ($kernel_version, $bootloader, $entry, $initrd) = @_; @@ -194,6 +217,12 @@ sub update_splash { } } +=item read($all_hds) + +Reads bootloader config by calling the proper read_XYZ function. + +=cut + sub read { my ($all_hds) = @_; my $fstab = [ fs::get::fstab($all_hds) ]; @@ -240,6 +269,12 @@ sub read { } } +=item read_grub2 ($o_fstab) + +Read back GRUB2 config + C</boot/grub2/drakboot.conf> + +=cut + sub read_grub2 { my %bootloader = getVarsFromSh("$::prefix/boot/grub2/drakboot.conf"); my %h = getVarsFromSh("$::prefix/etc/default/grub"); @@ -268,6 +303,12 @@ sub read_grub2 { \%bootloader; } +=item read_grub($fstab) + +Reads back Grub Legacy config. + +=cut + sub read_grub { my ($fstab) = @_; @@ -326,6 +367,12 @@ sub _may_fix_grub2dev { $grub2dev->{$hd_grub} = $real_boot_dev; } +=item read_grub_install_sh() { + +Reads "config" from /boot/grub/install.sh (mainly used partitions) + +=cut + sub read_grub_install_sh() { my $s = cat_("$::prefix/boot/grub/install.sh"); my %h; @@ -391,11 +438,24 @@ sub _parse_grub_menu_lst() { %b; } + +=item is_already_crypted($password) + +Returns whether grub password is already crypted or not + +=cut + sub is_already_crypted { my ($password) = @_; $password =~ /^--md5 (.*)/; } +=item read_grub_menu_lst($fstab, $grub2dev) + +Read config from /boot/grub/menu.lst + +=cut + sub read_grub_menu_lst { my ($fstab, $grub2dev) = @_; @@ -834,6 +894,12 @@ sub add_kernel { add_entry($bootloader, $v); } +=item rebuild_initrds($bootloader) + +Rebuilds all initrds + +=cut + sub rebuild_initrds { my ($bootloader) = @_; @@ -2123,6 +2189,16 @@ sub when_config_changed_grub { update_copy_in_boot($_) foreach glob($::prefix . boot_copies_dir() . '/*.link'); } +=item action($bootloader, $action, @para) + +Calls the C<$action> function with @para parameters: + + $actions->($bootloader, @para) + +If needed, the function name will be resolved to call a boot loader specific function (eg: for LILO/GRUB/...) + +=cut + sub action { my ($bootloader, $action, @para) = @_; @@ -2131,6 +2207,12 @@ sub action { $f->($bootloader, @para); } +=item install($bootloader, $all_hds) + +Writes back the boot loader config. Calls the proper write_XYZ() function. + +=cut + sub install { my ($bootloader, $all_hds) = @_; @@ -2194,6 +2276,12 @@ sub parse_grub2_config { } } +=item find_other_distros_grub_conf($fstab) + +Returns a list of other distros' grub.conf + +=cut + sub find_other_distros_grub_conf { my ($fstab) = @_; |