summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2010-02-10 16:59:11 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2010-02-10 16:59:11 +0000
commitefa7674024d31b5a5350c6dc7daf9c865d2e600b (patch)
treed262feb2020ed3ff626ae10aa70afe1099aebe0d
parentbc789c71c4ef077dab7edf18a5110cb8d0aa55a6 (diff)
downloaddrakx-efa7674024d31b5a5350c6dc7daf9c865d2e600b.tar
drakx-efa7674024d31b5a5350c6dc7daf9c865d2e600b.tar.gz
drakx-efa7674024d31b5a5350c6dc7daf9c865d2e600b.tar.bz2
drakx-efa7674024d31b5a5350c6dc7daf9c865d2e600b.tar.xz
drakx-efa7674024d31b5a5350c6dc7daf9c865d2e600b.zip
rework detection of already crypted grub passwords
-rw-r--r--perl-install/bootloader.pm19
1 files changed, 9 insertions, 10 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 6c4ab9c89..d6078ec35 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -322,7 +322,7 @@ sub _parse_grub_menu_lst() {
sub is_already_crypted {
my ($password) = @_;
- $password =~ /^\$1\$/; # CHECKME: EMPIRIC
+ $password =~ /^--md5 (.*)/;
}
sub read_grub_menu_lst {
@@ -333,9 +333,6 @@ sub read_grub_menu_lst {
foreach my $keyword (grep { $_ ne 'entries' } keys %b) {
$b{$keyword} = $b{$keyword} eq '' ? 1 : grub2file($b{$keyword}, $grub2dev, $fstab, \%b);
}
- if ($b{password} =~ /^--md5 (.*)/) {
- $b{password} = $1;
- }
#- sanitize
foreach my $e (@{$b{entries}}) {
@@ -1703,14 +1700,16 @@ sub write_grub {
{
my @conf;
- push @conf, $format->(grep { defined $bootloader->{$_} } qw(timeout));
- push @conf, $format->(grep { $bootloader->{$_} } qw(color serial shade terminal viewport background foreground));
- if (my $pw = $bootloader->{password}) {
- $pw = crypt_grub_password($pw) if !is_already_crypted($pw);
- $bootloader->{'password --md5'} = $pw;
- push @conf, $format->('password --md5');
+ if ($bootloader->{password}) {
+ if (!is_already_crypted($bootloader->{password})) {
+ my $encrypted = crypt_grub_password($bootloader->{password});
+ $bootloader->{password} = "--md5 $encrypted";
+ }
}
+ push @conf, $format->(grep { defined $bootloader->{$_} } qw(timeout));
+ push @conf, $format->(grep { $bootloader->{$_} } qw(color password serial shade terminal viewport background foreground));
+
push @conf, map { $_ . ' ' . $file2grub->($bootloader->{$_}) } grep { $bootloader->{$_} } qw(gfxmenu);
eval {