Skip to content

Commit 4d7c5af

Browse files
committed
bin/fai-cd create_grub2_image(): Add grub background image + DejaVuSansMono font to FAI-CD.
Background image: /usr/share/images/desktop-base/desktop-grub.png - Can be changed via: `update-alternatives --config desktop-grub` Font file: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf Needs 'grub2-common', 'fonts-dejavu-core' and 'desktop-base' packages.
1 parent 3c34fc1 commit 4d7c5af

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

bin/fai-cd

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,32 @@ copy_kernel_initrd() {
208208
echo "$isoversion" > $tmp/FAI-CD
209209
}
210210
# - - - - - - - - - - - - - - - - - - - - - - - - - -
211+
copy_background_and_font() {
212+
# copy background image and fonts.
213+
214+
local _font="/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
215+
local _bgimg="/usr/share/images/desktop-base/desktop-grub.png"
216+
217+
if ! [ -s "${_font}" ]; then
218+
return
219+
fi
220+
221+
if ! [ -s "${_bgimg}" ]; then
222+
return
223+
fi
224+
225+
# Needs 'desktop-base' package.
226+
cp -p "${_bgimg}" $tmp/boot/grub/
227+
228+
# Needs 'grub2-common' and 'fonts-dejavu-core' packages.
229+
grub-mkfont -s 16 -o "$tmp/boot/grub/$(basename ${_font%.ttf}.pf2)" "${_font}"
230+
}
231+
# - - - - - - - - - - - - - - - - - - - - - - - - - -
211232
create_grub2_image_arm64() {
212233

213234
mkdir -p $tmp/boot/grub
235+
copy_background_and_font
236+
214237
if [ -d $NFSROOT/usr/lib/grub/arm64-efi ]; then
215238

216239
prepare_grub_cfg
@@ -235,6 +258,7 @@ create_grub2_image_arm64() {
235258
create_grub2_image_x86() {
236259

237260
mkdir -p $tmp/boot/grub
261+
copy_background_and_font
238262

239263
if [ -d $NFSROOT/usr/lib/grub/x86_64-efi ]; then
240264

@@ -262,7 +286,7 @@ create_grub2_image_x86() {
262286
--format=i386-pc \
263287
--output=/tmp/core.img \
264288
--locales="" --fonts="" \
265-
--install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm regexp" \
289+
--install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm regexp gfxterm_background png" \
266290
--modules="linux normal iso9660 biosdisk search" \
267291
"boot/grub/grub.cfg=/tmp/grub.cfg"
268292
cat $NFSROOT/usr/lib/grub/i386-pc/cdboot.img $NFSROOT/tmp/core.img > $scratch/bios.img

0 commit comments

Comments
 (0)