From fbe54fe257e9bcaf13458b404211797b6786e868 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 21 Jun 2016 18:25:19 +0200 Subject: grub2: simplify using user.cfg (mga#15930) --- perl-install/bootloader.pm | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'perl-install') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index f32d6292c..9a5085aa3 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -339,14 +339,7 @@ sub read_grub2() { } # Get password prior to run update-grub2: - my $pw_f = get_grub2_users(); - if (-e $pw_f) { - foreach (cat_($pw_f)) { - if (/password_pbkdf2 root (.*)/) { - $bootloader{password} = $1; - } - } - } + $bootloader{password} = { getVarsFromSh(get_grub2_users()) }->{GRUB2_PASSWORD}; $bootloader{method} = cat_($f) =~ /set theme=.*maggy/ ? 'grub2-graphic' : 'grub2'; \%bootloader; @@ -1856,11 +1849,7 @@ sub write_grub2 { if (!is_grub2_already_crypted($bootloader->{password})) { $bootloader->{password} = crypt_grub2_password($bootloader->{password}); } - - output_with_perm($pw_f, 0755, qq(cat <{password} -EOF)); + output_with_perm($pw_f, 0600, "GRUB2_PASSWORD=$bootloader->{password}"); } else { rm_rf($pw_f); } @@ -1898,7 +1887,7 @@ EOF)); } sub get_grub2_users() { - "$::prefix/etc/grub.d/01_drakx_users"; + "$::prefix/boot/grub2/user.cfg"; } sub get_grub2_install_sh() { -- cgit v1.2.1