Refactor chooseDisk
function
This commit is contained in:
parent
19c475e58d
commit
bd9fa2933e
2 changed files with 3 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
|
|
||||||
source "../../Scripts/choose-disk.sh";
|
source "../../Scripts/choose-disk.sh";
|
||||||
chooseDisk archDisk "Which disk do you whish to format for installing Arch?";
|
archDisk="$(chooseDisk "Which disk do you whish to format for installing Arch?")";
|
||||||
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)}')";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
function chooseDisk() {
|
function chooseDisk() {
|
||||||
local -n result="$1";
|
local message="$1";
|
||||||
local message="$2";
|
|
||||||
local choice;
|
local choice;
|
||||||
local disk;
|
local disk;
|
||||||
local -a disks;
|
local -a disks;
|
||||||
|
@ -47,7 +46,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]});
|
||||||
result="/dev/${disk[0]}";
|
echo "/dev/${disk[0]}";
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
>&2 echo "The specified choice \"$choice\" is invalid!";
|
>&2 echo "The specified choice \"$choice\" is invalid!";
|
||||||
|
|
Loading…
Reference in a new issue