Move scripts for nix
to a different location
This commit is contained in:
parent
d0b055140e
commit
985a408900
3 changed files with 3 additions and 3 deletions
scripts/Common/Scripts
|
@ -1,59 +0,0 @@
|
|||
#!/bin/bash
|
||||
function chooseDisk() {
|
||||
local -n result="$1";
|
||||
local message="$2";
|
||||
local choice;
|
||||
local disk;
|
||||
local -a disks;
|
||||
local i;
|
||||
disks=();
|
||||
|
||||
while read disk
|
||||
do
|
||||
local -a diskInfo;
|
||||
diskInfo=($disk);
|
||||
|
||||
if [ "${diskInfo[2]}" == "TYPE" ] || [ "${diskInfo[2]}" == "disk" ]
|
||||
then
|
||||
disks+=("$disk");
|
||||
fi;
|
||||
done < <(lsblk -do NAME,SIZE,TYPE);
|
||||
|
||||
diskCount="$(expr "${#disks[@]}" - 1)";
|
||||
padding="${#diskCount}";
|
||||
|
||||
if [ "$diskCount" -gt 0 ]
|
||||
then
|
||||
while true
|
||||
do
|
||||
echo "$message";
|
||||
|
||||
for i in $(seq 0 "$(expr "$diskCount")")
|
||||
do
|
||||
local index;
|
||||
if [ "$i" -eq 0 ]
|
||||
then
|
||||
index="";
|
||||
else
|
||||
index="$i:";
|
||||
fi;
|
||||
|
||||
printf "%$(expr "${diskCount}" + 1)s ${disks[$i]}" "$index";
|
||||
echo "";
|
||||
done;
|
||||
|
||||
read -p "Your choice: " choice;
|
||||
|
||||
if [ "$choice" -ge 1 ] && [ "$choice" -le "$diskCount" ]
|
||||
then
|
||||
disk=(${disks[$choice]});
|
||||
result="/dev/${disk[0]}";
|
||||
return;
|
||||
else
|
||||
>&2 echo "The specified choice \"$choice\" is invalid!";
|
||||
fi;
|
||||
done;
|
||||
else
|
||||
>&2 echo "No valid disk found!";
|
||||
fi;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
function isTruthy() {
|
||||
local value;
|
||||
value="$1";
|
||||
|
||||
[ ! -z "$value" ] &&
|
||||
[ "$value" != "0" ] &&
|
||||
[ "$value" != "false" ] &&
|
||||
[ "$value" != "n" ] &&
|
||||
[ "$value" != "no" ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue