From 524a77da8f8811c483fc7a47eddd922143616474 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 8 Jun 2024 16:00:59 +0200 Subject: [PATCH 1/3] Update boot.sh --- src/boot.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/boot.sh b/src/boot.sh index ecc5cae..a2b59d0 100644 --- a/src/boot.sh +++ b/src/boot.sh @@ -13,27 +13,26 @@ SECURE="off" OVMF="/usr/share/OVMF" case "${BOOT_MODE,,}" in - full) + "full" ) DEST="macos" BOOT_DESC=" 1920x1080" ROM="OVMF_CODE.fd" VARS="OVMF_VARS-1920x1080.fd" ;; - hd) + "hd" ) DEST="macos_hd" BOOT_DESC=" 1024x768" ROM="OVMF_CODE.fd" VARS="OVMF_VARS-1024x768.fd" ;; - default) + "default" ) BOOT_DESC="" DEST="macos_default" ROM="OVMF_CODE.fd" VARS="OVMF_VARS.fd" ;; *) - error "Unknown BOOT_MODE, value \"${BOOT_MODE}\" is not recognized!" - exit 33 + error "Unknown BOOT_MODE, value \"${BOOT_MODE}\" is not recognized!" && exit 33 ;; esac From c9ff54f3aba95efdc65335cccb69dbc2d3af067b Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 8 Jun 2024 16:18:58 +0200 Subject: [PATCH 2/3] Update boot.sh --- src/boot.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/boot.sh b/src/boot.sh index a2b59d0..5878763 100644 --- a/src/boot.sh +++ b/src/boot.sh @@ -14,22 +14,22 @@ OVMF="/usr/share/OVMF" case "${BOOT_MODE,,}" in "full" ) - DEST="macos" + DEST="$PROCESS" BOOT_DESC=" 1920x1080" ROM="OVMF_CODE.fd" VARS="OVMF_VARS-1920x1080.fd" ;; "hd" ) - DEST="macos_hd" + DEST="${PROCESS}_hd" BOOT_DESC=" 1024x768" ROM="OVMF_CODE.fd" VARS="OVMF_VARS-1024x768.fd" ;; "default" ) BOOT_DESC="" - DEST="macos_default" ROM="OVMF_CODE.fd" VARS="OVMF_VARS.fd" + DEST="${PROCESS}_default" ;; *) error "Unknown BOOT_MODE, value \"${BOOT_MODE}\" is not recognized!" && exit 33 From c8d4f4545f5bdd0f2bd845815bc39679cd85da1c Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 8 Jun 2024 16:25:46 +0200 Subject: [PATCH 3/3] fix: Download correct version --- src/install.sh | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/install.sh b/src/install.sh index 251044e..6922073 100644 --- a/src/install.sh +++ b/src/install.sh @@ -5,44 +5,63 @@ set -Eeuo pipefail : "${VERSION:="sonoma"}" # OSX Version TMP="$STORAGE/tmp" -BASE_FILE="BaseSystem" BASE_IMG_ID="InstallMedia" BASE_IMG="$STORAGE/base.dmg" -BASE_TMP="$TMP/$BASE_FILE.dmg" downloadImage() { + local board + local version="$1" + local file="BaseSystem" + local path="$TMP/$file.dmg" + + case "${version,,}" in + "sonoma" | "14"* ) + board="Mac-A61BADE1FDAD7B05" ;; + "ventura" | "13"* ) + board="Mac-4B682C642B45593E" ;; + "monterey" | "12"* ) + board="Mac-B809C3757DA9BB8D" ;; + "bigsur" | "big-sur" | "11"* ) + board="Mac-2BD1B31983FE1663" ;; + "catalina" | "10"* ) + board="Mac-00BE6ED71E35EB86" ;; + *) + error "Unknown VERSION specified, value \"${version}\" is not recognized!" + return 1 ;; + esac + + local msg="Downloading macOS ($version) image" + info "$msg..." && html "$msg..." + rm -rf "$TMP" mkdir -p "$TMP" - local msg="Downloading macOS ($VERSION) image" - info "$msg..." && html "$msg..." - - /run/progress.sh "$BASE_TMP" "" "$msg ([P])..." & + /run/progress.sh "$path" "" "$msg ([P])..." & - if ! /run/fetch-macOS-v2.py --action download -s "$VERSION" -n "$BASE_FILE" -o "$TMP"; then - error "Failed to fetch macOS ($VERSION)!" + if ! /run/fetch-macOS-v2.py --action download -b "$board" -n "$file" -o "$TMP"; then + error "Failed to fetch macOS \"$version\" with board id \"$board\"!" fKill "progress.sh" return 1 fi fKill "progress.sh" - if [ ! -f "$BASE_TMP" ] || [ ! -s "$BASE_TMP" ]; then - error "Failed to find file $BASE_TMP !" + if [ ! -f "$path" ] || [ ! -s "$path" ]; then + error "Failed to find file \"$path\" !" return 1 fi - echo "$VERSION" > "$STORAGE/$PROCESS.version" + echo "$version" > "$STORAGE/$PROCESS.version" - mv "$BASE_TMP" "$BASE_IMG" + mv "$path" "$BASE_IMG" rm -rf "$TMP" return 0 } if [ ! -f "$BASE_IMG" ] || [ ! -s "$BASE_IMG" ]; then - if ! downloadImage; then + if ! downloadImage "$VERSION"; then rm -rf "$TMP" exit 34 fi @@ -52,7 +71,7 @@ STORED_VERSION=$(cat "$STORAGE/$PROCESS.version") if [ "$VERSION" != "$STORED_VERSION" ]; then info "Different version detected, switching base image from $STORED_VERSION to $VERSION" - if ! downloadImage; then + if ! downloadImage "$VERSION"; then rm -rf "$TMP" exit 34 fi