rename *_PART to *_DEVICE

This commit is contained in:
Tobias Powalowski 2023-01-13 09:03:10 +01:00
parent df5509797d
commit 2b59b03626
2 changed files with 29 additions and 29 deletions

View file

@ -170,9 +170,9 @@ for _bootnum in \$(efibootmgr | grep '^Boot[0-9]' | grep -F -i "${_BOOTMGR_LABEL
efibootmgr --quiet --bootnum "\${_bootnum}" --delete-bootnum
done
if [[ "\${_BOOTMGR_LOADER_PARAMETERS}" != "" ]]; then
efibootmgr --quiet --create --disk "${_BOOTMGR_DEVICE}" --part "${_BOOTMGR_PART_NUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" --unicode "\${_BOOTMGR_LOADER_PARAMETERS}" -e "3"
efibootmgr --quiet --create --disk "${_BOOTMGR_DEVICE}" --part "${_BOOTMGR_DEVICE_NUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" --unicode "\${_BOOTMGR_LOADER_PARAMETERS}" -e "3"
else
efibootmgr --quiet --create --disk "${_BOOTMGR_DEVICE}" --part "${_BOOTMGR_PART_NUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" -e "3"
efibootmgr --quiet --create --disk "${_BOOTMGR_DEVICE}" --part "${_BOOTMGR_DEVICE_NUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" -e "3"
fi
EFIBEOF
chmod a+x "/tmp/efibootmgr_run.sh"
@ -191,9 +191,9 @@ _do_apple_efi_hfs_bless() {
_do_uefi_bootmgr_setup() {
_UEFISYSDEV="$(findmnt -vno SOURCE "${_DESTDIR}/${_UEFISYS_MP}")"
_DEVICE="$(${_LSBLK} KNAME "${_UEFISYSDEV}")"
_UEFISYS_PART_NUM="$(${_BLKID} -p -i -s PART_ENTRY_NUMBER -o value "${_UEFISYSDEV}")"
_UEFISYS_DEVICE_NUM="$(${_BLKID} -p -i -s PART_ENTRY_NUMBER -o value "${_UEFISYSDEV}")"
_BOOTMGR_DEVICE="${_DEVICE}"
_BOOTMGR_PART_NUM="${_UEFISYS_PART_NUM}"
_BOOTMGR_DEVICE_NUM="${_UEFISYS_DEVICE_NUM}"
if [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Inc.' ]] || [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Computer, Inc.' ]]; then
_do_apple_efi_hfs_bless
else
@ -317,7 +317,7 @@ _do_efistub_parameters() {
_UEFISYS_PATH="EFI/archlinux"
_BOOTDEV="$(findmnt -vno SOURCE "${_DESTDIR}/boot")"
_UEFISYSDEV="$(findmnt -vno SOURCE "${_DESTDIR}/${_UEFISYS_MP}")"
_UEFISYS_PART_FS_UUID="$(_getfsuuid "${_UEFISYSDEV}")"
_UEFISYS_DEVICE_FS_UUID="$(_getfsuuid "${_UEFISYSDEV}")"
if [[ "${_UEFISYS_MP}" == "/boot" ]]; then
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
_KERNEL="${_VMLINUZ_EFISTUB}"
@ -537,12 +537,12 @@ _do_grub_config() {
_ROOTDEV_FS_UUID="$(chroot "${_DESTDIR}" grub-probe --target="fs_uuid" "/" 2>/dev/null)"
_ROOTDEV_HINTS_STRING="$(chroot "${_DESTDIR}" grub-probe --target="hints_string" "/" 2>/dev/null)"
_ROOTDEV_FS="$(chroot "${_DESTDIR}" grub-probe --target="fs" "/" 2>/dev/null)"
_USR_PART_FS_UUID="$(chroot "${_DESTDIR}" grub-probe --target="fs_uuid" "/usr" 2>/dev/null)"
_USR_PART_HINTS_STRING="$(chroot "${_DESTDIR}" grub-probe --target="hints_string" "/usr" 2>/dev/null)"
_USR_PART_FS="$(chroot "${_DESTDIR}" grub-probe --target="fs" "/usr" 2>/dev/null)"
_USR_DEVICE_FS_UUID="$(chroot "${_DESTDIR}" grub-probe --target="fs_uuid" "/usr" 2>/dev/null)"
_USR_DEVICE_HINTS_STRING="$(chroot "${_DESTDIR}" grub-probe --target="hints_string" "/usr" 2>/dev/null)"
_USR_DEVICE_FS="$(chroot "${_DESTDIR}" grub-probe --target="fs" "/usr" 2>/dev/null)"
if [[ -n "${_GRUB_UEFI}" ]]; then
_UEFISYS_PART_FS_UUID="$(chroot "${_DESTDIR}" grub-probe --target="fs_uuid" "/${_UEFISYS_MP}" 2>/dev/null)"
_UEFISYS_PART_HINTS_STRING="$(chroot "${_DESTDIR}" grub-probe --target="hints_string" "/${_UEFISYS_MP}" 2>/dev/null)"
_UEFISYS_DEVICE_FS_UUID="$(chroot "${_DESTDIR}" grub-probe --target="fs_uuid" "/${_UEFISYS_MP}" 2>/dev/null)"
_UEFISYS_DEVICE_HINTS_STRING="$(chroot "${_DESTDIR}" grub-probe --target="hints_string" "/${_UEFISYS_MP}" 2>/dev/null)"
fi
if [[ "${_ROOTDEV_FS_UUID}" == "${_BOOTDEV_FS_UUID}" ]]; then
_SUBDIR="/boot"
@ -588,7 +588,7 @@ insmod part_msdos
insmod fat
insmod ${_BOOTDEV_FS}
insmod ${_ROOTDEV_FS}
insmod ${_USR_PART_FS}
insmod ${_USR_DEVICE_FS}
insmod search_fs_file
insmod search_fs_uuid
insmod search_label
@ -617,7 +617,7 @@ else
insmod video_cirrus
fi
insmod font
search --fs-uuid --no-floppy --set=usr_part ${_USR_PART_HINTS_STRING} ${_USR_PART_FS_UUID}
search --fs-uuid --no-floppy --set=usr_part ${_USR_DEVICE_HINTS_STRING} ${_USR_DEVICE_FS_UUID}
search --fs-uuid --no-floppy --set=root_part ${_ROOTDEV_HINTS_STRING} ${_ROOTDEV_FS_UUID}
if [ -e "\${prefix}/fonts/unicode.pf2" ]; then
set _fontfile="\${prefix}/fonts/unicode.pf2"
@ -682,7 +682,7 @@ EOF
if [ "\${grub_platform}" == "efi" ]; then
## UEFI Shell
#menuentry "UEFI Shell \${_UEFI_ARCH} v2" {
# search --fs-uuid --no-floppy --set=root ${_UEFISYS_PART_HINTS_STRING} ${_UEFISYS_PART_FS_UUID}
# search --fs-uuid --no-floppy --set=root ${_UEFISYS_DEVICE_HINTS_STRING} ${_UEFISYS_DEVICE_FS_UUID}
# chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_v2.efi
#}
fi
@ -697,7 +697,7 @@ if [ "\${grub_platform}" == "efi" ]; then
# insmod fat
# insmod search_fs_uuid
# insmod chain
# search --fs-uuid --no-floppy --set=root ${_UEFISYS_PART_HINTS_STRING} ${_UEFISYS_PART_FS_UUID}
# search --fs-uuid --no-floppy --set=root ${_UEFISYS_DEVICE_HINTS_STRING} ${_UEFISYS_DEVICE_FS_UUID}
# chainloader /EFI/Microsoft/Boot/bootmgfw.efi
#}
fi
@ -804,7 +804,7 @@ _do_grub_bios() {
_BOOTDEV=$(cat "${_ANSWER}")
if [[ "$(${_BLKID} -p -i -o value -s PTTYPE "${_BOOTDEV}")" == "gpt" ]]; then
_CHECK_BIOS_BOOT_GRUB=1
_CHECK_UEFISYS_PART=""
_CHECK_UEFISYS_DEVICE=""
_RUN_CFDISK=""
_DEVICE="${_BOOTDEV}"
_check_gpt

View file

@ -31,7 +31,7 @@ _check_gpt() {
fi
if [[ -n "${_GUID_DETECTED}" ]]; then
### This check is not enabled in any function yet!
if [[ -n "${_CHECK_UEFISYS_PART}" ]]; then
if [[ -n "${_CHECK_UEFISYS_DEVICE}" ]]; then
_check_efisys_part
fi
if [[ -n "${_CHECK_BIOS_BOOT_GRUB}" ]]; then
@ -71,32 +71,32 @@ _check_efisys_part() {
fi
if sgdisk -p "${_DISK}" | grep -q 'EF00'; then
# check on unique PARTTYPE c12a7328-f81f-11d2-ba4b-00a0c93ec93b for EFI System Partition type UUID
_UEFISYS_PART="$(${_LSBLK} NAME,PARTTYPE "${_DISK}" | grep 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b' | cut -d " " -f1)"
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_PART}")" != "vfat" ]]; then
_UEFISYS_DEVICE="$(${_LSBLK} NAME,PARTTYPE "${_DISK}" | grep 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b' | cut -d " " -f1)"
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_DEVICE}")" != "vfat" ]]; then
## Check whether EFISYS is FAT, otherwise inform the user and offer to format the partition as FAT32.
_dialog --defaultno --yesno "Detected EFI System partition ${_UEFISYS_PART} does not appear to be FAT formatted. UEFI Specification requires EFI System partition to be FAT32 formatted. Do you want to format ${_UEFISYS_PART} as FAT32?\nNote: Setup will proceed even if you select NO. Some systems like Apple Macs may work with Non-FAT EFI System partition. However the installed system is not in conformance with UEFI Spec., and MAY NOT boot properly." 0 0 && _FORMAT_UEFISYS_FAT32=1
_dialog --defaultno --yesno "Detected EFI System partition ${_UEFISYS_DEVICE} does not appear to be FAT formatted. UEFI Specification requires EFI System partition to be FAT32 formatted. Do you want to format ${_UEFISYS_DEVICE} as FAT32?\nNote: Setup will proceed even if you select NO. Some systems like Apple Macs may work with Non-FAT EFI System partition. However the installed system is not in conformance with UEFI Spec., and MAY NOT boot properly." 0 0 && _FORMAT_UEFISYS_FAT32=1
fi
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_PART}")" == "vfat" ]] && [[ "$(${_BLKID} -p -i -o value -s VERSION "${_UEFISYS_PART}")" != "FAT32" ]]; then
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_DEVICE}")" == "vfat" ]] && [[ "$(${_BLKID} -p -i -o value -s VERSION "${_UEFISYS_DEVICE}")" != "FAT32" ]]; then
## Check whether EFISYS is FAT32 (specifically), otherwise warn the user about compatibility issues with UEFI Spec.
_dialog --defaultno --yesno "Detected EFI System partition ${_UEFISYS_PART} does not appear to be FAT32 formatted. Do you want to format ${_UEFISYS_PART} as FAT32?\nNote: Setup will proceed even if you select NO. Most systems will boot fine even with FAT16 or FAT12 EFI System partition, however some firmwares may refuse to boot with a non-FAT32 EFI System partition. It is recommended to use FAT32 for maximum compatibility with UEFI Spec." 0 0 && _FORMAT_UEFISYS_FAT32=1
_dialog --defaultno --yesno "Detected EFI System partition ${_UEFISYS_DEVICE} does not appear to be FAT32 formatted. Do you want to format ${_UEFISYS_DEVICE} as FAT32?\nNote: Setup will proceed even if you select NO. Most systems will boot fine even with FAT16 or FAT12 EFI System partition, however some firmwares may refuse to boot with a non-FAT32 EFI System partition. It is recommended to use FAT32 for maximum compatibility with UEFI Spec." 0 0 && _FORMAT_UEFISYS_FAT32=1
fi
#autodetect efisys mountpoint, on fail ask for mountpoint
_UEFISYS_MP="/$(basename "$(mount | grep "${_UEFISYS_PART}" | cut -d " " -f 3)")"
_UEFISYS_MP="/$(basename "$(mount | grep "${_UEFISYS_DEVICE}" | cut -d " " -f 3)")"
if [[ "${_UEFISYS_MP}" == "/" ]]; then
_dialog --inputbox "Enter the mountpoint of your EFI System partition (Default is /boot): " 0 0 "/boot" 2>"${_ANSWER}" || return 1
_UEFISYS_MP="$(cat "${_ANSWER}")"
fi
umount "${_DESTDIR}/${_UEFISYS_MP}" &> /dev/null
umount "${_UEFISYS_PART}" &> /dev/null
umount "${_UEFISYS_DEVICE}" &> /dev/null
if [[ -n "${_FORMAT_UEFISYS_FAT32}" ]]; then
mkfs.vfat -F32 -n "EFISYS" "${_UEFISYS_PART}"
mkfs.vfat -F32 -n "EFISYS" "${_UEFISYS_DEVICE}"
fi
mkdir -p "${_DESTDIR}/${_UEFISYS_MP}"
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_PART}")" == "vfat" ]]; then
mount -o rw,flush -t vfat "${_UEFISYS_PART}" "${_DESTDIR}/${_UEFISYS_MP}"
if [[ "$(${_LSBLK} FSTYPE "${_UEFISYS_DEVICE}")" == "vfat" ]]; then
mount -o rw,flush -t vfat "${_UEFISYS_DEVICE}" "${_DESTDIR}/${_UEFISYS_MP}"
else
_dialog --msgbox "${_UEFISYS_PART} is not formatted using FAT filesystem. Setup will go ahead but there might be issues using non-FAT FS for EFI System partition." 0 0
mount -o rw "${_UEFISYS_PART}" "${_DESTDIR}/${_UEFISYS_MP}"
_dialog --msgbox "${_UEFISYS_DEVICE} is not formatted using FAT filesystem. Setup will go ahead but there might be issues using non-FAT FS for EFI System partition." 0 0
mount -o rw "${_UEFISYS_DEVICE}" "${_DESTDIR}/${_UEFISYS_MP}"
fi
mkdir -p "${_DESTDIR}/${_UEFISYS_MP}/EFI" || true
else
@ -136,7 +136,7 @@ _partition() {
if [[ -n "${_DISK}" ]]; then
if [[ -n "${_GUIDPARAMETER}" ]]; then
_CHECK_BIOS_BOOT_GRUB=""
_CHECK_UEFISYS_PART=""
_CHECK_UEFISYS_DEVICE=""
_RUN_CFDISK=1
_check_gpt
else