|
|
@ -2,7 +2,7 @@
|
|
|
|
GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]')
|
|
|
|
GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]')
|
|
|
|
NEXTID=$(pvesh get /cluster/nextid)
|
|
|
|
NEXTID=$(pvesh get /cluster/nextid)
|
|
|
|
RELEASE=$(curl -sX GET "https://api.github.com/repos/home-assistant/operating-system/releases" | awk '/tag_name/{print $4;exit}' FS='[""]')
|
|
|
|
RELEASE=$(curl -sX GET "https://api.github.com/repos/home-assistant/operating-system/releases" | awk '/tag_name/{print $4;exit}' FS='[""]')
|
|
|
|
STABLE="8.2"
|
|
|
|
STABLE="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"`
|
|
|
@ -293,16 +293,16 @@ else
|
|
|
|
done
|
|
|
|
done
|
|
|
|
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 "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
|
|
|
|
msg_info "Getting URL for Home Assistant ${BRANCH} Disk Image"
|
|
|
|
msg_info "Getting URL for Home Assistant ${BRANCH} Disk Image"
|
|
|
|
URL=https://github.com/home-assistant/operating-system/releases/download/${BRANCH}/haos_ova-${BRANCH}.qcow2.xz
|
|
|
|
URL=https://github.com/home-assistant/operating-system/releases/download/${BRANCH}/haos_ova-${BRANCH}.qcow2.xz
|
|
|
|
msg_ok "Found URL for Home Assistant ${BRANCH} Disk Image"
|
|
|
|
sleep 2
|
|
|
|
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}${BRANCH}.qcow2${CL}${GN} Disk Image"
|
|
|
|
msg_ok "Downloaded ${CL}${BL}haos_ova-${BRANCH}.qcow2.xz${CL}"
|
|
|
|
msg_info "Extracting Disk Image"
|
|
|
|
msg_info "Extracting KVM 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}')
|
|
|
|
case $STORAGE_TYPE in
|
|
|
|
case $STORAGE_TYPE in
|
|
|
@ -316,15 +316,15 @@ for i in {0,1}; do
|
|
|
|
eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-}
|
|
|
|
eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-}
|
|
|
|
eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk}
|
|
|
|
eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk}
|
|
|
|
done
|
|
|
|
done
|
|
|
|
msg_ok "Extracted Disk Image"
|
|
|
|
msg_ok "Extracted KVM Disk Image"
|
|
|
|
|
|
|
|
|
|
|
|
msg_info "Creating HAOS VM"
|
|
|
|
msg_info "Creating HAOS VM"
|
|
|
|
qm create $VMID -agent 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $VM_NAME -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN \
|
|
|
|
qm create $VMID -agent 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $VM_NAME -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN \
|
|
|
|
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci
|
|
|
|
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci
|
|
|
|
pvesm alloc $STORAGE $VMID $DISK0 128 1>&/dev/null
|
|
|
|
pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null
|
|
|
|
qm importdisk $VMID ${FILE%.*} $STORAGE ${DIR_IMPORT:-} 1>&/dev/null
|
|
|
|
qm importdisk $VMID ${FILE%.*} $STORAGE ${DIR_IMPORT:-} 1>&/dev/null
|
|
|
|
qm set $VMID \
|
|
|
|
qm set $VMID \
|
|
|
|
-efidisk0 ${DISK0_REF},size=128K \
|
|
|
|
-efidisk0 ${DISK0_REF},efitype=4m,size=4M \
|
|
|
|
-scsi0 ${DISK1_REF},size=32G >/dev/null
|
|
|
|
-scsi0 ${DISK1_REF},size=32G >/dev/null
|
|
|
|
qm set $VMID \
|
|
|
|
qm set $VMID \
|
|
|
|
-boot order=scsi0 >/dev/null
|
|
|
|
-boot order=scsi0 >/dev/null
|
|
|
|