V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 43s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-25 20:23:29 +02:00
parent 91640426b1
commit 0612406a3c
3 changed files with 70 additions and 6 deletions

View File

@@ -12,6 +12,13 @@
guard_sourcing
#######################################
# EFI System Partition | EF00 | UEFI Bootloader (ESP, FAT32)
# BIOS Boot Partition | EF02 | BIOS Bootloader area (GRUB)
# Linux SWAP | 8200 | Linux Swap
# Linux ext4/btrfs | 8300 | Linux Filesystem (root, home)
#######################################
#######################################
# Function that generates each partition on each device according to the chosen recipe string.
# Globals:
@@ -100,7 +107,7 @@ partitioning() {
var_pri=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev}.${var_part}.primary" "${VAR_SETUP_PART}")
var_mount_path=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev}.${var_part}.mount.path" "${VAR_SETUP_PART}")
### Generate partition.
### Assign the landing zone of each partition.
if [[ "${var_end}" == "-1" ]]; then
var_end_arg="100%"
else
@@ -108,16 +115,62 @@ partitioning() {
fi
if ! parted -s "/dev/${var_dev}" mkpart "${var_pri}" "${var_fs}" "${var_begin}" "${var_end_arg}"; then
do_log "fatal" "file_only" "Partition: '/dev/${var_dev}${var_part}' creation failed."
return "${ERR_PART_CREATE}"
fi
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' generated | begin: '${var_begin}' | end: '${var_end_arg}'."
### Assign the correct GPT typecode via sgdisk if table is GPT.
if [[ "${VAR_RECIPE_TABLE,,}" == "gpt" ]]; then
declare typecode="8300" # Default: Linux FS
case "${var_fs,,}" in
fat32)
typecode="EF00" ;; # EFI System Partition
swap)
typecode="8200" ;; # Linux SWAP
bios)
typecode="EF02" ;; # BIOS Boot Partition
ext4|btrfs)
typecode="8300" ;; # Linux native FS
*)
do_log "warn" "file_only" "Partition: '/dev/${var_dev}${var_part}' unknown FS type: '${var_fs}', using default GPT FS '8300'."
;;
esac
if sgdisk --typecode="${var_part}:${typecode}" "/dev/${var_dev}" &>/dev/null; then
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' GPT typecode '${typecode}' set for '${var_fs}'."
else
do_log "warn" "file_only" "Partition: '/dev/${var_dev}${var_part}' GPT typecode '${typecode}' failed to set."
fi
fi
### Set the bootable flag if necessary.
if [[ "${var_boot,,}" == "true" ]]; then
parted -s "/dev/${var_dev}" set "${var_part}" boot on
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' marked as bootable."
case "${VAR_RECIPE_TABLE,,}:${VAR_FIRMWARE_TYPE,,}" in
gpt:uefi|mbr:uefi)
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' | [${VAR_RECIPE_TABLE^^}:UEFI] no bootable flag required."
;;
gpt:bios|mbr:bios)
parted -s "/dev/${var_dev}" set "${var_part}" boot on
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' | [${VAR_RECIPE_TABLE^^}:BIOS] marked as bootable."
;;
esac
fi
### Store PARTUUID of the partition.