Upgrade to OC 1.0.4 and PVE 8.3 Support (PVE 8.4 don't supported yet)
This commit is contained in:
parent
16b8a5a839
commit
8ecb4e635c
Binary file not shown.
|
@ -18,7 +18,7 @@ Easily install macOS on Proxmox VE with just a few steps! This guide provides th
|
|||
|
||||
## 🛠 Installation Guide
|
||||
|
||||
1. Install a **FRESH/CLEAN** version of Proxmox VE (v7.0.XX ~ 8.2.XX) - just follow the Next, Next & Finish (NNF) approach.
|
||||
1. Install a **FRESH/CLEAN** version of Proxmox VE (v7.0.XX ~ 8.3.XX) - just follow the Next, Next & Finish (NNF) approach.
|
||||
2. Open the **Proxmox Web Console** → Navigate to `Datacenter > YOUR_HOST_NAME > Shell`.
|
||||
3. Copy, paste, and execute the command below:
|
||||
|
||||
|
@ -55,10 +55,10 @@ sudo spctl --master-disable
|
|||
---
|
||||
|
||||
## 🖥 Proxmox VE Versions Supported
|
||||
✅ v7.0.XX ~ 8.2.XX
|
||||
✅ v7.0.XX ~ 8.3.XX
|
||||
|
||||
### 🔄 OpenCore Version
|
||||
- **Oct/2024 - 1.0.2** → Added support for macOS Sequoia
|
||||
- **April/2025 - 1.0.4** → Added support for macOS Sequoia
|
||||
|
||||
---
|
||||
|
||||
|
|
35
setup
35
setup
|
@ -36,8 +36,15 @@ clear
|
|||
if [ `pveversion | grep "pve-manager/[7,8]" | wc -l` -ne 1 ]
|
||||
then
|
||||
echo "This version of Proxmox Virtual Environment is not supported"
|
||||
echo "Please use version: 7.XX or 8.2"
|
||||
echo "Please use version: 7.XX ~ 8.3"
|
||||
exit
|
||||
|
||||
if [ `pveversion | grep "pve-manager/8.4]" | wc -l` -ne 1 ]
|
||||
then
|
||||
echo "This version of Proxmox Virtual Environment is not supported"
|
||||
echo "Please use version: 7.XX ~ 8.3"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
################################################################################################################################################################################################
|
||||
|
@ -48,8 +55,8 @@ SCRIPT_DIR=/root/OSX-PROXMOX
|
|||
LOGDIR=${SCRIPT_DIR}/logs
|
||||
TMPDIR=${SCRIPT_DIR}/tmp
|
||||
ISODIR=/var/lib/vz/template/iso/
|
||||
HACKPXVERSION="20241025T1034"
|
||||
OCVERSION="1.0.2"
|
||||
HACKPXVERSION="20250422T1602"
|
||||
OCVERSION="1.0.4"
|
||||
DEFAULT_VM_PREFIX="HACK-"
|
||||
DEFAULT_RAM_SIZE=4096
|
||||
|
||||
|
@ -107,7 +114,7 @@ then
|
|||
|
||||
if [ ${OSX_PLATFORM} == "AMD" ]
|
||||
then
|
||||
if [ `pveversion | grep -i '7.2\|7.3\|7.4\|8.0\|8.1\|8.2' | wc -l` -eq 1 ]
|
||||
if [ `pveversion | grep -i '7.2\|7.3\|7.4\|8.0\|8.1\|8.2\|8.3' | 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
|
||||
|
@ -118,7 +125,7 @@ then
|
|||
|
||||
if [ ${OSX_PLATFORM} == "INTEL" ]
|
||||
then
|
||||
if [ `pveversion | grep -i '7.2\|7.3\|7.4\|8.0\|8.1\|8.2' | wc -l` -eq 1 ]
|
||||
if [ `pveversion | grep -i '7.2\|7.3\|7.4\|8.0\|8.1\|8.2\|8.3' | 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
|
||||
|
@ -274,7 +281,7 @@ do
|
|||
then
|
||||
fallocate -x -l 800M ${TMPDIR}/recovery-highsierra.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-highsierra.iso -n HIGHSIERRA >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-highsierra.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-highsierra.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -464,7 +471,7 @@ do
|
|||
then
|
||||
fallocate -x -l 800M ${TMPDIR}/recovery-mojave.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-mojave.iso -n MOJAVE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-mojave.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-mojave.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -654,7 +661,7 @@ do
|
|||
then
|
||||
fallocate -x -l 800M ${TMPDIR}/recovery-catalina.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-catalina.iso -n CATALINA >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-catalina.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-catalina.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -844,7 +851,7 @@ do
|
|||
then
|
||||
fallocate -x -l 1024M ${TMPDIR}/recovery-bigsur.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-bigsur.iso -n BIGSUR >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-bigsur.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-bigsur.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -1034,7 +1041,7 @@ do
|
|||
then
|
||||
fallocate -x -l 1024M ${TMPDIR}/recovery-monterey.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-monterey.iso -n MONTEREY >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-monterey.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-monterey.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -1224,7 +1231,7 @@ do
|
|||
then
|
||||
fallocate -x -l 1024M ${TMPDIR}/recovery-ventura.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-ventura.iso -n VENTURA >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-ventura.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-ventura.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -1414,7 +1421,7 @@ do
|
|||
then
|
||||
fallocate -x -l 1450M ${TMPDIR}/recovery-sonoma.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-sonoma.iso -n SONOMA >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-sonoma.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-sonoma.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -1604,7 +1611,7 @@ do
|
|||
then
|
||||
fallocate -x -l 1450M ${TMPDIR}/recovery-sequoia.iso > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mkfs.msdos -F 32 ${TMPDIR}/recovery-sequoia.iso -n SEQUOIA >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-sequoia.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show ${TMPDIR}/recovery-sequoia.iso`
|
||||
mkdir -p /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV} /mnt/APPLE >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
||||
|
@ -1931,7 +1938,7 @@ do
|
|||
echo "Customize Opencore config.plist"
|
||||
echo " "
|
||||
|
||||
LOOPDEV=`losetup -f --show -P ${ISODIR}/opencore-osx-proxmox-vm.iso 2>> ${LOGFILE}`
|
||||
LOOPDEV=`losetup -f --show -P ${ISODIR}/opencore-osx-proxmox-vm.iso`
|
||||
|
||||
mkdir -p /mnt/opencore > ${LOGFILE} 2>> ${LOGFILE}
|
||||
mount ${LOOPDEV}p1 /mnt/opencore >> ${LOGFILE} 2>> ${LOGFILE}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Mac-EE2EBD4B90B839A8": "13.6.3",
|
||||
"Mac-EE2EBD4B90B839A8": "13.7",
|
||||
"Mac-BE0E8AC46FE800CC": "11.7.10",
|
||||
"Mac-9AE82516C7C6B903": "12.7.2",
|
||||
"Mac-9AE82516C7C6B903": "12.7.6",
|
||||
"Mac-942452F5819B1C1B": "10.13.6",
|
||||
"Mac-942C5DF58193131B": "10.13.6",
|
||||
"Mac-C08A6BB70A942AC2": "10.13.6",
|
||||
|
@ -10,25 +10,25 @@
|
|||
"Mac-2E6FAB96566FE58C": "10.15.7",
|
||||
"Mac-35C1E88140C3E6CF": "11.7.10",
|
||||
"Mac-7DF21CB3ED6977E5": "11.7.10",
|
||||
"Mac-9F18E312C5C2BF0B": "12.7.2",
|
||||
"Mac-937CB26E2E02BB01": "12.7.2",
|
||||
"Mac-827FAC58A8FDFA22": "latest",
|
||||
"Mac-226CB3C6A851A671": "latest",
|
||||
"Mac-9F18E312C5C2BF0B": "12.7.6",
|
||||
"Mac-937CB26E2E02BB01": "12.7.6",
|
||||
"Mac-827FAC58A8FDFA22": "14.7",
|
||||
"Mac-226CB3C6A851A671": "14.7",
|
||||
"Mac-0CFF9C7C2B63DF8D": "latest",
|
||||
"Mac-C3EC7CD22292981F": "10.15.7",
|
||||
"Mac-AFD8A9D944EA4843": "10.15.7",
|
||||
"Mac-189A3D4F975D5FFC": "11.7.10",
|
||||
"Mac-3CBD00234E554E41": "11.7.10",
|
||||
"Mac-2BD1B31983FE1663": "11.7.10",
|
||||
"Mac-06F11FD93F0323C5": "12.7.2",
|
||||
"Mac-06F11F11946D27C5": "12.7.2",
|
||||
"Mac-E43C1C25D4880AD6": "12.7.2",
|
||||
"Mac-473D31EABEB93F9B": "12.7.2",
|
||||
"Mac-66E35819EE2D0D05": "12.7.2",
|
||||
"Mac-A5C67F76ED83108C": "12.7.2",
|
||||
"Mac-B4831CEBD52A0C4C": "13.6.3",
|
||||
"Mac-CAD6701F7CEA0921": "13.6.3",
|
||||
"Mac-551B86E5744E2388": "13.6.3",
|
||||
"Mac-06F11FD93F0323C5": "12.7.6",
|
||||
"Mac-06F11F11946D27C5": "12.7.6",
|
||||
"Mac-E43C1C25D4880AD6": "12.7.6",
|
||||
"Mac-473D31EABEB93F9B": "12.7.6",
|
||||
"Mac-66E35819EE2D0D05": "12.7.6",
|
||||
"Mac-A5C67F76ED83108C": "12.7.6",
|
||||
"Mac-B4831CEBD52A0C4C": "13.7",
|
||||
"Mac-CAD6701F7CEA0921": "13.7",
|
||||
"Mac-551B86E5744E2388": "13.7",
|
||||
"Mac-937A206F2EE63C01": "latest",
|
||||
"Mac-827FB448E656EC26": "latest",
|
||||
"Mac-1E7E29AD0135F9BC": "latest",
|
||||
|
@ -43,7 +43,7 @@
|
|||
"Mac-942459F5819B171B": "10.13.6",
|
||||
"Mac-4B7AC7E43945597E": "10.15.7",
|
||||
"Mac-6F01561E16C75D06": "10.15.7",
|
||||
"Mac-F60DEB81FF30ACF6": "12.7.2",
|
||||
"Mac-F60DEB81FF30ACF6": "12.7.6",
|
||||
"Mac-27AD2F918AE68F61": "latest",
|
||||
"Mac-F2208EC8": "10.13.6",
|
||||
"Mac-8ED6AF5B48C039E1": "10.13.6",
|
||||
|
@ -51,7 +51,7 @@
|
|||
"Mac-7BA5B2794B2CDB12": "10.13.6",
|
||||
"Mac-031AEE4D24BFF0B1": "10.15.7",
|
||||
"Mac-F65AE981FFA204ED": "10.15.7",
|
||||
"Mac-35C5E08120C7EEAF": "12.7.2",
|
||||
"Mac-35C5E08120C7EEAF": "12.7.6",
|
||||
"Mac-7BA5B2DFE22DDD8C": "latest",
|
||||
"Mac-942B5BF58194151B": "10.13.6",
|
||||
"Mac-942B59F58194171B": "10.13.6",
|
||||
|
@ -63,14 +63,14 @@
|
|||
"Mac-77EB7D7DAF985301": "10.15.7",
|
||||
"Mac-81E3E92DD6088272": "11.7.10",
|
||||
"Mac-42FD25EABCABB274": "11.7.10",
|
||||
"Mac-A369DDC4E67F1C45": "12.7.2",
|
||||
"Mac-FFE5EF870D7BA81A": "12.7.2",
|
||||
"Mac-DB15BD556843C820": "12.7.2",
|
||||
"Mac-65CE76090165799A": "12.7.2",
|
||||
"Mac-B809C3757DA9BB8D": "12.7.2",
|
||||
"Mac-4B682C642B45593E": "13.6.3",
|
||||
"Mac-77F17D7DA9285301": "13.6.3",
|
||||
"Mac-BE088AF8C5EB4FA2": "13.6.3",
|
||||
"Mac-A369DDC4E67F1C45": "12.7.6",
|
||||
"Mac-FFE5EF870D7BA81A": "12.7.6",
|
||||
"Mac-DB15BD556843C820": "12.7.6",
|
||||
"Mac-65CE76090165799A": "12.7.6",
|
||||
"Mac-B809C3757DA9BB8D": "12.7.6",
|
||||
"Mac-4B682C642B45593E": "13.7",
|
||||
"Mac-77F17D7DA9285301": "13.7",
|
||||
"Mac-BE088AF8C5EB4FA2": "13.7",
|
||||
"Mac-AA95B1DDAB278B95": "latest",
|
||||
"Mac-63001698E7A34814": "latest",
|
||||
"Mac-CFF7D910A743CAAF": "latest",
|
||||
|
|
|
@ -7,28 +7,29 @@ Copyright (c) 2019, vit9696
|
|||
"""
|
||||
|
||||
import argparse
|
||||
import binascii
|
||||
import hashlib
|
||||
import json
|
||||
import linecache
|
||||
import os
|
||||
import random
|
||||
import struct
|
||||
import string
|
||||
import sys
|
||||
|
||||
try:
|
||||
from urllib.request import Request, HTTPError, urlopen
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urllib2 import Request, HTTPError, urlopen
|
||||
from urlparse import urlparse
|
||||
print('ERROR: Python 2 is not supported, please use Python 3')
|
||||
sys.exit(1)
|
||||
|
||||
SELF_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
RECENT_MAC = 'Mac-7BA5B2D9E42DDD94'
|
||||
# MacPro7,1
|
||||
RECENT_MAC = 'Mac-27AD2F918AE68F61'
|
||||
MLB_ZERO = '00000000000000000'
|
||||
MLB_VALID = 'C02749200YGJ803AX'
|
||||
MLB_PRODUCT = '00000000000J80300'
|
||||
MLB_VALID = 'F5K105303J9K3F71M'
|
||||
MLB_PRODUCT = 'F5K00000000K3F700'
|
||||
|
||||
TYPE_SID = 16
|
||||
TYPE_K = 64
|
||||
|
@ -43,12 +44,12 @@ INFO_SIGN_HASH = 'CH'
|
|||
INFO_SIGN_SESS = 'CT'
|
||||
INFO_REQURED = [INFO_PRODUCT, INFO_IMAGE_LINK, INFO_IMAGE_HASH, INFO_IMAGE_SESS, INFO_SIGN_LINK, INFO_SIGN_HASH, INFO_SIGN_SESS]
|
||||
|
||||
# Use -2 for better resize stability on Windows
|
||||
TERMINAL_MARGIN = 2
|
||||
|
||||
def run_query(url, headers, post=None, raw=False):
|
||||
if post is not None:
|
||||
data = '\n'.join([entry + '=' + post[entry] for entry in post])
|
||||
if sys.version_info[0] >= 3:
|
||||
data = data.encode('utf-8')
|
||||
data = '\n'.join(entry + '=' + post[entry] for entry in post).encode()
|
||||
else:
|
||||
data = None
|
||||
req = Request(url=url, headers=headers, data=data)
|
||||
|
@ -63,12 +64,11 @@ def run_query(url, headers, post=None, raw=False):
|
|||
|
||||
|
||||
def generate_id(id_type, id_value=None):
|
||||
valid_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
|
||||
return ''.join(random.choice(valid_chars) for i in range(id_type)) if not id_value else id_value
|
||||
return id_value or ''.join(random.choices(string.hexdigits[:16].upper(), k=id_type))
|
||||
|
||||
|
||||
def product_mlb(mlb):
|
||||
return '00000000000' + mlb[11] + mlb[12] + mlb[13] + mlb[14] + '00'
|
||||
return '00000000000' + mlb[11:15] + '00'
|
||||
|
||||
|
||||
def mlb_from_eeee(eeee):
|
||||
|
@ -79,13 +79,6 @@ def mlb_from_eeee(eeee):
|
|||
return f'00000000000{eeee}00'
|
||||
|
||||
|
||||
def int_from_unsigned_bytes(byte_list, byteorder):
|
||||
if byteorder == 'little':
|
||||
byte_list = byte_list[::-1]
|
||||
encoded = binascii.hexlify(byte_list)
|
||||
return int(encoded, 16)
|
||||
|
||||
|
||||
# zhangyoufu https://gist.github.com/MCJack123/943eaca762730ca4b7ae460b731b68e7#gistcomment-3061078 2021-10-08
|
||||
Apple_EFI_ROM_public_key_1 = 0xC3E748CAD9CD384329E10E25A91E43E1A762FF529ADE578C935BDDF9B13F2179D4855E6FC89E9E29CA12517D17DFA1EDCE0BEBF0EA7B461FFE61D94E2BDF72C196F89ACD3536B644064014DAE25A15DB6BB0852ECBD120916318D1CCDEA3C84C92ED743FC176D0BACA920D3FCF3158AFF731F88CE0623182A8ED67E650515F75745909F07D415F55FC15A35654D118C55A462D37A3ACDA08612F3F3F6571761EFCCBCC299AEE99B3A4FD6212CCFFF5EF37A2C334E871191F7E1C31960E010A54E86FA3F62E6D6905E1CD57732410A3EB0C6B4DEFDABE9F59BF1618758C751CD56CEF851D1C0EAA1C558E37AC108DA9089863D20E2E7E4BF475EC66FE6B3EFDCF
|
||||
|
||||
|
@ -119,8 +112,8 @@ def verify_chunklist(cnkpath):
|
|||
if signature_method == 1:
|
||||
data = f.read(256)
|
||||
assert len(data) == 256
|
||||
signature = int_from_unsigned_bytes(data, 'little')
|
||||
plaintext = 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff003031300d0609608648016503040201050004200000000000000000000000000000000000000000000000000000000000000000 | int_from_unsigned_bytes(digest, 'big')
|
||||
signature = int.from_bytes(data, 'little')
|
||||
plaintext = int(f'0x1{"f"*404}003031300d060960864801650304020105000420{"0"*64}', 16) | int.from_bytes(digest, 'big')
|
||||
assert pow(signature, 0x10001, Apple_EFI_ROM_public_key_1) == plaintext
|
||||
elif signature_method == 2:
|
||||
data = f.read(32)
|
||||
|
@ -185,7 +178,9 @@ def get_image_info(session, bid, mlb=MLB_ZERO, diag=False, os_type='default', ci
|
|||
try:
|
||||
key, value = line.split(': ')
|
||||
info[key] = value
|
||||
except Exception:
|
||||
except KeyError:
|
||||
continue
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
for k in INFO_REQURED:
|
||||
|
@ -205,27 +200,47 @@ def save_image(url, sess, filename='', directory=''):
|
|||
}
|
||||
|
||||
if not os.path.exists(directory):
|
||||
os.mkdir(directory)
|
||||
os.makedirs(directory)
|
||||
|
||||
if filename == '':
|
||||
filename = os.path.basename(purl.path)
|
||||
if filename.find('/') >= 0 or filename == '':
|
||||
if filename.find(os.sep) >= 0 or filename == '':
|
||||
raise RuntimeError('Invalid save path ' + filename)
|
||||
|
||||
print(f'Saving {url} to {directory}/{filename}...')
|
||||
print(f'Saving {url} to {directory}{os.sep}{filename}...')
|
||||
|
||||
with open(os.path.join(directory, filename), 'wb') as fh:
|
||||
response = run_query(url, headers, raw=True)
|
||||
headers = dict(response.headers)
|
||||
totalsize = -1
|
||||
for header in headers:
|
||||
if header.lower() == 'content-length':
|
||||
totalsize = int(headers[header])
|
||||
break
|
||||
size = 0
|
||||
oldterminalsize = 0
|
||||
while True:
|
||||
chunk = response.read(2**20)
|
||||
if not chunk:
|
||||
break
|
||||
fh.write(chunk)
|
||||
size += len(chunk)
|
||||
print(f'\r{size / (2**20)} MBs downloaded...', end='')
|
||||
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0)
|
||||
if oldterminalsize != terminalsize:
|
||||
print(f'\r{"":<{terminalsize}}', end='')
|
||||
oldterminalsize = terminalsize
|
||||
if totalsize > 0:
|
||||
progress = size / totalsize
|
||||
barwidth = terminalsize // 3
|
||||
print(f'\r{size / (2**20):.1f}/{totalsize / (2**20):.1f} MB ', end='')
|
||||
if terminalsize > 55:
|
||||
print(f'|{"=" * int(barwidth * progress):<{barwidth}}|', end='')
|
||||
print(f' {progress*100:.1f}% downloaded', end='')
|
||||
else:
|
||||
# Fallback if Content-Length isn't available
|
||||
print(f'\r{size / (2**20)} MB downloaded...', end='')
|
||||
sys.stdout.flush()
|
||||
print('\rDownload complete!\t\t\t\t\t')
|
||||
print('\nDownload complete!')
|
||||
|
||||
return os.path.join(directory, os.path.basename(filename))
|
||||
|
||||
|
@ -234,10 +249,9 @@ def verify_image(dmgpath, cnkpath):
|
|||
print('Verifying image with chunklist...')
|
||||
|
||||
with open(dmgpath, 'rb') as dmgf:
|
||||
cnkcount = 0
|
||||
for cnksize, cnkhash in verify_chunklist(cnkpath):
|
||||
cnkcount += 1
|
||||
print(f'\rChunk {cnkcount} ({cnksize} bytes)', end='')
|
||||
for cnkcount, (cnksize, cnkhash) in enumerate(verify_chunklist(cnkpath), 1):
|
||||
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0)
|
||||
print(f'\r{f"Chunk {cnkcount} ({cnksize} bytes)":<{terminalsize}}', end='')
|
||||
sys.stdout.flush()
|
||||
cnk = dmgf.read(cnksize)
|
||||
if len(cnk) != cnksize:
|
||||
|
@ -246,7 +260,7 @@ def verify_image(dmgpath, cnkpath):
|
|||
raise RuntimeError(f'Invalid chunk {cnkcount}: hash mismatch')
|
||||
if dmgf.read(1) != b'':
|
||||
raise RuntimeError('Invalid image: larger than chunklist')
|
||||
print('\rImage verification complete!\t\t\t\t\t')
|
||||
print('\nImage verification complete!')
|
||||
|
||||
|
||||
def action_download(args):
|
||||
|
@ -358,7 +372,7 @@ def action_selfcheck(args):
|
|||
if product_default[INFO_PRODUCT] != valid_default[INFO_PRODUCT]:
|
||||
# Product-only MLB can give the same value with valid default MLB.
|
||||
# This is not an error for all models, but for our chosen code it is.
|
||||
print('ERROR: Valid and product MLB give mismatch, got {product_default[INFO_PRODUCT]} and {valid_default[INFO_PRODUCT]}')
|
||||
print(f'ERROR: Valid and product MLB give mismatch, got {product_default[INFO_PRODUCT]} and {valid_default[INFO_PRODUCT]}')
|
||||
return 1
|
||||
|
||||
print('SUCCESS: Found no discrepancies with MLB validation algorithm!')
|
||||
|
|
|
@ -1,38 +1,54 @@
|
|||
# Lion (10.7):
|
||||
python macrecovery.py -b Mac-2E6FAB96566FE58C -m 00000000000F25Y00 download
|
||||
python macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00 download
|
||||
Lion
|
||||
./macrecovery.py -b Mac-2E6FAB96566FE58C -m 00000000000F25Y00
|
||||
./macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00
|
||||
|
||||
# Mountain Lion (10.8):
|
||||
python macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100 download
|
||||
Mountain Lion:
|
||||
./macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100
|
||||
|
||||
# Mavericks (10.9):
|
||||
python macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100 download
|
||||
Mavericks
|
||||
./macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100
|
||||
|
||||
# Yosemite (10.10):
|
||||
python macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00 download
|
||||
Yosemite:
|
||||
./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00
|
||||
|
||||
# El Capitan (10.11):
|
||||
python macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00 download
|
||||
El Capitan
|
||||
./macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00
|
||||
|
||||
# Sierra (10.12):
|
||||
python macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00 download
|
||||
Sierra
|
||||
./macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00
|
||||
|
||||
# High Sierra (10.13)
|
||||
python macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300 download
|
||||
python macrecovery.py -b Mac-BE088AF8C5EB4FA2 -m 00000000000J80300 download
|
||||
High Sierra
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300
|
||||
./macrecovery.py -b Mac-BE088AF8C5EB4FA2 -m 00000000000J80300
|
||||
|
||||
# Mojave (10.14)
|
||||
python macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00 download
|
||||
Mojave
|
||||
./macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00
|
||||
|
||||
# Catalina (10.15)
|
||||
python macrecovery.py -b Mac-00BE6ED71E35EB86 -m 00000000000000000 download
|
||||
Catalina
|
||||
./macrecovery.py -b Mac-CFF7D910A743CAAF -m 00000000000PHCD00
|
||||
./macrecovery.py -b Mac-00BE6ED71E35EB86 -m 00000000000000000
|
||||
|
||||
# Big Sur (11)
|
||||
python macrecovery.py -b Mac-42FD25EABCABB274 -m 00000000000000000 download
|
||||
Big Sur
|
||||
./macrecovery.py -b Mac-2BD1B31983FE1663 -m 00000000000000000
|
||||
|
||||
# Monterey (12)
|
||||
python macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download
|
||||
Monterey
|
||||
./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000
|
||||
|
||||
# Latest version
|
||||
# ie. Ventura (13)
|
||||
python macrecovery.py -b Mac-B4831CEBD52A0C4C -m 00000000000000000 download
|
||||
Ventura
|
||||
./macrecovery.py -b Mac-B4831CEBD52A0C4C -m 00000000000000000
|
||||
|
||||
Sonoma
|
||||
./macrecovery.py -b Mac-827FAC58A8FDFA22 -m 00000000000000000
|
||||
|
||||
Diagnostics
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000000000 -diag
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000JG3600 -diag
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 <real MLB> -diag
|
||||
|
||||
Default version
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000JG3600 (oldest)
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m <real MLB> -os default (newer)
|
||||
|
||||
Latest version
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000000000 -os latest
|
||||
./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m <real MLB> -os latest
|
||||
|
|
Loading…
Reference in New Issue