From 748c4c4e93128e0644d4a5900b691d966f16b98a Mon Sep 17 00:00:00 2001 From: Vince Date: Sat, 16 Oct 2021 23:46:24 +0800 Subject: [PATCH] Update install.sh --- install.sh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index a1caa3d..6f5c91e 100755 --- a/install.sh +++ b/install.sh @@ -123,15 +123,25 @@ install() { # Fedora workaround to fix the missing unicode.pf2 file (tested on fedora 34): https://bugzilla.redhat.com/show_bug.cgi?id=1739762 # This occurs when we add a theme on grub2 with Fedora. -# if has_command dnf; then -# if grep "GRUB_FONT=" /etc/default/grub 2>&1 >/dev/null; then -# #Replace GRUB_FONT -# sed -i "s|.*GRUB_FONT=.*|GRUB_FONT=/boot/efi/EFI/fedora/fonts/unicode.pf2|" /etc/default/grub -# else -# #Append GRUB_FONT -# echo "GRUB_FONT=/boot/efi/EFI/fedora/fonts/unicode.pf2" >> /etc/default/grub -# fi -# fi + if has_command dnf; then + if [[ -f "/boot/grub2/fonts/unicode.pf2" ]]; then + if grep "GRUB_FONT=" /etc/default/grub 2>&1 >/dev/null; then + #Replace GRUB_FONT + sed -i "s|.*GRUB_FONT=.*|GRUB_FONT=/boot/grub2/fonts/unicode.pf2|" /etc/default/grub + else + #Append GRUB_FONT + echo "GRUB_FONT=/boot/grub2/fonts/unicode.pf2" >> /etc/default/grub + fi + elif [[ -f "/boot/efi/EFI/fedora/fonts/unicode.pf2" ]]; then + if grep "GRUB_FONT=" /etc/default/grub 2>&1 >/dev/null; then + #Replace GRUB_FONT + sed -i "s|.*GRUB_FONT=.*|GRUB_FONT=/boot/efi/EFI/fedora/fonts/unicode.pf2|" /etc/default/grub + else + #Append GRUB_FONT + echo "GRUB_FONT=/boot/efi/EFI/fedora/fonts/unicode.pf2" >> /etc/default/grub + fi + fi + fi if grep "GRUB_THEME=" /etc/default/grub 2>&1 >/dev/null; then #Replace GRUB_THEME @@ -313,8 +323,7 @@ updating_grub() { if [[ -f /boot/efi/EFI/fedora/grub.cfg ]]; then prompt -i "Find config file on /boot/efi/EFI/fedora/grub.cfg ...\n" grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg - fi - if [[ -f /boot/grub2/grub.cfg ]]; then + elif [[ -f /boot/grub2/grub.cfg ]]; then prompt -i "Find config file on /boot/grub2/grub.cfg ...\n" grub2-mkconfig -o /boot/grub2/grub.cfg fi