create XBOOTLDR partition with vfat by default

This commit is contained in:
Tobias Powalowski 2024-04-09 21:51:54 +02:00
parent 4b34293f03
commit 1f01c65879
3 changed files with 44 additions and 23 deletions

View file

@ -1,8 +1,10 @@
On the road to 2024.04:
Highlights:
- hwdetect 2024.04.08
- hwdetect 2024.04.09
setup:
- cleanup hwdetect code
- create XBOOTLDR partition with vfat by default
- allow systemd-auto-gpt setup without syncinc files to ESP
---
2024.03 Highlights:
- kernel 6.8.x

View file

@ -74,7 +74,13 @@ _enter_mountpoint() {
elif [[ -z "${_UEFISYSDEV_DONE}" ]]; then
_dialog --no-cancel --title " EFI SYSTEM PARTITION (ESP) " --menu "" 8 50 2 "/efi" "MULTIBOOT" "/boot" "SINGLEBOOT" 2>"${_ANSWER}" || return 1
_MP=$(cat "${_ANSWER}")
if [[ ${_MP} == "/efi" ]]; then
_XBOOTLDR=1
fi
_UEFISYSDEV_DONE=1
elif [[ -n "${_XBOOTLDR}" ]]; then
_MP=/boot
_XBOOTLDR=""
else
_MP=""
while [[ -z "${_MP}" ]]; do
@ -217,13 +223,15 @@ _mountpoints() {
while [[ -z "${_MP_DONE}" ]]; do
#shellcheck disable=SC2086
if [[ -z "${_SWAP_DONE}" ]]; then
_dialog --title " Swap Partition " --menu "" 14 45 8 NONE - ${_DEVS} 2>"${_ANSWER}" || return 1
_dialog --title " Swap Partition " --menu "" 14 55 8 NONE - ${_DEVS} 2>"${_ANSWER}" || return 1
elif [[ -z "${_ROOT_DONE}" ]]; then
_dialog --title " Root Partition " --no-cancel --menu "" 14 45 8 ${_DEVS} 2>"${_ANSWER}" || return 1
_dialog --title " Root Partition " --no-cancel --menu "" 14 55 8 ${_DEVS} 2>"${_ANSWER}" || return 1
elif [[ -z "${_UEFISYSDEV_DONE}" ]]; then
_dialog --title " EFI SYSTEM PARTITION (ESP) " --no-cancel --menu "" 14 45 8 ${_DEVS} 2>"${_ANSWER}" || return 1
_dialog --title " EFI SYSTEM PARTITION (ESP) " --no-cancel --menu "" 14 55 8 ${_DEVS} 2>"${_ANSWER}" || return 1
elif [[ -n "${_XBOOTLDR}" ]]; then
_dialog --title " Extended Boot Loader Partition (XBOOTLDR) " --no-cancel --menu "" 14 55 8 ${_DEVS} 2>"${_ANSWER}" || return 1
else
_dialog --title " Additional Partitions " --no-cancel --menu "" 14 45 8 ${_DEVS} DONE _ 2>"${_ANSWER}" || return 1
_dialog --title " Additional Partitions " --no-cancel --menu "" 14 55 8 ${_DEVS} DONE _ 2>"${_ANSWER}" || return 1
fi
_DEV=$(cat "${_ANSWER}")
if [[ "${_DEV}" != "DONE" ]]; then
@ -252,14 +260,25 @@ _mountpoints() {
# create vfat on ESP, if not already vfat format
if [[ ! "${_FSTYPE}" == "vfat" && -z "${_UEFISYSDEV_DONE}" && -n "${_ROOT_DONE}" ]]; then
_FSTYPE="vfat"
_LABEL_NAME="ESP"
_DOMKFS=1
fi
# don't format ESP, if already vfat format
if [[ "${_FSTYPE}" == "vfat" && -z "${_UEFISYSDEV_DONE}" && -n "${_ROOT_DONE}" ]]; then
_SKIP_FILESYSTEM="1"
fi
# create vfat on XBOOTLDR, if not already vfat format
if [[ ! "${_FSTYPE}" == "vfat" && -n "${_UEFISYSDEV_DONE}" && -n "${_XBOOTLDR}" ]]; then
_FSTYPE="vfat"
_LABEL_NAME="XBOOTLDR"
_DOMKFS=1
fi
# don't format XBOOTLDR, if already vfat format
if [[ "${_FSTYPE}" == "vfat" && -n "${_UEFISYSDEV_DONE}" && -n "${_XBOOTLDR}" ]]; then
_SKIP_FILESYSTEM="1"
fi
# allow reformat. if already vfat format
if [[ -n "${_UEFISYSDEV_DONE}" && -n "${_ROOT_DONE}" ]]; then
if [[ -n "${_UEFISYSDEV_DONE}" && -n "${_ROOT_DONE}" && -z "${_XBOOTLDR}" ]]; then
[[ "${_FSTYPE}" == "vfat" ]] && _FSTYPE=""
fi
else
@ -330,7 +349,7 @@ _mountpoints() {
# remove root btrfs on ESP selection menu, readd it on top aftwerwards
if [[ ! "${_FSTYPE}" == "btrfs" ]]; then
_DEVS="${_DEVS//$(${_LSBLK} NAME,SIZE -d "${_DEV}" 2>"${_NO_LOG}")/}"
if [[ -n "${_UEFISYSDEV_DONE}" && -n ${_ROOT_BTRFS} ]]; then
if [[ -n "${_UEFISYSDEV_DONE}" && -z "${_XBOOTLDR}" && -n ${_ROOT_BTRFS} ]]; then
_DEVS="${_ROOT_BTRFS} ${_DEVS}"
_ROOT_BTRFS=""
fi
@ -526,7 +545,7 @@ _mkfs() {
# https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html
# systemd supports detection on GPT disks:
# 07/08/2023:
# UKI, rEFInd and systemd don't support XBOOT automount!
# UKI, rEFInd and systemd don't support XBOOTLDR automount!
# GRUB does not support /boot and /efi automount!
### TODO: recheck if it works later, at the moment safety first and no experiments with /boot and /efi!
# disabled for now this check: "${_GUID_VALUE}" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" && "${5}" == "/efi"

View file

@ -14,15 +14,15 @@ _auto_partition() {
_progress "20" "Creating BIOS_GRUB partition..."
echo "size=+${_GPT_BIOS_GRUB_DEV_SIZE}M, type=21686148-6449-6E6F-744E-656564454649, name=BIOS_GRUB" | sfdisk -a "${_DISK}" &>"${_LOG}"
if [[ -n "${_UEFI_BOOT}" ]]; then
_progress "25" "Creating EFI SYSTEM partition..."
echo "size=+${_UEFISYSDEV_SIZE}M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, name=EFI_SYSTEM" | sfdisk -a "${_DISK}" &>"${_LOG}"
_progress "25" "Creating EFI System partition..."
echo "size=+${_UEFISYSDEV_SIZE}M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, name=ESP" | sfdisk -a "${_DISK}" &>"${_LOG}"
fi
if [[ -z "${_UEFISYS_BOOTDEV}" ]]; then
_progress "40" "Creating XBOOTLDR partition..."
echo "size=+${_BOOTDEV_SIZE}M, type=BC13C2FF-59E6-4262-A352-B275FD6F7172, name=ARCH_LINUX_XBOOT" | sfdisk -a "${_DISK}" &>"${_LOG}"
_progress "40" "Creating Extended Boot Loader partition..."
echo "size=+${_BOOTDEV_SIZE}M, type=BC13C2FF-59E6-4262-A352-B275FD6F7172, name=XBOOTLDR" | sfdisk -a "${_DISK}" &>"${_LOG}"
fi
if [[ -z "${_SKIP_SWAP}" ]]; then
_progress "55" "Creating SWAP partition..."
_progress "65" "Creating SWAP partition..."
echo "size=+${_SWAPDEV_SIZE}M, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, name=ARCH_LINUX_SWAP" | sfdisk -a "${_DISK}" &>"${_LOG}"
fi
_progress "70" "Creating ROOT partition..."
@ -173,7 +173,7 @@ _autoprepare() {
fi
if [[ -n "${_UEFISYS_BOOTDEV}" ]]; then
while [[ -z "${_UEFISYSDEV_SET}" ]]; do
_dialog --title " /boot In MiB" --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 260" 8 55 "512" 2>"${_ANSWER}" || return 1
_dialog --title " EFI SYSTEM PARTITION (ESP) in MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 260" 8 65 "512" 2>"${_ANSWER}" || return 1
_UEFISYSDEV_SIZE="$(cat "${_ANSWER}")"
if [[ -z "${_UEFISYSDEV_SIZE}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have entered a invalid size, please enter again." 3 60
@ -192,7 +192,7 @@ _autoprepare() {
done
else
while [[ -z "${_UEFISYSDEV_SET}" ]]; do
_dialog --title " EFI SYSTEM PARTITION (ESP) In MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 260" 8 55 "1024" 2>"${_ANSWER}" || return 1
_dialog --title " EFI SYSTEM PARTITION (ESP) in MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 260" 8 65 "1024" 2>"${_ANSWER}" || return 1
_UEFISYSDEV_SIZE="$(cat "${_ANSWER}")"
if [[ -z "${_UEFISYSDEV_SIZE}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have entered a invalid size, please enter again." 3 60
@ -211,7 +211,7 @@ _autoprepare() {
fi
_DISK_SIZE="$((_DISK_SIZE-_UEFISYSDEV_SIZE))"
while [[ -z "${_BOOTDEV_SET}" ]]; do
_dialog --title " /boot In MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 100" 8 55 "512" 2>"${_ANSWER}" || return 1
_dialog --title " Extended Boot Loader Partition (XBOOTLDR) in MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 100" 8 65 "512" 2>"${_ANSWER}" || return 1
_BOOTDEV_SIZE="$(cat "${_ANSWER}")"
if [[ -z "${_BOOTDEV_SIZE}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have entered a invalid size, please enter again." 3 60
@ -229,7 +229,7 @@ _autoprepare() {
done
else
while [[ -z "${_BOOTDEV_SET}" ]]; do
_dialog --title " /boot In MiB "--no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 100" 8 55 "512" 2>"${_ANSWER}" || return 1
_dialog --title " /boot in MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Minimum value is 100" 8 65 "512" 2>"${_ANSWER}" || return 1
_BOOTDEV_SIZE="$(cat "${_ANSWER}")"
if [[ -z "${_BOOTDEV_SIZE}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have entered a invalid size, please enter again." 3 60
@ -250,7 +250,7 @@ _autoprepare() {
_SWAP_SIZE="256"
[[ "${_DISK_SIZE}" -lt "256" ]] && _SWAP_SIZE="${_DISK_SIZE}"
while [[ -z "${_SWAPDEV_SET}" ]]; do
_dialog --title " Swap In MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Value 0 skips Swap" 8 55 "${_SWAP_SIZE}" 2>"${_ANSWER}" || return 1
_dialog --title " Swap in MiB " --no-cancel --inputbox "Disk space left: ${_DISK_SIZE}M | Value 0 skips Swap" 8 65 "${_SWAP_SIZE}" 2>"${_ANSWER}" || return 1
_SWAPDEV_SIZE=$(cat "${_ANSWER}")
if [[ -z "${_SWAPDEV_SIZE}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have entered an invalid size, please enter again." 3 60
@ -273,7 +273,7 @@ _autoprepare() {
#shellcheck disable=SC2086
_dialog --title " Filesystem / and /home " --no-cancel --menu "" 10 45 8 ${_FSOPTS} 2>"${_ANSWER}" || return 1
_FSTYPE=$(cat "${_ANSWER}")
_dialog --title " Confirmation " --yesno " Filesystem ${_FSTYPE} will be used for / and /home?" 5 55 && _CHOSENFS=1
_dialog --title " Confirmation " --yesno " Filesystem ${_FSTYPE} will be used for / and /home?" 5 65 && _CHOSENFS=1
done
_DISK_SIZE="$((_DISK_SIZE-_SWAPDEV_SIZE))"
_ROOT_SIZE="7500"
@ -287,7 +287,7 @@ _autoprepare() {
_dialog --title " / in MiB " --inputbox "Disk space left: $((_DISK_SIZE-350))M | Minimum value is 2000\nValue 0 skips /home and uses the left ${_DISK_SIZE}M for /" 9 60 "${_ROOT_SIZE}" 2>"${_ANSWER}" || return 1
_ROOTDEV_SIZE=$(cat "${_ANSWER}")
if [[ "${_ROOTDEV_SIZE}" == 0 ]]; then
if _dialog --title " Confirmation " --yesno "${_DISK_SIZE}M will be used for your / completely?" 5 55; then
if _dialog --title " Confirmation " --yesno "${_DISK_SIZE}M will be used for your / completely?" 5 65; then
_ROOTDEV_SET=1
_SKIP_HOME=1
fi
@ -300,7 +300,7 @@ _autoprepare() {
_dialog --title " ERROR " --no-mouse --infobox "You have entered a too large size, please enter again." 3 60
sleep 5
else
if _dialog --title " Confirmation " --yesno "$((_DISK_SIZE-_ROOTDEV_SIZE))M will be used for your /home completely?" 5 55; then
if _dialog --title " Confirmation " --yesno "$((_DISK_SIZE-_ROOTDEV_SIZE))M will be used for your /home completely?" 5 65; then
_ROOTDEV_SET=1
_HOMEDEV_NUM="$((_DEV_NUM+1))"
_DEV_NUM="${_HOMEDEV_NUM}"
@ -324,9 +324,9 @@ _autoprepare() {
## <partnum>|<fstype>|<mountpoint>|<labelname>
## The partitions in FSSPECS list should be listed in the "mountpoint" order.
## Make sure the "root" partition is defined first in the FSSPECS list
[[ -z "${_SKIP_SWAP}" ]] && _FSSPEC_SWAPDEV="${_SWAPDEV_NUM}|swap|swap|ARCH_SWAP"
[[ -z "${_SKIP_SWAP}" ]] && _FSSPEC_SWAPDEV="${_SWAPDEV_NUM}|swap|swap|SWAP"
_FSSPEC_ROOTDEV="${_ROOTDEV_NUM}|${_FSTYPE}|/|ARCH_ROOT"
_FSSPEC_BOOTDEV="${_BOOTDEV_NUM}|vfat|/boot|ARCH_BOOT"
_FSSPEC_BOOTDEV="${_BOOTDEV_NUM}|vfat|/boot|XBOOTLDR"
[[ -z "${_SKIP_HOME}" ]] &&_FSSPEC_HOMEDEV="${_HOMEDEV_NUM}|${_FSTYPE}|/home|ARCH_HOME"
_FSSPEC_UEFISYSDEV="${_UEFISYSDEV_NUM}|vfat|${_UEFISYS_MP}|ESP"
if [[ -n "${_GUIDPARAMETER}" && -n "${_UEFI_BOOT}" ]]; then