3
0
Fork 0
forked from mirrors/nixpkgs

nixos/grub: Implements use of file format for splashImage.

GRUB 2.0 supports png, jpeg and tga. This will use the image's suffix to
load the right module.

As jpeg module is named jpeg, jpg is renamed jpeg.

If the user uses wrong image suffix for an image, it wouldn't work anyway.

This will leave up to two additional left-over files in /boot/ if user switches
through all the supported file formats. The module already left the png
image if the user disabled the splash image.
This commit is contained in:
Samuel Dionne-Riel 2018-05-13 19:51:50 -04:00
parent 8f3a541a3d
commit 0ccfe14e25

View file

@ -299,12 +299,16 @@ else {
copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n"; copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n";
} }
if ($splashImage) { if ($splashImage) {
# FIXME: GRUB 1.97 doesn't resize the background image if it # Keeps the image's extension.
# doesn't match the video resolution. my ($filename, $dirs, $suffix) = fileparse($splashImage, qr"\..[^.]*$");
copy $splashImage, "$bootPath/background.png" or die "cannot copy $splashImage to $bootPath\n"; # The module for jpg is jpeg.
if ($suffix eq ".jpg") {
$suffix = ".jpeg";
}
copy $splashImage, "$bootPath/background$suffix" or die "cannot copy $splashImage to $bootPath\n";
$conf .= " $conf .= "
insmod png insmod " . substr($suffix, 1) . "
if background_image " . $grubBoot->path . "/background.png; then if background_image " . $grubBoot->path . "/background$suffix; then
set color_normal=white/black set color_normal=white/black
set color_highlight=black/white set color_highlight=black/white
else else