diff --git a/Dockerfile b/Dockerfile index f73c12c1..1bddbef9 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 ./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 432d01ba..58f246fd 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 ./entrypoint.sh +CMD ["bash", "-c", "entrypoint.sh"] # username: user # password: alpine diff --git a/Dockerfile.monterey b/Dockerfile.monterey index 6d7718de..c5fd02f0 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 ./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.naked b/Dockerfile.naked index 712d0592..c7204d8f 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 ./entrypoint.sh +CMD ["bash", "-c", "entrypoint.sh"] diff --git a/Dockerfile.naked-auto b/Dockerfile.naked-auto index 44f2866d..d9757e34 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 ./entrypoint.sh +CMD ["bash", "-c", "entrypoint.sh"] diff --git a/entrypoint.auto.sh b/entrypoint.auto.sh new file mode 100755 index 00000000..0ae900c2 --- /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 00000000..6acac730 --- /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 00000000..f0135103 --- /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 00000000..2ab3d70e --- /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 00000000..6acac730 --- /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