From 5469cb8a582cc6354b45b2a4ddd9820ebeffa1c5 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Wed, 3 Mar 2021 16:54:45 +0000 Subject: Add WIDTH and HEIGHT environment variables --- custom/generate-specific-bootdisk.sh | 43 ++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 < Date: Thu, 4 Mar 2021 09:48:04 +0000 Subject: Add --custom-plist-url, --custom-plist or --master-plist to both serial generators. --- custom/generate-specific-bootdisk.sh | 53 ++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 < Date: Thu, 4 Mar 2021 11:42:36 +0000 Subject: Syntax error: `elif` obviously needs a `; then` --- custom/generate-specific-bootdisk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 -- cgit v1.2.3 From 45a5f2c074de948eaef8d48bde2a3df9ce238289 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 11:57:52 +0000 Subject: wget -O case sensitive, silence source /env errors. --- custom/generate-specific-bootdisk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 -- cgit v1.2.3 From e03f0737c3ce4428047808c367409396cfa9e7ff Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 11:59:40 +0000 Subject: Fix `.//config-custom.plist` --- custom/generate-specific-bootdisk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 -- cgit v1.2.3 From 4b278bc42c10c29fc8592d018bf2e59678cf8174 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 4 Mar 2021 12:05:41 +0000 Subject: Shift exits --- custom/generate-specific-bootdisk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'custom/generate-specific-bootdisk.sh') 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 -- cgit v1.2.3