From 8a3799b0090269bfac3ba0b6720040075e7b0c19 Mon Sep 17 00:00:00 2001 From: mfgbhatti Date: Mon, 24 Jan 2022 20:23:23 +0000 Subject: [PATCH] changed and updated diskselection --- startup.sh | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/startup.sh b/startup.sh index ea02a2a..39ff290 100644 --- a/startup.sh +++ b/startup.sh @@ -193,24 +193,22 @@ drivessd () { esac } -# selection for disk type -diskpart () { -# show disks present on system -lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print NR,"/dev/"$2" - "$3}' # show disks with /dev/ prefix and size -echo -ne " ------------------------------------------------------------------------- - THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK - Please make sure you know what you are doing because - after formating your disk there is no way to get data back ------------------------------------------------------------------------- - -Please enter full path to disk: (example /dev/sda): -" -read -r option -echo "DISK=$option" >> setup.conf - -drivessd -set_option DISK "$option" +diskselection () { + # selection for disk type + # show disks present on system + DISKLIST="$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2" - "$3}')" # show disks with /dev/ prefix and size + PS3="$PROMPT" + select _DISK in "${DISKLIST[@]}"; do + if elements_present "$_DISK" "${DISKLIST[@]}"; then + # remove size from string + DISK=$(echo "$_DISK" | awk '{print $1}') + set_option DISK "$DISK" + break + else + invalid_option + break + fi + done } userinfo () {