mirror of
https://github.com/sickcodes/osx-serial-generator.git
synced 2024-11-23 12:39:41 +00:00
Add safety to scripts, de-BASH5, simplify logic
This commit is contained in:
parent
8ff21f5a52
commit
fad6722051
0
CREDITS.md
Normal file
0
CREDITS.md
Normal file
218
README.md
218
README.md
@ -1,2 +1,216 @@
|
||||
# osx-serial-generator
|
||||
Generate complete sets of Serial Numbers for OSX-KVM, Docker-OSX and of course, OpenCore.
|
||||
# OSX Serial Generator
|
||||
|
||||
![Running mac osx in a docker container](/running-mac-inside-docker-qemu.png?raw=true "OSX KVM DOCKER")
|
||||
|
||||
Generate macOS valid serials, uuids, and board serials. Pertinent for working in iMessage security research.
|
||||
|
||||
This project provides two tools for generating serial numbers for Hackintosh, OpenCore, Docker-OSx and OSX-KVM.
|
||||
|
||||
Author: Sick.Codes https://sick.codes/ & https://twitter.com/sickcodes
|
||||
|
||||
### PR & Contributor Credits
|
||||
|
||||
https://github.com/sickcodes/osx-serial-generator/blob/master/CREDITS.md
|
||||
|
||||
## Related
|
||||
|
||||
- [Docker-OSX](https://github.com/sickcodes/Docker-OSX)
|
||||
- [OSX-KVM](https://github.com/kholia/OSX-KVM)
|
||||
- [OpenCore](https://github.com/acidanthera/OpenCorePkg)
|
||||
- [Hackintosh](https://www.reddit.com/r/hackintosh/)
|
||||
|
||||
# Purpose
|
||||
|
||||
These script were written by @sickcodes [https://twitter.com/sickcodes](https://twitter.com/sickcodes) for automating generating unique values at runtime in [Docker-OSX](https://github.com/sickcodes/Docker-OSX).
|
||||
|
||||
This is for generating sets of serial numbers that simply work.
|
||||
|
||||
If this is your first time, just run the first command below, without any options, and you will be given 1 complete set.
|
||||
|
||||
Used at runtime in [Docker-OSX](https://github.com/sickcodes/Docker-OSX).
|
||||
|
||||
- [https://github.com/kholia/OSX-KVM](https://github.com/kholia/OSX-KVM): "Run macOS on QEMU/KVM. With OpenCore + Big Sur support now! Only commercial (paid) support is available."
|
||||
|
||||
- [https://github.com/sickcodes/Docker-OSX](https://github.com/sickcodes/Docker-OSX): "Run Mac in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X!"
|
||||
|
||||
- [https://github.com/kholia/OSX-KVM](https://github.com/kholia/OSX-KVM)
|
||||
|
||||
# Requirements
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian/Pop
|
||||
sudo apt update -y && sudo apt install libguestfs-tools build-essential wget git -y
|
||||
|
||||
# Fedora, RHEL, CentOS
|
||||
sudo yum install libguestfs wget git -y
|
||||
sudo yum groupinstall 'Development Tools' -y
|
||||
|
||||
# Arch, Manjaro
|
||||
sudo pacman -Sy libguestfs wget git base-devel
|
||||
|
||||
```
|
||||
|
||||
# Generating New Unique Serial Numbers
|
||||
|
||||
Example
|
||||
```bash
|
||||
# make 1 serial set, using
|
||||
./generate-unique-machine-values.sh -c 1
|
||||
|
||||
# make 100 serial sets
|
||||
./generate-unique-machine-values.sh -c 100 --model="iMacPro1,1"
|
||||
|
||||
# make 5 serial sets, but also make config.plist for each set, and OpenCore-nopicker.qcow2 for each serial set.
|
||||
./generate-unique-machine-values.sh -c 5 --plists --bootdisks
|
||||
```
|
||||
|
||||
## Already have your own `config.plist`?
|
||||
|
||||
If you want to automate creating the qcow bootdisk each time, you can use placeholders and let this script build the image each time you change anything.
|
||||
|
||||
If you want to use placeholders, you can supply that to either of the scripts in this repo and use `--custom-plist=./my_config.plist`
|
||||
|
||||
```bash
|
||||
# make 5 serial sets, but also use my config.plist for each set AND make qcow2 image for each!
|
||||
./generate-unique-machine-values.sh -c 5 --custom-plist=./my_config.plist --bootdisks
|
||||
```
|
||||
|
||||
Or you can manually enter the values generated above:
|
||||
|
||||
```xml
|
||||
<key>MLB</key>
|
||||
<string>{{BOARD_SERIAL}}</string>
|
||||
<key>ROM</key>
|
||||
<data>{{ROM}}</data>
|
||||
<key>SpoofVendor</key>
|
||||
<true/>
|
||||
<key>SystemProductName</key>
|
||||
<string>{{DEVICE_MODEL}}</string>
|
||||
<key>SystemSerialNumber</key>
|
||||
<string>{{SERIAL}}</string>
|
||||
<key>SystemUUID</key>
|
||||
<string>{{UUID}}</string>
|
||||
...
|
||||
...
|
||||
...
|
||||
<key>Resolution</key>
|
||||
<string>{{WIDTH}}x{{HEIGHT}}@32</string>
|
||||
<key>SanitiseClearScreen</key>
|
||||
```
|
||||
```
|
||||
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
|
||||
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
```
|
||||
|
||||
```bash
|
||||
General options:
|
||||
--count, -n, -c <count> Number of serials to generate
|
||||
--model, -m <model> Device model, e.g. 'iMacPro1,1'
|
||||
--csv <filename> Optionally change the CSV output filename
|
||||
--tsv <filename> Optionally change the TSV output filename
|
||||
--output-dir <directory> Optionally change the script output location
|
||||
--width <string> Resolution x axis length in px, default 1920
|
||||
--height <string> Resolution y axis length in px, default 1080
|
||||
--master-plist-url <url> Specify an alternative master plist, via URL
|
||||
--master-plist <filename> Optionally change the input plist
|
||||
--custom-plist <filename> Same as --master-plist
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--envs Create all corresponding sourcable envs
|
||||
--plists Create all corresponding config.plists
|
||||
--bootdisks Create all corresponding bootdisks [SLOW]
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Additional options only if you are creating ONE serial set:
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--output-env <filename> Optionally change the serials env filename
|
||||
|
||||
Custom plist placeholders:
|
||||
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
|
||||
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
|
||||
Example:
|
||||
./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
|
||||
|
||||
Defaults:
|
||||
- One serial, for 'iMacPro1,1', in the current working directory
|
||||
- CSV and TSV output
|
||||
- plists in ./plists/ & bootdisks in ./bootdisks/ & envs in ./envs
|
||||
- if you set --bootdisk name, --bootdisks is assumed
|
||||
- if you set --custom-plist, --plists is assumed
|
||||
- if you set --output-env, --envs is assumed
|
||||
|
||||
```
|
||||
|
||||
# Generating A Bootdisk Using Specific Serial Numbers
|
||||
|
||||
If you already know the serial numbers, or you've generated them above in the past, then you can use this script:
|
||||
|
||||
```bash
|
||||
|
||||
Required options:
|
||||
--model <string> Device model, e.g. 'iMacPro1,1'
|
||||
--serial <string> Device Serial number
|
||||
--board-serial <string> Main Logic Board Serial number (MLB)
|
||||
--uuid <string> SMBIOS UUID (SmUUID)
|
||||
--mac-address <string> Used for both the MAC address and to set ROM
|
||||
ROM is lowercased sans any colons
|
||||
Optional options:
|
||||
--width <integer> Resolution x axis length in px, default 1920
|
||||
--height <integer> Resolution y axis length in px, default 1080
|
||||
--master-plist-url <url> Specify an alternative master plist, via URL
|
||||
--custom-plist <filename>
|
||||
|| --master-plist <filename> Optionally change the input plist.
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--output-plist <filename> Optionally change the output plist filename
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}},
|
||||
{{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
|
||||
Example:
|
||||
./generate-specific-bootdisk.sh \
|
||||
--model iMacPro1,1 \
|
||||
--serial C02TW0WAHX87 \
|
||||
--board-serial C027251024NJG36UE \
|
||||
--uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \
|
||||
--mac-address A8:5C:2C:9A:46:2F \
|
||||
--output-bootdisk ./OpenCore-nopicker.qcow2 \
|
||||
--width 1920 \
|
||||
--height 1080
|
||||
|
||||
```
|
||||
|
||||
|
||||
# Examples from Docker-OSX
|
||||
|
||||
In the case example of why these scripts were written is:
|
||||
|
||||
`GENERATE_UNIQUE` is used as a Docker argument to randomly generate 1 set at runtime, for every new container.
|
||||
|
||||
`GENERATE_SPECIFIC` is used to specify an already known model, serial, board-serial, uuid and MAC address.
|
||||
|
||||
```bash
|
||||
[[ "${GENERATE_UNIQUE}" == true ]] && { \
|
||||
./Docker-OSX/custom/generate-unique-machine-values.sh \
|
||||
--master-plist-url="${MASTER_PLIST_URL}" \
|
||||
--count 1 \
|
||||
--tsv ./serial.tsv \
|
||||
--bootdisks \
|
||||
--width "${WIDTH:-1920}" \
|
||||
--height "${HEIGHT:-1080}" \
|
||||
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
|
||||
--output-env "${ENV:=/env}" \
|
||||
; } \
|
||||
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
|
||||
source "${ENV:=/env}" 2>/dev/null \
|
||||
; ./Docker-OSX/custom/generate-specific-bootdisk.sh \
|
||||
--master-plist-url="${MASTER_PLIST_URL}" \
|
||||
--model "${DEVICE_MODEL}" \
|
||||
--serial "${SERIAL}" \
|
||||
--board-serial "${BOARD_SERIAL}" \
|
||||
--uuid "${UUID}" \
|
||||
--mac-address "${MAC_ADDRESS}" \
|
||||
--width "${WIDTH:-1920}" \
|
||||
--height "${HEIGHT:-1080}" \
|
||||
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}"
|
||||
```
|
||||
|
884
config-nopicker-custom.plist
Normal file
884
config-nopicker-custom.plist
Normal file
@ -0,0 +1,884 @@
|
||||
<!-- This file is modified by @sickcodes from https://github.com/kholia/OSX-KVM/tree/master/OpenCore-Catalina -->
|
||||
<!-- The modifications are placeholders for: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}} -->
|
||||
<!-- All credit for this file https://github.com/kholia/OSX-KVM/blob/master/CREDITS.md -->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ACPI</key>
|
||||
<dict>
|
||||
<key>Add</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>add DTGP method</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Path</key>
|
||||
<string>SSDT-DTGP.aml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>Fake EC and USBX Power</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Path</key>
|
||||
<string>SSDT-EC.aml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>USB 2.0 Injection</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Path</key>
|
||||
<string>SSDT-EHCI.aml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>CPU AGPM Plugin=1</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Path</key>
|
||||
<string>SSDT-PLUG.aml</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Delete</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>All</key>
|
||||
<false/>
|
||||
<key>Comment</key>
|
||||
<string>Delete CpuPm</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>OemTableId</key>
|
||||
<data>Q3B1UG0AAAA=</data>
|
||||
<key>TableLength</key>
|
||||
<integer>0</integer>
|
||||
<key>TableSignature</key>
|
||||
<data>U1NEVA==</data>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>All</key>
|
||||
<false/>
|
||||
<key>Comment</key>
|
||||
<string>Delete Cpu0Ist</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>OemTableId</key>
|
||||
<data>Q3B1MElzdAA=</data>
|
||||
<key>TableLength</key>
|
||||
<integer>0</integer>
|
||||
<key>TableSignature</key>
|
||||
<data>U1NEVA==</data>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Patch</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>_Q11 to XQ11</string>
|
||||
<key>Count</key>
|
||||
<integer>1</integer>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>Find</key>
|
||||
<data>X1ExMQ==</data>
|
||||
<key>Limit</key>
|
||||
<integer>0</integer>
|
||||
<key>Mask</key>
|
||||
<data></data>
|
||||
<key>OemTableId</key>
|
||||
<data></data>
|
||||
<key>Replace</key>
|
||||
<data>WFExMQ==</data>
|
||||
<key>ReplaceMask</key>
|
||||
<data></data>
|
||||
<key>Skip</key>
|
||||
<integer>0</integer>
|
||||
<key>TableLength</key>
|
||||
<integer>0</integer>
|
||||
<key>TableSignature</key>
|
||||
<data></data>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>_Q12 to XQ12</string>
|
||||
<key>Count</key>
|
||||
<integer>1</integer>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>Find</key>
|
||||
<data>X1ExMg==</data>
|
||||
<key>Limit</key>
|
||||
<integer>0</integer>
|
||||
<key>Mask</key>
|
||||
<data></data>
|
||||
<key>OemTableId</key>
|
||||
<data></data>
|
||||
<key>Replace</key>
|
||||
<data>WFExMg==</data>
|
||||
<key>ReplaceMask</key>
|
||||
<data></data>
|
||||
<key>Skip</key>
|
||||
<integer>0</integer>
|
||||
<key>TableLength</key>
|
||||
<integer>0</integer>
|
||||
<key>TableSignature</key>
|
||||
<data></data>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Quirks</key>
|
||||
<dict>
|
||||
<key>FadtEnableReset</key>
|
||||
<false/>
|
||||
<key>NormalizeHeaders</key>
|
||||
<false/>
|
||||
<key>RebaseRegions</key>
|
||||
<false/>
|
||||
<key>ResetHwSig</key>
|
||||
<false/>
|
||||
<key>ResetLogoStatus</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Booter</key>
|
||||
<dict>
|
||||
<key>MmioWhitelist</key>
|
||||
<array/>
|
||||
<key>Quirks</key>
|
||||
<dict>
|
||||
<key>AvoidRuntimeDefrag</key>
|
||||
<true/>
|
||||
<key>DevirtualiseMmio</key>
|
||||
<false/>
|
||||
<key>DisableSingleUser</key>
|
||||
<false/>
|
||||
<key>DisableVariableWrite</key>
|
||||
<false/>
|
||||
<key>DiscardHibernateMap</key>
|
||||
<false/>
|
||||
<key>EnableSafeModeSlide</key>
|
||||
<true/>
|
||||
<key>EnableWriteUnprotector</key>
|
||||
<true/>
|
||||
<key>ForceExitBootServices</key>
|
||||
<false/>
|
||||
<key>ProtectMemoryRegions</key>
|
||||
<false/>
|
||||
<key>ProtectSecureBoot</key>
|
||||
<false/>
|
||||
<key>ProtectUefiServices</key>
|
||||
<false/>
|
||||
<key>ProvideCustomSlide</key>
|
||||
<true/>
|
||||
<key>ProvideMaxSlide</key>
|
||||
<integer>0</integer>
|
||||
<key>RebuildAppleMemoryMap</key>
|
||||
<false/>
|
||||
<key>SetupVirtualMap</key>
|
||||
<false/>
|
||||
<key>SignalAppleOS</key>
|
||||
<false/>
|
||||
<key>SyncRuntimePermissions</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>DeviceProperties</key>
|
||||
<dict>
|
||||
<key>Add</key>
|
||||
<dict>
|
||||
<key>PciRoot(0x1)/Pci(0x1F,0x0)</key>
|
||||
<dict>
|
||||
<key>compatible</key>
|
||||
<string>pci8086,2916</string>
|
||||
<key>device-id</key>
|
||||
<data>
|
||||
FikA
|
||||
</data>
|
||||
<key>name</key>
|
||||
<string>pci8086,2916</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Delete</key>
|
||||
<dict>
|
||||
<key>PciRoot(0x0)/Pci(0x1b,0x0)</key>
|
||||
<array>
|
||||
<string>MaximumBootBeepVolume</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Kernel</key>
|
||||
<dict>
|
||||
<key>Add</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>Any</string>
|
||||
<key>BundlePath</key>
|
||||
<string>VoodooHDA.kext</string>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/VoodooHDA</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>Lilu.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Patch engine</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/Lilu</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>12.0.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>VirtualSMC.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>SMC emulator</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/VirtualSMC</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>12.0.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>WhateverGreen.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Video patches</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/WhateverGreen</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>12.0.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BundlePath</key>
|
||||
<string>AGPMInjector.kext</string>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string></string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BundlePath</key>
|
||||
<string>USBPorts.kext</string>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string></string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>MCEReporterDisabler.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>AppleMCEReporter disabler</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>ExecutablePath</key>
|
||||
<string></string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>19.0.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Block</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>Any</string>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>Identifier</key>
|
||||
<string>com.apple.driver.AppleTyMCEDriver</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Emulate</key>
|
||||
<dict>
|
||||
<key>Cpuid1Data</key>
|
||||
<data>
|
||||
VAYFAAAAAAAAAAAAAAAAAA==
|
||||
</data>
|
||||
<key>Cpuid1Mask</key>
|
||||
<data>
|
||||
////AAAAAAAAAAAAAAAAAA==
|
||||
</data>
|
||||
</dict>
|
||||
<key>Force</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>Any</string>
|
||||
<key>BundlePath</key>
|
||||
<string>System/Library/Extensions/IONetworkingFamily.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Patch engine</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>Identifier</key>
|
||||
<string>com.apple.iokit.IONetworkingFamily</string>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/IONetworkingFamily</string>
|
||||
<key>MaxKernel</key>
|
||||
<string>13.99.99</string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Patch</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Base</key>
|
||||
<string>_cpu_topology_sort</string>
|
||||
<key>Comment</key>
|
||||
<string>algrey - cpu_topology_sort -disable _x86_validate_topology</string>
|
||||
<key>Count</key>
|
||||
<integer>1</integer>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Find</key>
|
||||
<data>
|
||||
6AAA//8=
|
||||
</data>
|
||||
<key>Identifier</key>
|
||||
<string>kernel</string>
|
||||
<key>Limit</key>
|
||||
<integer>0</integer>
|
||||
<key>Mask</key>
|
||||
<data>
|
||||
/wAA//8=
|
||||
</data>
|
||||
<key>MaxKernel</key>
|
||||
<string>20.99.99</string>
|
||||
<key>MinKernel</key>
|
||||
<string>17.0.0</string>
|
||||
<key>Replace</key>
|
||||
<data>
|
||||
Dx9EAAA=
|
||||
</data>
|
||||
<key>ReplaceMask</key>
|
||||
<data>
|
||||
</data>
|
||||
<key>Skip</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Base</key>
|
||||
<string></string>
|
||||
<key>Comment</key>
|
||||
<string>algrey - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN</string>
|
||||
<key>Count</key>
|
||||
<integer>1</integer>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Find</key>
|
||||
<data>
|
||||
MduAPQAAAAAGdQA=
|
||||
</data>
|
||||
<key>Identifier</key>
|
||||
<string>kernel</string>
|
||||
<key>Limit</key>
|
||||
<integer>0</integer>
|
||||
<key>Mask</key>
|
||||
<data>
|
||||
/////wAAAP///wA=
|
||||
</data>
|
||||
<key>MaxKernel</key>
|
||||
<string>20.99.99</string>
|
||||
<key>MinKernel</key>
|
||||
<string>17.0.0</string>
|
||||
<key>Replace</key>
|
||||
<data>
|
||||
u7xP6njpXQAAAJA=
|
||||
</data>
|
||||
<key>ReplaceMask</key>
|
||||
<data>
|
||||
</data>
|
||||
<key>Skip</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Quirks</key>
|
||||
<dict>
|
||||
<key>AppleCpuPmCfgLock</key>
|
||||
<false/>
|
||||
<key>AppleXcpmCfgLock</key>
|
||||
<false/>
|
||||
<key>AppleXcpmExtraMsrs</key>
|
||||
<false/>
|
||||
<key>AppleXcpmForceBoost</key>
|
||||
<false/>
|
||||
<key>CustomSMBIOSGuid</key>
|
||||
<false/>
|
||||
<key>DisableIoMapper</key>
|
||||
<false/>
|
||||
<key>DisableLinkeditJettison</key>
|
||||
<true/>
|
||||
<key>DisableRtcChecksum</key>
|
||||
<false/>
|
||||
<key>DummyPowerManagement</key>
|
||||
<true/>
|
||||
<key>ExternalDiskIcons</key>
|
||||
<false/>
|
||||
<key>IncreasePciBarSize</key>
|
||||
<false/>
|
||||
<key>LapicKernelPanic</key>
|
||||
<false/>
|
||||
<key>PanicNoKextDump</key>
|
||||
<false/>
|
||||
<key>PowerTimeoutKernelPanic</key>
|
||||
<false/>
|
||||
<key>ThirdPartyDrives</key>
|
||||
<false/>
|
||||
<key>XhciPortLimit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>Scheme</key>
|
||||
<dict>
|
||||
<key>FuzzyMatch</key>
|
||||
<true/>
|
||||
<key>KernelArch</key>
|
||||
<string>x86_64</string>
|
||||
<key>KernelCache</key>
|
||||
<string>Auto</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Misc</key>
|
||||
<dict>
|
||||
<key>BlessOverride</key>
|
||||
<array/>
|
||||
<key>Boot</key>
|
||||
<dict>
|
||||
<key>ConsoleAttributes</key>
|
||||
<integer>0</integer>
|
||||
<key>HibernateMode</key>
|
||||
<string>Auto</string>
|
||||
<key>HideAuxiliary</key>
|
||||
<false/>
|
||||
<key>PickerAttributes</key>
|
||||
<integer>1</integer>
|
||||
<key>PickerAudioAssist</key>
|
||||
<false/>
|
||||
<key>PickerMode</key>
|
||||
<string>External</string>
|
||||
<key>PollAppleHotKeys</key>
|
||||
<true/>
|
||||
<key>ShowPicker</key>
|
||||
<false/>
|
||||
<key>TakeoffDelay</key>
|
||||
<integer>0</integer>
|
||||
<key>Timeout</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>Debug</key>
|
||||
<dict>
|
||||
<key>AppleDebug</key>
|
||||
<false/>
|
||||
<key>ApplePanic</key>
|
||||
<false/>
|
||||
<key>DisableWatchDog</key>
|
||||
<false/>
|
||||
<key>DisplayDelay</key>
|
||||
<integer>0</integer>
|
||||
<key>DisplayLevel</key>
|
||||
<integer>2147483650</integer>
|
||||
<key>SerialInit</key>
|
||||
<false/>
|
||||
<key>SysReport</key>
|
||||
<false/>
|
||||
<key>Target</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>Entries</key>
|
||||
<array/>
|
||||
<key>Security</key>
|
||||
<dict>
|
||||
<key>AllowNvramReset</key>
|
||||
<true/>
|
||||
<key>AllowSetDefault</key>
|
||||
<false/>
|
||||
<key>ApECID</key>
|
||||
<integer>0</integer>
|
||||
<key>AuthRestart</key>
|
||||
<false/>
|
||||
<key>BootProtect</key>
|
||||
<string>None</string>
|
||||
<key>DmgLoading</key>
|
||||
<string>Signed</string>
|
||||
<key>EnablePassword</key>
|
||||
<false/>
|
||||
<key>ExposeSensitiveData</key>
|
||||
<integer>6</integer>
|
||||
<key>HaltLevel</key>
|
||||
<integer>2147483648</integer>
|
||||
<key>PasswordHash</key>
|
||||
<data></data>
|
||||
<key>PasswordSalt</key>
|
||||
<data></data>
|
||||
<key>ScanPolicy</key>
|
||||
<integer>0</integer>
|
||||
<key>SecureBootModel</key>
|
||||
<string>Disabled</string>
|
||||
<key>Vault</key>
|
||||
<string>Optional</string>
|
||||
</dict>
|
||||
<key>Tools</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Arguments</key>
|
||||
<string></string>
|
||||
<key>Auxiliary</key>
|
||||
<false/>
|
||||
<key>Comment</key>
|
||||
<string>Not signed for security reasons</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Name</key>
|
||||
<string>UEFI Shell</string>
|
||||
<key>Path</key>
|
||||
<string>OpenShell.efi</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arguments</key>
|
||||
<string>Shutdown</string>
|
||||
<key>Auxiliary</key>
|
||||
<true/>
|
||||
<key>Comment</key>
|
||||
<string>Perform shutdown</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
<key>Name</key>
|
||||
<string>Shutdown</string>
|
||||
<key>Path</key>
|
||||
<string>ResetSystem.efi</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>NVRAM</key>
|
||||
<dict>
|
||||
<key>Add</key>
|
||||
<dict>
|
||||
<key>4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14</key>
|
||||
<dict>
|
||||
<key>DefaultBackgroundColor</key>
|
||||
<data>AAAAAA==</data>
|
||||
<key>UIScale</key>
|
||||
<data>AQ==</data>
|
||||
</dict>
|
||||
<key>4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102</key>
|
||||
<dict>
|
||||
<key>rtc-blacklist</key>
|
||||
<data></data>
|
||||
</dict>
|
||||
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
|
||||
<dict>
|
||||
<key>SystemAudioVolume</key>
|
||||
<data>Rg==</data>
|
||||
<key>boot-args</key>
|
||||
<string>-v keepsyms=1 tlbto_us=0 vti=9</string>
|
||||
<key>run-efi-updater</key>
|
||||
<string>No</string>
|
||||
<key>csr-active-config</key>
|
||||
<data>ZwAAAA==</data>
|
||||
<key>prev-lang:kbd</key>
|
||||
<data>ZW4tVVM6MA==</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Delete</key>
|
||||
<dict>
|
||||
<key>4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14</key>
|
||||
<array>
|
||||
<string>UIScale</string>
|
||||
<string>DefaultBackgroundColor</string>
|
||||
</array>
|
||||
<key>4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102</key>
|
||||
<array>
|
||||
<string>rtc-blacklist</string>
|
||||
</array>
|
||||
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
|
||||
<array>
|
||||
<string>boot-args</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>LegacyEnable</key>
|
||||
<false/>
|
||||
<key>LegacyOverwrite</key>
|
||||
<false/>
|
||||
<key>LegacySchema</key>
|
||||
<dict>
|
||||
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
|
||||
<array>
|
||||
<string>EFILoginHiDPI</string>
|
||||
<string>EFIBluetoothDelay</string>
|
||||
<string>LocationServicesEnabled</string>
|
||||
<string>SystemAudioVolume</string>
|
||||
<string>SystemAudioVolumeDB</string>
|
||||
<string>SystemAudioVolumeSaved</string>
|
||||
<string>bluetoothActiveControllerInfo</string>
|
||||
<string>bluetoothInternalControllerInfo</string>
|
||||
<string>flagstate</string>
|
||||
<string>fmm-computer-name</string>
|
||||
<string>nvda_drv</string>
|
||||
<string>prev-lang:kbd</string>
|
||||
</array>
|
||||
<key>8BE4DF61-93CA-11D2-AA0D-00E098032B8C</key>
|
||||
<array>
|
||||
<string>Boot0080</string>
|
||||
<string>Boot0081</string>
|
||||
<string>Boot0082</string>
|
||||
<string>BootNext</string>
|
||||
<string>BootOrder</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>WriteFlash</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>PlatformInfo</key>
|
||||
<dict>
|
||||
<key>Automatic</key>
|
||||
<true/>
|
||||
<key>Generic</key>
|
||||
<dict>
|
||||
<key>AdviseWindows</key>
|
||||
<false/>
|
||||
<key>MLB</key>
|
||||
<string>{{BOARD_SERIAL}}</string>
|
||||
<key>ROM</key>
|
||||
<data>{{ROM}}</data>
|
||||
<key>SpoofVendor</key>
|
||||
<true/>
|
||||
<key>SystemProductName</key>
|
||||
<string>{{DEVICE_MODEL}}</string>
|
||||
<key>SystemSerialNumber</key>
|
||||
<string>{{SERIAL}}</string>
|
||||
<key>SystemUUID</key>
|
||||
<string>{{UUID}}</string>
|
||||
</dict>
|
||||
<key>UpdateDataHub</key>
|
||||
<true/>
|
||||
<key>UpdateNVRAM</key>
|
||||
<true/>
|
||||
<key>UpdateSMBIOS</key>
|
||||
<true/>
|
||||
<key>UpdateSMBIOSMode</key>
|
||||
<string>Create</string>
|
||||
</dict>
|
||||
<key>UEFI</key>
|
||||
<dict>
|
||||
<key>APFS</key>
|
||||
<dict>
|
||||
<key>EnableJumpstart</key>
|
||||
<true/>
|
||||
<key>GlobalConnect</key>
|
||||
<false/>
|
||||
<key>HideVerbose</key>
|
||||
<false/>
|
||||
<key>JumpstartHotPlug</key>
|
||||
<true/>
|
||||
<key>MinDate</key>
|
||||
<integer>0</integer>
|
||||
<key>MinVersion</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>Audio</key>
|
||||
<dict>
|
||||
<key>AudioCodec</key>
|
||||
<integer>0</integer>
|
||||
<key>AudioDevice</key>
|
||||
<string>PciRoot(0x1)/Pci(0x1,0x0)/Pci(0x0,0x1)</string>
|
||||
<key>AudioOut</key>
|
||||
<integer>0</integer>
|
||||
<key>AudioSupport</key>
|
||||
<false/>
|
||||
<key>MinimumVolume</key>
|
||||
<integer>20</integer>
|
||||
<key>PlayChime</key>
|
||||
<false/>
|
||||
<key>VolumeAmplifier</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>ConnectDrivers</key>
|
||||
<true/>
|
||||
<key>Drivers</key>
|
||||
<array>
|
||||
<string>VBoxHfs.efi</string>
|
||||
<string>OpenRuntime.efi</string>
|
||||
<string>OpenCanopy.efi</string>
|
||||
<string>#AudioDxe.efi</string>
|
||||
<string>#OpenUsbKbDxe.efi</string>
|
||||
<string>#UsbMouseDxe.efi</string>
|
||||
<string>#Ps2KeyboardDxe.efi</string>
|
||||
<string>#Ps2MouseDxe.efi</string>
|
||||
<string>#HiiDatabase.efi</string>
|
||||
<string>#NvmExpressDxe.efi</string>
|
||||
<string>#XhciDxe.efi</string>
|
||||
<string>#ExFatDxe.efi</string>
|
||||
<string>#PartitionDxe.efi</string>
|
||||
<string>#CrScreenshotDxe.efi</string>
|
||||
</array>
|
||||
<key>Input</key>
|
||||
<dict>
|
||||
<key>KeyFiltering</key>
|
||||
<false/>
|
||||
<key>KeyForgetThreshold</key>
|
||||
<integer>5</integer>
|
||||
<key>KeyMergeThreshold</key>
|
||||
<integer>2</integer>
|
||||
<key>KeySupport</key>
|
||||
<true/>
|
||||
<key>KeySupportMode</key>
|
||||
<string>Auto</string>
|
||||
<key>KeySwap</key>
|
||||
<false/>
|
||||
<key>PointerSupport</key>
|
||||
<false/>
|
||||
<key>PointerSupportMode</key>
|
||||
<string>ASUS</string>
|
||||
<key>TimerResolution</key>
|
||||
<integer>50000</integer>
|
||||
</dict>
|
||||
<key>Output</key>
|
||||
<dict>
|
||||
<key>ClearScreenOnModeSwitch</key>
|
||||
<false/>
|
||||
<key>ConsoleMode</key>
|
||||
<string></string>
|
||||
<key>DirectGopRendering</key>
|
||||
<false/>
|
||||
<key>IgnoreTextInGraphics</key>
|
||||
<false/>
|
||||
<key>ProvideConsoleGop</key>
|
||||
<true/>
|
||||
<key>ReconnectOnResChange</key>
|
||||
<false/>
|
||||
<key>ReplaceTabWithSpace</key>
|
||||
<false/>
|
||||
<key>Resolution</key>
|
||||
<string>{{WIDTH}}x{{HEIGHT}}@32</string>
|
||||
<key>SanitiseClearScreen</key>
|
||||
<false/>
|
||||
<key>TextRenderer</key>
|
||||
<string>BuiltinGraphics</string>
|
||||
<key>UgaPassThrough</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>ProtocolOverrides</key>
|
||||
<dict>
|
||||
<key>AppleAudio</key>
|
||||
<false/>
|
||||
<key>AppleBootPolicy</key>
|
||||
<false/>
|
||||
<key>AppleDebugLog</key>
|
||||
<false/>
|
||||
<key>AppleEvent</key>
|
||||
<false/>
|
||||
<key>AppleFramebufferInfo</key>
|
||||
<false/>
|
||||
<key>AppleImageConversion</key>
|
||||
<false/>
|
||||
<key>AppleImg4Verification</key>
|
||||
<false/>
|
||||
<key>AppleKeyMap</key>
|
||||
<false/>
|
||||
<key>AppleRtcRam</key>
|
||||
<false/>
|
||||
<key>AppleSecureBoot</key>
|
||||
<false/>
|
||||
<key>AppleSmcIo</key>
|
||||
<false/>
|
||||
<key>AppleUserInterfaceTheme</key>
|
||||
<false/>
|
||||
<key>DataHub</key>
|
||||
<false/>
|
||||
<key>DeviceProperties</key>
|
||||
<false/>
|
||||
<key>FirmwareVolume</key>
|
||||
<false/>
|
||||
<key>HashServices</key>
|
||||
<false/>
|
||||
<key>OSInfo</key>
|
||||
<false/>
|
||||
<key>UnicodeCollation</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>Quirks</key>
|
||||
<dict>
|
||||
<key>ExitBootServicesDelay</key>
|
||||
<integer>0</integer>
|
||||
<key>IgnoreInvalidFlexRatio</key>
|
||||
<false/>
|
||||
<key>ReleaseUsbOwnership</key>
|
||||
<false/>
|
||||
<key>RequestBootVarRouting</key>
|
||||
<true/>
|
||||
<key>TscSyncTimeout</key>
|
||||
<integer>0</integer>
|
||||
<key>UnblockFsConnect</key>
|
||||
<true/>
|
||||
<key>ConnectDrivers</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
270
generate-specific-bootdisk.sh
Executable file
270
generate-specific-bootdisk.sh
Executable file
@ -0,0 +1,270 @@
|
||||
#!/bin/bash
|
||||
# ___ _____ __ ___ _ _ ___ _
|
||||
# / _ \/ __\ \/ / / __| ___ _ _(_)__ _| | / __|___ _ _ ___ _ _ __ _| |_ ___ _ _
|
||||
# | (_) \__ \> < \__ \/ -_) '_| / _` | | | (_ / -_) ' \/ -_) '_/ _` | _/ _ \ '_|
|
||||
# \___/|___/_/\_\ |___/\___|_| |_\__,_|_| \___\___|_||_\___|_| \__,_|\__\___/_|
|
||||
#
|
||||
# Repo: https://github.com/sickcodes/osx-serial-generator/
|
||||
# Title: OSX Serial Generator
|
||||
# Author: Sick.Codes https://sick.codes/
|
||||
# Version: 3.1
|
||||
# License: GPLv3+
|
||||
|
||||
set -e
|
||||
|
||||
help_text="Usage: ./generate-specific-bootdisk.sh
|
||||
|
||||
Required options:
|
||||
--model <string> Device model, e.g. 'iMacPro1,1'
|
||||
--serial <string> Device Serial number
|
||||
--board-serial <string> Main Logic Board Serial number (MLB)
|
||||
--uuid <string> SMBIOS UUID (SmUUID)
|
||||
--mac-address <string> Used for both the MAC address and to set ROM
|
||||
ROM is lowercased sans any colons
|
||||
Optional options:
|
||||
--width <integer> Resolution x axis length in px, default 1920
|
||||
--height <integer> Resolution y axis length in px, default 1080
|
||||
--master-plist-url <url> Specify an alternative master plist, via URL
|
||||
--custom-plist <filename>
|
||||
|| --master-plist <filename> Optionally change the input plist.
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--output-plist <filename> Optionally change the output plist filename
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}},
|
||||
{{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
|
||||
Example:
|
||||
./generate-specific-bootdisk.sh \\
|
||||
--model iMacPro1,1 \\
|
||||
--serial C02TW0WAHX87 \\
|
||||
--board-serial C027251024NJG36UE \\
|
||||
--uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \\
|
||||
--mac-address A8:5C:2C:9A:46:2F \\
|
||||
--output-bootdisk ./OpenCore-nopicker.qcow2 \\
|
||||
--width 1920 \\
|
||||
--height 1080
|
||||
|
||||
Author: Sick.Codes https://sick.codes/
|
||||
Project: https://github.com/sickcodes/osx-serial-generator/
|
||||
License: GPLv3+
|
||||
"
|
||||
|
||||
OPENCORE_IMAGE_MAKER_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/opencore-image-ng.sh'
|
||||
MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist'
|
||||
|
||||
# gather arguments
|
||||
while (( "$#" )); do
|
||||
case "${1}" in
|
||||
|
||||
--help | -h | h | help )
|
||||
echo "${help_text}" && exit 0
|
||||
;;
|
||||
|
||||
--model=* | -m=* )
|
||||
export DEVICE_MODEL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--model* | -m* )
|
||||
export DEVICE_MODEL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--serial=* )
|
||||
export SERIAL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--serial* )
|
||||
export SERIAL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--board-serial=* )
|
||||
export BOARD_SERIAL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--board-serial* )
|
||||
export BOARD_SERIAL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--uuid=* )
|
||||
export UUID="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--uuid* )
|
||||
export UUID="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--mac-address=* )
|
||||
export MAC_ADDRESS="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--mac-address* )
|
||||
export MAC_ADDRESS="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--width=* )
|
||||
export WIDTH="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--width* )
|
||||
export WIDTH="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--height=* )
|
||||
export HEIGHT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--height* )
|
||||
export HEIGHT="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--output-bootdisk=* )
|
||||
export OUTPUT_QCOW="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--output-bootdisk* )
|
||||
export OUTPUT_QCOW="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--output-plist=* )
|
||||
export OUTPUT_PLIST="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--output-plist* )
|
||||
export OUTPUT_PLIST="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist-url=* )
|
||||
export MASTER_PLIST_URL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist-url* )
|
||||
export MASTER_PLIST_URL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist=* )
|
||||
export MASTER_PLIST="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--master-plist* )
|
||||
export MASTER_PLIST="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--custom-plist=* )
|
||||
export MASTER_PLIST="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--custom-plist* )
|
||||
export MASTER_PLIST="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option ${1}. Running with default values..."
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
download_qcow_efi_folder () {
|
||||
[ -d ./OSX-KVM ] || git clone --depth 1 https://github.com/kholia/OSX-KVM.git
|
||||
cp -ra ./OSX-KVM/OpenCore-Catalina/EFI .
|
||||
mkdir -p ./EFI/OC/Resources
|
||||
# clone some Apple drivers
|
||||
[ -d ./OcBinaryData ] || git clone --depth 1 https://github.com/acidanthera/OcBinaryData.git
|
||||
# copy said drivers into EFI/OC/Resources
|
||||
cp -a ./OcBinaryData/Resources/* ./EFI/OC/Resources
|
||||
# EFI Shell commands
|
||||
touch startup.nsh \
|
||||
&& echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh
|
||||
}
|
||||
|
||||
generate_bootdisk () {
|
||||
|
||||
# need a config.plist
|
||||
if [ "${MASTER_PLIST}" ]; then
|
||||
[ -e "${MASTER_PLIST}" ] || echo "Could not find: ${MASTER_PLIST}"
|
||||
elif [ "${MASTER_PLIST}" ] && [ "${MASTER_PLIST_URL}" ]; then
|
||||
echo 'You specified both a custom plist FILE & custom plist URL.'
|
||||
echo 'Use only one of those options.'
|
||||
elif [ "${MASTER_PLIST_URL}" ]; then
|
||||
wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
else
|
||||
# default is config-nopicker-custom.plist from OSX-KVM with placeholders used in Docker-OSX
|
||||
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
fi
|
||||
|
||||
[ -e ./opencore-image-ng.sh ] \
|
||||
|| { wget "${OPENCORE_IMAGE_MAKER_URL}" \
|
||||
&& chmod +x opencore-image-ng.sh ; }
|
||||
|
||||
# plist required for bootdisks, so create anyway.
|
||||
if [ "${DEVICE_MODEL}" ] \
|
||||
&& [ "${SERIAL}" ] \
|
||||
&& [ "${BOARD_SERIAL}" ] \
|
||||
&& [ "${UUID}" ] \
|
||||
&& [ "${MAC_ADDRESS}" ]; then
|
||||
ROM="${MAC_ADDRESS//\:/}"
|
||||
ROM="${ROM,,}"
|
||||
sed -e s/\{\{DEVICE_MODEL\}\}/"${DEVICE_MODEL}"/g \
|
||||
-e s/\{\{SERIAL\}\}/"${SERIAL}"/g \
|
||||
-e s/\{\{BOARD_SERIAL\}\}/"${BOARD_SERIAL}"/g \
|
||||
-e s/\{\{UUID\}\}/"${UUID}"/g \
|
||||
-e s/\{\{ROM\}\}/"${ROM}"/g \
|
||||
-e s/\{\{WIDTH\}\}/"${WIDTH:-1920}"/g \
|
||||
-e s/\{\{HEIGHT\}\}/"${HEIGHT:-1080}"/g \
|
||||
"${MASTER_PLIST}" > ./tmp.config.plist || exit 1
|
||||
else
|
||||
cat <<EOF && exit 1
|
||||
Error: one of the following values is missing:
|
||||
|
||||
--model "${DEVICE_MODEL:-MISSING}"
|
||||
--serial "${SERIAL:-MISSING}"
|
||||
--board-serial "${BOARD_SERIAL:-MISSING}"
|
||||
--uuid "${UUID:-MISSING}"
|
||||
--mac-address "${MAC_ADDRESS:-MISSING}"
|
||||
|
||||
--width "${WIDTH:-1920}"
|
||||
--height "${HEIGHT:-1080}"
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
./opencore-image-ng.sh \
|
||||
--cfg "./tmp.config.plist" \
|
||||
--img "${OUTPUT_QCOW:-./${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
|
||||
rm ./tmp.config.plist
|
||||
|
||||
}
|
||||
|
||||
main () {
|
||||
download_qcow_efi_folder
|
||||
generate_bootdisk
|
||||
}
|
||||
|
||||
main
|
||||
|
372
generate-unique-machine-values.sh
Executable file
372
generate-unique-machine-values.sh
Executable file
@ -0,0 +1,372 @@
|
||||
#!/bin/bash
|
||||
# ___ _____ __ ___ _ _ ___ _
|
||||
# / _ \/ __\ \/ / / __| ___ _ _(_)__ _| | / __|___ _ _ ___ _ _ __ _| |_ ___ _ _
|
||||
# | (_) \__ \> < \__ \/ -_) '_| / _` | | | (_ / -_) ' \/ -_) '_/ _` | _/ _ \ '_|
|
||||
# \___/|___/_/\_\ |___/\___|_| |_\__,_|_| \___\___|_||_\___|_| \__,_|\__\___/_|
|
||||
#
|
||||
# Repo: https://github.com/sickcodes/osx-serial-generator/
|
||||
# Title: OSX Serial Generator
|
||||
# Author: Sick.Codes https://sick.codes/
|
||||
# Version: 3.1
|
||||
# License: GPLv3+
|
||||
|
||||
set -e
|
||||
|
||||
help_text="Usage: ./generate-unique-machine-values.sh
|
||||
|
||||
General options:
|
||||
--count, -n, -c <count> Number of serials to generate
|
||||
--model, -m <model> Device model, e.g. 'iMacPro1,1'
|
||||
--csv <filename> Optionally change the CSV output filename
|
||||
--tsv <filename> Optionally change the TSV output filename
|
||||
--output-dir <directory> Optionally change the script output location
|
||||
--width <string> Resolution x axis length in px, default 1920
|
||||
--height <string> Resolution y axis length in px, default 1080
|
||||
--master-plist-url <url> Specify an alternative master plist, via URL
|
||||
--master-plist <filename> Optionally change the input plist
|
||||
--custom-plist <filename> Same as --master-plist
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--envs Create all corresponding sourcable envs
|
||||
--plists Create all corresponding config.plists
|
||||
--bootdisks Create all corresponding bootdisks [SLOW]
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Additional options only if you are creating ONE serial set:
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--output-env <filename> Optionally change the serials env filename
|
||||
|
||||
Custom plist placeholders:
|
||||
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
|
||||
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
|
||||
Example:
|
||||
./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
|
||||
|
||||
Defaults:
|
||||
- One serial, for 'iMacPro1,1', in the current working directory
|
||||
- CSV and TSV output
|
||||
- plists in ./plists/ & bootdisks in ./bootdisks/ & envs in ./envs
|
||||
- if you set --bootdisk name, --bootdisks is assumed
|
||||
- if you set --custom-plist, --plists is assumed
|
||||
- if you set --output-env, --envs is assumed
|
||||
|
||||
Author: Sick.Codes https://sick.codes/
|
||||
Project: https://github.com/sickcodes/osx-serial-generator/
|
||||
License: GPLv3+
|
||||
"
|
||||
|
||||
OPENCORE_IMAGE_MAKER_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/opencore-image-ng.sh'
|
||||
MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist'
|
||||
|
||||
# gather arguments
|
||||
while (( "$#" )); do
|
||||
case "${1}" in
|
||||
|
||||
--help | -h | h | help )
|
||||
echo "${help_text}" && exit 0
|
||||
;;
|
||||
|
||||
--count=* | -c=* | -n=* )
|
||||
export SERIAL_SET_COUNT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--count* | -c* | -n* )
|
||||
export SERIAL_SET_COUNT="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--csv=* )
|
||||
export CSV_OUTPUT_FILENAME="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--csv* )
|
||||
export CSV_OUTPUT_FILENAME="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--tsv=* )
|
||||
export TSV_OUTPUT_FILENAME="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--tsv* )
|
||||
export TSV_OUTPUT_FILENAME="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--output-dir=* )
|
||||
export OUTPUT_DIRECTORY="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--output-dir* )
|
||||
export OUTPUT_DIRECTORY="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--output-bootdisk=* )
|
||||
export OUTPUT_BOOTDISK="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--output-bootdisk* )
|
||||
export OUTPUT_BOOTDISK="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--output-env=* )
|
||||
export OUTPUT_ENV="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--output-env* )
|
||||
export OUTPUT_ENV="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--model=* | -m=* )
|
||||
export DEVICE_MODEL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--model* | -m* )
|
||||
export DEVICE_MODEL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--width=* )
|
||||
export WIDTH="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--width* )
|
||||
export WIDTH="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--height=* )
|
||||
export HEIGHT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--height* )
|
||||
export HEIGHT="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist-url=* )
|
||||
export MASTER_PLIST_URL="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist-url* )
|
||||
export MASTER_PLIST_URL="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist=* )
|
||||
export MASTER_PLIST="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--master-plist* )
|
||||
export MASTER_PLIST="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--custom-plist=* )
|
||||
export MASTER_PLIST="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--custom-plist* )
|
||||
export MASTER_PLIST="${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
--plists )
|
||||
export CREATE_PLISTS=1
|
||||
shift
|
||||
;;
|
||||
--bootdisks )
|
||||
export CREATE_BOOTDISKS=1
|
||||
shift
|
||||
;;
|
||||
--envs )
|
||||
export CREATE_ENVS=1
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option. Running with default values..."
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
build_mac_serial () {
|
||||
[ -d ./OpenCorePkg ] || git clone --depth 1 https://github.com/acidanthera/OpenCorePkg.git
|
||||
make -C ./OpenCorePkg/Utilities/macserial/
|
||||
mv ./OpenCorePkg/Utilities/macserial/macserial .
|
||||
chmod +x ./macserial
|
||||
stat ./macserial
|
||||
}
|
||||
|
||||
download_vendor_mac_addresses () {
|
||||
# download the MAC Address vendor list
|
||||
[ -e "${MAC_ADDRESSES_FILE:=vendor_macs.tsv}" ] || wget -O "${MAC_ADDRESSES_FILE}" https://gitlab.com/wireshark/wireshark/-/raw/master/manuf
|
||||
}
|
||||
|
||||
download_qcow_efi_folder () {
|
||||
[ -d ./OSX-KVM ] || git clone --depth 1 https://github.com/kholia/OSX-KVM.git
|
||||
cp -ra ./OSX-KVM/OpenCore-Catalina/EFI .
|
||||
mkdir -p ./EFI/OC/Resources
|
||||
# clone some Apple drivers
|
||||
[ -d ./OcBinaryData ] || git clone --depth 1 https://github.com/acidanthera/OcBinaryData.git
|
||||
# copy said drivers into EFI/OC/Resources
|
||||
cp -a ./OcBinaryData/Resources/* ./EFI/OC/Resources
|
||||
# EFI Shell commands
|
||||
touch startup.nsh && echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh
|
||||
}
|
||||
|
||||
|
||||
generate_serial_sets () {
|
||||
|
||||
|
||||
|
||||
if [ "${CSV_OUTPUT_FILENAME}" ]; then
|
||||
[ "${CSV_OUTPUT_FILENAME}" ] && export CSV_SERIAL_SETS_FILE="${CSV_OUTPUT_FILENAME}"
|
||||
elif [ "${TSV_OUTPUT_FILENAME}" ]; then
|
||||
[ "${TSV_OUTPUT_FILENAME}" ] && export TSV_SERIAL_SETS_FILE="${TSV_OUTPUT_FILENAME}"
|
||||
else
|
||||
export CSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.csv"
|
||||
export TSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.tsv"
|
||||
fi
|
||||
|
||||
./macserial \
|
||||
--num "${SERIAL_SET_COUNT}" \
|
||||
--model "${DEVICE_MODEL}" \
|
||||
| while IFS='\ \|\ ' read -r SERIAL BOARD_SERIAL; do
|
||||
# make a uuid...
|
||||
UUID="$(uuidgen)"
|
||||
UUID="${UUID^^}"
|
||||
|
||||
# get a random vendor specific MAC address.
|
||||
RANDOM_MAC_PREFIX="$(grep -e "${VENDOR_REGEX}" < "${MAC_ADDRESSES_FILE:=vendor_macs.tsv}" | sort --random-sort | head -n1)"
|
||||
RANDOM_MAC_PREFIX="$(cut -d$'\t' -f1 <<< "${RANDOM_MAC_PREFIX}")"
|
||||
MAC_ADDRESS="$(printf "${RANDOM_MAC_PREFIX}:%02X:%02X:%02X" $[RANDOM%256] $[RANDOM%256] $[RANDOM%256])"
|
||||
|
||||
[ -z "${WIDTH}" ] && WIDTH=1920
|
||||
[ -z "${HEIGHT}" ] && HEIGHT=1080
|
||||
|
||||
# append to csv file
|
||||
cat <<EOF >> "${CSV_SERIAL_SETS_FILE}"
|
||||
"${DEVICE_MODEL}","${SERIAL}","${BOARD_SERIAL}","${UUID}","${MAC_ADDRESS}","${WIDTH}","${HEIGHT}"
|
||||
EOF
|
||||
echo "Wrote CSV to: ${CSV_SERIAL_SETS_FILE}"
|
||||
|
||||
# append to tsv file
|
||||
T=$'\t'
|
||||
cat <<EOF >> "${TSV_SERIAL_SETS_FILE}"
|
||||
${DEVICE_MODEL}${T}${SERIAL}${T}${BOARD_SERIAL}${T}${UUID}${T}${MAC_ADDRESS}${T}${WIDTH}${T}${HEIGHT}
|
||||
EOF
|
||||
echo "Wrote CSV to: ${TSV_SERIAL_SETS_FILE}"
|
||||
|
||||
# make envs if --envs, but also if you set the env filename it will switch on by itself
|
||||
if [ "${CREATE_ENVS}" ] || [ "${OUTPUT_ENV}" ]; then
|
||||
mkdir -p "${OUTPUT_DIRECTORY}/envs"
|
||||
OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}"
|
||||
touch "${OUTPUT_ENV_FILE}"
|
||||
cat <<EOF > "${OUTPUT_ENV_FILE}"
|
||||
export DEVICE_MODEL="${DEVICE_MODEL}"
|
||||
export SERIAL="${SERIAL}"
|
||||
export BOARD_SERIAL="${BOARD_SERIAL}"
|
||||
export UUID="${UUID}"
|
||||
export MAC_ADDRESS="${MAC_ADDRESS}"
|
||||
export WIDTH="${WIDTH}"
|
||||
export HEIGHT="${HEIGHT}"
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
# plist required for bootdisks, so create anyway.
|
||||
if [ "${CREATE_PLISTS}" ] || [ "${CREATE_BOOTDISKS}" ]; then
|
||||
|
||||
# need a config.plist
|
||||
if [ "${MASTER_PLIST}" ]; then
|
||||
[ -e "${MASTER_PLIST}" ] || echo "Could not find: ${MASTER_PLIST}"
|
||||
elif [ "${MASTER_PLIST}" ] && [ "${MASTER_PLIST_URL}" ]; then
|
||||
echo 'You specified both a custom plist FILE & custom plist URL.'
|
||||
echo 'Use only one of those options.'
|
||||
elif [ "${MASTER_PLIST_URL}" ]; then
|
||||
wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
else
|
||||
# default is config-nopicker-custom.plist from OSX-KVM with placeholders used in Docker-OSX
|
||||
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
fi
|
||||
|
||||
mkdir -p "${OUTPUT_DIRECTORY}/plists"
|
||||
source "${OUTPUT_ENV_FILE}"
|
||||
ROM_VALUE="${MAC_ADDRESS//\:/}"
|
||||
ROM_VALUE="${ROM_VALUE,,}"
|
||||
sed -e s/\{\{DEVICE_MODEL\}\}/"${DEVICE_MODEL}"/g \
|
||||
-e s/\{\{SERIAL\}\}/"${SERIAL}"/g \
|
||||
-e s/\{\{BOARD_SERIAL\}\}/"${BOARD_SERIAL}"/g \
|
||||
-e s/\{\{UUID\}\}/"${UUID}"/g \
|
||||
-e s/\{\{ROM\}\}/"${ROM}"/g \
|
||||
-e s/\{\{WIDTH\}\}/"${WIDTH}"/g \
|
||||
-e s/\{\{HEIGHT\}\}/"${HEIGHT}"/g \
|
||||
"${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
|
||||
fi
|
||||
|
||||
# make bootdisk qcow2 format if --bootdisks, but also if you set the bootdisk filename
|
||||
if [ "${CREATE_BOOTDISKS}" ] || [ "${OUTPUT_BOOTDISK}" ]; then
|
||||
[ -e ./opencore-image-ng.sh ] \
|
||||
|| { wget "${OPENCORE_IMAGE_MAKER_URL}" \
|
||||
&& chmod +x opencore-image-ng.sh ; }
|
||||
mkdir -p "${OUTPUT_DIRECTORY}/bootdisks"
|
||||
./opencore-image-ng.sh \
|
||||
--cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \
|
||||
--img "${OUTPUT_BOOTDISK:-${OUTPUT_DIRECTORY}/bootdisks/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
[ -e "${CSV_SERIAL_SETS_FILE}" ] && \
|
||||
cat <(echo "DEVICE_MODEL,SERIAL,BOARD_SERIAL,UUID,MAC_ADDRESS,WIDTH,HEIGHT") "${CSV_SERIAL_SETS_FILE}"
|
||||
|
||||
|
||||
[ -e "${TSV_SERIAL_SETS_FILE}" ] && \
|
||||
cat <(printf "DEVICE_MODEL\tSERIAL\tBOARD_SERIAL\tUUID\tMAC_ADDRESS\tWIDTH\tHEIGHT\n") "${TSV_SERIAL_SETS_FILE}"
|
||||
|
||||
}
|
||||
|
||||
main () {
|
||||
# setting default variables if there are no options
|
||||
export DATE_NOW="$(date +%F-%T)"
|
||||
export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}"
|
||||
export VENDOR_REGEX="${VENDOR_REGEX:=Apple, Inc.}"
|
||||
export SERIAL_SET_COUNT="${SERIAL_SET_COUNT:=1}"
|
||||
export OUTPUT_DIRECTORY="${OUTPUT_DIRECTORY:=.}"
|
||||
cat <<EOF
|
||||
DEVICE_MODEL: ${DEVICE_MODEL}
|
||||
SERIAL_SET_COUNT: ${SERIAL_SET_COUNT}
|
||||
OUTPUT_DIRECTORY: ${OUTPUT_DIRECTORY}
|
||||
EOF
|
||||
[ -d "${OUTPUT_DIRECTORY}" ] || mkdir -p "${OUTPUT_DIRECTORY}"
|
||||
[ -e ./macserial ] || build_mac_serial
|
||||
download_vendor_mac_addresses
|
||||
download_qcow_efi_folder
|
||||
generate_serial_sets
|
||||
echo "${SERIAL_SETS_FILE}"
|
||||
}
|
||||
|
||||
main
|
||||
|
164
opencore-image-ng.sh
Executable file
164
opencore-image-ng.sh
Executable file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# https://github.com/kraxel/imagefish
|
||||
|
||||
######################################################################
|
||||
# defaults
|
||||
|
||||
iso=""
|
||||
img=""
|
||||
cfg=""
|
||||
|
||||
######################################################################
|
||||
# create work dir
|
||||
|
||||
function msg() {
|
||||
local txt="$1"
|
||||
local bold="\x1b[1m"
|
||||
local normal="\x1b[0m"
|
||||
echo -e "${bold}### ${txt}${normal}"
|
||||
}
|
||||
|
||||
function do_cleanup() {
|
||||
msg "cleaning up ..."
|
||||
if test "$GUESTFISH_PID" != ""; then
|
||||
guestfish --remote -- exit >/dev/null 2>&1 || true
|
||||
fi
|
||||
sudo rm -rf "$WORK"
|
||||
}
|
||||
|
||||
WORK="${TMPDIR-/var/tmp}/${0##*/}-$$"
|
||||
mkdir "$WORK" || exit 1
|
||||
trap 'do_cleanup' EXIT
|
||||
|
||||
BASE="$(dirname $0)"
|
||||
|
||||
######################################################################
|
||||
# parse args
|
||||
|
||||
function print_help() {
|
||||
cat <<EOF
|
||||
usage: $0 [ options ]
|
||||
options:
|
||||
--iso <iso-image>
|
||||
--img <disk-image>
|
||||
--cfg <clover-config>
|
||||
EOF
|
||||
}
|
||||
|
||||
while test "$1" != ""; do
|
||||
case "$1" in
|
||||
--iso)
|
||||
iso="$2"
|
||||
shift; shift
|
||||
;;
|
||||
--img)
|
||||
img="$2"
|
||||
shift; shift
|
||||
;;
|
||||
--cfg)
|
||||
cfg="$2"
|
||||
shift; shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
######################################################################
|
||||
# guestfish script helpers
|
||||
|
||||
function fish() {
|
||||
echo "#" "$@"
|
||||
guestfish --remote -- "$@" || exit 1
|
||||
}
|
||||
|
||||
function fish_init() {
|
||||
local format
|
||||
|
||||
case "$img" in
|
||||
*.raw) format="raw" ;;
|
||||
*) format="qcow2";;
|
||||
esac
|
||||
|
||||
msg "creating and adding disk image"
|
||||
fish disk-create $img $format 384M
|
||||
fish add $img
|
||||
fish run
|
||||
}
|
||||
|
||||
function fish_fini() {
|
||||
fish umount-all
|
||||
}
|
||||
|
||||
# disabled by @sickcodes to allow unattended image overwrites
|
||||
######################################################################
|
||||
# sanity checks
|
||||
|
||||
# if test ! -f "$cfg"; then
|
||||
# echo "ERROR: cfg not found: $cfg"
|
||||
# exit 1
|
||||
# fi
|
||||
# if test -f "$img"; then
|
||||
# if test "$allow_override" = "yes"; then
|
||||
# rm -f "$img"
|
||||
# else
|
||||
# echo "ERROR: image exists: $img"
|
||||
# exit 1
|
||||
# fi
|
||||
# fi
|
||||
|
||||
######################################################################
|
||||
# go!
|
||||
|
||||
msg "copy files from local folder"
|
||||
BASE="$(dirname $0)"
|
||||
cp -a $BASE/EFI $WORK
|
||||
find "$WORK"
|
||||
|
||||
#msg "[debug] list drivers in EFI/OC"
|
||||
#(cd $WORK/EFI/OC; find driver* -print)
|
||||
|
||||
export LIBGUESTFS_BACKEND=direct
|
||||
eval $(guestfish --listen)
|
||||
if test "$GUESTFISH_PID" = ""; then
|
||||
echo "ERROR: starting guestfish failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fish_init
|
||||
|
||||
msg "partition disk image"
|
||||
fish part-init /dev/sda gpt
|
||||
fish part-add /dev/sda p 2048 300000
|
||||
fish part-add /dev/sda p 302048 -2048
|
||||
fish part-set-gpt-type /dev/sda 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||
fish part-set-bootable /dev/sda 1 true
|
||||
fish mkfs vfat /dev/sda1 label:EFI
|
||||
fish mkfs vfat /dev/sda2 label:OpenCoreBoo
|
||||
fish mount /dev/sda2 /
|
||||
fish mkdir /ESP
|
||||
fish mount /dev/sda1 /ESP
|
||||
|
||||
msg "copy files to disk image"
|
||||
cp -v "$cfg" $WORK/config.plist
|
||||
fish mkdir /ESP/EFI
|
||||
fish mkdir /ESP/EFI/OC
|
||||
fish mkdir /ESP/EFI/OC/Kexts
|
||||
fish mkdir /ESP/EFI/OC/ACPI
|
||||
fish mkdir /ESP/EFI/OC/Resources
|
||||
fish mkdir /ESP/EFI/OC/Tools
|
||||
fish copy-in $WORK/EFI/BOOT /ESP/EFI
|
||||
fish copy-in $WORK/EFI/OC/OpenCore.efi /ESP/EFI/OC
|
||||
fish copy-in $WORK/EFI/OC/Drivers /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Kexts /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/ACPI /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Resources /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Tools /ESP/EFI/OC/
|
||||
|
||||
# Note
|
||||
fish copy-in startup.nsh /
|
||||
|
||||
BASE="$(dirname $0)"
|
||||
fish copy-in "$WORK/config.plist" /ESP/EFI/OC/
|
||||
|
||||
fish find /ESP/
|
||||
fish_fini
|
Loading…
Reference in New Issue
Block a user