From 38ec740df84032e2564d9744c57db372024ab07a Mon Sep 17 00:00:00 2001 From: farhan Date: Sat, 5 Mar 2022 14:06:39 +0000 Subject: [PATCH] added ssd check in disk selection --- scripts/startup.sh | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/scripts/startup.sh b/scripts/startup.sh index baf0e75..bdaaaf0 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -208,23 +208,6 @@ echo -ne "Your key boards layout: ${keymap} \n" set_option KEYMAP $keymap } -drivessd () { -echo -ne " -Is this an ssd? yes/no: -" - -options=("Yes" "No") -select_option $? 1 "${options[@]}" - -case ${options[$?]} in - y|Y|yes|Yes|YES) - set_option MOUNT_OPTIONS "noatime,compress=zstd,ssd,commit=120";; - n|N|no|NO|No) - set_option MOUNT_OPTIONS "noatime,compress=zstd,commit=120";; - *) echo "Wrong option. Try again";drivessd;; -esac -} - # selection for disk type diskpart () { echo -ne " @@ -238,15 +221,19 @@ echo -ne " PS3=' Select the disk to install on: ' -options=($(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}')) +options=("$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}')") select_option $? 1 "${options[@]}" disk=${options[$?]%|*} echo -e "\n${disk%|*} selected \n" - set_option DISK ${disk%|*} + set_option DISK "${disk%|*}" +if [[ "$(lsblk -n --output TYPE,ROTA | awk '$1=="disk"{print $2}')" -eq "0" ]]; then + set_option "MOUNT_OPTION" "noatime,compress=zstd,ssd,commit=120" +else + set_option "MOUNT_OPTION" "noatime,compress=zstd,commit=120" +fi -drivessd } userinfo () { read -p "Please enter your username: " username