diff --git a/Dockerfile b/Dockerfile
index c4c0dd0..453c66e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -174,6 +174,18 @@ RUN python fetch-macOS.py --version "${VERSION}" \
WORKDIR /home/arch/OSX-KVM
+ARG LINUX=true
+
+# required to use libguestfs inside a docker container, to create bootdisks for docker-osx on-the-fly
+RUN if [[ "${LINUX}" == true ]]; then \
+ sudo pacman -Syu linux libguestfs --noconfirm \
+ && patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
+ && curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \
+ && bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." \
+ ; fi
+
+RUN git clone https://github.com/sickcodes/Docker-OSX.git
+
RUN touch Launch.sh \
&& chmod +x ./Launch.sh \
&& tee -a Launch.sh <<< '#!/bin/sh' \
@@ -183,7 +195,7 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-8}000 \' \
&& tee -a Launch.sh <<< '-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \' \
&& tee -a Launch.sh <<< '-machine q35,accel=kvm:tcg \' \
- && tee -a Launch.sh <<< '-smp ${SMP:-4},cores=${CORES:-4} \' \
+ && tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \
&& tee -a Launch.sh <<< '-usb -device usb-kbd -device usb-tablet \' \
&& tee -a Launch.sh <<< '-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \' \
&& tee -a Launch.sh <<< '-drive if=pflash,format=raw,readonly,file=/home/arch/OSX-KVM/OVMF_CODE.fd \' \
@@ -191,7 +203,7 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< '-smbios type=2 \' \
&& tee -a Launch.sh <<< '-audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \' \
&& tee -a Launch.sh <<< '-device ich9-ahci,id=sata \' \
- && tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \' \
+ && tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2} \' \
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.2,drive=OpenCoreBoot \' \
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.3,drive=InstallMedia \' \
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \' \
diff --git a/custom/config-nopicker-custom.plist b/custom/config-nopicker-custom.plist
index c93ee96..6166234 100644
--- a/custom/config-nopicker-custom.plist
+++ b/custom/config-nopicker-custom.plist
@@ -702,19 +702,19 @@
AdviseWindows
MLB
- {{BOARD_SERIAL_OLD}}
+ {{BOARD_SERIAL}}
ROM
- {{ROM_OLD}}
+ {{ROM}}
SpoofVendor
SystemProductName
{{DEVICE_MODEL}}
SystemSerialNumber
- {{SERIAL_OLD}}
+ {{SERIAL}}
SystemUUID
- {{SYSTEM_UUID_OLD}}
+ {{UUID}}
UpdateDataHub
diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh
index 2717d22..46c3571 100755
--- a/custom/generate-specific-bootdisk.sh
+++ b/custom/generate-specific-bootdisk.sh
@@ -25,12 +25,12 @@ General options:
--help, -h, help Display this help and exit
Example:
- ./genboot.sh \\
- --model iMacPro1,1 \\
- --serial C02TW0WAHX87 \\
- --board-serial C027251024NJG36UE \\
- --uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \\
- --mac-address A8:5C:2C:9A:46:2F \\
+ ./generate-specific-bootdisk.sh \
+ --model iMacPro1,1 \
+ --serial C02TW0WAHX87 \
+ --board-serial C027251024NJG36UE \
+ --uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \
+ --mac-address A8:5C:2C:9A:46:2F \
--output-bootdisk OpenCore-nopicker.qcow2
Author: Sick.Codes https://sick.codes/
@@ -58,21 +58,21 @@ while (( "$#" )); do
;;
--serial=* )
- export SERIAL_NUMBER="${1#*=}"
+ export SERIAL="${1#*=}"
shift
;;
--serial* )
- export SERIAL_NUMBER="${2}"
+ export SERIAL="${2}"
shift
shift
;;
--board-serial=* )
- export BOARD_SERIAL_NUMBER="${1#*=}"
+ export BOARD_SERIAL="${1#*=}"
shift
;;
--board-serial* )
- export BOARD_SERIAL_NUMBER="${2}"
+ export BOARD_SERIAL="${2}"
shift
shift
;;
@@ -142,25 +142,25 @@ generate_bootdisk () {
[[ -e ./opencore-image-ng.sh ]] || wget https://raw.githubusercontent.com/sickcodes/Docker-OSX/custom-identity/custom/opencore-image-ng.sh && chmod +x opencore-image-ng.sh
# plist required for bootdisks, so create anyway.
if [[ "${DEVICE_MODEL}" ]] \
- && [[ "${SERIAL_NUMBER}" ]] \
- && [[ "${BOARD_SERIAL_NUMBER}" ]] \
+ && [[ "${SERIAL}" ]] \
+ && [[ "${BOARD_SERIALR}" ]] \
&& [[ "${UUID}" ]] \
&& [[ "${MAC_ADDRESS}" ]]; then
- ROM_VALUE="${MacAddress//\:/}"
- ROM_VALUE="${ROM_VALUE,,}"
+ ROM="${MAC_ADDRESS//\:/}"
+ ROM="${ROM,,}"
sed -e s/{{DEVICE_MODEL}}/"${DEVICE_MODEL}"/g \
- -e s/{{SERIAL_OLD}}/"${SERIAL_NUMBER}"/g \
- -e s/{{BOARD_SERIAL_OLD}}/"${BOARD_SERIAL_NUMBER}"/g \
- -e s/{{SYSTEM_UUID_OLD}}/"${UUID}"/g \
- -e s/{{ROM_OLD}}/"${ROM_VALUE}"/g \
+ -e s/{{SERIAL}}/"${SERIAL}"/g \
+ -e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \
+ -e s/{{UUID}}/"${UUID}"/g \
+ -e s/{{ROM}}/"${ROM}"/g \
"${PLIST_MASTER}" > ./tmp.config.plist || exit 1
else
cat <> "${CSV_SERIAL_SETS_FILE}"
+ echo "\"${DEVICE_MODEL}\",\"${SERIAL}\",\"${BOARD_SERIAL}\",\"${UUID}\",\"${MAC_ADDRESS}\"" >> "${CSV_SERIAL_SETS_FILE}"
fi
# append to tsv file
if [[ "${TSV_SERIAL_SETS_FILE}" ]]; then
- printf "${DEVICE_MODEL}\t${Serial}\t${BoardSerial}\t${SmUUID}\t${MacAddress}\n" >> "${TSV_SERIAL_SETS_FILE}"
+ printf "${DEVICE_MODEL}\t${SERIAL}\t${BOARD_SERIAL}\t${UUID}\t${MAC_ADDRESS}\n" >> "${TSV_SERIAL_SETS_FILE}"
fi
- OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${Serial}.env.sh"}"
+ OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}"
touch "${OUTPUT_ENV_FILE}"
cat < "${OUTPUT_ENV_FILE}"
-export Type=${DEVICE_MODEL}
-export Serial=${Serial}
-export BoardSerial=${BoardSerial}
-export SmUUID=${SmUUID}
-export MacAddress=${MacAddress}
+export DEVICE_MODEL="${DEVICE_MODEL}"
+export SERIAL="${SERIAL}"
+export BOARD_SERIAL="${BOARD_SERIAL}"
+export UUID="${UUID}"
+export MAC_ADDRESS="${MAC_ADDRESS}"
EOF
# plist required for bootdisks, so create anyway.
if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_QCOWS}" ]]; then
mkdir -p "${OUTPUT_DIRECTORY}/plists"
source "${OUTPUT_ENV_FILE}"
- ROM_VALUE="${MacAddress//\:/}"
+ ROM_VALUE="${MAC_ADDRESS//\:/}"
ROM_VALUE="${ROM_VALUE,,}"
- sed -e s/{{DEVICE_MODEL}}/"${Type}"/g \
- -e s/{{SERIAL_OLD}}/"${Serial}"/g \
- -e s/{{BOARD_SERIAL_OLD}}/"${BoardSerial}"/g \
- -e s/{{SYSTEM_UUID_OLD}}/"${SmUUID}"/g \
- -e s/{{ROM_OLD}}/"${ROM_VALUE}"/g \
- "${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${Serial}.config.plist" || exit 1
+ sed -e s/{{DEVICE_MODEL}}/"${DEVICE_MODEL}"/g \
+ -e s/{{SERIAL}}/"${SERIAL}"/g \
+ -e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \
+ -e s/{{UUID}}/"${UUID}"/g \
+ -e s/{{ROM}}/"${ROM}"/g \
+ "${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
fi
if [[ "${CREATE_QCOWS}" ]]; then
mkdir -p "${OUTPUT_DIRECTORY}/qcows"
./opencore-image-ng.sh \
- --cfg "${OUTPUT_DIRECTORY}/plists/${Serial}.config.plist" \
- --img "${OUTPUT_QCOW:-${OUTPUT_DIRECTORY}/qcows/${Serial}.OpenCore-nopicker.qcow2}" || exit 1
+ --cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \
+ --img "${OUTPUT_QCOW:-${OUTPUT_DIRECTORY}/qcows/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
fi
done
[[ -e "${CSV_SERIAL_SETS_FILE}" ]] && \
- cat <(echo "Type,Serial,BoardSerial,SmUUID,MacAddress") "${CSV_SERIAL_SETS_FILE}"
+ cat <(echo "DEVICE_MODEL,SERIAL,BOARD_SERIAL,UUID,MAC_ADDRESS") "${CSV_SERIAL_SETS_FILE}"
[[ -e "${TSV_SERIAL_SETS_FILE}" ]] && \
- cat <(printf "Type\tSerial\tBoardSerial\tSmUUID\tMacAddress\n") "${TSV_SERIAL_SETS_FILE}"
+ cat <(printf "DEVICE_MODEL\tSERIAL\BOARD_SERIAL\tUUID\tMAC_ADDRESS\n") "${TSV_SERIAL_SETS_FILE}"
}
diff --git a/custom/opencore-image-ng.sh b/custom/opencore-image-ng.sh
index 6cbfe5b..56eaa45 100755
--- a/custom/opencore-image-ng.sh
+++ b/custom/opencore-image-ng.sh
@@ -89,21 +89,22 @@ function fish_fini() {
fish umount-all
}
+# disabled by sick.codes to allow unattended image overwrites
######################################################################
# sanity checks
-if test ! -f "$cfg"; then
- echo "ERROR: cfg not found: $cfg"
- exit 1
-fi
-if test -f "$img"; then
- if test "$allow_override" = "yes"; then
- rm -f "$img"
- else
- echo "ERROR: image exists: $img"
- exit 1
- fi
-fi
+# if test ! -f "$cfg"; then
+# echo "ERROR: cfg not found: $cfg"
+# exit 1
+# fi
+# if test -f "$img"; then
+# if test "$allow_override" = "yes"; then
+# rm -f "$img"
+# else
+# echo "ERROR: image exists: $img"
+# exit 1
+# fi
+# fi
######################################################################
# go!