add progressbar on grub

This commit is contained in:
Tobias Powalowski 2023-08-06 11:29:41 +02:00
parent 8fc765963b
commit ca3fa0a540

View file

@ -857,15 +857,16 @@ _do_grub_bios() {
fi
}
_do_grub_uefi() {
_setup_grub_uefi() {
_do_uefi_common || return 1
[[ "${_UEFI_ARCH}" == "X64" ]] && _GRUB_ARCH="x86_64"
[[ "${_UEFI_ARCH}" == "IA32" ]] && _GRUB_ARCH="i386"
[[ "${_UEFI_ARCH}" == "AA64" ]] && _GRUB_ARCH="arm64"
_do_grub_common_before
_chroot_mount
_progress "25" "Setting up GRUB(2) UEFI..."
if [[ -n "${_UEFI_SECURE_BOOT}" ]]; then
_progress "10" "Setting up GRUB(2) UEFI..."
_progress "50" "Setting up GRUB(2) UEFI..."
# install fedora shim
[[ -d ${_DESTDIR}/${_UEFISYS_MP}/EFI/BOOT ]] || mkdir -p "${_DESTDIR}"/"${_UEFISYS_MP}"/EFI/BOOT
cp -f /usr/share/archboot/bootloader/shim"${_SPEC_UEFI_ARCH}".efi "${_DESTDIR}"/"${_UEFISYS_MP}"/EFI/BOOT/BOOT"${_UEFI_ARCH}".EFI
@ -888,15 +889,19 @@ _do_grub_uefi() {
fi
_chroot_umount
_GRUB_UEFI=1
_do_grub_config || return 1
_GRUB_UEFI=""
_progress "100" "Setting up GRUB(2) UEFI completed."
sleep 2
}
_setup_grub_uefi_sb() {
if [[ -n "${_UEFI_SECURE_BOOT}" ]]; then
_progress "50" "Setting up GRUB(2) UEFI..."
_progress "25" "Setting GRUB(2) UEFI Secure Boot..."
# generate GRUB with config embeded
#remove existing, else weird things are happening
[[ -f "${_DESTDIR}/${_GRUB_PREFIX_DIR}/grub${_SPEC_UEFI_ARCH}.efi" ]] && rm "${_DESTDIR}"/"${_GRUB_PREFIX_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407
# add -v for verbose
_progress "50" "Setting GRUB(2) UEFI Secure Boot..."
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
${_NSPAWN} grub-mkstandalone -d /usr/lib/grub/"${_GRUB_ARCH}"-efi -O "${_GRUB_ARCH}"-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd chain tpm" --fonts="ter-u16n" --locales="en@quot" --themes="" -o "${_GRUB_PREFIX_DIR}/grub${_SPEC_UEFI_ARCH}.efi" "boot/grub/grub.cfg=/${_GRUB_PREFIX_DIR}/${_GRUB_CFG}"
elif [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
@ -917,8 +922,16 @@ _do_grub_uefi() {
#sleep 5
${_NSPAWN} grub-mkstandalone -d /usr/lib/grub/"${_GRUB_ARCH}"-efi -O "${_GRUB_ARCH}"-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard" --fonts="ter-u16n" --locales="en@quot" --themes="" -o "${_GRUB_PREFIX_DIR}/grub${_SPEC_UEFI_ARCH}.efi" "boot/grub/grub.cfg=/${_GRUB_PREFIX_DIR}/${_GRUB_CFG}"
fi
_progress "100" "Setting up GRUB(2) UEFI Secure Boot completed."
sleep 2
fi
_progress "98" "Setting up GRUB(2) UEFI..."
}
_do_grub_uefi() {
_setup_grub_uefi | _dialog --title " Logging to ${_LOG} " --gauge "Setting up GRUB(2) UEFI..." 6 75 0
_do_grub_config || return 1
_GRUB_UEFI=""
_setup_grub_uefi_sb | _dialog --title " Logging to ${_LOG} " --gauge "Setting up GRUB(2) UEFI Secure Boot..." 6 75 0
if [[ -e "${_DESTDIR}/${_UEFISYS_MP}/EFI/grub/grub${_SPEC_UEFI_ARCH}.efi" && -z "${_UEFI_SECURE_BOOT}" && -e "${_DESTDIR}/boot/grub/${_GRUB_ARCH}-efi/core.efi" ]]; then
_BOOTMGR_LABEL="GRUB"
_BOOTMGR_LOADER_PATH="/EFI/grub/grub${_SPEC_UEFI_ARCH}.efi"
@ -958,7 +971,7 @@ _install_bootloader_uefi() {
# https://github.com/systemd/systemd/issues/27837
# https://sourceforge.net/p/gnu-efi/bugs/37/
if [[ -n "${_UEFI_SECURE_BOOT}" ]]; then
_do_grub_uefi | _dialog --title " Logging to ${_LOG} " --gauge "Setting up GRUB(2) UEFI. This needs some time..." 6 75 0
_do_grub_uefi
else
_dialog --title " ${_UEFI_ARCH} UEFI Bootloader " --menu "" 8 40 2 \
"${_EFISTUB_MENU_LABEL}" "${_EFISTUB_MENU_TEXT}" \
@ -967,7 +980,7 @@ _install_bootloader_uefi() {
"EFISTUB")
_do_efistub_uefi ;;
"GRUB_UEFI")
_do_grub_uefi | _dialog --title " Logging to ${_LOG} " --gauge "Setting up GRUB(2) UEFI. This needs some time..." 6 75 0 ;;
_do_grub_uefi ;;
esac
fi
}