Explorar el Código

Update haos-vm.sh

Include a choice within the "Advanced" settings to configure the CPU model between kvm64 (default) or host.
tteckster hace 2 años
padre
commit
49263e9874
Se han modificado 1 ficheros con 18 adiciones y 1 borrados
  1. 18 1
      vm/haos-vm.sh

+ 18 - 1
vm/haos-vm.sh

@@ -129,6 +129,7 @@ function default_settings() {
   MACHINE=""
   MACHINE=""
   DISK_CACHE=""
   DISK_CACHE=""
   HN="haos$stable"
   HN="haos$stable"
+  CPU_TYPE=""
   CORE_COUNT="2"
   CORE_COUNT="2"
   RAM_SIZE="4096"
   RAM_SIZE="4096"
   BRG="vmbr0"
   BRG="vmbr0"
@@ -141,6 +142,7 @@ function default_settings() {
   echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}"
   echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}"
   echo -e "${DGN}Using Disk Cache: ${BGN}Default${CL}"
   echo -e "${DGN}Using Disk Cache: ${BGN}Default${CL}"
   echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}"
   echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}"
+  echo -e "${DGN}Using CPU Model: ${BGN}Default${CL}"
   echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}"
   echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}"
   echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}"
   echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}"
   echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}"
   echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}"
@@ -226,6 +228,21 @@ function advanced_settings() {
     exit-script
     exit-script
   fi
   fi
 
 
+  if CPU_TYPE1=$(whiptail --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \
+    "0" "KVM64 (Default)" ON \
+    "1" "Host" OFF \
+    3>&1 1>&2 2>&3); then
+    if [ $CPU_TYPE1 = "1" ]; then
+      echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}"
+      CPU_TYPE=" -cpu host"
+    else
+      echo -e "${DGN}Using CPU Model: ${BGN}Default${CL}"
+      CPU_TYPE=""
+    fi
+  else
+    exit-script
+  fi
+
   if CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
   if CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
     if [ -z $CORE_COUNT ]; then
     if [ -z $CORE_COUNT ]; then
       CORE_COUNT="2"
       CORE_COUNT="2"
@@ -396,7 +413,7 @@ for i in {0,1}; do
 done
 done
 msg_ok "Extracted KVM Disk Image"
 msg_ok "Extracted KVM Disk Image"
 msg_info "Creating HAOS VM"
 msg_info "Creating HAOS VM"
-qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE \
+qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \
   -name $HN -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci
   -name $HN -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci
 pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null
 pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null
 qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null
 qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null