Added PVE 7.2 support

This commit is contained in:
Gabriel 2022-09-11 20:49:45 -03:00
parent 71466c87ce
commit 3707e70cbd
2 changed files with 221 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# OSX-PROXMOX - Run macOS on ANY Computer - AMD & Intel
Install `** FRESH/CLEAN **` Proxmox VE v7.0.XX ~ 7.1.XX - Next, Next & Finish (NNF).
Install `** FRESH/CLEAN **` Proxmox VE v7.0.XX ~ 7.2.XX - Next, Next & Finish (NNF).
Open Proxmox Web Console -> Datacenter > NAME OF YOUR HOST > Shell.

229
setup
View File

@ -48,7 +48,7 @@ SCRIPT_DIR=/root/OSX-PROXMOX
LOGDIR=${SCRIPT_DIR}/logs
TMPDIR=${SCRIPT_DIR}/tmp
ISODIR=/var/lib/vz/template/iso/
HACKPXVERSION="202209101215"
HACKPXVERSION="202209112045"
OCVERSION="0.8.4"
DEFAULT_VM_PREFIX="HACK-"
DEFAULT_RAM_SIZE=4096
@ -108,12 +108,22 @@ then
if [ ${OSX_PLATFORM} == "AMD" ]
then
if [ `pveversion | grep -i 7.2 | wc -l` -eq 1 ]
then
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt video=vesafb:off video=efifb:off initcall_blacklist=sysfb_init"/g' /etc/default/grub
else
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt video=vesafb:off video=efifb:off"/g' /etc/default/grub
fi
fi
if [ ${OSX_PLATFORM} == "INTEL" ]
then
if [ `pveversion | grep -i 7.2 | wc -l` -eq 1 ]
then
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt video=vesafb:off video=efifb:off initcall_blacklist=sysfb_init"/g' /etc/default/grub
else
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt video=vesafb:off video=efifb:off"/g' /etc/default/grub
fi
echo "options kvm-intel nested=Y" > /etc/modprobe.d/kvm-intel.conf
fi
@ -164,7 +174,7 @@ do
echo " 3 - macOS Catalina - 10.15"
echo " 4 - macOS Big Sur - 11"
echo " 5 - macOS Monterey - 12"
echo " ? - macOS Ventura - 13 (coming soon)"
echo " 6 - macOS Ventura - 13"
echo " "
echo " Next VM ID: ${NEXTID}"
echo " Opencore version: ${OCVERSION}"
@ -324,7 +334,7 @@ do
--ide2 local:iso/recovery-highsierra.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -364,7 +374,7 @@ do
--ide2 local:iso/recovery-highsierra.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -515,7 +525,7 @@ do
--ide2 local:iso/recovery-mojave.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -555,7 +565,7 @@ do
--ide2 local:iso/recovery-mojave.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -706,7 +716,7 @@ do
--ide2 local:iso/recovery-catalina.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -746,7 +756,7 @@ do
--ide2 local:iso/recovery-catalina.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -897,7 +907,7 @@ do
--ide2 local:iso/recovery-bigsur.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -937,7 +947,7 @@ do
--ide2 local:iso/recovery-bigsur.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -1088,7 +1098,7 @@ do
--ide2 local:iso/recovery-monterey.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
@ -1128,7 +1138,202 @@ do
--ide2 local:iso/recovery-monterey.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep "6.1" | wc -l` -eq 1 ]
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
fi
echo "Virtual machine (${VM_NAME}) created successfully."
echo " "
echo "Access the Proxmox Web Panel to continue with the installation ..."
echo "https://`ip address show vmbr0 | grep -w "inet" | awk -F " " '{ print $2 }' | awk -F "/" '{ print $1 }'`:8006"
echo " "
exit
fi
################################################################################################################################################################################################
################################################################################################################################################################################################
################################################################################################################################################################################################
## macOS Ventura - 13
if [ ${OPT} -eq 6 ]
then
clear
echo " "
echo "macOS Ventura"
echo " "
echo -n "Enter the VM ID [or ENTER to automatically generate (${NEXTID})]: "
read VM_ID
if [ -z $VM_ID ]; then VM_ID=$NEXTID; fi;
echo " "
echo -n "Enter VM Name [or ENTER for Default: HACK-VENTURA]: "
read VM_NAME
if [ -z $VM_NAME ]; then VM_NAME="${DEFAULT_VM_PREFIX}VENTURA"; fi;
echo " "
echo -n "Enter a disk size [INTEGER] [or ENTER for Default: 64 Gb]: "
read SIZEDISK
if [ -z $SIZEDISK ]; then SIZEDISK=64; fi;
if ! [[ $SIZEDISK =~ $re ]] ; then echo "ERROR! SIZEDISK MUST HAVE INTEGER NUMBER!"; exit; fi;
echo " "
echo "Storages available:"
echo " "
for stg in `pvesh get storage --noborder --noheader`
do
echo " - ${stg}"
done
echo " "
echo -n "Enter which storage to create the VM [or ENTER for Default: local-lvm]: "
read STORAGECRTVM
if [ -z $STORAGECRTVM ]; then STORAGECRTVM="local-lvm"; fi;
echo " "
echo -n "Allocate CPU cores [Need Power of 2] [or ENTER for Default: 4]: "
read PROC_COUNT
if [ -z $PROC_COUNT ]; then PROC_COUNT=4; fi;
echo " "
echo -n "Allocate RAM [MiB] [or ENTER for Default: 4096]: "
read RAM_SIZE
if [ -z $RAM_SIZE ]; then RAM_SIZE=$DEFAULT_RAM_SIZE; fi;
## echo " "
## echo -n "Do you want to download and create the recovery image? [Y/N] [or ENTER for Default: Y]: "
## read CRTRECODISK
##
## if [ -z $CRTRECODISK ]; then CRTRECODISK="Y"; fi;
##
## if [ "${CRTRECODISK}" == "Y" ] || [ "${CRTRECODISK}" == "y" ]
## then
## echo " "
## echo "Downloading and creating the recovery image for installation ..."
##
## LOGFILE=${LOGDIR}/crt-recovery-ventura.log
##
## if [ ! -e ${ISODIR}/recovery-ventura.iso ]
## then
## dd if=/dev/zero of=${TMPDIR}/recovery-ventura.iso bs=1M count=800 > ${LOGFILE} 2>> ${LOGFILE}
## mkfs.msdos -F 32 ${TMPDIR}/recovery-ventura.iso -n VENTURA >> ${LOGFILE} 2>> ${LOGFILE}
## losetup /dev/loop0 ${TMPDIR}/recovery-ventura.iso >> ${LOGFILE} 2>> ${LOGFILE}
## mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
## mount /dev/loop0 /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
##
## mkdir /mnt/APPLE/com.apple.recovery.boot >> ${LOGFILE} 2>> ${LOGFILE}
## cd /mnt/APPLE/com.apple.recovery.boot >> ${LOGFILE} 2>> ${LOGFILE}
##
## python3.9 ${SCRIPT_DIR}/tools/macrecovery/macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download >> ${LOGFILE} 2>> ${LOGFILE}
##
## cd ${SCRIPT_DIR}
##
## umount /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
## rmdir /mnt/APPLE
## losetup -d /dev/loop0 >> ${LOGFILE} 2>> ${LOGFILE}
##
## mv ${TMPDIR}/recovery-ventura.iso ${ISODIR}
##
## rm -rf ${TMPDIR}
## echo "Download and recovery created successfully."
## else
## echo "Recovery image of macOS Ventura already exists."
## fi
## else
## echo " "
## echo "Skipping download and creating recovery image ..."
## fi
echo " "
echo -n "Please send your ISO of macOS Ventura Beta to Proxmox and replace in config of your VM!"
echo " "
echo " "
echo "Creating virtual machine with macOS - Ventura ..."
if [ ${OSX_PLATFORM} == 'AMD' ]
then
LOGFILE=${LOGDIR}/crt-vm-amd-ventura.log
qm create ${VM_ID} \
--agent 1 \
--args '-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -device usb-mouse,bus=ehci.0,port=3 -cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+bmi1,+bmi2,+xsave,+xsaveopt,check' \
--autostart 0 \
--balloon 0 \
--bios ovmf \
--boot 'order=ide0;virtio0' \
--cores ${PROC_COUNT} \
--description ' Hackintosh VM - Ventura' \
--efidisk0 ${STORAGECRTVM}:4 \
--machine q35 \
--memory ${RAM_SIZE} \
--name ${VM_NAME} \
--net0 vmxnet3,bridge=vmbr0 \
--numa 0 \
--onboot 0 \
--ostype other \
--sockets 1 \
--start 0 \
--tablet 1 \
--vga vmware \
--vmgenid 1 \
--scsihw virtio-scsi-pci \
--virtio0 ${STORAGECRTVM}:${SIZEDISK},cache=none,discard=on \
--ide0 local:iso/opencore-osx-proxmox-vm.iso,cache=unsafe,size=80M > ${LOGFILE} 2>> ${LOGFILE}
## --ide2 local:iso/recovery-ventura.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+bmi2,+xsave,+xsaveopt,check/+bmi2,+xsave,+xsaveopt,check -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi
fi
if [ ${OSX_PLATFORM} == 'INTEL' ]
then
LOGFILE=${LOGDIR}/crt-vm-intel-ventura.log
qm create ${VM_ID} \
--agent 1 \
--args '-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -device usb-mouse,bus=ehci.0,port=3 -cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc' \
--autostart 0 \
--balloon 0 \
--bios ovmf \
--boot 'order=ide0;virtio0' \
--cores ${PROC_COUNT} \
--description ' Hackintosh VM - Ventura' \
--efidisk0 ${STORAGECRTVM}:4 \
--machine q35 \
--memory ${RAM_SIZE} \
--name ${VM_NAME} \
--net0 vmxnet3,bridge=vmbr0 \
--numa 0 \
--onboot 0 \
--ostype other \
--sockets 1 \
--start 0 \
--tablet 1 \
--vga vmware \
--vmgenid 1 \
--scsihw virtio-scsi-pci \
--virtio0 ${STORAGECRTVM}:${SIZEDISK},cache=none,discard=on \
--ide0 local:iso/opencore-osx-proxmox-vm.iso,cache=unsafe,size=80M > ${LOGFILE} 2>> ${LOGFILE}
## --ide2 local:iso/recovery-ventura.iso,cache=unsafe,size=800M > ${LOGFILE} 2>> ${LOGFILE}
## Fix for QEMU 6.1 for PCI Passthrough
if [ `qemu-system-x86_64 --version | grep -e "6.1" -e "6.2" | wc -l` -eq 1 ]
then
sed -i 's/+kvm_pv_eoi,+hypervisor,+invtsc/+kvm_pv_eoi,+hypervisor,+invtsc -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off/g' /etc/pve/qemu-server/${VM_ID}.conf
fi