Improved GPT check logic

This commit is contained in:
HimDek 2022-03-28 08:31:32 +05:30
parent 7c67172c49
commit 4eeaa78c07
1 changed files with 9 additions and 4 deletions

View File

@ -276,19 +276,24 @@ case $? in
you select the right partition that donot contain any useful files. you select the right partition that donot contain any useful files.
------------------------------------------------------------------------ ------------------------------------------------------------------------
" "
fdisk -l fdisk -l
echo -e "\nWhich disk do you want to select the partition from?"
options=($(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}'))
select_option $? 1 "${options[@]}"
disk=${options[$?]%|*}
set_option DISK ${disk%|*}
echo -e "\n" echo -e "\n"
echo "Select the Partition to Install on (This will be the root partition mounted on \"\\\"): " echo "Select the Partition to Install on (This will be the root partition mounted on \"\\\"): "
options=($(lsblk -n --output TYPE,KNAME,SIZE,MOUNTPOINT | awk '$1=="part"{print "/dev/"$2"|"$3"__________"$4}')) options=($(lsblk -n --output TYPE,KNAME,SIZE,MOUNTPOINT ${disk%|*} | awk '$1=="part"{print "/dev/"$2"|"$3"__________"$4}'))
select_option $? 1 "${options[@]}" select_option $? 1 "${options[@]}"
part=${options[$?]%|*} part=${options[$?]%|*}
set_option INSTALL_IN "PART" set_option INSTALL_IN "PART"
set_option DISK ""
set_option PART ${part%|*} set_option PART ${part%|*}
echo -e "\n${part%|*} selected as root partition. Is that OK?" echo -e "\n${part%|*} selected as root partition. Is that OK?"
@ -365,7 +370,7 @@ case $? in
*) set_option FORMATEFI "no" ;; *) set_option FORMATEFI "no" ;;
esac esac
elif [[ $(fdisk -l | grep -i 'Disklabel type') = "Disklabel type: gpt" ]]; then # Checking for GPT Disk Label on a Legacy BIOS (non UEFI) System elif [[ $(fdisk -l ${disk%|*} | grep -i 'Disklabel type') = "Disklabel type: gpt" ]]; then # Checking for GPT Disk Label on a Legacy BIOS (non UEFI) System
clear clear
echo -en " echo -en "
------------------------------------------------------------------------ ------------------------------------------------------------------------