Merge pull request #168 from sickcodes/generate-custom-edits

Script for making iMessage serial numbers OpenCore Docker-OSX edits
This commit is contained in:
sickcodes 2021-03-06 18:11:45 +00:00 committed by GitHub
commit 5f595ed588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 113 deletions

View File

@ -1,5 +1,6 @@
|Version|Date|Notes| |Version|Date|Notes|
|---|---|---| |---|---|---|
| |2021-03-06|Change envs to require --envs. Automatically enable --envs if --output-env is used. Same for plists, bootdisks. Fix help ugliness and sanity of generate serial scripts. Fix bootdisk not getting written to persistent file when using NOPICKER=true. NOPICKER=true is overridden by a custom plist now anyway. Remove useless case statements. Allow -e HEADLESS=true as human readable alternative to -e DISPLAY=:99.|
|4.1|2021-03-04|Add `-e MASTER_PLIST_URL` to all images to allow using your own remote plist.| |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-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,'`| | |2021-03-02|Add ADDITIONAL_PORTS, for example `-e ADDITIONAL_PORTS='hostfwd=tcp::23-:23,'`|

View File

@ -298,15 +298,9 @@ VOLUME ["/tmp/.X11-unix"]
# And the default serial numbers # And the default serial numbers
CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
; case "$(file --brief /image)" in \
QEMU\ QCOW2\ Image* ) export IMAGE_PATH=/image \
;; \
directory* ) export IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img \
;; \
esac \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export BOOTDISK="${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \
; } \ ; } \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/custom/generate-unique-machine-values.sh \
@ -332,12 +326,6 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS
--height "${HEIGHT:-1080}" \ --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 \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; ./enable-ssh.sh && envsubst < ./Launch.sh | bash ; ./enable-ssh.sh && envsubst < ./Launch.sh | bash
# virt-manager mode: eta son # virt-manager mode: eta son

View File

@ -133,6 +133,8 @@ ENV BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false
ENV ENV=/env ENV ENV=/env
ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img
@ -149,7 +151,7 @@ CMD echo "${BOILERPLATE}" \
; sudo chown -R $(id -u):$(id -g) /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 ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export BOOTDISK="${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \
; } \ ; } \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/custom/generate-unique-machine-values.sh \
@ -175,21 +177,10 @@ CMD echo "${BOILERPLATE}" \
--height "${HEIGHT:-1080}" \ --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 \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
QEMU\ QCOW2\ Image* ) export BOOTDISK=/bootdisk \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; [[ "${DISPLAY}" = ':99' ]] && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 0.1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \
; } \ ; } \
; echo "Checking whether /image is a directory or a QEMU disk." \
; case "$(file --brief /image)" in \
QEMU*) export IMAGE_PATH=/image;; \
directory*) export IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img;; \
esac \
; stat "${IMAGE_PATH}" \ ; stat "${IMAGE_PATH}" \
; echo "Large image is being copied between layers, please wait a minute..." \ ; echo "Large image is being copied between layers, please wait a minute..." \
; ./enable-ssh.sh \ ; ./enable-ssh.sh \

View File

@ -106,6 +106,8 @@ ENV BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false
ENV ENV=/env ENV ENV=/env
ENV IMAGE_PATH=/image ENV IMAGE_PATH=/image
@ -113,13 +115,13 @@ ENV IMAGE_PATH=/image
ENV NOPICKER=true ENV NOPICKER=true
CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
; [[ "${DISPLAY}" = ':99' ]] && { \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \
; } \ ; } \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ && export BOOTDISK="${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \
; } \ ; } \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \ ; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \ ./Docker-OSX/custom/generate-unique-machine-values.sh \
@ -145,10 +147,4 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS
--height "${HEIGHT:-1080}" \ --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 \
;; \
directory* ) export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \
;; \
esac \
; ./enable-ssh.sh && envsubst < ./Launch.sh | bash ; ./enable-ssh.sh && envsubst < ./Launch.sh | bash

View File

@ -11,55 +11,50 @@
# Version: 3.1 # Version: 3.1
# License: GPLv3+ # License: GPLv3+
help_text="Usage: generate-unique-machine-values.sh help_text="Usage: ./generate-unique-machine-values.sh
General options: General options:
--count, -n, -c <count> Number of serials to generate --count, -n, -c <count> Number of serials to generate
--model, -m <model> Device model, e.g. 'iMacPro1,1' --model, -m <model> Device model, e.g. 'iMacPro1,1'
--csv <filename> Optionally change the CSV output filename. --csv <filename> Optionally change the CSV output filename
--tsv <filename> Optionally change the TSV output filename. --tsv <filename> Optionally change the TSV output filename
--output-bootdisk <filename> Optionally change the bootdisk qcow output filename. Useless when count > 1. --output-dir <directory> Optionally change the script output location
--output-env <filename> Optionally change the bootdisk env filename. Useless when count > 1. --width <string> Resolution x axis length in px, default 1920
--output-dir <directory> Optionally change the script output location. --height <string> Resolution y axis length in px, default 1080
--width <string> Resolution x axis length in pixels (default 1920) --master-plist-url <url> Specify an alternative master plist, via URL
--height <string> Resolution y axis length in pixels (default 1080 --master-plist <filename> Optionally change the input plist
--custom-plist <filename> Same as --master-plist
--master-plist-url <url> Specify an alternative master plist, via URL. --output-bootdisk <filename> Optionally change the bootdisk filename
--master-plist | --custom-plist <filename> --envs Create all corresponding sourcable envs
Optionally change the input plist. Placeholders: --plists Create all corresponding config.plists
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, --bootdisks Create all corresponding bootdisks [SLOW]
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
--plists Create corresponding config.plists for each serial set.
--bootdisks [SLOW] Create corresponding boot disk images for each serial set. Additional options only if you are creating only ONE serial set:
--output-bootdisk <filename> Optionally change the bootdisk filename
--output-env <filename> Optionally change the serials env filename
Custom plist placeholders:
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
Example: Example:
./generate-unique-machine-values.sh --count 1 --model='iMacPro1,1' --plists --bootdisks ./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
The above example will generate a Defaults:
- serial - One serial, for 'iMacPro1,1', in the current working directory
- board serial - CSV and TSV output
- uuid - plists in ./plists/ & bootdisks in ./bootdisks/ & envs in ./envs
- MAC address - if you set --bootdisk name, --bootdisks is assumed
- ROM value based on lowercase MAC address - if you set --custom-plist, --plists is assumed
- Boot disk qcow image. - if you set --output-env, --envs is assumed
- config.plist
Notes:
- Default is 1 serial for 'iMacPro1,1' in the current working directory.
- Default output is CSV, whereas setting the TSV option will output as tab-separated.
- CSV is double quoted.
- If you do not set a CSV filename, the output will be sent to the output-dir.
- If you do not set an output-dir, the current directory will be the output directory.
- Sourcable environment variable shell files will be written to a folder, 'envs'.
- config.plist files will be written to a folder, 'plists'.
Author: Sick.Codes https://sick.codes/ Author: Sick.Codes https://sick.codes/
Project: https://github.com/sickcodes/Docker-OSX/ Project: https://github.com/sickcodes/Docker-OSX/
" "
MACINFOPKG_VERSION=2.1.2 MACINFOPKG_VERSION=2.1.2
OPENCORE_IMAGE_MAKER_URL='https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/opencore-image-ng.sh'
# gather arguments # gather arguments
while (( "$#" )); do while (( "$#" )); do
@ -110,7 +105,7 @@ while (( "$#" )); do
;; ;;
--output-bootdisk=* ) --output-bootdisk=* )
export OUTPUT_QCOW="${1#*=}" export OUTPUT_BOOTDISK="${1#*=}"
shift shift
;; ;;
--output-bootdisk* ) --output-bootdisk* )
@ -198,7 +193,11 @@ while (( "$#" )); do
shift shift
;; ;;
--bootdisks ) --bootdisks )
export CREATE_QCOWS=1 export CREATE_BOOTDISKS=1
shift
;;
--envs )
export CREATE_ENVS=1
shift shift
;; ;;
@ -245,38 +244,19 @@ download_qcow_efi_folder () {
generate_serial_sets () { generate_serial_sets () {
if [[ "${MASTER_PLIST}" ]]; then
[[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}"
elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then
echo 'You specified both a custom plist file 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 ; }
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}"
export VENDOR_REGEX="${VENDOR_REGEX:=Apple, Inc.}"
if [[ "${CSV_OUTPUT_FILENAME}" ]] || [[ "${TSV_OUTPUT_FILENAME}" ]]; then if [[ "${CSV_OUTPUT_FILENAME}" ]]; then
[[ ${CSV_OUTPUT_FILENAME} ]] && export CSV_SERIAL_SETS_FILE="${CSV_OUTPUT_FILENAME}" [[ ${CSV_OUTPUT_FILENAME} ]] && export CSV_SERIAL_SETS_FILE="${CSV_OUTPUT_FILENAME}"
elif [[ "${TSV_OUTPUT_FILENAME}" ]]; then
[[ ${TSV_OUTPUT_FILENAME} ]] && export TSV_SERIAL_SETS_FILE="${TSV_OUTPUT_FILENAME}" [[ ${TSV_OUTPUT_FILENAME} ]] && export TSV_SERIAL_SETS_FILE="${TSV_OUTPUT_FILENAME}"
else else
export SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.csv" export CSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.csv"
export TSV_SERIAL_SETS_FILE="${OUTPUT_DIRECTORY}/serial_sets-${DATE_NOW}.tsv"
fi fi
touch "${SERIAL_SETS_FILE}"
echo "Writing serial sets to ${SERIAL_SETS_FILE}"
./macserial \ ./macserial \
--num "${SERIAL_SET_COUNT:=1}" \ --num "${SERIAL_SET_COUNT}" \
--model "${DEVICE_MODEL}" \ --model "${DEVICE_MODEL}" \
| while IFS='\ \|\ ' read -r SERIAL BOARD_SERIAL; do | while IFS='\ \|\ ' read -r SERIAL BOARD_SERIAL; do
# make a uuid... # make a uuid...
@ -288,30 +268,54 @@ generate_serial_sets () {
RANDOM_MAC_PREFIX="$(cut -d$'\t' -f1 <<< "${RANDOM_MAC_PREFIX}")" RANDOM_MAC_PREFIX="$(cut -d$'\t' -f1 <<< "${RANDOM_MAC_PREFIX}")"
MAC_ADDRESS="$(printf "${RANDOM_MAC_PREFIX}:%02X:%02X:%02X" $[RANDOM%256] $[RANDOM%256] $[RANDOM%256])" MAC_ADDRESS="$(printf "${RANDOM_MAC_PREFIX}:%02X:%02X:%02X" $[RANDOM%256] $[RANDOM%256] $[RANDOM%256])"
[[ -z "${WIDTH}" ]] && WIDTH=1920
[[ -z "${HEIGHT}" ]] && HEIGHT=1080
# append to csv file # append to csv file
if [[ "${CSV_SERIAL_SETS_FILE}" ]]; then cat <<EOF >> "${CSV_SERIAL_SETS_FILE}"
echo "\"${DEVICE_MODEL}\",\"${SERIAL}\",\"${BOARD_SERIAL}\",\"${UUID}\",\"${MAC_ADDRESS}\"" >> "${CSV_SERIAL_SETS_FILE}" "${DEVICE_MODEL}","${SERIAL}","${BOARD_SERIAL}","${UUID}","${MAC_ADDRESS}","${WIDTH}","${HEIGHT}"
fi EOF
# append to tsv file # append to tsv file
if [[ "${TSV_SERIAL_SETS_FILE}" ]]; then T=$'\t'
printf "${DEVICE_MODEL}\t${SERIAL}\t${BOARD_SERIAL}\t${UUID}\t${MAC_ADDRESS}\n" >> "${TSV_SERIAL_SETS_FILE}" cat <<EOF >> "${TSV_SERIAL_SETS_FILE}"
fi ${DEVICE_MODEL}${T}${SERIAL}${T}${BOARD_SERIAL}${T}${UUID}${T}${MAC_ADDRESS}${T}${WIDTH}${T}${HEIGHT}
EOF
OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}" # make envs if --envs, but also if you set the env filename it will switch on by itself
touch "${OUTPUT_ENV_FILE}" if [[ "${CREATE_ENVS}" ]] || [[ "${OUTPUT_ENV}" ]]; then
cat <<EOF > "${OUTPUT_ENV_FILE}" mkdir -p "${OUTPUT_DIRECTORY}/envs"
OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${SERIAL}.env.sh"}"
touch "${OUTPUT_ENV_FILE}"
cat <<EOF > "${OUTPUT_ENV_FILE}"
export DEVICE_MODEL="${DEVICE_MODEL}" export DEVICE_MODEL="${DEVICE_MODEL}"
export SERIAL="${SERIAL}" export SERIAL="${SERIAL}"
export BOARD_SERIAL="${BOARD_SERIAL}" export BOARD_SERIAL="${BOARD_SERIAL}"
export UUID="${UUID}" export UUID="${UUID}"
export MAC_ADDRESS="${MAC_ADDRESS}" export MAC_ADDRESS="${MAC_ADDRESS}"
export WIDTH="${WIDTH:=1920}" export WIDTH="${WIDTH}"
export HEIGHT="${HEIGHT:=1080}" export HEIGHT="${HEIGHT}"
EOF EOF
fi
# plist required for bootdisks, so create anyway. # plist required for bootdisks, so create anyway.
if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_QCOWS}" ]]; then if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_BOOTDISKS}" ]]; then
# need a config.plist
if [[ "${MASTER_PLIST}" ]]; then
[[ -e "${MASTER_PLIST}" ]] || echo "Could not find: ${MASTER_PLIST}"
elif [[ "${MASTER_PLIST}" ]] && [[ "${MASTER_PLIST_URL}" ]]; then
echo 'You specified both a custom plist FILE AND a custom plist URL. Only use one of those options.'
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
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
mkdir -p "${OUTPUT_DIRECTORY}/plists" mkdir -p "${OUTPUT_DIRECTORY}/plists"
source "${OUTPUT_ENV_FILE}" source "${OUTPUT_ENV_FILE}"
ROM_VALUE="${MAC_ADDRESS//\:/}" ROM_VALUE="${MAC_ADDRESS//\:/}"
@ -326,11 +330,15 @@ EOF
"${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 "${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
fi fi
if [[ "${CREATE_QCOWS}" ]]; then # make bootdisk qcow2 format if --bootdisks, but also if you set the bootdisk filename
mkdir -p "${OUTPUT_DIRECTORY}/qcows" if [[ "${CREATE_BOOTDISKS}" ]] || [[ "${OUTPUT_BOOTDISK}" ]]; then
[[ -e ./opencore-image-ng.sh ]] \
|| { wget "${OPENCORE_IMAGE_MAKER_URL}" \
&& chmod +x opencore-image-ng.sh ; }
mkdir -p "${OUTPUT_DIRECTORY}/bootdisks"
./opencore-image-ng.sh \ ./opencore-image-ng.sh \
--cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \ --cfg "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" \
--img "${OUTPUT_QCOW:-${OUTPUT_DIRECTORY}/qcows/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1 --img "${OUTPUT_BOOTDISK:-${OUTPUT_DIRECTORY}/bootdisks/${SERIAL}.OpenCore-nopicker.qcow2}" || exit 1
fi fi
done done
@ -341,12 +349,14 @@ EOF
[[ -e "${TSV_SERIAL_SETS_FILE}" ]] && \ [[ -e "${TSV_SERIAL_SETS_FILE}" ]] && \
cat <(printf "DEVICE_MODEL\tSERIAL\tBOARD_SERIAL\tUUID\tMAC_ADDRESS\n") "${TSV_SERIAL_SETS_FILE}" cat <(printf "DEVICE_MODEL\tSERIAL\tBOARD_SERIAL\tUUID\tMAC_ADDRESS\n") "${TSV_SERIAL_SETS_FILE}"
} }
main () { main () {
# setting default variables if there are no options # setting default variables if there are no options
export DATE_NOW="$(date +%F-%T)"
export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}" export DEVICE_MODEL="${DEVICE_MODEL:=iMacPro1,1}"
export VENDOR_REGEX="${VENDOR_REGEX:=Apple, Inc.}"
export SERIAL_SET_COUNT="${SERIAL_SET_COUNT:=1}" export SERIAL_SET_COUNT="${SERIAL_SET_COUNT:=1}"
export OUTPUT_DIRECTORY="${OUTPUT_DIRECTORY:=.}" export OUTPUT_DIRECTORY="${OUTPUT_DIRECTORY:=.}"
cat <<EOF cat <<EOF