Update haos-vm.sh

This commit is contained in:
tteckster 2022-04-16 12:43:35 -04:00 committed by GitHub
parent d49ad57a3c
commit cb0cad67ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 15 deletions

View File

@ -47,8 +47,6 @@ set -o nounset
set -o pipefail set -o pipefail
shopt -s expand_aliases shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit' alias die='EXIT=$? LINE=$LINENO error_exit'
CM='\xE2\x9C\x94\033'
GN=`echo "\033[1;92m"`
trap die ERR trap die ERR
trap cleanup EXIT trap cleanup EXIT
function error_exit() { function error_exit() {
@ -112,7 +110,7 @@ else
"${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit
done done
fi fi
msg_ok "Using ${BL}$STORAGE${CL} for Storage Location." msg_ok "Using ${BL}$STORAGE${CL} ${GN}for Storage Location."
VMID=$(pvesh get /cluster/nextid) VMID=$(pvesh get /cluster/nextid)
msg_ok "Container ID is ${BL}$VMID${CL}." msg_ok "Container ID is ${BL}$VMID${CL}."
msg_info "Getting URL for Latest Home Assistant Disk Image" msg_info "Getting URL for Latest Home Assistant Disk Image"
@ -124,7 +122,7 @@ r = requests.get(url).json()
if "message" in r: if "message" in r:
exit() exit()
for release in r: for release in r:
if release["prerelease"]: if release["release"]:
continue continue
for asset in release["assets"]: for asset in release["assets"]:
if asset["name"].find("$RELEASE_TYPE") != -1: if asset["name"].find("$RELEASE_TYPE") != -1:
@ -137,8 +135,6 @@ if [ -z "$URL" ]; then
die "Github has returned an error. A rate limit may have been applied to your connection." die "Github has returned an error. A rate limit may have been applied to your connection."
fi fi
msg_ok "Found URL for Latest Home Assistant Disk Image" msg_ok "Found URL for Latest Home Assistant Disk Image"
msg_info "${BL}${URL}${CL}"
sleep 2
msg_ok "${BL}${URL}${CL}" msg_ok "${BL}${URL}${CL}"
wget -q --show-progress $URL wget -q --show-progress $URL
echo -en "\e[1A\e[0K" echo -en "\e[1A\e[0K"
@ -213,4 +209,4 @@ msg_info "Starting Home Assistant OS (${VM_NAME}) VM"
qm start $VMID qm start $VMID
msg_ok "Started Home Assistant OS (${VM_NAME}) VM" msg_ok "Started Home Assistant OS (${VM_NAME}) VM"
echo -e "${GN} Completed Successfully!${CL} (${VM_NAME}) VM ID is ${BL}${VMID}${CL} \n" msg_ok "Completed Successfully!\n"