From 3c89ba2b56f5fdaac3a5da007fcc31ccd1fdfcd2 Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 25 Oct 2022 03:43:46 -0400 Subject: [PATCH] Update create_lxc.sh --- ct/create_lxc.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ct/create_lxc.sh b/ct/create_lxc.sh index 48a7d513..f82768a5 100644 --- a/ct/create_lxc.sh +++ b/ct/create_lxc.sh @@ -5,6 +5,7 @@ RD=`echo "\033[01;31m"` GN=`echo "\033[1;92m"` CL=`echo "\033[m"` CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" BFR="\\r\\033[K" HOLD="-" set -o errexit @@ -33,6 +34,14 @@ function msg_ok() { local msg="$1" echo -e "${BFR} ${CM} ${GN}${msg}${CL}" } +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Validating Storage" +VALID=$(pvesm status -content rootdir | awk 'NR>1') +if [ -z "$VALID" ]; then msg_error "Unable to detect a valid storage location."; exit 1; fi; function select_storage() { local CLASS=$1 @@ -57,10 +66,7 @@ function select_storage() { MENU+=( "$TAG" "$ITEM" "OFF" ) done < <(pvesm status -content $CONTENT | awk 'NR>1') - if [ $((${#MENU[@]}/3)) -eq 0 ]; then - echo -e "'$CONTENT_LABEL' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." - elif [ $((${#MENU[@]}/3)) -eq 1 ]; then + if [ $((${#MENU[@]}/3)) -eq 1 ]; then printf ${MENU[0]} else local STORAGE