From 4eeaa78c075093b7a8c78c79c71fb4431d10d79a Mon Sep 17 00:00:00 2001 From: HimDek Date: Mon, 28 Mar 2022 08:31:32 +0530 Subject: [PATCH] Improved GPT check logic --- scripts/startup.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/startup.sh b/scripts/startup.sh index ecb8f61..6e4715b 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -276,19 +276,24 @@ case $? in you select the right partition that donot contain any useful files. ------------------------------------------------------------------------ - " 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 "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[@]}" part=${options[$?]%|*} set_option INSTALL_IN "PART" - set_option DISK "" set_option PART ${part%|*} echo -e "\n${part%|*} selected as root partition. Is that OK?" @@ -365,7 +370,7 @@ case $? in *) set_option FORMATEFI "no" ;; 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 echo -en " ------------------------------------------------------------------------