From af6f443708130bf4083cc964eb3c184772a8ced1 Mon Sep 17 00:00:00 2001 From: tteckster Date: Fri, 18 Feb 2022 08:26:00 -0500 Subject: [PATCH] Update haos_vm.sh --- vm/haos_vm.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/vm/haos_vm.sh b/vm/haos_vm.sh index a4c235f4..a95b2f49 100644 --- a/vm/haos_vm.sh +++ b/vm/haos_vm.sh @@ -15,7 +15,10 @@ set -o nounset set -o pipefail shopt -s expand_aliases alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' +BL=`echo "\033[36m"` +CM='\xE2\x9C\x94\033' +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` trap die ERR trap cleanup EXIT function error_exit() { @@ -79,10 +82,10 @@ else "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit done fi -info "Using '$STORAGE' for storage location." +info "Using ${BL}$STORAGE${CL} for Storage Location." VMID=$(pvesh get /cluster/nextid) -info "Container ID is $VMID." -echo -en "\e[1;92m Getting URL for Latest Home Assistant Disk Image... \e[0m" +info "Container ID is ${BL}$VMID${CL}." +echo -en "${GN} Getting URL for Latest Home Assistant Disk Image... " RELEASE_TYPE=qcow2 URL=$(cat</dev/null set +o errtrace ( -echo -e "${CHECKMARK} \r" - echo -en "\e[1;92m Adding Serial Port and Configuring Console... \e[0m" +echo -e "${CM} ${CL} \r" + echo -en "${GN} Adding Serial Port and Configuring Console... " trap ' warn "Unable to configure serial port. VM is still functional." if [ "$(qm config $VMID | sed -n ''/serial0/p'')" != "" ]; then @@ -152,12 +155,12 @@ echo -e "${CHECKMARK} \r" fi exit ' ERR - echo -e "${CHECKMARK} \r" + echo -e "${CM} ${CL} \r" if [ "$(command -v kpartx)" = "" ]; then - echo -en "\e[1;92m Installing kpartx... \e[0m" + echo -en "${GN} Installing kpartx... " apt-get update >/dev/null apt-get -qqy install kpartx &>/dev/null - echo -e "${CHECKMARK} \r" + echo -e "${CM} ${CL} \r" fi DISK1_PATH="$(pvesm path $DISK1_REF)" DISK1_PART1="$(kpartx -al $DISK1_PATH | awk 'NR==1 {print $1}')" @@ -174,4 +177,4 @@ echo -e "${CHECKMARK} \r" qm set $VMID -serial0 socket >/dev/null ) -info "Completed Successfully! New VM ID is \e[1m$VMID\e[0m." +info "${GN} Completed Successfully!${CL} HAOS VM ID is ${BL}${VMID}${CL}"