From 5469cb8a582cc6354b45b2a4ddd9820ebeffa1c5 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Wed, 3 Mar 2021 16:54:45 +0000 Subject: [PATCH 01/10] Add WIDTH and HEIGHT environment variables --- CHANGELOG.md | 1 + Dockerfile | 29 ++++++--- README.md | 76 +++++++++++++++++++++++- custom/config-nopicker-custom.plist | 2 +- custom/generate-specific-bootdisk.sh | 43 +++++++++++--- custom/generate-unique-machine-values.sh | 27 +++++++++ 6 files changed, 162 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9157591..8396d7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ |Version|Date|Notes| |---|---|---| +| |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`.| diff --git a/Dockerfile b/Dockerfile index bff6570..8afebe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -259,8 +259,19 @@ ENV NETWORKING=vmxnet3 ENV NOPICKER=false -ENV UNIQUE=false -# Boolean for generating a bootdisk with new serials. +# 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 + +# 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 VOLUME ["/tmp/.X11-unix"] @@ -296,11 +307,13 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --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}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ @@ -310,6 +323,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --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}" || exit 1 \ ; } \ ; case "$(file --brief /bootdisk)" in \ diff --git a/README.md b/README.md index 3a8b604..08cf699 100644 --- a/README.md +++ b/README.md @@ -493,6 +493,43 @@ sudo nohup dockerd & 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 Allow ipv4 forwarding for bridged networking connections: @@ -706,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. ```bash +# this is a quick way to check your serial number via cli inside OSX ioreg -l | grep IOPlatformSerialNumber # 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 # proof of concept only, generates random serial numbers, headlessly, and quits right after. @@ -724,6 +763,8 @@ docker run --rm -it \ sickcodes/docker-osx:auto ``` +# This example generates a specific set of serial numbers at runtime + ```bash # 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! @@ -743,6 +784,7 @@ docker run -it \ sickcodes/docker-osx:auto ``` +# This example generates a specific set of serial numbers at runtime, with your existing image, at 1000x1000 display resolution. ```bash # run an existing image in current directory, with a screen, with SSH, with nopicker, and save the bootdisk for later. @@ -762,6 +804,8 @@ docker run -it \ -e BOARD_SERIAL="C027251024NJG36UE" \ -e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \ -e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \ + -e WIDTH=1000 \ + -e HEIGHT=1000 \ -e BOOTDISK=/bootdisk \ -v "${PWD}/mynewbootdisk.qcow:/bootdisk" \ -v "${PWD}/mac_hdd_ng.img:/image" \ @@ -780,6 +824,36 @@ Or you can generate them inside the `./custom` folder. And then use: -e MAC_ADDRESS="" \ ``` +# Change Resolution Docker-OSX + +The display resolution is controlled by this line: + +https://github.com/sickcodes/Docker-OSX/blob/master/custom/config-nopicker-custom.plist#L819 + +However, you need to mount that disk. Boring! + +Instead, you can simply add the following to any image: + +```bash +-e GENERATE_UNIQUE=true \ +-e WIDTH=1920 \ +-e HEIGHT=1080 \ +``` + +It will take around 1 minute longer to boot because it will make a new boot partition. + +```bash +-e GENERATE_SPECIFIC=true \ +-e WIDTH=1920 \ +-e HEIGHT=1080 \ +-e SERIAL="" \ +-e BOARD_SERIAL="" \ +-e UUID="" \ +-e MAC_ADDRESS="" \ +``` + +Must be used with either `-e GENERATE_UNIQUE=true` or `-e GENERATE_SPECIFIC=true`. + #### Persistence from generating serial numbers is obviously ideal: ```bash diff --git a/custom/config-nopicker-custom.plist b/custom/config-nopicker-custom.plist index 6166234..aa60a39 100644 --- a/custom/config-nopicker-custom.plist +++ b/custom/config-nopicker-custom.plist @@ -816,7 +816,7 @@ ReplaceTabWithSpace Resolution - 1920x1080@32 + {{WIDTH}}x{{HEIGHT}}@32 SanitiseClearScreen TextRenderer diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index 76aff0c..d5450b8 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -15,12 +15,14 @@ help_text="Usage: generate-specific-bootdisk.sh General options: --model Device model, e.g. 'iMacPro1,1' - --serial Device Serial number. - --board-serial Board Serial number. - --uuid SmUUID. - --mac-address Used to set the ROM value; lowercased and without a colon. - --output-bootdisk Optionally change the bootdisk output filename. - --custom-plist Optionally change the input plist. + --serial Device Serial number + --board-serial Board Serial number + --uuid SmUUID + --mac-address Used to set the ROM value; lowercased and without a colon + --width Resolution x axis length in pixels (default 1920) + --height Resolution y axis length in pixels (default 1080 + --output-bootdisk Optionally change the bootdisk output filename + --custom-plist Optionally change the input plist --help, -h, help Display this help and exit @@ -31,7 +33,9 @@ Example: --board-serial C027251024NJG36UE \ --uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \ --mac-address A8:5C:2C:9A:46:2F \ - --output-bootdisk OpenCore-nopicker.qcow2 + --output-bootdisk OpenCore-nopicker.qcow2 \ + --widht 1920 \ + --height 1080 Author: Sick.Codes https://sick.codes/ Project: https://github.com/sickcodes/Docker-OSX/ @@ -97,6 +101,26 @@ while (( "$#" )); do 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 @@ -153,6 +177,8 @@ generate_bootdisk () { -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 \ "${PLIST_MASTER}" > ./tmp.config.plist || exit 1 else cat < Optionally change the bootdisk qcow output filename. Useless when count > 1. --output-env Optionally change the bootdisk env filename. Useless when count > 1. --output-dir Optionally change the script output location. + --width Resolution x axis length in pixels (default 1920) + --height Resolution y axis length in pixels (default 1080 --help, -h, help Display this help and exit --plists Create corresponding config.plists for each serial set. @@ -132,6 +134,27 @@ while (( "$#" )); do shift ;; + --width=* ) + export WIDTH="${1#*=}" + shift + ;; + + --width* ) + export WIDTH="${2}" + shift + shift + ;; + + --height=* ) + export HEIGHT="${1#*=}" + shift + ;; + --height* ) + export HEIGHT="${2}" + shift + shift + ;; + --plists ) export CREATE_PLISTS=1 shift @@ -231,6 +254,8 @@ export SERIAL="${SERIAL}" export BOARD_SERIAL="${BOARD_SERIAL}" export UUID="${UUID}" export MAC_ADDRESS="${MAC_ADDRESS}" +export WIDTH="${WIDTH:=1920}" +export HEIGHT="${HEIGHT:=1080}" EOF # plist required for bootdisks, so create anyway. @@ -244,6 +269,8 @@ EOF -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 \ "${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 fi From 408248ae4f95f4c2760afa94bfb06d799c7317f8 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 09:12:50 +0000 Subject: [PATCH 02/10] Missing WIDTH and HEIGHT from naked and auto Dockerfiles --- Dockerfile.auto | 14 +++++++++----- Dockerfile.naked | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Dockerfile.auto b/Dockerfile.auto index ca6e548..a5b03a8 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -152,11 +152,13 @@ CMD echo "${BOILERPLATE}" \ ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --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}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ @@ -166,6 +168,8 @@ CMD echo "${BOILERPLATE}" \ --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}" || exit 1 \ ; } \ ; case "$(file --brief /bootdisk)" in \ diff --git a/Dockerfile.naked b/Dockerfile.naked index 09db8a3..e2a2806 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -122,11 +122,13 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --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}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ @@ -136,6 +138,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --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}" || exit 1 \ ; } \ ; case "$(file --brief /bootdisk)" in \ From 3f4c0c6bd4d993e90fd66138521247a2014e70f2 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 09:48:04 +0000 Subject: [PATCH 03/10] Add --custom-plist-url, --custom-plist or --master-plist to both serial generators. --- custom/generate-specific-bootdisk.sh | 53 +++++++++++++++++++--- custom/generate-unique-machine-values.sh | 58 ++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 9 deletions(-) diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index d5450b8..1dadfe5 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -22,7 +22,12 @@ General options: --width Resolution x axis length in pixels (default 1920) --height Resolution y axis length in pixels (default 1080 --output-bootdisk Optionally change the bootdisk output filename - --custom-plist Optionally change the input plist + + --master-plist-url Specify an alternative master plist, via URL. + --custom-plist | --master-plist + Optionally change the input plist. Placeholders: + {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, + {{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}} --help, -h, help Display this help and exit @@ -131,12 +136,33 @@ while (( "$#" )); do 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 INPUT_PLIST="${1#*=}" + export MASTER_PLIST="${1#*=}" shift ;; --custom-plist* ) - export INPUT_PLIST="${2}" + export MASTER_PLIST="${2}" shift shift ;; @@ -162,8 +188,23 @@ download_qcow_efi_folder () { } generate_bootdisk () { - [[ -e ./config-nopicker-custom.plist ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist + + if [[ "${MASTER_PLIST}" ]]; then + [[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}" + elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; + echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' + elif [[ "${MASTER_PLIST_URL}" ]]; + wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + else + MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' + wget -o "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + fi + + [[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/opencore-image-ng.sh && chmod +x opencore-image-ng.sh + # plist required for bootdisks, so create anyway. if [[ "${DEVICE_MODEL}" ]] \ && [[ "${SERIAL}" ]] \ @@ -179,7 +220,7 @@ generate_bootdisk () { -e s/{{ROM}}/"${ROM}"/g \ -e s/{{WIDTH}}/"${WIDTH:-1920}"/g \ -e s/{{HEIGHT}}/"${HEIGHT:-1080}"/g \ - "${PLIST_MASTER}" > ./tmp.config.plist || exit 1 + "${MASTER_PLIST}" > ./tmp.config.plist || exit 1 else cat < Resolution x axis length in pixels (default 1920) --height Resolution y axis length in pixels (default 1080 + --master-plist-url Specify an alternative master plist, via URL. + --master-plist | --custom-plist + Optionally change the input plist. Placeholders: + {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, + {{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}} + --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. @@ -54,7 +60,6 @@ Project: https://github.com/sickcodes/Docker-OSX/ " MACINFOPKG_VERSION=2.1.2 -PLIST_MASTER=config-nopicker-custom.plist # gather arguments while (( "$#" )); do @@ -155,6 +160,39 @@ while (( "$#" )); do 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 @@ -206,8 +244,22 @@ download_qcow_efi_folder () { generate_serial_sets () { - [[ -e ./config-nopicker-custom.plist ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist + + if [[ "${MASTER_PLIST}" ]]; then + [[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}" + elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; + echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' + elif [[ "${MASTER_PLIST_URL}" ]]; + wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + else + MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' + wget -o "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + fi + [[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/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}" @@ -271,7 +323,7 @@ EOF -e s/{{ROM}}/"${ROM}"/g \ -e s/{{WIDTH}}/"${WIDTH}"/g \ -e s/{{HEIGHT}}/"${HEIGHT}"/g \ - "${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 + "${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 fi if [[ "${CREATE_QCOWS}" ]]; then From 377c4e7cc5cdd785e965e13e15086c2326797b51 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 09:52:45 +0000 Subject: [PATCH 04/10] Add -e MASTER_PLIST_URL to change the input config.plist at runtime. --- CHANGELOG.md | 1 + Dockerfile | 4 ++++ Dockerfile.auto | 2 ++ Dockerfile.naked | 2 ++ 4 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8396d7d..abc2d75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ |Version|Date|Notes| |---|---|---| +| |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`| diff --git a/Dockerfile b/Dockerfile index 8afebe3..5539d62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -273,6 +273,8 @@ ENV NOPICKER=false ENV WIDTH=1920 ENV HEIGHT=1080 +ENV MASTER_PLIST_URL="https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist" + VOLUME ["/tmp/.X11-unix"] # check if /image is a disk image or a directory. This allows you to optionally use -v disk.img:/image @@ -307,6 +309,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --count 1 \ --tsv ./serial.tsv \ --bootdisks \ @@ -318,6 +321,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ --board-serial "${BOARD_SERIAL}" \ diff --git a/Dockerfile.auto b/Dockerfile.auto index a5b03a8..d203551 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -152,6 +152,7 @@ CMD echo "${BOILERPLATE}" \ ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --count 1 \ --tsv ./serial.tsv \ --bootdisks \ @@ -163,6 +164,7 @@ CMD echo "${BOILERPLATE}" \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ --board-serial "${BOARD_SERIAL}" \ diff --git a/Dockerfile.naked b/Dockerfile.naked index e2a2806..a1a1de3 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -122,6 +122,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; } \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ./Docker-OSX/custom/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --count 1 \ --tsv ./serial.tsv \ --bootdisks \ @@ -133,6 +134,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" \ || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ --board-serial "${BOARD_SERIAL}" \ From 84fc71722c1742c0f51fb4b89317717ae4a987df Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 11:42:36 +0000 Subject: [PATCH 05/10] Syntax error: `elif` obviously needs a `; then` --- custom/generate-specific-bootdisk.sh | 4 ++-- custom/generate-unique-machine-values.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index 1dadfe5..62e2005 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -191,9 +191,9 @@ generate_bootdisk () { if [[ "${MASTER_PLIST}" ]]; then [[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}" - elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; + elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' - elif [[ "${MASTER_PLIST_URL}" ]]; + elif [[ "${MASTER_PLIST_URL}" ]]; then wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else diff --git a/custom/generate-unique-machine-values.sh b/custom/generate-unique-machine-values.sh index 811f4b5..0aee356 100755 --- a/custom/generate-unique-machine-values.sh +++ b/custom/generate-unique-machine-values.sh @@ -247,9 +247,9 @@ generate_serial_sets () { if [[ "${MASTER_PLIST}" ]]; then [[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}" - elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; + elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' - elif [[ "${MASTER_PLIST_URL}" ]]; + elif [[ "${MASTER_PLIST_URL}" ]]; then wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else From 45a5f2c074de948eaef8d48bde2a3df9ce238289 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 11:57:52 +0000 Subject: [PATCH 06/10] wget -O case sensitive, silence source /env errors. --- Dockerfile | 4 ++-- Dockerfile.auto | 4 ++-- Dockerfile.naked | 7 +++---- custom/generate-specific-bootdisk.sh | 4 ++-- custom/generate-unique-machine-values.sh | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5539d62..9dba25d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -319,8 +319,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --output-env "${ENV:=/env}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" \ - || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/custom/generate-specific-bootdisk.sh \ --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ diff --git a/Dockerfile.auto b/Dockerfile.auto index d203551..b5ac7da 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -162,8 +162,8 @@ CMD echo "${BOILERPLATE}" \ --output-env "${ENV:=/env}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" \ - || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/custom/generate-specific-bootdisk.sh \ --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ diff --git a/Dockerfile.naked b/Dockerfile.naked index a1a1de3..b0e0871 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -132,8 +132,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --output-env "${ENV:=/env}" || exit 1 \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" \ - || ./Docker-OSX/custom/generate-specific-bootdisk.sh \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/custom/generate-specific-bootdisk.sh \ --master-plist-url="${MASTER_PLIST_URL}" \ --model "${DEVICE_MODEL}" \ --serial "${SERIAL}" \ @@ -142,8 +142,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --mac-address "${MAC_ADDRESS}" \ --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ - ; } \ + --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" ; case "$(file --brief /bootdisk)" in \ QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \ ;; \ diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index 62e2005..9f56409 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -194,11 +194,11 @@ generate_bootdisk () { elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then - wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' - wget -o "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 fi diff --git a/custom/generate-unique-machine-values.sh b/custom/generate-unique-machine-values.sh index 0aee356..2eece98 100755 --- a/custom/generate-unique-machine-values.sh +++ b/custom/generate-unique-machine-values.sh @@ -250,11 +250,11 @@ generate_serial_sets () { elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then - wget -o "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' - wget -o "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 fi From e03f0737c3ce4428047808c367409396cfa9e7ff Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 11:59:40 +0000 Subject: [PATCH 07/10] Fix `.//config-custom.plist` --- custom/generate-specific-bootdisk.sh | 4 ++-- custom/generate-unique-machine-values.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index 9f56409..f407f3d 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -194,11 +194,11 @@ generate_bootdisk () { elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then - wget -O "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' - wget -O "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 fi diff --git a/custom/generate-unique-machine-values.sh b/custom/generate-unique-machine-values.sh index 2eece98..f013898 100755 --- a/custom/generate-unique-machine-values.sh +++ b/custom/generate-unique-machine-values.sh @@ -250,11 +250,11 @@ generate_serial_sets () { elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then - wget -O "./${MASTER_PLIST:=/config-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' - wget -O "./${MASTER_PLIST:=/config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ + wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 fi From 4b278bc42c10c29fc8592d018bf2e59678cf8174 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 12:05:41 +0000 Subject: [PATCH 08/10] Shift exits --- Dockerfile | 4 ++-- Dockerfile.auto | 4 ++-- Dockerfile.naked | 5 +++-- custom/generate-specific-bootdisk.sh | 4 ++-- custom/generate-unique-machine-values.sh | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9dba25d..61464b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -316,7 +316,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --output-env "${ENV:=/env}" \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" 2>/dev/null \ @@ -329,7 +329,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --mac-address "${MAC_ADDRESS}" \ --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ + --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ ; } \ ; case "$(file --brief /bootdisk)" in \ QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \ diff --git a/Dockerfile.auto b/Dockerfile.auto index b5ac7da..1e0c84e 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -159,7 +159,7 @@ CMD echo "${BOILERPLATE}" \ --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --output-env "${ENV:=/env}" \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" 2>/dev/null \ @@ -172,7 +172,7 @@ CMD echo "${BOILERPLATE}" \ --mac-address "${MAC_ADDRESS}" \ --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \ + --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ ; } \ ; case "$(file --brief /bootdisk)" in \ QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \ diff --git a/Dockerfile.naked b/Dockerfile.naked index b0e0871..6ac5333 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -129,7 +129,7 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --width "${WIDTH:-1920}" \ --height "${HEIGHT:-1080}" \ --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" || exit 1 \ + --output-env "${ENV:=/env}" \ ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ source "${ENV:=/env}" 2>/dev/null \ @@ -142,7 +142,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS --mac-address "${MAC_ADDRESS}" \ --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}" \ + ; } \ ; case "$(file --brief /bootdisk)" in \ QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \ ;; \ diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh index f407f3d..b847a50 100755 --- a/custom/generate-specific-bootdisk.sh +++ b/custom/generate-specific-bootdisk.sh @@ -195,11 +195,11 @@ generate_bootdisk () { echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}" \ - || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + || { echo "Could not download ${MASTER_PLIST_URL}" && exit 1 ; } else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ - || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + || { echo "Could not download ${MASTER_PLIST_URL}" && exit 1 ; } fi diff --git a/custom/generate-unique-machine-values.sh b/custom/generate-unique-machine-values.sh index f013898..6ab15b8 100755 --- a/custom/generate-unique-machine-values.sh +++ b/custom/generate-unique-machine-values.sh @@ -251,11 +251,11 @@ generate_serial_sets () { echo 'You specified both a custom plist file AND a custom plist url. Use one or the other.' elif [[ "${MASTER_PLIST_URL}" ]]; then wget -O "${MASTER_PLIST:=./config-custom.plist}" "${MASTER_PLIST_URL}" \ - || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + || { echo "Could not download ${MASTER_PLIST_URL}" && exit 1 ; } else MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist' wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" \ - || echo "Could not download ${MASTER_PLIST_URL}" && exit 1 + || { echo "Could not download ${MASTER_PLIST_URL}" && exit 1 ; } fi [[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/opencore-image-ng.sh && chmod +x opencore-image-ng.sh From 2077c3a45354ed6beb753afaed49d789d94a25b6 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 13:22:13 +0000 Subject: [PATCH 09/10] v4.1 WIDTH/HEIGHT && move resolution README note --- CHANGELOG.md | 4 +- Dockerfile | 9 ++-- Dockerfile.auto | 9 ++-- Dockerfile.naked | 9 ++-- README.md | 123 +++++++++++++++++++++++++++++++++++------------ 5 files changed, 109 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abc2d75..5fc75bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ |Version|Date|Notes| |---|---|---| -| |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.| +|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`.| diff --git a/Dockerfile b/Dockerfile index 61464b8..756773d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,12 @@ # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| # -# Repo: https://github.com/sickcodes/Docker-OSX/ -# Title: Mac on Docker (Docker-OSX) -# Author: Sick.Codes https://sick.codes/ -# Version: 4.0 +# Title: Docker-OSX (Mac on Docker) +# Author: Sick.Codes https://twitter.com/sickcodes +# Version: 4.1 # 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 # OpenCore support go to https://github.com/Leoyzen/KVM-Opencore diff --git a/Dockerfile.auto b/Dockerfile.auto index 1e0c84e..7586eee 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -3,13 +3,14 @@ # / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | -# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| AUTOINSTALL +# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :AUTO # -# Title: Mac on Docker (Docker-OSX) [AUTOINSTALL] -# Author: Sick.Codes https://twitter.com/sickcodes -# Version: 4.0 +# Title: Docker-OSX (Mac on Docker) +# Author: Sick.Codes https://twitter.com/sickcodes +# Version: 4.1 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX +# Website: https://sick.codes # # This Dockerfile is a pre-installed naked installation of Docker-OSX! # diff --git a/Dockerfile.naked b/Dockerfile.naked index 6ac5333..b8ffb3f 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -3,13 +3,14 @@ # / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | -# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| NAKED/SUPPLY_YOUR_OWN +# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKED # -# Title: Mac on Docker (Docker-OSX) [AUTOINSTALL] -# Author: Sick.Codes https://twitter.com/sickcodes -# Version: 4.0 +# Title: Docker-OSX (Mac on Docker) [AUTOINSTALL] +# Author: Sick.Codes https://twitter.com/sickcodes +# Version: 4.1 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX +# Website: https://sick.codes # # This image won't run unless you supply a disk image using: # -v ${PWD}/mac_hdd_ng.img:/image diff --git a/README.md b/README.md index 08cf699..9a2c07c 100644 --- a/README.md +++ b/README.md @@ -784,7 +784,7 @@ docker run -it \ sickcodes/docker-osx:auto ``` -# This example generates a specific set of serial numbers at runtime, with your existing image, at 1000x1000 display resolution. +### This example generates a specific set of serial numbers at runtime, with your existing image, at 1000x1000 display resolution. ```bash # run an existing image in current directory, with a screen, with SSH, with nopicker, and save the bootdisk for later. @@ -824,36 +824,6 @@ Or you can generate them inside the `./custom` folder. And then use: -e MAC_ADDRESS="" \ ``` -# Change Resolution Docker-OSX - -The display resolution is controlled by this line: - -https://github.com/sickcodes/Docker-OSX/blob/master/custom/config-nopicker-custom.plist#L819 - -However, you need to mount that disk. Boring! - -Instead, you can simply add the following to any image: - -```bash --e GENERATE_UNIQUE=true \ --e WIDTH=1920 \ --e HEIGHT=1080 \ -``` - -It will take around 1 minute longer to boot because it will make a new boot partition. - -```bash --e GENERATE_SPECIFIC=true \ --e WIDTH=1920 \ --e HEIGHT=1080 \ --e SERIAL="" \ --e BOARD_SERIAL="" \ --e UUID="" \ --e MAC_ADDRESS="" \ -``` - -Must be used with either `-e GENERATE_UNIQUE=true` or `-e GENERATE_SPECIFIC=true`. - #### Persistence from generating serial numbers is obviously ideal: ```bash @@ -950,6 +920,97 @@ generate-specific-bootdisk.sh \ --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 \ +``` + # Allow USB passthrough The simplest way to do this is the following: From b2f6ac509c78387d250a59c666eae03e2dc65ef7 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 13:27:12 +0000 Subject: [PATCH 10/10] Typo --- Dockerfile.naked | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.naked b/Dockerfile.naked index b8ffb3f..920a51f 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -5,7 +5,7 @@ # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKED # -# Title: Docker-OSX (Mac on Docker) [AUTOINSTALL] +# Title: Docker-OSX (Mac on Docker) # Author: Sick.Codes https://twitter.com/sickcodes # Version: 4.1 # License: GPLv3+