Skip to content

Commit

Permalink
Merge pull request #41486 from grahamc/support-null-font
Browse files Browse the repository at this point in the history
grub: Support when boot.loader.grub.font is null
  • Loading branch information
grahamc committed Jun 5, 2018
2 parents bd00584 + ab889c1 commit 5467f0e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
5 changes: 3 additions & 2 deletions nixos/modules/system/boot/loader/grub/grub.nix
Expand Up @@ -64,9 +64,10 @@ let
)) + ":" + (makeSearchPathOutput "bin" "sbin" [
pkgs.mdadm pkgs.utillinux
]);
font = if lib.last (lib.splitString "." cfg.font) == "pf2"
font = if cfg.font == null then ""
else (if lib.last (lib.splitString "." cfg.font) == "pf2"
then cfg.font
else "${convertedFont}";
else "${convertedFont}");
});

bootDeviceCounters = fold (device: attr: attr // { "${device}" = (attr."${device}" or 0) + 1; }) {}
Expand Down
26 changes: 14 additions & 12 deletions nixos/modules/system/boot/loader/grub/install-grub.pl
Expand Up @@ -281,22 +281,24 @@ sub GrubFs {
else
insmod vbe
fi
insmod font
if loadfont " . $grubBoot->path . "/converted-font.pf2; then
insmod gfxterm
if [ \"\${grub_platform}\" = \"efi\" ]; then
set gfxmode=$gfxmodeEfi
set gfxpayload=keep
else
set gfxmode=$gfxmodeBios
set gfxpayload=text
fi
terminal_output gfxterm
fi
";

if ($font) {
copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n";
$conf .= "
insmod font
if loadfont " . $grubBoot->path . "/converted-font.pf2; then
insmod gfxterm
if [ \"\${grub_platform}\" = \"efi\" ]; then
set gfxmode=$gfxmodeEfi
set gfxpayload=keep
else
set gfxmode=$gfxmodeBios
set gfxpayload=text
fi
terminal_output gfxterm
fi
";
}
if ($splashImage) {
# Keeps the image's extension.
Expand Down

0 comments on commit 5467f0e

Please sign in to comment.