armbian-install: Display real devices in the selection message.

This commit is contained in:
The-going 2024-07-23 16:20:08 +03:00 committed by Igor
parent 95aa15ac53
commit 648bdea785

View File

@ -810,10 +810,14 @@ main()
IFS="'"
options=()
if [[ -n $emmccheck ]]; then
ichip='eMMC';
if [[ "${emmccheck#*mmcblk}" == "0" ]]; then
ichip='SD card'
else
ichip='eMMC'
fi
dest_boot=$emmccheck'p1'
dest_root=$emmccheck'p1'
else
elif [ -b /dev/nand1 ] && [ -b /dev/nand2 ]; then
ichip='legacy SUNXI NAND'
dest_boot='/dev/nand1'
dest_root='/dev/nand2'
@ -828,19 +832,30 @@ main()
else
[[ -n $sduuid && -n $diskcheck ]] && options+=(1 'Boot from SD - system on SATA, USB or NVMe')
[[ -n $emmccheck ]] && options+=(2 "Boot from $ichip - system on $ichip")
[[ -n $emmccheck && -n $diskcheck ]] && options+=(3 "Boot from $ichip - system on SATA, USB or NVMe")
[[ -n $mtdcheck ]] && options+=(4 'Boot from MTD Flash - system on SATA, USB or NVMe')
[[ -n ${root_partition_device} && ${DEVICE_TYPE} != "uefi" ]] && options+=(5 'Install/Update the bootloader on ${root_partition_device}')
[[ -n $sduuid && -n $diskcheck ]] && options+=(1 'Boot from SD - system on SATA, USB or NVMe')
[[ -n $emmccheck ]] && options+=(2 "Boot from $ichip - system on $ichip")
[[ -n $emmccheck && -n $diskcheck ]] && options+=(3 "Boot from $ichip - system on SATA, USB or NVMe")
[[ -n $mtdcheck ]] && options+=(4 'Boot from MTD Flash - system on SATA, USB or NVMe')
if [[ -n ${root_partition_device} && ${DEVICE_TYPE} != "uefi" ]]; then
if [ "${root_partition_device#*mmcblk}" == "0" ]; then
rootchip='SD card'
else
rootchip='eMMC'
fi
options+=(5 "Install/Update the bootloader on $rootchip (${root_partition_device})")
fi
BOOTPART=$(find /dev -name 'mmcblk*boot0' -and -type b)
if [ "${BOOTPART/boot0}" != "${root_partition_device}" ]; then
options+=(6 "Install/Update the bootloader on eMMC (${BOOTPART/boot0/})")
elif [ -b /dev/mmcblk0 ]; then
BOOTPART=/dev/mmcblk0
options+=(6 "Install/Update the bootloader on SD card (${BOOTPART/boot0/})")
fi
case $LINUXFAMILY in
odroidxu4 | mvebu* | mt7623 | spacemit)
BOOTPART=$(find /dev -name 'mmcblk*boot0' -and -type b)
[[ "$(echo $BOOTPART | wc -w)" == "1" ]] && \
options+=(6 "Install/Update the bootloader on eMMC ${BOOTPART/boot0/} partition")
;;
esac
[[ -n $mtdcheck && \
$(type -t write_uboot_platform_mtd) == function ]] && options+=(7 'Install/Update the bootloader on MTD Flash')
fi
@ -865,11 +880,11 @@ main()
2)
title="$ichip install"
command='Power off'
show_warning "This script will erase your $ichip. Continue?"
show_warning "This script will erase your $ichip ($emmccheck).\n Continue?"
if [[ -n $emmccheck ]]; then
umount_device "$emmccheck"
format_emmc "$emmccheck"
else
elif [ -b /dev/nand ]; then
umount_device '/dev/nand'
format_nand
fi
@ -879,11 +894,11 @@ main()
title="$ichip boot | USB/SATA/NVMe root install"
command='Power off'
check_partitions
show_warning "This script will erase your $ichip and $DISK_ROOT_PART. Continue?"
show_warning "This script will erase your ${ichip} ($emmccheck)\n and $DISK_ROOT_PART. Continue?"
if [[ -n $emmccheck ]]; then
umount_device "$emmccheck"
format_emmc "$emmccheck"
else
elif [ -b /dev/nand ]; then
umount_device '/dev/nand'
format_nand
fi
@ -912,14 +927,14 @@ main()
fi
;;
5)
show_warning 'This script will update the bootloader on ${root_partition_device}. Continue?'
show_warning 'This script will update the bootloader on ${root_partition_device}.\n\n Continue?'
write_uboot_platform "$DIR" "${root_partition_device}"
update_bootscript
dialog --backtitle "$backtitle" --title 'Writing bootloader' --msgbox '\n Done.' 7 30
return
;;
6)
show_warning "This script will update the bootloader on ${BOOTPART/boot0/}. Continue?"
show_warning "This script will update the bootloader on ${BOOTPART/boot0/}.\n\n Continue?"
write_uboot_platform "$DIR" ${BOOTPART/boot0/}
echo 'Done'
return