Moved to associative array
This commit is contained in:
parent
a5f7ffe5e3
commit
83452dea57
@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#!/bin/bash
|
|
||||||
|
### GLOBALS ###
|
||||||
|
declare -A DISKS
|
||||||
|
|
||||||
|
### GLOBALS ###
|
||||||
|
|
||||||
echo_rgb() {
|
echo_rgb() {
|
||||||
# Echo a colored string to the terminal based on rgb values
|
# Echo a colored string to the terminal based on rgb values
|
||||||
@ -124,13 +128,18 @@ get_available_disks() {
|
|||||||
|
|
||||||
done <<< "$(lsblk)"
|
done <<< "$(lsblk)"
|
||||||
|
|
||||||
local ret_val
|
|
||||||
# Build the array into a string, yes this is less efficient, but easier to modify in the future if something changes
|
# Build the array into a string, yes this is less efficient, but easier to modify in the future if something changes
|
||||||
|
local disk_num
|
||||||
|
disk_num=0
|
||||||
for disk in "${available_disks[@]}"; do
|
for disk in "${available_disks[@]}"; do
|
||||||
|
DISKS["${disk_num}"]+="${disk}"
|
||||||
ret_val="${ret_val} ${disk}"
|
ret_val="${ret_val} ${disk}"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "${ret_val}"
|
}
|
||||||
|
|
||||||
|
choose_disk() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
@ -141,8 +150,8 @@ install() {
|
|||||||
available_disks="$(get_available_disks)"
|
available_disks="$(get_available_disks)"
|
||||||
|
|
||||||
log "info" "Available disks: "
|
log "info" "Available disks: "
|
||||||
for disk in ${available_disks}; do
|
for disk in "${!DISKS[@]}"; do
|
||||||
echo " - $(important "${disk}")"
|
echo " - $(important "${DISKS[disk]}")"
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user