Update haos-vm-v4.sh

Validate Storage
This commit is contained in:
tteckster 2022-08-11 13:43:47 -04:00 committed by GitHub
parent 35c8333768
commit 1cdc6b9687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -194,6 +194,7 @@ else
fi fi
} }
start_script start_script
msg_info "Validating Storage"
while read -r line; do while read -r line; do
TAG=$(echo $line | awk '{print $1}') TAG=$(echo $line | awk '{print $1}')
TYPE=$(echo $line | awk '{printf "%-10s", $2}') TYPE=$(echo $line | awk '{printf "%-10s", $2}')
@ -203,11 +204,13 @@ while read -r line; do
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
fi fi
STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" )
done < <(pvesm status -content images | awk 'NR>1') done < <(pvesm status -content images | awk 'NR>1')
if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then VALID=$(pvesm status -content images | awk 'NR>1')
echo -e "'Disk image' needs to be selected for at least one storage location." if [ -z "$VALID" ]; then
die "Unable to detect valid storage location." echo -e "${RD}⚠ Unable to detect a valid storage location.${CL}"
echo -e "Exiting..."
exit
elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then
STORAGE=${STORAGE_MENU[0]} STORAGE=${STORAGE_MENU[0]}
else else