fix: use proper disk iteration

This commit is contained in:
Price Hiller 2022-07-29 22:43:49 -05:00
parent ab01803bc5
commit e4990c5035

View File

@ -159,7 +159,7 @@ list_disks() {
count=0 count=0
log "info" "Available disks" log "info" "Available disks"
for disk in ${disks}; do for disk in ${disks}; do
printf "%s\n" "${count}.)" "${disk}" printf "%s %s\n" "${count}.)" "${disk}"
count=$((count + 1)) count=$((count + 1))
done done
} }
@ -194,12 +194,12 @@ install() {
list_disks "${available_disks}" list_disks "${available_disks}"
read -rp "Select a disk number to install arch linux to: " disk_selected read -rp "Select a disk number to install arch linux to: " disk_selected
if "${disk_selected}" -eq "${disk_selected}" 2>/dev/null; then case $disk_selected in
: '' | *[!0-9]*)
else
log "error" "A number was not passed" log "error" "A number was not passed"
continue continue
fi ;;
esac
if [[ "${disk_selected}" -gt "${disk_count}" ]]; then if [[ "${disk_selected}" -gt "${disk_count}" ]]; then
log "error" "Invalid disk number passed, received ${disk_selected}, but the maximum disk number is ${disk_count}" log "error" "Invalid disk number passed, received ${disk_selected}, but the maximum disk number is ${disk_count}"