#!/bin/sh
set -eu
# Installed in /etc/grub.d; grub-mkconfig emits these commands before 10_linux.
for font in /boot/grub/themes/tossos/*.pf2; do
    [ -f "$font" ] || continue
    # locate the filesystem through GRUB's own helper, including separate /boot
    . /usr/share/grub/grub-mkconfig_lib
    prepare_grub_to_access_device "$(grub-probe --target=device "$font")"
    relative_font="$(make_system_path_relative_to_its_root "$font")"
    printf 'loadfont "%s"\n' "$relative_font"
done
