54 Commits

Author SHA1 Message Date
4a89aab5d5 CREDIT: @TheHackerCoding Typo in README.md #194 2021-03-15 19:28:02 +00:00
e9dc4aa0c2 4.2 Switch to using custom-plist at runtime. Allow -v -v plist:/plist plus -e MASTER_PLIST=/plist or -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist 2021-03-15 19:23:18 +00:00
7c633bc810 Merge pull request #194 from TheHackerCoding/master 2021-03-15 11:46:57 +00:00
79a2c10287 Update README.md 2021-03-15 07:39:17 -04:00
1a10562b01 Merge pull request #189 from sickcodes/low-ram-bug 2021-03-14 12:20:58 +00:00
502457528a Propose RAM default to 2G instead of 8G
Alternative, calc at runtime?

Perhaps
```
-e RAM=auto \
```
```
RAM=${RAM:-$(("$(head -n1 /proc/meminfo | tr -dc '[:digit:]') / 900000"))}000 \
exec qemu-system-x86_64 -m ${RAM} \
```
2021-03-14 12:10:14 +00:00
5657d4230a Update issue templates 2021-03-14 09:59:30 +00:00
5fc2b8b263 Update issue templates 2021-03-14 09:55:22 +00:00
2295eef68f How to mount additional disks inside OSX 2021-03-12 17:58:33 +00:00
b57d94c2e1 Update issue-template.md 2021-03-10 22:23:31 +00:00
1d52a5a106 Fix redundant documentation 2021-03-09 22:06:35 +00:00
c7efa930c7 Merge pull request #173 from sickcodes/touch-before-chown
sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${…
2021-03-10 03:35:48 +07:00
e4c0b64200 FIRST: sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2021-03-09 20:34:09 +00:00
8cd84276a3 Add temporary folder for hardlinks ./custom 2021-03-09 20:00:40 +00:00
9fffacde9a Incorrect link update 2021-03-09 19:29:38 +00:00
e2bab5b765 Merge pull request #171 from sickcodes/move-custom-to-submodule
Move custom serial generator scripts to their own repo:
2021-03-10 02:08:27 +07:00
0bce4b044f osx-serial-generator submodule update 2021-03-09 17:52:21 +00:00
5a71e19756 ./custom is now ./osx-serial-generator via submodule. Submodule inits. 2021-03-09 16:55:18 +00:00
d6b86a604a osx-serial-generator submodule update 2021-03-09 16:38:34 +00:00
d32104aae7 Merge pull request #172 from sickcodes/sickcodes-issue-template
Update issue templates
2021-03-09 12:13:51 +00:00
38c84714ee Update issue templates 2021-03-09 12:13:08 +00:00
ab9761adb7 Add https://github.com/sickcodes/osx-serial-generator.git as a submodule to replace ./custom 2021-03-09 08:44:58 +00:00
7f2ef89ab7 Merge pull request #169 from sickcodes/nopicker-bug
Fix BOOTDISK expected logic
2021-03-06 19:39:10 +00:00
c2916fd487 Dockerfile syntax error. 2021-03-06 19:25:26 +00:00
7382df8fa1 Fix BOOTDISK expected logic 2021-03-06 19:18:23 +00:00
5f595ed588 Merge pull request #168 from sickcodes/generate-custom-edits
Script for making iMessage serial numbers OpenCore Docker-OSX edits
2021-03-06 18:11:45 +00:00
7d6e5b30d8 Remove useless case statements. Allow -e HEADLESS=true as human readable alternative to -e DISPLAY=:99. 2021-03-06 17:59:03 +00:00
8935ce08ab Fix bootdisk not getting written to persistent file when using NOPICKER=true. NOPICKER=true is overridden by a custom plist now anyway. 2021-03-06 17:48:15 +00:00
72d942763e Fix help. Change envs to --envs. Auto turn on envs, plists, bootdisks if setting their output file names 2021-03-06 17:21:14 +00:00
3add4f7a98 Merge pull request #163 from sickcodes/resolution-changes-runtime
Add WIDTH and HEIGHT environment variables
2021-03-04 13:46:58 +00:00
b2f6ac509c Typo 2021-03-04 13:27:12 +00:00
2077c3a453 v4.1 WIDTH/HEIGHT && move resolution README note 2021-03-04 13:22:13 +00:00
4b278bc42c Shift exits 2021-03-04 12:05:41 +00:00
e03f0737c3 Fix .//config-custom.plist 2021-03-04 11:59:40 +00:00
45a5f2c074 wget -O case sensitive, silence source /env errors. 2021-03-04 11:57:52 +00:00
84fc71722c Syntax error: elif obviously needs a ; then 2021-03-04 11:42:36 +00:00
377c4e7cc5 Add -e MASTER_PLIST_URL to change the input config.plist at runtime. 2021-03-04 09:52:45 +00:00
3f4c0c6bd4 Add --custom-plist-url, --custom-plist <filename> or --master-plist to both serial generators. 2021-03-04 09:48:04 +00:00
408248ae4f Missing WIDTH and HEIGHT from naked and auto Dockerfiles 2021-03-04 09:12:50 +00:00
5469cb8a58 Add WIDTH and HEIGHT environment variables 2021-03-03 16:54:45 +00:00
2e185aa2c3 Merge pull request #162 from sickcodes/additional-ports
Add ADDITIONAL_PORTS, -e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,'
2021-03-03 07:09:27 +00:00
55f3fd00b1 Add ADDITIONAL_PORTS, -e ADDITIONAL_PORTS='hostfwd=tcp::23-:23,' 2021-03-02 21:24:28 +00:00
60daed5e3a Merge pull request #161 from edsonboldrini/patch-1
Update README.md
2021-03-02 15:51:00 +00:00
5b060b8de2 Update README.md 2021-03-02 07:20:09 -03:00
e307f1cb51 Merge pull request #160 from sickcodes/vmxnet3
Switch default internet to vmxnet3 as there is no incompatability...
2021-03-01 11:46:29 +00:00
5d648e1b59 Switch default internet to vmxnet3 as there is no incompatability with services. 2021-03-01 11:23:12 +00:00
275b27ef8f Documentation for Big Sur. v4.0 2021-02-27 12:10:08 +00:00
fd80032eab Merge pull request #158 from sickcodes/bigsur
Add bigsur BaseSystem.img support. Use `--build-arg VERSION=11`
2021-02-27 11:44:40 +00:00
d2ee959d27 Add bigsur BaseSystem.img support. Use --build-arg VERSION=11 or higher. Downloads latest version currently. 2021-02-27 07:54:28 +00:00
8fffd79f16 Merge pull request #157 from sickcodes/helm-updates
Update helm chart to include link back to OG project. Dissolve testing branch references in favor of master.
2021-02-27 07:07:52 +00:00
a9e8821a06 Update helm chart to include link back to OG project. Dissolve testing branch references in favor of master. 2021-02-27 07:05:43 +00:00
27efe6658d Merge pull request #155 from sickcodes/custom-identity
Custom Serial Numbers (iMessage/iCloud security analysis)
2021-02-26 17:34:41 +00:00
7dc344ef44 Merge pull request #154 from sickcodes/wget-options
Add an unset WGET_OPTIONS variable for hub.docker.com to download 20GB silently, but not general users.
2021-02-26 03:52:43 +00:00
105fdfd48f Add an unset WGET_OPTIONS variable that is set to --no-verbose in hub.docker.com, but unset by default, so you can watch progress. 2021-02-26 03:46:58 +00:00
19 changed files with 803 additions and 307 deletions

View File

@ -0,0 +1,26 @@
---
name: Issue Running Docker-OSX
about: OS related issued, please help us identify the issue by posting the output
of this
title: ''
labels: ''
assignees: ''
---
# OS related issued, please help us identify the issue by posting the output of this
uname -a \
; echo "${DISPLAY}" \
; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs \
; grep NAME /etc/os-release \
; df -h . \
; qemu-system-x86_64 --version \
; libvirtd --version \
; free -mh \
; nproc \
; egrep -c '(svm|vmx)' /proc/cpuinfo \
; ls -lha /dev/kvm \
; ls -lha /tmp/.X11-unix/ \
; ps aux | grep dockerd \
; docker ps | grep osx \
; grep "docker\|kvm\|virt" /etc/group

10
.github/ISSUE_TEMPLATE/open-an-issue.md vendored Normal file
View File

@ -0,0 +1,10 @@
---
name: Open an Issue
about: About anything!
title: ''
labels: ''
assignees: ''
---

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "osx-serial-generator"]
path = osx-serial-generator
url = https://github.com/sickcodes/osx-serial-generator.git

View File

@ -1,5 +1,13 @@
|Version|Date|Notes| |Version|Date|Notes|
|---|---|---| |---|---|---|
|4.2|2021-03-15|No longer use static qcow2 bootdisks. Create at runtime. Supply own with `-v plist:/plist` plus `-e MASTER_PLIST=/plist` or `-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist`|
| |2021-03-14|Change default RAM to 2G|
| |2021-03-09|Add https://github.com/sickcodes/osx-serial-generator.git as a submodule to replace ./custom|
| |2021-03-06|Change envs to require --envs. Automatically enable --envs if --output-env is used. Same for plists, bootdisks. Fix help ugliness and sanity of generate serial scripts. Fix bootdisk not getting written to persistent file when using NOPICKER=true. NOPICKER=true is overridden by a custom plist now anyway. Remove useless case statements. Allow -e HEADLESS=true as human readable alternative to -e DISPLAY=:99.|
|4.1|2021-03-04|Add `-e MASTER_PLIST_URL` to all images to allow using your own remote plist.|
| |2021-03-03|Add `WIDTH` and `HEIGHT` to set the x and y resolutions, use in conjuction with serial numbers.|
| |2021-03-02|Add ADDITIONAL_PORTS, for example `-e ADDITIONAL_PORTS='hostfwd=tcp::23-:23,'`|
|4.0|2021-02-27|Add big-sur support. Use `sickcodes/docker-osx:big-sur` or build using `--build-arg VERSION=11`|
| |2021-02-26|Change `-e NOPICKER=true` to simply do `sed -i '/^.*InstallMedia.*/d' Launch.sh` and `export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2`.| | |2021-02-26|Change `-e NOPICKER=true` to simply do `sed -i '/^.*InstallMedia.*/d' Launch.sh` and `export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2`.|
|3.2|2021-02-25|Add a script to generate unique machine serial numbers. Add a script to generate a bootdisk from given serial numbers. Add Linux for libguestfs which allows the docker container to make QEMU bootdisks with specific serial numbers.| |3.2|2021-02-25|Add a script to generate unique machine serial numbers. Add a script to generate a bootdisk from given serial numbers. Add Linux for libguestfs which allows the docker container to make QEMU bootdisks with specific serial numbers.|
| |2021-02-21|Add NOPICKER environment variable to ALL images.| | |2021-02-21|Add NOPICKER environment variable to ALL images.|

View File

@ -56,3 +56,6 @@ These credits refer to the contributors to this repository:
[@MrBenFTW](https://github.com/MrBenFTW) - Tempfix for arch #150 [@MrBenFTW](https://github.com/MrBenFTW) - Tempfix for arch #150
[@edsonboldrini](https://github.com/edsonboldrini) - Update README.md #161
[@TheHackerCoding](https://github.com/TheHackerCoding) - Typo in README.md #194

View File

@ -5,11 +5,12 @@
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / |
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_|
# #
# Repo: https://github.com/sickcodes/Docker-OSX/ # Title: Docker-OSX (Mac on Docker)
# Title: Mac on Docker (Docker-OSX) # Author: Sick.Codes https://twitter.com/sickcodes
# Author: Sick.Codes https://sick.codes/ # Version: 4.2
# Version: 3.2
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes
# #
# All credits for OSX-KVM and the rest at @Kholia's repo: https://github.com/kholia/osx-kvm # All credits for OSX-KVM and the rest at @Kholia's repo: https://github.com/kholia/osx-kvm
# OpenCore support go to https://github.com/Leoyzen/KVM-Opencore # OpenCore support go to https://github.com/Leoyzen/KVM-Opencore
@ -125,7 +126,7 @@ RUN tee -a sshd_config <<< 'AllowTcpForwarding yes' \
USER arch USER arch
# download OSX-KVM # download OSX-KVM
RUN git clone --depth 1 https://github.com/kholia/OSX-KVM.git /home/arch/OSX-KVM RUN git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git /home/arch/OSX-KVM
# enable ssh # enable ssh
# docker exec .... ./enable-ssh.sh # docker exec .... ./enable-ssh.sh
@ -150,7 +151,7 @@ RUN touch enable-ssh.sh \
# RUN yes | sudo pacman -Syu qemu libvirt dnsmasq virt-manager bridge-utils edk2-ovmf netctl libvirt-dbus --overwrite --noconfirm # RUN yes | sudo pacman -Syu qemu libvirt dnsmasq virt-manager bridge-utils edk2-ovmf netctl libvirt-dbus --overwrite --noconfirm
RUN yes | sudo pacman -Syu qemu libvirt dnsmasq virt-manager bridge-utils openresolv jack ebtables edk2-ovmf netctl libvirt-dbus --overwrite --noconfirm \ RUN yes | sudo pacman -Syu qemu libvirt dnsmasq virt-manager bridge-utils openresolv jack ebtables edk2-ovmf netctl libvirt-dbus wget --overwrite --noconfirm \
&& yes | sudo pacman -Scc && yes | sudo pacman -Scc
# TEMP-FIX for pacman issue # TEMP-FIX for pacman issue
@ -164,10 +165,23 @@ RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
WORKDIR /home/arch/OSX-KVM WORKDIR /home/arch/OSX-KVM
RUN python fetch-macOS.py --version "${VERSION}" \ RUN [[ "${VERSION%%.*}" -lt 11 ]] && { python fetch-macOS.py --version "${VERSION}" \
&& qemu-img convert BaseSystem.dmg -O qcow2 -p -c BaseSystem.img \ && qemu-img convert BaseSystem.dmg -O qcow2 -p -c BaseSystem.img \
&& qemu-img create -f qcow2 mac_hdd_ng.img "${SIZE}" \ && qemu-img create -f qcow2 mac_hdd_ng.img "${SIZE}" \
&& rm -f BaseSystem.dmg && rm -f BaseSystem.dmg \
; } || true
# VERSION=11.2.1
# this downloads LATEST ONLY
ARG FETCH_MAC_OS_RAW=https://raw.githubusercontent.com/acidanthera/OpenCorePkg/master/Utilities/macrecovery/macrecovery.py
# submit a PR to here to get the version option https://github.com/acidanthera/OpenCorePkg/blob/master/Utilities/macrecovery/macrecovery.py
RUN [[ "${VERSION%%.*}" -ge 11 ]] && { wget "${FETCH_MAC_OS_RAW}" \
&& python macrecovery.py download \
&& qemu-img convert BaseSystem.dmg -O qcow2 -p -c BaseSystem.img \
&& qemu-img create -f qcow2 mac_hdd_ng.img "${SIZE}" \
&& rm -f BaseSystem.dmg \
; } || true
# > Launch.sh # > Launch.sh
# > Docker-OSX.xml # > Docker-OSX.xml
@ -184,8 +198,14 @@ RUN if [[ "${LINUX}" == true ]]; then \
&& bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." \ && bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." \
; fi ; fi
# temporary branch, remove in final PR # optional --build-arg to change branches for testing
RUN git clone --branch custom-identity https://github.com/sickcodes/Docker-OSX.git ARG BRANCH=master
ARG REPO='https://github.com/sickcodes/Docker-OSX.git'
RUN git clone --recurse-submodules --depth 1 --branch "${BRANCH}" "${REPO}"
# env -e ADDITIONAL_PORTS with a comma
# for example, -e ADDITIONAL_PORTS=hostfwd=tcp::23-:23,
ENV ADDITIONAL_PORTS=
RUN touch Launch.sh \ RUN touch Launch.sh \
&& chmod +x ./Launch.sh \ && chmod +x ./Launch.sh \
@ -193,7 +213,7 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< 'set -eu' \ && tee -a Launch.sh <<< 'set -eu' \
&& tee -a Launch.sh <<< 'sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true' \ && tee -a Launch.sh <<< 'sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true' \
&& tee -a Launch.sh <<< 'sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true' \ && tee -a Launch.sh <<< 'sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true' \
&& tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-8}000 \' \ && tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-2}000 \' \
&& tee -a Launch.sh <<< '-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \' \ && tee -a Launch.sh <<< '-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \' \
&& tee -a Launch.sh <<< '-machine q35,accel=kvm:tcg \' \ && tee -a Launch.sh <<< '-machine q35,accel=kvm:tcg \' \
&& tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \ && tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \
@ -210,8 +230,8 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \' \ && tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \' \
&& tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=qcow2 \' \ && tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=qcow2 \' \
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.4,drive=MacHDD \' \ && tee -a Launch.sh <<< '-device ide-hd,bus=sata.4,drive=MacHDD \' \
&& tee -a Launch.sh <<< '-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, \' \ && tee -a Launch.sh <<< '-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900,${ADDITIONAL_PORTS} \' \
&& tee -a Launch.sh <<< '-device ${NETWORKING:-e1000-82545em},netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \' \ && tee -a Launch.sh <<< '-device ${NETWORKING:-vmxnet3},netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \' \
&& tee -a Launch.sh <<< '-monitor stdio \' \ && tee -a Launch.sh <<< '-monitor stdio \' \
&& tee -a Launch.sh <<< '-vga vmware \' \ && tee -a Launch.sh <<< '-vga vmware \' \
&& tee -a Launch.sh <<< '${EXTRA:-}' && tee -a Launch.sh <<< '${EXTRA:-}'
@ -227,7 +247,7 @@ USER arch
ENV USER arch ENV USER arch
ENV BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 ENV BOOTDISK=
ENV DISPLAY=:0.0 ENV DISPLAY=:0.0
@ -235,13 +255,25 @@ ENV ENV=/env
ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img
ENV NETWORKING=e1000-82545em # ENV NETWORKING=e1000-82545em
# ENV NETWORKING=vmxnet3 ENV NETWORKING=vmxnet3
# Boolean for generating a bootdisk with new random serials.
ENV GENERATE_UNIQUE=false
# Boolean for generating a bootdisk with specific serials.
ENV GENERATE_SPECIFIC=false
# boolean for skipping the disk selection menu at in the boot process
ENV NOPICKER=false ENV NOPICKER=false
ENV UNIQUE=false # The x and y coordinates for resolution.
# Boolean for generating a bootdisk with new serials. # Must be used with either -e GENERATE_UNIQUE=true or -e GENERATE_SPECIFIC=true.
ENV WIDTH=1920
ENV HEIGHT=1080
ENV MASTER_PLIST_URL=
ENV MASTER_PLIST=./Docker-OSX/osx-serial-generator/config-custom.plist
VOLUME ["/tmp/.X11-unix"] VOLUME ["/tmp/.X11-unix"]
@ -257,48 +289,52 @@ VOLUME ["/tmp/.X11-unix"]
# -e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \ # -e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \
# -e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \ # -e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
### DEPRECATED:
# the output will be /bootdisk. # the output will be /bootdisk.
# /bootdisk is a useful persistent place to store the 15Mb serial number bootdisk. # /bootdisk is a useful persistent place to store the 15Mb serial number bootdisk.
### WHY? Pointless as bootdisk will be made at runtime.
# if you don't set any of the above: # if you don't set any of the above:
# the default serial numbers are already contained in ./OpenCore-Catalina/OpenCore.qcow2 # the default serial numbers are already contained in ./OpenCore-Catalina/OpenCore.qcow2
# And the default serial numbers # And the default serial numbers
CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ # First, the container touches files. This will cause the host to give the file to that container
; case "$(file --brief /image)" in \ # Second, the container chowns all those files, so that it can use them
QEMU\ QCOW2\ Image* ) export IMAGE_PATH=/image \ # If NOPICKER is true, the config-nopicker-custom.plist is used
;; \ ## If you set a URL instead, it will download that over whatever you set for the MASTER_PLIST
directory* ) export IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img \
;; \ CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
esac \ ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-nopicker-custom.plist}" \
; } \ ; } \
|| export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-custom.plist}" \
; [[ "${MASTER_PLIST_URL}" ]] && wget -O "${MASTER_PLIST}" "${MASTER_PLIST_URL}" \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \
--master-plist="${MASTER_PLIST}" \
--count 1 \ --count 1 \
--tsv ./serial.tsv \ --tsv ./serial.tsv \
--bootdisks \ --bootdisks \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ --width "${WIDTH:-1920}" \
--output-env "${ENV:=/env}" || exit 1 \ --height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
--output-env "${ENV:=/env}" \
; } \ ; } \
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
source "${ENV:=/env}" \ source "${ENV:=/env}" 2>/dev/null \
|| ./Docker-OSX/custom/generate-specific-bootdisk.sh \ ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
--master-plist="${MASTER_PLIST}" \
--model "${DEVICE_MODEL}" \ --model "${DEVICE_MODEL}" \
--serial "${SERIAL}" \ --serial "${SERIAL}" \
--board-serial "${BOARD_SERIAL}" \ --board-serial "${BOARD_SERIAL}" \
--uuid "${UUID}" \ --uuid "${UUID}" \
--mac-address "${MAC_ADDRESS}" \ --mac-address "${MAC_ADDRESS}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ --width "${WIDTH:-1920}" \
--height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
; } \ ; } \
; case "$(file --brief /bootdisk)" in \
QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; ./enable-ssh.sh && envsubst < ./Launch.sh | bash ; ./enable-ssh.sh && envsubst < ./Launch.sh | bash
# virt-manager mode: eta son # virt-manager mode: eta son

View File

@ -3,13 +3,14 @@
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ /
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| /
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / |
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| AUTOINSTALL # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :AUTO
# #
# Title: Mac on Docker (Docker-OSX) [AUTOINSTALL] # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 3.2 # Version: 4.2
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes
# #
# This Dockerfile is a pre-installed naked installation of Docker-OSX! # This Dockerfile is a pre-installed naked installation of Docker-OSX!
# #
@ -78,7 +79,7 @@ RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \ RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \
&& if [[ "${SCROT}" ]]; then \ && if [[ "${SCROT}" ]]; then \
pacman -Syu scrot base-devel --noconfirm \ pacman -Syu scrot base-devel --noconfirm \
&& git clone https://github.com/stolk/imcat.git \ && git clone --recurse-submodules --depth 1 https://github.com/stolk/imcat.git \
&& cd imcat \ && cd imcat \
&& make \ && make \
&& sudo cp imcat /usr/bin/imcat \ && sudo cp imcat /usr/bin/imcat \
@ -119,67 +120,78 @@ ARG IMAGE_URL='https://images2.sick.codes/mac_hdd_ng_auto.img'
# use the COMPLETE arg, for a complete image, ready to boot. # use the COMPLETE arg, for a complete image, ready to boot.
# otherwise use your own image: -v "$PWD/disk.img":/image # otherwise use your own image: -v "$PWD/disk.img":/image
ARG WGET_OPTIONS=
# ARG WGET_OPTIONS='--no-verbose'
RUN if [[ "${COMPLETE}" ]]; then \ RUN if [[ "${COMPLETE}" ]]; then \
echo "Downloading 20GB+ image... This step might take a while... Press Ctrl+C if you want to abort." \ echo "Downloading 20GB+ image... This step might take a while... Press Ctrl+C if you want to abort." \
; rm -f /home/arch/OSX-KVM/mac_hdd_ng.img \ ; rm -f /home/arch/OSX-KVM/mac_hdd_ng.img \
&& wget --no-verbose -O /home/arch/OSX-KVM/mac_hdd_ng.img "${IMAGE_URL}" \ && wget ${WGET_OPTIONS} -O /home/arch/OSX-KVM/mac_hdd_ng.img "${IMAGE_URL}" \
; fi ; fi
ENV BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 ENV BOOTDISK=
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false
ENV ENV=/env ENV ENV=/env
ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img
ENV NOPICKER=true ENV NOPICKER=true
# The x and y coordinates for resolution.
# Must be used with either -e GENERATE_UNIQUE=true or -e GENERATE_SPECIFIC=true.
ENV WIDTH=1920
ENV HEIGHT=1080
ENV MASTER_PLIST_URL=
ENV MASTER_PLIST=./Docker-OSX/osx-serial-generator/config-nopicker-custom.plist
ENV TERMS_OF_USE=i_agree ENV TERMS_OF_USE=i_agree
ENV BOILERPLATE="By using this Dockerfile, you hereby agree that you are a security reseacher or developer and agree to use this Dockerfile to make the world a safer place. Examples include: making your apps safer, finding your mobile phone, compiling security products, etc. You understand that Docker-OSX is an Open Source project, which is released to the public under the GNU Pulic License version 3 and above. You acknowledge that the Open Source project is absolutely unaffiliated with any third party, in any form whatsoever. Any trademarks or intelectual property which happen to be mentioned anywhere in or around the project are owned by their respective owners. By using this Dockerfile, you agree to agree to the EULA of each piece of upstream or downstream software. The following code is released for the sole purpose of security research, under the GNU Public License version 3. If you are concerned about the licensing, please note that this project is not AGPL. A copy of the license is available online: https://github.com/sickcodes/Docker-OSX/blob/master/LICENSE. In order to use the following Dockerfile you must read and understand the terms. Once you have read the terms, use the -e TERMS_OF_USE=i_agree or -e TERMS_OF_USE=i_disagree" ENV BOILERPLATE="By using this Dockerfile, you hereby agree that you are a security reseacher or developer and agree to use this Dockerfile to make the world a safer place. Examples include: making your apps safer, finding your mobile phone, compiling security products, etc. You understand that Docker-OSX is an Open Source project, which is released to the public under the GNU Pulic License version 3 and above. You acknowledge that the Open Source project is absolutely unaffiliated with any third party, in any form whatsoever. Any trademarks or intelectual property which happen to be mentioned anywhere in or around the project are owned by their respective owners. By using this Dockerfile, you agree to agree to the EULA of each piece of upstream or downstream software. The following code is released for the sole purpose of security research, under the GNU Public License version 3. If you are concerned about the licensing, please note that this project is not AGPL. A copy of the license is available online: https://github.com/sickcodes/Docker-OSX/blob/master/LICENSE. In order to use the following Dockerfile you must read and understand the terms."
CMD echo "${BOILERPLATE}" \ CMD echo "${BOILERPLATE}" \
; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \
; echo "Disk is being copied between layers... Please wait a minute..." \ ; echo "Disk is being copied between layers... Please wait a minute..." \
; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ ; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-nopicker-custom.plist}" \
; } \ ; } \
|| export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-custom.plist}" \
; [[ "${MASTER_PLIST_URL}" ]] && wget -O "${MASTER_PLIST}" "${MASTER_PLIST_URL}" \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \
--master-plist="${MASTER_PLIST}" \
--count 1 \ --count 1 \
--tsv ./serial.tsv \ --tsv ./serial.tsv \
--bootdisks \ --bootdisks \
--width "${WIDTH:-1920}" \
--height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
--output-env "${ENV:=/env}" || exit 1 \ --output-env "${ENV:=/env}" \
; } \ ; } \
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
source "${ENV:=/env}" \ source "${ENV:=/env}" 2>/dev/null \
|| ./Docker-OSX/custom/generate-specific-bootdisk.sh \ ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
--master-plist="${MASTER_PLIST}" \
--model "${DEVICE_MODEL}" \ --model "${DEVICE_MODEL}" \
--serial "${SERIAL}" \ --serial "${SERIAL}" \
--board-serial "${BOARD_SERIAL}" \ --board-serial "${BOARD_SERIAL}" \
--uuid "${UUID}" \ --uuid "${UUID}" \
--mac-address "${MAC_ADDRESS}" \ --mac-address "${MAC_ADDRESS}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ --width "${WIDTH:-1920}" \
--height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
; } \ ; } \
; case "$(file --brief /bootdisk)" in \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; [[ "${DISPLAY}" = ':99' ]] && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 0.1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \
; } \ ; } \
; echo "Checking whether /image is a directory or a QEMU disk." \
; case "$(file --brief /image)" in \
QEMU*) export IMAGE_PATH=/image;; \
directory*) export IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img;; \
esac \
; stat "${IMAGE_PATH}" \ ; stat "${IMAGE_PATH}" \
; echo "Large image is being copied between layers, please wait a minute..." \ ; echo "Large image is being copied between layers, please wait a minute..." \
; ./enable-ssh.sh \ ; ./enable-ssh.sh \

View File

@ -3,13 +3,14 @@
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ /
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| /
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / |
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| NAKED/SUPPLY_YOUR_OWN # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKED
# #
# Title: Mac on Docker (Docker-OSX) [AUTOINSTALL] # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 3.2 # Version: 4.2
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes
# #
# This image won't run unless you supply a disk image using: # This image won't run unless you supply a disk image using:
# -v ${PWD}/mac_hdd_ng.img:/image # -v ${PWD}/mac_hdd_ng.img:/image
@ -67,7 +68,7 @@ ARG SCROT
RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \ RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \
&& if [[ "${SCROT}" ]]; then \ && if [[ "${SCROT}" ]]; then \
pacman -Syu scrot base-devel --noconfirm \ pacman -Syu scrot base-devel --noconfirm \
&& git clone https://github.com/stolk/imcat.git \ && git clone --recurse-submodules --depth 1 https://github.com/stolk/imcat.git \
&& cd imcat \ && cd imcat \
&& make \ && make \
&& sudo cp imcat /usr/bin/imcat \ && sudo cp imcat /usr/bin/imcat \
@ -101,47 +102,60 @@ RUN mkdir -p ~/.ssh \
&& tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ && tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \
&& tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' && tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null'
ENV BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 ENV BOOTDISK=
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false
ENV ENV=/env ENV ENV=/env
ENV IMAGE_PATH=/image ENV IMAGE_PATH=/image
ENV NOPICKER=true ENV NOPICKER=true
CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ # The x and y coordinates for resolution.
; [[ "${DISPLAY}" = ':99' ]] && { \ # Must be used with either -e GENERATE_UNIQUE=true or -e GENERATE_SPECIFIC=true.
ENV WIDTH=1920
ENV HEIGHT=1080
ENV MASTER_PLIST_URL=
ENV MASTER_PLIST=./Docker-OSX/osx-serial-generator/config-nopicker-custom.plist
CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \
; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \
; } \ ; } \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-nopicker-custom.plist}" \
; } \ ; } \
|| export MASTER_PLIST="${MASTER_PLIST:-./Docker-OSX/osx-serial-generator/config-custom.plist}" \
; [[ "${MASTER_PLIST_URL}" ]] && wget -O "${MASTER_PLIST}" "${MASTER_PLIST_URL}" \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \
--master-plist="${MASTER_PLIST}" \
--count 1 \ --count 1 \
--tsv ./serial.tsv \ --tsv ./serial.tsv \
--bootdisks \ --bootdisks \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ --width "${WIDTH:-1920}" \
--output-env "${ENV:=/env}" || exit 1 \ --height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
--output-env "${ENV:=/env}" \
; } \ ; } \
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
source "${ENV:=/env}" \ source "${ENV:=/env}" 2>/dev/null \
|| ./Docker-OSX/custom/generate-specific-bootdisk.sh \ ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
--master-plist="${MASTER_PLIST}" \
--model "${DEVICE_MODEL}" \ --model "${DEVICE_MODEL}" \
--serial "${SERIAL}" \ --serial "${SERIAL}" \
--board-serial "${BOARD_SERIAL}" \ --board-serial "${BOARD_SERIAL}" \
--uuid "${UUID}" \ --uuid "${UUID}" \
--mac-address "${MAC_ADDRESS}" \ --mac-address "${MAC_ADDRESS}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ --width "${WIDTH:-1920}" \
--height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
; } \ ; } \
; case "$(file --brief /bootdisk)" in \
QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; ./enable-ssh.sh && envsubst < ./Launch.sh | bash ; ./enable-ssh.sh && envsubst < ./Launch.sh | bash

254
README.md
View File

@ -15,7 +15,9 @@ https://github.com/sickcodes/Docker-OSX/blob/master/CREDITS.md
Docker Hub: https://hub.docker.com/r/sickcodes/docker-osx Docker Hub: https://hub.docker.com/r/sickcodes/docker-osx
- sickcodes/docker-osx:latest - base recovery image - sickcodes/docker-osx:latest - base recovery image (10)
- sickcodes/docker-osx:big-sur - base recovery image (11)
- sickcodes/docker-osx:naked - supply your own .img file - sickcodes/docker-osx:naked - supply your own .img file
@ -41,13 +43,39 @@ Thank you to @cephasara for this major contribution.
#### Follow [@sickcodes on Twitter](https://twitter.com/sickcodes) for updates or feature requests! #### Follow [@sickcodes on Twitter](https://twitter.com/sickcodes) for updates or feature requests!
# Basic Quick Start Docker-OSX
```bash
docker pull sickcodes/docker-osx:latest
# Catalina
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
sickcodes/docker-osx:latest
# Big Sur
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
sickcodes/docker-osx:big-sur
# Wait 2-3 minutes until you see the logo.
```
# How to use # How to use
### There are 3 images: **latest**, **auto** and **naked**. ### There are 3 images: **latest**, **auto** and **naked**.
`sickcodes/docker-osx:latest` - [I want to try it out.](https://github.com/sickcodes/Docker-OSX#quick-start-175gb-pre-made-image) `sickcodes/docker-osx:latest` - [I want to try it out.](https://github.com/sickcodes/Docker-OSX#quick-start-large-pre-made-image)
`sickcodes/docker-osx:latest` - [I want to use Docker-OSX to develop/secure Apps in Xcode (sign into Xcode, Transporter)](https://github.com/sickcodes/Docker-OSX#quick-start-docker-osx) `sickcodes/docker-osx:latest` - [I want to use Docker-OSX to develop/secure Apps in Xcode (sign into Xcode, Transporter)](https://github.com/sickcodes/Docker-OSX#basic-quick-start-docker-osx)
`sickcodes/docker-osx:naked` - [I want to use Docker-OSX in CI/CD (sign into Xcode, Transporter)](https://github.com/sickcodes/Docker-OSX#fully-headless-using-my-own-image-for-cicd) `sickcodes/docker-osx:naked` - [I want to use Docker-OSX in CI/CD (sign into Xcode, Transporter)](https://github.com/sickcodes/Docker-OSX#fully-headless-using-my-own-image-for-cicd)
Create your personal image using `:latest`. And then pull your image out. And then use duplicate that image again & again for use in `:naked`. Create your personal image using `:latest`. And then pull your image out. And then use duplicate that image again & again for use in `:naked`.
@ -57,17 +85,17 @@ Create your personal image using `:latest`. And then pull your image out. And th
`sickcodes/docker-osx:naked` - [I need iMessage/iCloud for security research.](https://github.com/sickcodes/Docker-OSX#serial-numbers) `sickcodes/docker-osx:naked` - [I need iMessage/iCloud for security research.](https://github.com/sickcodes/Docker-OSX#serial-numbers)
#### I need a screen. #### I need a screen.
**KEEP** these two lines are in your command. Works in ANY of the machines: **KEEP** these two lines are in your command. Works in `auto` & `naked` machines:
```dockerfile ```dockerfile
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \ -e "DISPLAY=${DISPLAY:-:0.0}" \
``` ```
#### I need headless. #### I need headless.
**REMOVE** these two lines from ANY of the machines: **REMOVE** these two lines from `auto` or `naked` machines:
```dockerfile ```dockerfile
-v /tmp/.X11-unix:/tmp/.X11-unix \ # -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \ # -e "DISPLAY=${DISPLAY:-:0.0}" \
``` ```
#### I have used it already, and want to copy this image. #### I have used it already, and want to copy this image.
@ -78,23 +106,6 @@ Use `docker commit`, copy the ID, and then `docker start ID`
[Pull out the .img file](https://github.com/sickcodes/Docker-OSX#backup-the-disk-wheres-my-disk), and then use that [.img file with :naked](https://github.com/sickcodes/Docker-OSX#quick-start-own-image-naked-container-image) [Pull out the .img file](https://github.com/sickcodes/Docker-OSX#backup-the-disk-wheres-my-disk), and then use that [.img file with :naked](https://github.com/sickcodes/Docker-OSX#quick-start-own-image-naked-container-image)
# Basic Quick Start Docker-OSX
```bash
docker pull sickcodes/docker-osx:latest
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
sickcodes/docker-osx:latest
# Wait 2-3 minutes until you see the logo.
```
# Quick Start Large Pre-Made Image # Quick Start Large Pre-Made Image
Current large image size: 17.5GB Current large image size: 17.5GB
@ -212,7 +223,8 @@ docker run -it \
sickcodes/docker-osx:naked sickcodes/docker-osx:naked
``` ```
# Features In Docker-OSX v3.2 # Features In Docker-OSX v4
- `sickcodes/docker-osx:big-sur` - original base recovery image for latest OS (safe)
- Serial number generators. [See below or ./custom](https://github.com/sickcodes/Docker-OSX/tree/master/custom) - Serial number generators. [See below or ./custom](https://github.com/sickcodes/Docker-OSX/tree/master/custom)
- Full auto mode: boot straight to OSX shell and even run commands as runtime arguments! - Full auto mode: boot straight to OSX shell and even run commands as runtime arguments!
- `sickcodes/docker-osx:latest` - original base recovery image (safe) - `sickcodes/docker-osx:latest` - original base recovery image (safe)
@ -481,6 +493,43 @@ sudo nohup dockerd &
sudo systemctl enable docker sudo systemctl enable docker
``` ```
# How to Forward Additional Ports from the guest.
This is how it visually looks:
`host:10023 <-> 10023:container:10023 <-> 80:guest`
```bash
On the host
```bash
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,' \
-p 10023:10023 \
sickcodes/docker-osx:auto
```
Inside the container:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install nginx
sudo sed -i -e 's/8080/80/' /usr/local/etc/nginx/nginx.confcd
# sudo nginx -s stop
sudo nginx
```
nginx should appear on the host at port 10023.
You can string multiple statements, for example:
```bash
-e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,hostfwd=tcp::10043-:443,'
-p 10023:10023 \
-p 10043:10043 \
```
# How to Enable Network Forwarding # How to Enable Network Forwarding
Allow ipv4 forwarding for bridged networking connections: Allow ipv4 forwarding for bridged networking connections:
@ -565,12 +614,11 @@ sudo mv somedir/mac_hdd_ng.img .
# Internet Speeds # Internet Speeds
### Slow internet but iMessage & iCloud compatability ### FAST internet
`-e NETWORKING=e1000-82545em`
### FAST internet but not compatable with iMessage & iCloud
`-e NETWORKING=vmxnet3` `-e NETWORKING=vmxnet3`
### SLOW internet
`-e NETWORKING=e1000-82545em`
# DESTROY: Wipe old images to free disk space # DESTROY: Wipe old images to free disk space
@ -695,11 +743,13 @@ For serial numbers, generate them in `./custom` OR make docker generate them at
At any time, verify your serial number before logging in iCloud, etc. At any time, verify your serial number before logging in iCloud, etc.
```bash ```bash
# this is a quick way to check your serial number via cli inside OSX
ioreg -l | grep IOPlatformSerialNumber ioreg -l | grep IOPlatformSerialNumber
# or from the host # or from the host
sshpass -p alpine ssh user@localhost -p 50922 'ioreg -l | grep IOPlatformSerialNumber' sshpass -p 'alpine' ssh user@localhost -p 50922 'ioreg -l | grep IOPlatformSerialNumber'
``` ```
# This example generates a random set of serial numbers at runtime, headlessly
```bash ```bash
# proof of concept only, generates random serial numbers, headlessly, and quits right after. # proof of concept only, generates random serial numbers, headlessly, and quits right after.
@ -713,10 +763,11 @@ docker run --rm -it \
sickcodes/docker-osx:auto sickcodes/docker-osx:auto
``` ```
# This example generates a specific set of serial numbers at runtime
```bash ```bash
# run the same as above 17gb auto image, with SSH, with nopicker, and save the bootdisk for later. # run the same as above 17gb auto image, with SSH, with nopicker, and save the bootdisk for later.
# you don't need to save the bootdisk IF you supply specific serial numbers! # you don't need to save the bootdisk IF you supply specific serial numbers!
touch ./C02TW0WAHX87.qcow
docker run -it \ docker run -it \
--device /dev/kvm \ --device /dev/kvm \
@ -732,14 +783,15 @@ docker run -it \
sickcodes/docker-osx:auto sickcodes/docker-osx:auto
``` ```
### This example generates a specific set of serial numbers at runtime, with your existing image, at 1000x1000 display resolution.
```bash ```bash
# run an existing image in current directory, with a screen, with SSH, with nopicker, and save the bootdisk for later. # run an existing image in current directory, with a screen, with SSH, with nopicker.
stat mac_hdd_ng.img # make sure you have an image if you're using :naked stat mac_hdd_ng.img # make sure you have an image if you're using :naked
touch ./mynewbootdisk.qcow
docker run -it \ docker run -it \
-v "${PWD}/mac_hdd_ng.img:/image" \
--device /dev/kvm \ --device /dev/kvm \
-e "DISPLAY=${DISPLAY:-:0.0}" \ -e "DISPLAY=${DISPLAY:-:0.0}" \
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \
@ -751,9 +803,8 @@ docker run -it \
-e BOARD_SERIAL="C027251024NJG36UE" \ -e BOARD_SERIAL="C027251024NJG36UE" \
-e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \ -e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \
-e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \ -e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
-e BOOTDISK=/bootdisk \ -e WIDTH=1000 \
-v "${PWD}/mynewbootdisk.qcow:/bootdisk" \ -e HEIGHT=1000 \
-v "${PWD}/mac_hdd_ng.img:/image" \
sickcodes/docker-osx:naked sickcodes/docker-osx:naked
``` ```
@ -774,10 +825,9 @@ Or you can generate them inside the `./custom` folder. And then use:
```bash ```bash
stat mac_hdd_ng_testing.img stat mac_hdd_ng_testing.img
touch ./output.qcow
touch ./output.env touch ./output.env
# generate fresh random serial numbers, with a screen, using my own image, and save the bootdisk AND env file with my new serial numbers for later. # generate fresh random serial numbers, with a screen, using your own image, and save env file with your new serial numbers for later.
docker run -it \ docker run -it \
--device /dev/kvm \ --device /dev/kvm \
@ -788,8 +838,6 @@ docker run -it \
-e GENERATE_UNIQUE=true \ -e GENERATE_UNIQUE=true \
-e GENERATE_SPECIFIC=true \ -e GENERATE_SPECIFIC=true \
-e DEVICE_MODEL="iMacPro1,1" \ -e DEVICE_MODEL="iMacPro1,1" \
-e BOOTDISK=/bootdisk \
-v "${PWD}/output.qcow:/bootdisk" \
-v "${PWD}/output.env:/env" \ -v "${PWD}/output.env:/env" \
-v "${PWD}/mac_hdd_ng_testing.img:/image" \ -v "${PWD}/mac_hdd_ng_testing.img:/image" \
sickcodes/docker-osx:naked sickcodes/docker-osx:naked
@ -809,7 +857,7 @@ _`ROM` is just the lowercased mac address, without `:` between each word._
You can tell the container to generate them for you using `-e GENERATE_UNIQUE=true` You can tell the container to generate them for you using `-e GENERATE_UNIQUE=true`
Or tell the container to use specific ones using `-e GENERATE_UNIQUE=true` Or tell the container to use specific ones using `-e GENERATE_SPECIFIC=true`
```bash ```bash
-e GENERATE_SPECIFIC=true \ -e GENERATE_SPECIFIC=true \
@ -865,6 +913,130 @@ generate-specific-bootdisk.sh \
--output-bootdisk OpenCore-nopicker.qcow2 --output-bootdisk OpenCore-nopicker.qcow2
``` ```
# Change Resolution Docker-OSX - change resolution OpenCore OSX-KVM
The display resolution is controlled by this line:
https://github.com/sickcodes/Docker-OSX/blob/master/custom/config-nopicker-custom.plist#L819
Instead of mounting that disk, Docker-OSX will generate a new `OpenCore.qcow2` by using this one cool trick:
```bash
-e GENERATE_UNIQUE=true \
-e WIDTH=800 \
-e HEIGHT=600 \
```
To use `WIDTH`/`HEIGHT`, you must use with either `-e GENERATE_UNIQUE=true` or `-e GENERATE_SPECIFIC=true`.
It will take around 30 seconds longer to boot because it needs to make a new boot partition using `libguestfs`.
```bash
-e GENERATE_SPECIFIC=true \
-e WIDTH=1920 \
-e HEIGHT=1080 \
-e SERIAL="" \
-e BOARD_SERIAL="" \
-e UUID="" \
-e MAC_ADDRESS="" \
```
## Change Docker-OSX Resolution Examples
```bash
# using an image in your current directory
stat mac_hdd_ng.img
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v "${PWD}/mac_hdd_ng.img:/image" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_SPECIFIC=true \
-e DEVICE_MODEL="iMacPro1,1" \
-e SERIAL="C02TW0WAHX87" \
-e BOARD_SERIAL="C027251024NJG36UE" \
-e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \
-e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist \
-e WIDTH=1600 \
-e HEIGHT=900 \
sickcodes/docker-osx:naked
```
```bash
# generating random serial numbers, using the DIY installer, along with the screen resolution changes.
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_UNIQUE=true \
-e WIDTH=800 \
-e HEIGHT=600 \
sickcodes/docker-osx:latest
```
Here's a few other resolutions! If you resolution is invalid, it will default to 800x600.
```
-e WIDTH=800 \
-e HEIGHT=600 \
```
```
-e WIDTH=1280 \
-e HEIGHT=768 \
```
```
-e WIDTH=1600 \
-e HEIGHT=900 \
```
```
-e WIDTH=1920 \
-e HEIGHT=1080 \
```
```
-e WIDTH=2560 \
-e HEIGHT=1600 \
```
# Mount a disk inside OSX from the host
Pass the disk into the container as a volume and then pass the disk again into QEMU command line extras with.
Use the `config-custom.plist` because you probably want to see the boot menu, otherwise omit the first line:
```bash
DISK_TWO="${PWD}/mount_me.img"
```
```dockerfile
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
-v "${DISK_TWO}:/disktwo" \
-e EXTRA='-device ide-hd,bus=sata.5,drive=DISK-TWO -drive id=DISK-TWO,if=none,file=/disktwo,format=qcow2' \
```
Example:
```bash
OSX_IMAGE="${PWD}/mac_hdd_ng_xcode_bigsur.img"
DISK_TWO="${PWD}/mount_me.img"
docker run -it \
--device /dev/kvm \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
-v "${OSX_IMAGE}":/image \
-v "${DISK_TWO}":/disktwo \
-e EXTRA='-device ide-hd,bus=sata.5,drive=DISK-TWO -drive id=DISK-TWO,if=none,file=/disktwo,format=qcow2' \
sickcodes/docker-osx:naked
```
# Allow USB passthrough # Allow USB passthrough
The simplest way to do this is the following: The simplest way to do this is the following:

7
custom/README.md Normal file
View File

@ -0,0 +1,7 @@
# OSX Serial Generator
This folder has been moved to its own repository :)
This is a temporary copy for hardlinks.
See [https://github.com/sickcodes/osx-serial-generator](https://github.com/sickcodes/osx-serial-generator)

View File

@ -1,4 +1,5 @@
<!-- This file is modified from https://github.com/kholia/OSX-KVM/tree/master/OpenCore-Catalina --> <!-- 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 --> <!-- All credit for this file https://github.com/kholia/OSX-KVM/blob/master/CREDITS.md -->
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@ -704,9 +705,7 @@
<key>MLB</key> <key>MLB</key>
<string>{{BOARD_SERIAL}}</string> <string>{{BOARD_SERIAL}}</string>
<key>ROM</key> <key>ROM</key>
<data> <data>{{ROM}}</data>
{{ROM}}
</data>
<key>SpoofVendor</key> <key>SpoofVendor</key>
<true/> <true/>
<key>SystemProductName</key> <key>SystemProductName</key>
@ -816,7 +815,7 @@
<key>ReplaceTabWithSpace</key> <key>ReplaceTabWithSpace</key>
<false/> <false/>
<key>Resolution</key> <key>Resolution</key>
<string>1920x1080@32</string> <string>{{WIDTH}}x{{HEIGHT}}@32</string>
<key>SanitiseClearScreen</key> <key>SanitiseClearScreen</key>
<false/> <false/>
<key>TextRenderer</key> <key>TextRenderer</key>

View File

@ -1,43 +1,58 @@
#!/bin/bash #!/bin/bash
# ____ __ ____ ______ __ # ___ _____ __ ___ _ _ ___ _
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / _ \/ __\ \/ / / __| ___ _ _(_)__ _| | / __|___ _ _ ___ _ _ __ _| |_ ___ _ _
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # | (_) \__ \> < \__ \/ -_) '_| / _` | | | (_ / -_) ' \/ -_) '_/ _` | _/ _ \ '_|
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # \___/|___/_/\_\ |___/\___|_| |_\__,_|_| \___\___|_||_\___|_| \__,_|\__\___/_|
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| GEN BOOT DISK
# #
# Repo: https://github.com/sickcodes/Docker-OSX/ # Repo: https://github.com/sickcodes/osx-serial-generator/
# Title: Mac on Docker (Docker-OSX) # Title: OSX Serial Generator
# Author: Sick.Codes https://sick.codes/ # Author: Sick.Codes https://sick.codes/
# Version: 3.1 # Version: 3.1
# License: GPLv3+ # License: GPLv3+
help_text="Usage: generate-specific-bootdisk.sh set -e
General options: help_text="Usage: ./generate-specific-bootdisk.sh
Required options:
--model <string> Device model, e.g. 'iMacPro1,1' --model <string> Device model, e.g. 'iMacPro1,1'
--serial <filename> Device Serial number. --serial <string> Device Serial number
--board-serial <filename> Board Serial number. --board-serial <string> Main Logic Board Serial number (MLB)
--uuid <filename> SmUUID. --uuid <string> SMBIOS UUID (SmUUID)
--mac-address <string> Used to set the ROM value; lowercased and without a colon. --mac-address <string> Used for both the MAC address and to set ROM
--output-bootdisk <filename> Optionally change the bootdisk output filename. 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
--input-plist-url <url> Specify an alternative master plist, via URL
--master-plist-url <url> Same as above.
--custom-plist <filename> Optionally change the input plist. --custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--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 --help, -h, help Display this help and exit
Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}},
{{ROM}}, {{WIDTH}}, {{HEIGHT}}
Example: Example:
./generate-specific-bootdisk.sh \ ./generate-specific-bootdisk.sh \\
--model iMacPro1,1 \ --model iMacPro1,1 \\
--serial C02TW0WAHX87 \ --serial C02TW0WAHX87 \\
--board-serial C027251024NJG36UE \ --board-serial C027251024NJG36UE \\
--uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \ --uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \\
--mac-address A8:5C:2C:9A:46:2F \ --mac-address A8:5C:2C:9A:46:2F \\
--output-bootdisk OpenCore-nopicker.qcow2 --output-bootdisk ./OpenCore-nopicker.qcow2 \\
--width 1920 \\
--height 1080
Author: Sick.Codes https://sick.codes/ Author: Sick.Codes https://sick.codes/
Project: https://github.com/sickcodes/Docker-OSX/ Project: https://github.com/sickcodes/osx-serial-generator/
License: GPLv3+
" "
PLIST_MASTER=config-nopicker-custom.plist 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 # gather arguments
while (( "$#" )); do while (( "$#" )); do
@ -51,6 +66,7 @@ while (( "$#" )); do
export DEVICE_MODEL="${1#*=}" export DEVICE_MODEL="${1#*=}"
shift shift
;; ;;
--model* | -m* ) --model* | -m* )
export DEVICE_MODEL="${2}" export DEVICE_MODEL="${2}"
shift shift
@ -61,6 +77,7 @@ while (( "$#" )); do
export SERIAL="${1#*=}" export SERIAL="${1#*=}"
shift shift
;; ;;
--serial* ) --serial* )
export SERIAL="${2}" export SERIAL="${2}"
shift shift
@ -71,6 +88,7 @@ while (( "$#" )); do
export BOARD_SERIAL="${1#*=}" export BOARD_SERIAL="${1#*=}"
shift shift
;; ;;
--board-serial* ) --board-serial* )
export BOARD_SERIAL="${2}" export BOARD_SERIAL="${2}"
shift shift
@ -81,6 +99,7 @@ while (( "$#" )); do
export UUID="${1#*=}" export UUID="${1#*=}"
shift shift
;; ;;
--uuid* ) --uuid* )
export UUID="${2}" export UUID="${2}"
shift shift
@ -91,34 +110,81 @@ while (( "$#" )); do
export MAC_ADDRESS="${1#*=}" export MAC_ADDRESS="${1#*=}"
shift shift
;; ;;
--mac-address* ) --mac-address* )
export MAC_ADDRESS="${2}" export MAC_ADDRESS="${2}"
shift shift
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=* ) --output-bootdisk=* )
export OUTPUT_QCOW="${1#*=}" export OUTPUT_QCOW="${1#*=}"
shift shift
;; ;;
--output-bootdisk* ) --output-bootdisk* )
export OUTPUT_QCOW="${2}" export OUTPUT_QCOW="${2}"
shift shift
shift shift
;; ;;
--custom-plist=* ) --output-plist=* )
export INPUT_PLIST="${1#*=}" export OUTPUT_PLIST="${1#*=}"
shift shift
;; ;;
--custom-plist* )
export INPUT_PLIST="${2}" --output-plist* )
export OUTPUT_PLIST="${2}"
shift
shift
;;
--master-plist-url=* | --input-plist-url=* | --custom-plist-url=* )
export MASTER_PLIST_URL="${1#*=}"
shift
;;
--master-plist-url* | --input-plist-url* | --custom-plist-url* )
export MASTER_PLIST_URL="${2}"
shift
shift
;;
--master-plist=* | --input-plist=* | --custom-plist=* )
export MASTER_PLIST="${1#*=}"
shift
;;
--master-plist* | --input-plist* | --custom-plist* )
export MASTER_PLIST="${2}"
shift shift
shift shift
;; ;;
*) *)
echo "Invalid option. Running with default values..." echo "Invalid option ${1}. Running with default values..."
shift shift
;; ;;
esac esac
@ -126,36 +192,69 @@ done
download_qcow_efi_folder () { download_qcow_efi_folder () {
git clone --depth 1 https://github.com/kholia/OSX-KVM.git
cp -ra ./OSX-KVM/OpenCore-Catalina/EFI . export EFI_FOLDER=./OpenCore-Catalina/EFI
mkdir -p ./EFI/OC/Resources export RESOURCES_FOLDER=./resources/OcBinaryData/Resources
# clone some Apple drivers
git clone --depth 1 https://github.com/acidanthera/OcBinaryData.git # check if we are inside OSX-KVM already
# copy said drivers into EFI/OC/Resources # if not, download OSX-KVM locally
cp -a ./OcBinaryData/Resources/* ./EFI/OC/Resources [ -d ./OpenCore-Catalina/EFI/ ] || {
[ -d ./OSX-KVM/ ] || git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git
export EFI_FOLDER="./OSX-KVM/${EFI_FOLDER}"
}
[ -d ./resources/OcBinaryData/Resources/ ] || {
export RESOURCES_FOLDER="./OSX-KVM/${RESOURCES_FOLDER}"
}
# EFI Shell commands # EFI Shell commands
touch startup.nsh && echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh touch startup.nsh && echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh
cp -ra "${EFI_FOLDER}" .
mkdir -p ./EFI/OC/Resources
# copy Apple drivers into EFI/OC/Resources
cp -a "${RESOURCES_FOLDER}"/* ./EFI/OC/Resources
} }
generate_bootdisk () { generate_bootdisk () {
[[ -e ./config-nopicker-custom.plist ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/custom-identity/custom/config-nopicker-custom.plist
[[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/custom-identity/custom/opencore-image-ng.sh && chmod +x opencore-image-ng.sh # 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. # plist required for bootdisks, so create anyway.
if [[ "${DEVICE_MODEL}" ]] \ if [ "${DEVICE_MODEL}" ] \
&& [[ "${SERIAL}" ]] \ && [ "${SERIAL}" ] \
&& [[ "${BOARD_SERIAL}" ]] \ && [ "${BOARD_SERIAL}" ] \
&& [[ "${UUID}" ]] \ && [ "${UUID}" ] \
&& [[ "${MAC_ADDRESS}" ]]; then && [ "${MAC_ADDRESS}" ]; then
ROM="${MAC_ADDRESS//\:/}" ROM="${MAC_ADDRESS//\:/}"
ROM="${ROM,,}" ROM="${ROM,,}"
sed -e s/{{DEVICE_MODEL}}/"${DEVICE_MODEL}"/g \ sed -e s/\{\{DEVICE_MODEL\}\}/"${DEVICE_MODEL}"/g \
-e s/{{SERIAL}}/"${SERIAL}"/g \ -e s/\{\{SERIAL\}\}/"${SERIAL}"/g \
-e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \ -e s/\{\{BOARD_SERIAL\}\}/"${BOARD_SERIAL}"/g \
-e s/{{UUID}}/"${UUID}"/g \ -e s/\{\{UUID\}\}/"${UUID}"/g \
-e s/{{ROM}}/"${ROM}"/g \ -e s/\{\{ROM\}\}/"${ROM}"/g \
"${PLIST_MASTER}" > ./tmp.config.plist || exit 1 -e s/\{\{WIDTH\}\}/"${WIDTH:-1920}"/g \
-e s/\{\{HEIGHT\}\}/"${HEIGHT:-1080}"/g \
"${MASTER_PLIST}" > ./tmp.config.plist || exit 1
else else
cat <<EOF cat <<EOF && exit 1
Error: one of the following values is missing: Error: one of the following values is missing:
--model "${DEVICE_MODEL:-MISSING}" --model "${DEVICE_MODEL:-MISSING}"
@ -164,12 +263,14 @@ Error: one of the following values is missing:
--uuid "${UUID:-MISSING}" --uuid "${UUID:-MISSING}"
--mac-address "${MAC_ADDRESS:-MISSING}" --mac-address "${MAC_ADDRESS:-MISSING}"
--width "${WIDTH:-1920}"
--height "${HEIGHT:-1080}"
EOF EOF
exit 1
fi fi
./opencore-image-ng.sh \ ./opencore-image-ng.sh \
--cfg "${INPUT_PLIST:-./tmp.config.plist}" \ --cfg "./tmp.config.plist" \
--img "${OUTPUT_QCOW:-./${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1 --img "${OUTPUT_QCOW:-./${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
rm ./tmp.config.plist rm ./tmp.config.plist

View File

@ -1,58 +1,63 @@
#!/bin/bash #!/bin/bash
# ____ __ ____ ______ __ # ___ _____ __ ___ _ _ ___ _
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / _ \/ __\ \/ / / __| ___ _ _(_)__ _| | / __|___ _ _ ___ _ _ __ _| |_ ___ _ _
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # | (_) \__ \> < \__ \/ -_) '_| / _` | | | (_ / -_) ' \/ -_) '_/ _` | _/ _ \ '_|
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # \___/|___/_/\_\ |___/\___|_| |_\__,_|_| \___\___|_||_\___|_| \__,_|\__\___/_|
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| SERIALIZER
# #
# Repo: https://github.com/sickcodes/Docker-OSX/ # Repo: https://github.com/sickcodes/osx-serial-generator/
# Title: Mac on Docker (Docker-OSX) # Title: OSX Serial Generator
# Author: Sick.Codes https://sick.codes/ # Author: Sick.Codes https://sick.codes/
# Version: 3.1 # Version: 3.1
# License: GPLv3+ # License: GPLv3+
help_text="Usage: generate-unique-machine-values.sh set -e
help_text="Usage: ./generate-unique-machine-values.sh
General options: General options:
--count, -n, -c <count> Number of serials to generate --count, -n, -c <count> Number of serials to generate
--model, -m <model> Device model, e.g. 'iMacPro1,1' --model, -m <model> Device model, e.g. 'iMacPro1,1'
--csv <filename> Optionally change the CSV output filename. --csv <filename> Optionally change the CSV output filename
--tsv <filename> Optionally change the TSV output filename. --tsv <filename> Optionally change the TSV output filename
--output-bootdisk <filename> Optionally change the bootdisk qcow output filename. Useless when count > 1. --output-dir <directory> Optionally change the script output location
--output-env <filename> Optionally change the bootdisk env filename. Useless when count > 1. --width <string> Resolution x axis length in px, default 1920
--output-dir <directory> Optionally change the script output location. --height <string> Resolution y axis length in px, default 1080
--input-plist-url <url> Specify an alternative master plist, via URL
--master-plist-url <url> Same as above.
--custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--output-bootdisk <filename> Optionally change the bootdisk filename
--create-envs, --envs Create all corresponding sourcable envs
--create-plists, --plists Create all corresponding config.plists
--create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW]
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
--plists Create corresponding config.plists for each serial set.
--bootdisks [SLOW] Create corresponding boot disk images for each serial set. 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: Example:
./generate-unique-machine-values.sh --count 1 --model='iMacPro1,1' --plists --bootdisks ./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
The above example will generate a Defaults:
- serial - One serial, for 'iMacPro1,1', in the current working directory
- board serial - CSV and TSV output
- uuid - plists in ./plists/ & bootdisks in ./bootdisks/ & envs in ./envs
- MAC address - if you set --bootdisk name, --bootdisks is assumed
- ROM value based on lowercase MAC address - if you set --custom-plist, --plists is assumed
- Boot disk qcow image. - if you set --output-env, --envs is assumed
- config.plist
Notes:
- Default is 1 serial for 'iMacPro1,1' in the current working directory.
- Default output is CSV, whereas setting the TSV option will output as tab-separated.
- CSV is double quoted.
- If you do not set a CSV filename, the output will be sent to the output-dir.
- If you do not set an output-dir, the current directory will be the output directory.
- Sourcable environment variable shell files will be written to a folder, 'envs'.
- config.plist files will be written to a folder, 'plists'.
Author: Sick.Codes https://sick.codes/ Author: Sick.Codes https://sick.codes/
Project: https://github.com/sickcodes/Docker-OSX/ Project: https://github.com/sickcodes/osx-serial-generator/
License: GPLv3+
" "
MACINFOPKG_VERSION=2.1.2 OPENCORE_IMAGE_MAKER_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/opencore-image-ng.sh'
PLIST_MASTER=config-nopicker-custom.plist MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist'
# gather arguments # gather arguments
while (( "$#" )); do while (( "$#" )); do
@ -66,6 +71,7 @@ while (( "$#" )); do
export SERIAL_SET_COUNT="${1#*=}" export SERIAL_SET_COUNT="${1#*=}"
shift shift
;; ;;
--count* | -c* | -n* ) --count* | -c* | -n* )
export SERIAL_SET_COUNT="${2}" export SERIAL_SET_COUNT="${2}"
shift shift
@ -76,6 +82,7 @@ while (( "$#" )); do
export CSV_OUTPUT_FILENAME="${1#*=}" export CSV_OUTPUT_FILENAME="${1#*=}"
shift shift
;; ;;
--csv* ) --csv* )
export CSV_OUTPUT_FILENAME="${2}" export CSV_OUTPUT_FILENAME="${2}"
shift shift
@ -86,6 +93,7 @@ while (( "$#" )); do
export TSV_OUTPUT_FILENAME="${1#*=}" export TSV_OUTPUT_FILENAME="${1#*=}"
shift shift
;; ;;
--tsv* ) --tsv* )
export TSV_OUTPUT_FILENAME="${2}" export TSV_OUTPUT_FILENAME="${2}"
shift shift
@ -96,6 +104,7 @@ while (( "$#" )); do
export OUTPUT_DIRECTORY="${1#*=}" export OUTPUT_DIRECTORY="${1#*=}"
shift shift
;; ;;
--output-dir* ) --output-dir* )
export OUTPUT_DIRECTORY="${2}" export OUTPUT_DIRECTORY="${2}"
shift shift
@ -103,11 +112,12 @@ while (( "$#" )); do
;; ;;
--output-bootdisk=* ) --output-bootdisk=* )
export OUTPUT_QCOW="${1#*=}" export OUTPUT_BOOTDISK="${1#*=}"
shift shift
;; ;;
--output-bootdisk* ) --output-bootdisk* )
export OUTPUT_QCOW="${2}" export OUTPUT_BOOTDISK="${2}"
shift shift
shift shift
;; ;;
@ -116,6 +126,7 @@ while (( "$#" )); do
export OUTPUT_ENV="${1#*=}" export OUTPUT_ENV="${1#*=}"
shift shift
;; ;;
--output-env* ) --output-env* )
export OUTPUT_ENV="${2}" export OUTPUT_ENV="${2}"
shift shift
@ -126,18 +137,69 @@ while (( "$#" )); do
export DEVICE_MODEL="${1#*=}" export DEVICE_MODEL="${1#*=}"
shift shift
;; ;;
--model* | -m* ) --model* | -m* )
export DEVICE_MODEL="${2}" export DEVICE_MODEL="${2}"
shift shift
shift shift
;; ;;
--plists ) --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=* | --input-plist-url=* | --custom-plist-url=* )
export MASTER_PLIST_URL="${1#*=}"
shift
;;
--master-plist-url* | --input-plist-url* | --custom-plist-url* )
export MASTER_PLIST_URL="${2}"
shift
shift
;;
--master-plist=* | --input-plist=* | --custom-plist=* )
export MASTER_PLIST="${1#*=}"
shift
;;
--master-plist* | --input-plist* | --custom-plist* )
export MASTER_PLIST="${2}"
shift
shift
;;
--create-plists | --plists )
export CREATE_PLISTS=1 export CREATE_PLISTS=1
shift shift
;; ;;
--bootdisks )
export CREATE_QCOWS=1 --create-bootdisks | --bootdisks )
export CREATE_BOOTDISKS=1
shift
;;
--create-envs | --envs )
export CREATE_ENVS=1
shift shift
;; ;;
@ -150,58 +212,65 @@ done
build_mac_serial () { build_mac_serial () {
export MACINFOPKG_VERSION="${MACINFOPKG_VERSION:=2.1.2}" [ -d ./OpenCorePkg ] || git clone --depth 1 https://github.com/acidanthera/OpenCorePkg.git
wget -O "${TARBALL:=./MacInfoPkg.tar.gz}" \ make -C ./OpenCorePkg/Utilities/macserial/
"https://github.com/acidanthera/MacInfoPkg/archive/${MACINFOPKG_VERSION}.tar.gz" mv ./OpenCorePkg/Utilities/macserial/macserial .
tar -xzvf "${TARBALL}"
cd "./MacInfoPkg-${MACINFOPKG_VERSION}/macserial" \
&& ./build.tool \
&& cd -
mv "./MacInfoPkg-${MACINFOPKG_VERSION}/macserial/bin/macserial" .
rm -f "${TARBALL}"
rm -rf "./MacInfoPkg-${MACINFOPKG_VERSION}/"
chmod +x ./macserial chmod +x ./macserial
stat ./macserial stat ./macserial
} }
download_vendor_mac_addresses () { download_vendor_mac_addresses () {
# download the MAC Address vendor list # 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 [ -e "${MAC_ADDRESSES_FILE:=vendor_macs.tsv}" ] || wget -O "${MAC_ADDRESSES_FILE}" https://gitlab.com/wireshark/wireshark/-/raw/master/manuf
} }
download_qcow_efi_folder () { download_qcow_efi_folder () {
git clone --depth 1 https://github.com/kholia/OSX-KVM.git
cp -ra ./OSX-KVM/OpenCore-Catalina/EFI . export EFI_FOLDER=./OpenCore-Catalina/EFI
mkdir -p ./EFI/OC/Resources export RESOURCES_FOLDER=./resources/OcBinaryData/Resources
# clone some Apple drivers
git clone --depth 1 https://github.com/acidanthera/OcBinaryData.git # check if we are inside OSX-KVM already
# copy said drivers into EFI/OC/Resources # if not, download OSX-KVM locally
cp -a ./OcBinaryData/Resources/* ./EFI/OC/Resources [ -d ./OpenCore-Catalina/EFI/ ] || {
[ -d ./OSX-KVM/ ] || git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git
export EFI_FOLDER="./OSX-KVM/${EFI_FOLDER}"
}
[ -d ./resources/OcBinaryData/Resources/ ] || {
export RESOURCES_FOLDER="./OSX-KVM/${RESOURCES_FOLDER}"
}
# EFI Shell commands # EFI Shell commands
touch startup.nsh && echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh touch startup.nsh && echo 'fs0:\EFI\BOOT\BOOTx64.efi' > startup.nsh
cp -ra "${EFI_FOLDER}" .
mkdir -p ./EFI/OC/Resources
# copy Apple drivers into EFI/OC/Resources
cp -a "${RESOURCES_FOLDER}"/* ./EFI/OC/Resources
} }
generate_serial_sets () { generate_serial_sets () {
[[ -e ./config-nopicker-custom.plist ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/custom-identity/custom/config-nopicker-custom.plist
[[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/custom-identity/custom/opencore-image-ng.sh && chmod +x opencore-image-ng.sh
mkdir -p "${OUTPUT_DIRECTORY}/envs"
export DATE_NOW="$(date +%F-%T)"
export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}"
export VENDOR_REGEX="${VENDOR_REGEX:=Apple, Inc.}"
if [[ "${CSV_OUTPUT_FILENAME}" ]] || [[ "${TSV_OUTPUT_FILENAME}" ]]; then
[[ ${CSV_OUTPUT_FILENAME} ]] && export CSV_SERIAL_SETS_FILE="${CSV_OUTPUT_FILENAME}"
[[ ${TSV_OUTPUT_FILENAME} ]] && export TSV_SERIAL_SETS_FILE="${TSV_OUTPUT_FILENAME}" if [ "${CSV_OUTPUT_FILENAME}" ]; then
[ "${CSV_OUTPUT_FILENAME}" ] && export CSV_SERIAL_SETS_FILE="${CSV_OUTPUT_FILENAME}"
else else
export SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.csv" export CSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.csv"
fi
if [ "${TSV_OUTPUT_FILENAME}" ]; then
[ "${TSV_OUTPUT_FILENAME}" ] && export TSV_SERIAL_SETS_FILE="${TSV_OUTPUT_FILENAME}"
else
export TSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.tsv"
fi fi
touch "${SERIAL_SETS_FILE}"
echo "Writing serial sets to ${SERIAL_SETS_FILE}"
./macserial \ ./macserial \
--num "${SERIAL_SET_COUNT:=1}" \ --num "${SERIAL_SET_COUNT}" \
--model "${DEVICE_MODEL}" \ --model "${DEVICE_MODEL}" \
| while IFS='\ \|\ ' read -r SERIAL BOARD_SERIAL; do | while IFS='\ \|\ ' read -r SERIAL BOARD_SERIAL; do
# make a uuid... # make a uuid...
@ -213,16 +282,25 @@ generate_serial_sets () {
RANDOM_MAC_PREFIX="$(cut -d$'\t' -f1 <<< "${RANDOM_MAC_PREFIX}")" 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])" 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 # append to csv file
if [[ "${CSV_SERIAL_SETS_FILE}" ]]; then cat <<EOF >> "${CSV_SERIAL_SETS_FILE}"
echo "\"${DEVICE_MODEL}\",\"${SERIAL}\",\"${BOARD_SERIAL}\",\"${UUID}\",\"${MAC_ADDRESS}\"" >> "${CSV_SERIAL_SETS_FILE}" "${DEVICE_MODEL}","${SERIAL}","${BOARD_SERIAL}","${UUID}","${MAC_ADDRESS}","${WIDTH}","${HEIGHT}"
fi EOF
echo "Wrote CSV to: ${CSV_SERIAL_SETS_FILE}"
# append to tsv file # append to tsv file
if [[ "${TSV_SERIAL_SETS_FILE}" ]]; then T=$'\t'
printf "${DEVICE_MODEL}\t${SERIAL}\t${BOARD_SERIAL}\t${UUID}\t${MAC_ADDRESS}\n" >> "${TSV_SERIAL_SETS_FILE}" cat <<EOF >> "${TSV_SERIAL_SETS_FILE}"
fi ${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}"
# if any of these are on, we need the env file.
if [ "${CREATE_ENVS}" ] || [ "${CREATE_PLISTS}" ] || [ "${CREATE_BOOTDISKS}" ] || [ "${OUTPUT_BOOTDISK}" ] || [ "${OUTPUT_ENV}" ]; then
mkdir -p "${OUTPUT_DIRECTORY}/envs"
OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}" OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}"
touch "${OUTPUT_ENV_FILE}" touch "${OUTPUT_ENV_FILE}"
cat <<EOF > "${OUTPUT_ENV_FILE}" cat <<EOF > "${OUTPUT_ENV_FILE}"
@ -231,43 +309,69 @@ export SERIAL="${SERIAL}"
export BOARD_SERIAL="${BOARD_SERIAL}" export BOARD_SERIAL="${BOARD_SERIAL}"
export UUID="${UUID}" export UUID="${UUID}"
export MAC_ADDRESS="${MAC_ADDRESS}" export MAC_ADDRESS="${MAC_ADDRESS}"
export WIDTH="${WIDTH}"
export HEIGHT="${HEIGHT}"
EOF EOF
fi
# plist required for bootdisks, so create anyway. # plist required for bootdisks, so create anyway.
if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_QCOWS}" ]]; then 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" mkdir -p "${OUTPUT_DIRECTORY}/plists"
source "${OUTPUT_ENV_FILE}" source "${OUTPUT_ENV_FILE}"
ROM_VALUE="${MAC_ADDRESS//\:/}" ROM_VALUE="${MAC_ADDRESS//\:/}"
ROM_VALUE="${ROM_VALUE,,}" ROM_VALUE="${ROM_VALUE,,}"
sed -e s/{{DEVICE_MODEL}}/"${DEVICE_MODEL}"/g \ sed -e s/\{\{DEVICE_MODEL\}\}/"${DEVICE_MODEL}"/g \
-e s/{{SERIAL}}/"${SERIAL}"/g \ -e s/\{\{SERIAL\}\}/"${SERIAL}"/g \
-e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \ -e s/\{\{BOARD_SERIAL\}\}/"${BOARD_SERIAL}"/g \
-e s/{{UUID}}/"${UUID}"/g \ -e s/\{\{UUID\}\}/"${UUID}"/g \
-e s/{{ROM}}/"${ROM}"/g \ -e s/\{\{ROM\}\}/"${ROM}"/g \
"${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 -e s/\{\{WIDTH\}\}/"${WIDTH}"/g \
-e s/\{\{HEIGHT\}\}/"${HEIGHT}"/g \
"${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
fi fi
if [[ "${CREATE_QCOWS}" ]]; then # make bootdisk qcow2 format if --bootdisks, but also if you set the bootdisk filename
mkdir -p "${OUTPUT_DIRECTORY}/qcows" 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 \ ./opencore-image-ng.sh \
--cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \ --cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \
--img "${OUTPUT_QCOW:-${OUTPUT_DIRECTORY}/qcows/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1 --img "${OUTPUT_BOOTDISK:-${OUTPUT_DIRECTORY}/bootdisks/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
fi fi
done done
[[ -e "${CSV_SERIAL_SETS_FILE}" ]] && \ [ -e "${CSV_SERIAL_SETS_FILE}" ] && \
cat <(echo "DEVICE_MODEL,SERIAL,BOARD_SERIAL,UUID,MAC_ADDRESS") "${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}" ]] && \ [ -e "${TSV_SERIAL_SETS_FILE}" ] && \
cat <(printf "DEVICE_MODEL\tSERIAL\tBOARD_SERIAL\tUUID\tMAC_ADDRESS\n") "${TSV_SERIAL_SETS_FILE}" cat <(printf "DEVICE_MODEL\tSERIAL\tBOARD_SERIAL\tUUID\tMAC_ADDRESS\tWIDTH\tHEIGHT\n") "${TSV_SERIAL_SETS_FILE}"
} }
main () { main () {
# setting default variables if there are no options # setting default variables if there are no options
export DATE_NOW="$(date +%F-%T)"
export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}" export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}"
export VENDOR_REGEX="${VENDOR_REGEX:=Apple, Inc.}"
export SERIAL_SET_COUNT="${SERIAL_SET_COUNT:=1}" export SERIAL_SET_COUNT="${SERIAL_SET_COUNT:=1}"
export OUTPUT_DIRECTORY="${OUTPUT_DIRECTORY:=.}" export OUTPUT_DIRECTORY="${OUTPUT_DIRECTORY:=.}"
cat <<EOF cat <<EOF
@ -275,8 +379,8 @@ DEVICE_MODEL: ${DEVICE_MODEL}
SERIAL_SET_COUNT: ${SERIAL_SET_COUNT} SERIAL_SET_COUNT: ${SERIAL_SET_COUNT}
OUTPUT_DIRECTORY: ${OUTPUT_DIRECTORY} OUTPUT_DIRECTORY: ${OUTPUT_DIRECTORY}
EOF EOF
[[ -d "${OUTPUT_DIRECTORY}" ]] || mkdir -p "${OUTPUT_DIRECTORY}" [ -d "${OUTPUT_DIRECTORY}" ] || mkdir -p "${OUTPUT_DIRECTORY}"
[[ -e ./macserial ]] || build_mac_serial [ -e ./macserial ] || build_mac_serial
download_vendor_mac_addresses download_vendor_mac_addresses
download_qcow_efi_folder download_qcow_efi_folder
generate_serial_sets generate_serial_sets

View File

@ -89,7 +89,7 @@ function fish_fini() {
fish umount-all fish umount-all
} }
# disabled by sick.codes to allow unattended image overwrites # disabled by @sickcodes to allow unattended image overwrites
###################################################################### ######################################################################
# sanity checks # sanity checks

View File

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.0.1.0" appVersion: "0.0.1.0"
description: "Containerized OSX! Run OSX in a pod, headlessly, or with Xvfb. Test your Apps and master CI/CD processes." description: "Containerized OSX! Run OSX in a pod, headlessly, or with Xvfb. Test your Apps and master CI/CD processes."
name: docker-osx name: docker-osx
version: 0.1.0 version: 0.2.0
keywords: keywords:
- docker-osx - docker-osx
- mac - mac

Binary file not shown.

BIN
helm/docker-osx-0.2.0.tgz Normal file

Binary file not shown.

View File

@ -3,9 +3,9 @@ entries:
docker-osx: docker-osx:
- apiVersion: v1 - apiVersion: v1
appVersion: 0.0.1.0 appVersion: 0.0.1.0
created: "2021-02-12T18:10:08.054368621Z" created: "2021-02-27T04:15:48.784861502Z"
description: Containerized OSX! Run OSX in a pod, headlessly, or with Xvfb. Test your Apps and master CI/CD processes. description: Containerized OSX! Run OSX in a pod, headlessly, or with Xvfb. Test your Apps and master CI/CD processes.
digest: 04e88d78156fa1de709a3dad16558cb8f0bd1c1f0bde8144d530c9a0c143123a digest: 5a62a9291b1494b9cfaa0708ab7bab9d13cca30adbeaced3d29a5bb6935caac9
keywords: keywords:
- docker-osx - docker-osx
- mac - mac
@ -19,6 +19,6 @@ entries:
- osx - osx
name: docker-osx name: docker-osx
urls: urls:
- https://sickcodes.github.io/Docker-OSX/helm/docker-osx-0.1.0.tgz - https://sickcodes.github.io/Docker-OSX/helm/docker-osx-0.2.0.tgz
version: 0.1.0 version: 0.2.0
generated: "2021-02-12T18:10:08.053067083Z" generated: "2021-02-27T04:15:48.782073839Z"

1
osx-serial-generator Submodule

Submodule osx-serial-generator added at 0149015547