#!/bin/sh
# Fedora-name shim for grub-mkconfig.
#
# Even with "bootloader --disabled", Anaconda's CreateBLSEntriesTask still runs
# "grub2-mkconfig -o /etc/grub2.cfg" in the target for every live install
# (pyanaconda/modules/storage/bootloader/utils.py, create_bls_entries), and a
# non-zero exit aborts the whole install with an opaque D-Bus traceback during
# "Installing boot loader". FWS never reads /etc/grub2.cfg: the kickstart %post
# (fws-grub-finalize) writes /boot/grub/grub.cfg itself and logs its failures.
# So only that exact call is skipped; any other use still reaches grub-mkconfig.
if [ "$#" -eq 2 ] && [ "$1" = "-o" ] && [ "$2" = "/etc/grub2.cfg" ]; then
    echo "[FWS] grub2-mkconfig -o /etc/grub2.cfg skipped (GRUB is configured in %post)" >&2
    exit 0
fi
exec grub-mkconfig "$@"
