Revert broken chooseDisk function

This commit is contained in:
Manuel Thalmann 2023-04-01 13:40:52 +02:00
parent d7238d019f
commit bd89dc711f
2 changed files with 9 additions and 3 deletions

View file

@ -1,10 +1,15 @@
pushd "${BASH_SOURCE%/*}" > /dev/null; pushd "${BASH_SOURCE%/*}" > /dev/null;
source "../../Scripts/choose-disk.sh"; source "../../Scripts/choose-disk.sh";
ARCH_DISK="${ARCH_DISK:-$(chooseDisk "Which disk do you wish to format for installing Arch?")}"; ARCH_DISK="${ARCH_DISK}";
memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')"; memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')";
swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')"; swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')";
if [ -z "$ARCH_DISK" ]
then
chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?";
fi;
{ {
echo "g"; echo "g";

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
function chooseDisk() { function chooseDisk() {
local message="$1"; local -n result="$1";
local message="$2";
local choice; local choice;
local disk; local disk;
local -a disks; local -a disks;
@ -46,7 +47,7 @@ function chooseDisk() {
if [ "$choice" -ge 1 ] && [ "$choice" -le "$diskCount" ] if [ "$choice" -ge 1 ] && [ "$choice" -le "$diskCount" ]
then then
disk=(${disks[$choice]}); disk=(${disks[$choice]});
echo "/dev/${disk[0]}"; result="/dev/${disk[0]}";
return; return;
else else
>&2 echo "The specified choice \"$choice\" is invalid!"; >&2 echo "The specified choice \"$choice\" is invalid!";