Update haos_vm.sh

This commit is contained in:
tteckster 2022-04-26 08:30:17 -04:00 committed by GitHub
parent 3bf93c1fc1
commit 4cb7fa4bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
NEXTID=$(pvesh get /cluster/nextid) NEXTID=$(pvesh get /cluster/nextid)
RELEASE="7.6"
YW=`echo "\033[33m"` YW=`echo "\033[33m"`
BL=`echo "\033[36m"` BL=`echo "\033[36m"`
RD=`echo "\033[01;31m"` RD=`echo "\033[01;31m"`
@ -12,7 +13,7 @@ HOLD="-"
CM="${GN}${CL}" CM="${GN}${CL}"
while true; do while true; do
read -p "This will create a New Home Assistant OS VM. Proceed(y/n)?" yn read -p "This will create a New ${RELEASE} Home Assistant OS VM. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]* ) break;; [Yy]* ) break;;
[Nn]* ) exit;; [Nn]* ) exit;;
@ -48,8 +49,8 @@ function default_settings() {
echo -e "${BL}Using Default Settings${CL}" echo -e "${BL}Using Default Settings${CL}"
echo -e "${DGN}Using VM ID ${BGN}$NEXTID${CL}" echo -e "${DGN}Using VM ID ${BGN}$NEXTID${CL}"
VMID=$NEXTID VMID=$NEXTID
echo -e "${DGN}Using VM Name ${BGN}haos${CL}" echo -e "${DGN}Using VM Name ${BGN}haos${RELEASE}${CL}"
VM_NAME=haos VM_NAME=haos${RELEASE}
echo -e "${DGN}Using ${BGN}2vCPU${CL}" echo -e "${DGN}Using ${BGN}2vCPU${CL}"
CORE_COUNT="2" CORE_COUNT="2"
echo -e "${DGN}Using ${BGN}4096MiB${CL}" echo -e "${DGN}Using ${BGN}4096MiB${CL}"
@ -72,10 +73,10 @@ clear
header_info header_info
echo -e "${RD}Using Advanced Settings${CL}" echo -e "${RD}Using Advanced Settings${CL}"
echo -e "${DGN}Using VM ID ${BGN}$VMID${CL}" echo -e "${DGN}Using VM ID ${BGN}$VMID${CL}"
echo -e "${YW}Enter VM Name (no-spaces), or Press [ENTER] for Default: hoas " echo -e "${YW}Enter VM Name (no-spaces), or Press [ENTER] for Default: haos${RELEASE} "
read VMNAME read VMNAME
if [ -z $VMNAME ]; then if [ -z $VMNAME ]; then
VM_NAME=haos VM_NAME=haos${RELEASE}
else else
VM_NAME=$(echo ${VMNAME,,} | tr -d ' ') VM_NAME=$(echo ${VMNAME,,} | tr -d ' ')
fi fi
@ -219,14 +220,14 @@ else
fi fi
msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location."
msg_ok "Container ID is ${CL}${BL}$VMID${CL}." msg_ok "Container ID is ${CL}${BL}$VMID${CL}."
msg_info "Getting URL for Latest Home Assistant Disk Image" msg_info "Getting URL for Stable Branch Home Assistant Disk Image"
URL="https://github.com/home-assistant/operating-system/releases/download/7.6/haos_ova-7.6.qcow2.xz" URL=https://github.com/home-assistant/operating-system/releases/download/${RELEASE}/haos_ova-${RELEASE}.qcow2.xz
msg_ok "Found URL for Latest Home Assistant Disk Image" msg_ok "Found URL for Latest Home Assistant Disk Image"
msg_ok "${CL}${BL}${URL}${CL}" msg_ok "${CL}${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"
FILE=$(basename $URL) FILE=$(basename $URL)
msg_ok "Downloaded ${CL}${BL}qcow2${CL}${GN} Disk Image" msg_ok "Downloaded ${CL}${BL}${RELEASE}.qcow2${CL}${GN} Disk Image"
msg_info "Extracting Disk Image" msg_info "Extracting Disk Image"
unxz $FILE unxz $FILE
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')