Pārlūkot izejas kodu

Update haos_vm.sh

tteckster 3 gadi atpakaļ
vecāks
revīzija
87d4da1e8d
1 mainītis faili ar 5 papildinājumiem un 3 dzēšanām
  1. 5 3
      vm/haos_vm.sh

+ 5 - 3
vm/haos_vm.sh

@@ -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.1"
+STABLE="8.2"
 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"`
@@ -287,7 +287,7 @@ elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then
 else
 else
   while [ -z "${STORAGE:+x}" ]; do
   while [ -z "${STORAGE:+x}" ]; do
     STORAGE=$(whiptail --title "Storage Pools" --radiolist \
     STORAGE=$(whiptail --title "Storage Pools" --radiolist \
-    "Which storage pool you would like to use for the container?\n\n" \
+    "Which storage pool you would like to use for the HAOS VM?\n\n" \
     16 $(($MSG_MAX_LENGTH + 23)) 6 \
     16 $(($MSG_MAX_LENGTH + 23)) 6 \
     "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit
     "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit
   done
   done
@@ -309,6 +309,7 @@ case $STORAGE_TYPE in
   btrfs|nfs|dir)
   btrfs|nfs|dir)
         DISK_EXT=".qcow2"
         DISK_EXT=".qcow2"
         DISK_REF="$VMID/"
         DISK_REF="$VMID/"
+        DIR_IMPORT="-format qcow2"
 esac
 esac
 for i in {0,1}; do
 for i in {0,1}; do
   disk="DISK$i"
   disk="DISK$i"
@@ -321,12 +322,13 @@ 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 128 1>&/dev/null
-qm importdisk $VMID ${FILE%.*} $STORAGE 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},size=128K \
   -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
+
 msg_ok "Created HAOS VM ${CL}${BL}${VM_NAME}"
 msg_ok "Created HAOS VM ${CL}${BL}${VM_NAME}"
 
 
 if [ "$START_VM" == "yes" ]; then
 if [ "$START_VM" == "yes" ]; then