From d380dd13451aa1431af9bef6a41c8b58db07ae6d Mon Sep 17 00:00:00 2001 From: pathtofile Date: Mon, 12 Dec 2022 14:27:09 +1100 Subject: [PATCH] Cleaned Dockerfile CMD entrypoint to make it easier to extend or build on top of built image --- Dockerfile | 34 ++------------------- Dockerfile.auto | 65 ++-------------------------------------- Dockerfile.monterey | 34 ++------------------- Dockerfile.naked | 38 ++--------------------- Dockerfile.naked-auto | 62 ++------------------------------------ entrypoint.auto.sh | 65 ++++++++++++++++++++++++++++++++++++++++ entrypoint.monterey.sh | 34 +++++++++++++++++++++ entrypoint.naked-auto.sh | 62 ++++++++++++++++++++++++++++++++++++++ entrypoint.naked.sh | 38 +++++++++++++++++++++++ entrypoint.sh | 34 +++++++++++++++++++++ 10 files changed, 243 insertions(+), 223 deletions(-) create mode 100755 entrypoint.auto.sh create mode 100755 entrypoint.monterey.sh create mode 100755 entrypoint.naked-auto.sh create mode 100755 entrypoint.naked.sh create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index f73c12c..e1e746a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -354,38 +354,8 @@ VOLUME ["/tmp/.X11-unix"] # the default serial numbers are already contained in ./OpenCore/OpenCore.qcow2 # And the default serial numbers -CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; [[ "${NOPICKER}" == true ]] && { \ - sed -i '/^.*InstallMedia.*/d' Launch.sh \ - && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ - ; } \ - || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ - ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" \ - || exit 1 ; } \ - ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" 2>/dev/null \ - ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --model "${DEVICE_MODEL}" \ - --serial "${SERIAL}" \ - --board-serial "${BOARD_SERIAL}" \ - --uuid "${UUID}" \ - --mac-address "${MAC_ADDRESS}" \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - || exit 1 ; } \ - ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh +COPY entrypoint.sh . +CMD ["bash", "-c", "entrypoint.sh"] # virt-manager mode: eta son # CMD virsh define <(envsubst < Docker-OSX.xml) && virt-manager || virt-manager diff --git a/Dockerfile.auto b/Dockerfile.auto index 432d01b..08e2cab 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -206,69 +206,8 @@ 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" -CMD echo "${BOILERPLATE}" \ - ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ - ; echo "Disk is being copied between layers... Please wait a minute..." \ - ; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; [[ "${NOPICKER}" == true ]] && { \ - sed -i '/^.*InstallMedia.*/d' Launch.sh \ - && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ - ; } \ - || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ - ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" \ - || exit 1 ; } \ - ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" 2>/dev/null \ - ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --model "${DEVICE_MODEL}" \ - --serial "${SERIAL}" \ - --board-serial "${BOARD_SERIAL}" \ - --uuid "${UUID}" \ - --mac-address "${MAC_ADDRESS}" \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - || exit 1 ; } \ - ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ - nohup Xvfb :99 -screen 0 1920x1080x16 \ - & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ - ; } \ - ; stat "${IMAGE_PATH}" \ - ; echo "Large image is being copied between layers, please wait a minute..." \ - ; ./enable-ssh.sh \ - ; [[ -e ~/.ssh/id_docker_osx ]] || { \ - /usr/bin/ssh-keygen -t rsa -f ~/.ssh/id_docker_osx -q -N "" \ - && chmod 600 ~/.ssh/id_docker_osx \ - ; } \ - ; /bin/bash -c ./Launch.sh \ - & echo "Booting Docker-OSX in the background. Please wait..." \ - ; until [[ "$(sshpass -p${PASSWORD:=alpine} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME:=user}@127.0.0.1)" ]]; do \ - echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ - ; sleep 1 \ - ; done \ - ; grep id_docker_osx ~/.ssh/config || { \ - tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ - ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ - ; tee -a ~/.ssh/config <<< ' Port 10022' \ - ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ - ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ - ; tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' \ - ; } \ - && echo 'Default username: user' \ - && echo 'Default password: alpine' \ - && echo 'Change it immediately using the command: passwd' \ - && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" +COPY entrypoint.auto.sh . +CMD ["bash", "-c", "entrypoint.auto.sh"] # username: user # password: alpine diff --git a/Dockerfile.monterey b/Dockerfile.monterey index 6d7718d..5f7650d 100644 --- a/Dockerfile.monterey +++ b/Dockerfile.monterey @@ -217,38 +217,8 @@ VOLUME ["/tmp/.X11-unix"] # the default serial numbers are already contained in ./OpenCore/OpenCore.qcow2 # And the default serial numbers -CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; [[ "${NOPICKER}" == true ]] && { \ - sed -i '/^.*InstallMedia.*/d' Launch.sh \ - && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ - ; } \ - || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ - ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" \ - || exit 1 ; } \ - ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" 2>/dev/null \ - ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --model "${DEVICE_MODEL}" \ - --serial "${SERIAL}" \ - --board-serial "${BOARD_SERIAL}" \ - --uuid "${UUID}" \ - --mac-address "${MAC_ADDRESS}" \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - || exit 1 ; } \ - ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh +COPY entrypoint.monterey.sh . +CMD ["bash", "-c", "entrypoint.monterey.sh"] # virt-manager mode: eta son # CMD virsh define <(envsubst < Docker-OSX.xml) && virt-manager || virt-manager diff --git a/Dockerfile.naked b/Dockerfile.naked index 712d059..5fe759e 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -166,39 +166,5 @@ ENV HEIGHT=1080 ENV LIBGUESTFS_DEBUG=1 ENV LIBGUESTFS_TRACE=1 -CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ - nohup Xvfb :99 -screen 0 1920x1080x16 \ - & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ - ; } \ - ; [[ "${NOPICKER}" == true ]] && { \ - sed -i '/^.*InstallMedia.*/d' Launch.sh \ - && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ - ; } \ - || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ - ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" \ - || exit 1 ; } \ - ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" 2>/dev/null \ - ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --model "${DEVICE_MODEL}" \ - --serial "${SERIAL}" \ - --board-serial "${BOARD_SERIAL}" \ - --uuid "${UUID}" \ - --mac-address "${MAC_ADDRESS}" \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - || exit 1 ; } \ - ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh +COPY entrypoint.naked.sh . +CMD ["bash", "-c", "entrypoint.naked.sh"] diff --git a/Dockerfile.naked-auto b/Dockerfile.naked-auto index 44f2866..7a9ef50 100644 --- a/Dockerfile.naked-auto +++ b/Dockerfile.naked-auto @@ -183,63 +183,5 @@ 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" -CMD echo "${BOILERPLATE}" \ - ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ - ; echo "Disk is being copied between layers... Please wait a minute..." \ - ; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ - ; [[ "${NOPICKER}" == true ]] && { \ - sed -i '/^.*InstallMedia.*/d' Launch.sh \ - && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ - ; } \ - || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ - ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --count 1 \ - --tsv ./serial.tsv \ - --bootdisks \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - --output-env "${ENV:=/env}" \ - || exit 1 ; } \ - ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ - source "${ENV:=/env}" 2>/dev/null \ - ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ - --master-plist-url="${MASTER_PLIST_URL}" \ - --model "${DEVICE_MODEL}" \ - --serial "${SERIAL}" \ - --board-serial "${BOARD_SERIAL}" \ - --uuid "${UUID}" \ - --mac-address "${MAC_ADDRESS}" \ - --width "${WIDTH:-1920}" \ - --height "${HEIGHT:-1080}" \ - --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ - || exit 1 ; } \ - ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ - nohup Xvfb :99 -screen 0 1920x1080x16 \ - & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ - ; } \ - ; stat "${IMAGE_PATH}" \ - ; echo "Large image is being copied between layers, please wait a minute..." \ - ; ./enable-ssh.sh \ - ; [[ -e ~/.ssh/id_docker_osx ]] || { \ - /usr/bin/ssh-keygen -t rsa -f ~/.ssh/id_docker_osx -q -N "" \ - && chmod 600 ~/.ssh/id_docker_osx \ - ; } \ - ; /bin/bash -c ./Launch.sh \ - & echo "Booting Docker-OSX in the background. Please wait..." \ - ; until [[ "$(sshpass -p${PASSWORD:=alpine} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME:=user}@127.0.0.1)" ]]; do \ - echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ - ; sleep 1 \ - ; done \ - ; grep id_docker_osx ~/.ssh/config || { \ - tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ - ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ - ; tee -a ~/.ssh/config <<< ' Port 10022' \ - ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ - ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ - ; tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' \ - ; } \ - && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" +COPY entrypoint.naked-auto.sh . +CMD ["bash", "-c", "entrypoint.naked-auto.sh"] diff --git a/entrypoint.auto.sh b/entrypoint.auto.sh new file mode 100755 index 0000000..0ae900c --- /dev/null +++ b/entrypoint.auto.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +echo "${BOILERPLATE}" \ + ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ + ; echo "Disk is being copied between layers... Please wait a minute..." \ + ; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; [[ "${NOPICKER}" == true ]] && { \ + sed -i '/^.*InstallMedia.*/d' Launch.sh \ + && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ + ; } \ + || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --count 1 \ + --tsv ./serial.tsv \ + --bootdisks \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + --output-env "${ENV:=/env}" \ + || exit 1 ; } \ + ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --board-serial "${BOARD_SERIAL}" \ + --uuid "${UUID}" \ + --mac-address "${MAC_ADDRESS}" \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + || exit 1 ; } \ + ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ + nohup Xvfb :99 -screen 0 1920x1080x16 \ + & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ + ; } \ + ; stat "${IMAGE_PATH}" \ + ; echo "Large image is being copied between layers, please wait a minute..." \ + ; ./enable-ssh.sh \ + ; [[ -e ~/.ssh/id_docker_osx ]] || { \ + /usr/bin/ssh-keygen -t rsa -f ~/.ssh/id_docker_osx -q -N "" \ + && chmod 600 ~/.ssh/id_docker_osx \ + ; } \ + ; /bin/bash -c ./Launch.sh \ + & echo "Booting Docker-OSX in the background. Please wait..." \ + ; until [[ "$(sshpass -p${PASSWORD:=alpine} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME:=user}@127.0.0.1)" ]]; do \ + echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ + ; sleep 1 \ + ; done \ + ; grep id_docker_osx ~/.ssh/config || { \ + tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ + ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ + ; tee -a ~/.ssh/config <<< ' Port 10022' \ + ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ + ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ + ; tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' \ + ; } \ + && echo 'Default username: user' \ + && echo 'Default password: alpine' \ + && echo 'Change it immediately using the command: passwd' \ + && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" diff --git a/entrypoint.monterey.sh b/entrypoint.monterey.sh new file mode 100755 index 0000000..6acac73 --- /dev/null +++ b/entrypoint.monterey.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; [[ "${NOPICKER}" == true ]] && { \ + sed -i '/^.*InstallMedia.*/d' Launch.sh \ + && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ + ; } \ + || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --count 1 \ + --tsv ./serial.tsv \ + --bootdisks \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + --output-env "${ENV:=/env}" \ + || exit 1 ; } \ + ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --board-serial "${BOARD_SERIAL}" \ + --uuid "${UUID}" \ + --mac-address "${MAC_ADDRESS}" \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + || exit 1 ; } \ + ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh diff --git a/entrypoint.naked-auto.sh b/entrypoint.naked-auto.sh new file mode 100755 index 0000000..f013510 --- /dev/null +++ b/entrypoint.naked-auto.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +echo "${BOILERPLATE}" \ + ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ + ; echo "Disk is being copied between layers... Please wait a minute..." \ + ; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; [[ "${NOPICKER}" == true ]] && { \ + sed -i '/^.*InstallMedia.*/d' Launch.sh \ + && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ + ; } \ + || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --count 1 \ + --tsv ./serial.tsv \ + --bootdisks \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + --output-env "${ENV:=/env}" \ + || exit 1 ; } \ + ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --board-serial "${BOARD_SERIAL}" \ + --uuid "${UUID}" \ + --mac-address "${MAC_ADDRESS}" \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + || exit 1 ; } \ + ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ + nohup Xvfb :99 -screen 0 1920x1080x16 \ + & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ + ; } \ + ; stat "${IMAGE_PATH}" \ + ; echo "Large image is being copied between layers, please wait a minute..." \ + ; ./enable-ssh.sh \ + ; [[ -e ~/.ssh/id_docker_osx ]] || { \ + /usr/bin/ssh-keygen -t rsa -f ~/.ssh/id_docker_osx -q -N "" \ + && chmod 600 ~/.ssh/id_docker_osx \ + ; } \ + ; /bin/bash -c ./Launch.sh \ + & echo "Booting Docker-OSX in the background. Please wait..." \ + ; until [[ "$(sshpass -p${PASSWORD:=alpine} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME:=user}@127.0.0.1)" ]]; do \ + echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ + ; sleep 1 \ + ; done \ + ; grep id_docker_osx ~/.ssh/config || { \ + tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ + ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ + ; tee -a ~/.ssh/config <<< ' Port 10022' \ + ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ + ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ + ; tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' \ + ; } \ + && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" diff --git a/entrypoint.naked.sh b/entrypoint.naked.sh new file mode 100755 index 0000000..2ab3d70 --- /dev/null +++ b/entrypoint.naked.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ + nohup Xvfb :99 -screen 0 1920x1080x16 \ + & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ + ; } \ + ; [[ "${NOPICKER}" == true ]] && { \ + sed -i '/^.*InstallMedia.*/d' Launch.sh \ + && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ + ; } \ + || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --count 1 \ + --tsv ./serial.tsv \ + --bootdisks \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + --output-env "${ENV:=/env}" \ + || exit 1 ; } \ + ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --board-serial "${BOARD_SERIAL}" \ + --uuid "${UUID}" \ + --mac-address "${MAC_ADDRESS}" \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + || exit 1 ; } \ + ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..6acac73 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; [[ "${NOPICKER}" == true ]] && { \ + sed -i '/^.*InstallMedia.*/d' Launch.sh \ + && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2}" \ + ; } \ + || export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --count 1 \ + --tsv ./serial.tsv \ + --bootdisks \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + --output-env "${ENV:=/env}" \ + || exit 1 ; } \ + ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ + source "${ENV:=/env}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --board-serial "${BOARD_SERIAL}" \ + --uuid "${UUID}" \ + --mac-address "${MAC_ADDRESS}" \ + --width "${WIDTH:-1920}" \ + --height "${HEIGHT:-1080}" \ + --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2}" \ + || exit 1 ; } \ + ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh