Skip to content

Commit

Permalink
UEFI: bugfix generation EFI partition
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Jan 5, 2025
1 parent 5ccc94d commit 8974086
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/bsp/common/usr/bin/armbian-install
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ root_partition_device=/dev/$root_partition_device_name
# find targets: legacy SUNXI NAND, EMMC, SATA, NVMe, MTD block and/or MTD char driven flash
[[ -b /dev/nand ]] && nandcheck=$(ls -d -1 /dev/nand* | grep -w 'nand' | awk '{print $NF}');
emmccheck=$(ls -d -1 /dev/mmcblk* 2>/dev/null | grep -w 'mmcblk[0-9]' | grep -v "$root_partition_device");
diskcheck=$(lsblk -l | awk -F" " '/ disk / {print $1}' | grep -E '^sd|^nvme|^mmc' | grep -v "$root_partition_device_name" | grep -v boot)
diskcheck=$(lsblk -Al | awk -F" " '/ disk / {print $1}' | grep -E '^sd|^nvme|^mmc' | grep -v "$root_partition_device_name" | grep -v boot)
# Start mtdcheck with probable MTD block device partitions:
mtdcheck=$(grep 'mtdblock' /proc/partitions | awk '{print $NF}' | xargs)
# Append mtdcheck with probable MTD char devices filtered for partition name(s)
Expand Down Expand Up @@ -669,6 +669,8 @@ check_partitions()
CMD="lsblk -io KNAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep -v -w $root_partition_name $INCLUDE $EXCLUDE | grep -E '^sd|^nvme|^md|^mmc' | awk -F\" \" '/ part | raid..? / {print \$1}'"
AvailablePartitions=$(eval $CMD)

FREE_SPACE=$(sfdisk --list-free /dev/$diskcheck | grep G | tail -1 | awk '{print $4}' | sed "s/G//")

dialog --yes-label "Proceed" --no-label 'Skip' --title "$title" --backtitle "$backtitle" --yesno "\nIt is highly recommended to wipe all partitions on the destination disk\n \n/dev/$diskcheck\n\nand leave installer to make them!" 10 75

# wiping destination to make sure we don't run into issues
Expand All @@ -680,13 +682,16 @@ check_partitions()
if [[ "${ACKNOWLEDGEMENT}" == "Yes, I understand" ]]; then
dd if=/dev/zero of=/dev/${diskcheck} bs=1M count=10 >> $logfile 2>&1
partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
echo -e 'mktable gpt\nmkpart primary ext4 0% 100%\nquit' | sudo parted "/dev/${diskcheck}" >> $logfile 2>&1
sudo partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
sleep 2
# only make one ext4 partition if we don't have UEFI
if [[ "$DEVICE_TYPE" != uefi ]]; then
echo -e 'mktable gpt\nmkpart primary ext4 0% 100%\nquit' | sudo parted "/dev/${diskcheck}" >> $logfile 2>&1
sudo partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
sleep 2
fi
fi
fi

if [[ -z $AvailablePartitions ]]; then
if [[ -z $AvailablePartitions ]] || [[ "${FREE_SPACE%.*}" -gt 4 ]]; then
# Consider brand new devices or devices with a wiped partition table
if [[ -z $(blkid /dev/$diskcheck) ]]; then
# There is not yet any partition table on the disk device.
Expand Down Expand Up @@ -736,7 +741,7 @@ check_partitions()
} | fdisk /dev/$diskcheck &> /dev/null || true
fi
fi
CMD="lsblk -io KNAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep -v -w $root_partition_name $INCLUDE $EXCLUDE | grep -E '^sd|^nvme|^md|^mmc' | awk -F\" \" '/ part | raid..? / {print \$1}' | uniq | sed 's|^|/dev/|' | nl | xargs echo -n"
CMD="lsblk -io KNAME,FSTYPE,SIZE,TYPE,MOUNTPOINT,PARTTYPENAME | grep -v -w $root_partition_name $INCLUDE $EXCLUDE | grep Linux | grep -E '^sd|^nvme|^md|^mmc' | awk -F\" \" '/ part | raid..? / {print \$1}' | uniq | sed 's|^|/dev/|' | nl | xargs echo -n"
partprobe
AvailablePartitions=$(eval $CMD)
PartitionOptions=($AvailablePartitions)
Expand Down

0 comments on commit 8974086

Please sign in to comment.