diff --git a/Dockerfile b/Dockerfile
index 9753ebd..20ecc07 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,8 +10,8 @@ ARG DEBCONF_NONINTERACTIVE_SEEN="true"
RUN set -eu && \
apt-get update && \
apt-get --no-install-recommends -y install \
- guestfish \
- linux-image-generic && \
+ fdisk \
+ mtools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
diff --git a/config.plist b/config.plist
index 97b4e45..526ce17 100644
--- a/config.plist
+++ b/config.plist
@@ -1015,7 +1015,7 @@
HibernateSkipsPicker
HideAuxiliary
-
+
InstanceIdentifier
LauncherOption
@@ -1037,7 +1037,7 @@
TakeoffDelay
0
Timeout
- 15
+ 0
Debug
@@ -1063,7 +1063,7 @@
Security
AllowSetDefault
-
+
ApECID
0
AuthRestart
@@ -1083,7 +1083,7 @@
PasswordSalt
ScanPolicy
- 17761027
+ 18809603
SecureBootModel
Disabled
Vault
@@ -1189,7 +1189,7 @@
SystemAudioVolume
Rg==
boot-args
- -v keepsyms=1 amfi_get_out_of_my_way=1 tlbto_us=0 vti=9
+ keepsyms=1
csr-active-config
Jg8=
prev-lang:kbd
@@ -1260,11 +1260,13 @@
AdviseFeatures
MLB
- C02119700QXJG36JC
+ C02717306J9JG361M
+ MaxBIOSVersion
+
ProcessorType
0
ROM
- 0022412e3d4a
+ m7zhIYfl
SpoofVendor
SystemMemoryStatus
@@ -1272,9 +1274,9 @@
SystemProductName
iMacPro1,1
SystemSerialNumber
- C02FPBZPHX87
+ C02TM2ZBHX87
SystemUUID
- 213FA768-A62C-4299-8598-47AA666E436F
+ 007076A6-F2A2-4461-BBE5-BAD019F8025A
UpdateDataHub
diff --git a/readme.md b/readme.md
index e4fc0c8..66a6e05 100644
--- a/readme.md
+++ b/readme.md
@@ -61,7 +61,7 @@ kubectl apply -f kubernetes.yml
- Start the container and connect to [port 8006](http://localhost:8006) using your web browser.
- - Select `macOS Base System` by pressing the enter key to begin the installation.
+ - Select `macOS Base System` (by pressing the enter key) to begin the installation.
- Choose `Disk Utility` and then select the largest `Apple Inc. VirtIO Block Media` disk.
@@ -69,7 +69,7 @@ kubectl apply -f kubernetes.yml
- Close the current window and proceed the installation by clicking `Reinstall macOS`.
- - When prompted where you want to install macOS, select the disk you just created previously.
+ - When prompted where you want to install it, select the disk you just created previously.
- There will be several reboots, select `macOS Installer` each time until it shows your own disk.
diff --git a/src/build.sh b/src/build.sh
index f57cce1..64df478 100644
--- a/src/build.sh
+++ b/src/build.sh
@@ -1,48 +1,67 @@
#!/usr/bin/env bash
set -Eeuo pipefail
-function msg() {
- local txt="$1"
- local bold="\x1b[1m"
- local normal="\x1b[0m"
- echo -e "${bold}### ${txt}${normal}"
-}
-
-function cleanup() {
- if test "$GUESTFISH_PID" != ""; then
- guestfish --remote -- exit >/dev/null 2>&1 || true
- fi
-}
-
-function fish() {
- echo "#" "$@"
- guestfish --remote -- "$@" || exit 1
-}
-
-rm -rf /images
-msg "Mounting template ISO..."
-
-trap 'cleanup' EXIT
-
-export LIBGUESTFS_BACKEND=direct
-# shellcheck disable=SC2046
-eval $(guestfish --listen)
-if test "$GUESTFISH_PID" = ""; then
- echo "ERROR: Starting Guestfish failed!"
- exit 1
+echo "Extracting template image..."
+
+DST="/images"
+OUT="/tmp/extract"
+
+rm -rf "$OUT"
+rm -rf "$DST"
+
+mkdir -p "$OUT"
+mkdir -p "$DST"
+
+if [ ! -f "$1" ] || [ ! -s "$1" ]; then
+ error "Could not find image file \"$1\"." && exit 10
fi
-fish add "$1"
-fish run
-fish mount /dev/sda1 /
-fish ls /EFI
+START=$(sfdisk -l "$1" | grep -i -m 1 "EFI System" | awk '{print $2}')
+mcopy -bspmQ -i "$1@@${START}S" ::EFI "$OUT"
+
+cp "$2" "$OUT/EFI/OC/"
+
+echo "Creating OpenCore image..."
+
+START=2048
+COUNT=522207
+SIZE=268435456
+
+FILE="OpenCore.img"
+IMG="/tmp/$SIZE.img"
+NAME=$(basename "$IMG")
+
+rm -f "$IMG"
+
+if ! truncate -s "$SIZE" "$IMG"; then
+ rm -f "$IMG"
+ error "Could not allocate file $IMG for the OpenCore image." && exit 11
+fi
+
+PART="/tmp/partition.fdisk"
+
+{ echo "label: gpt"
+ echo "label-id: 1ACB1E00-3B8F-4B2A-86A4-D99ED21DCAEB"
+ echo "device: $NAME"
+ echo "unit: sectors"
+ echo "first-lba: 34"
+ echo "last-lba: 524254"
+ echo "sector-size: 512"
+ echo ""
+ echo "${NAME}1 : start=$START, size=$COUNT, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=05157F6E-0AE8-4D1A-BEA5-AC172453D02C, name=\"primary\""
+
+} > "$PART"
+
+sfdisk -q "$IMG" < "$PART"
+
+echo "drive c: file=\"$IMG\" partition=0 offset=1048576" > /etc/mtools.conf
+
+mformat -F -M 512 -c 4 -T "$COUNT" -v "EFI" "C:"
-msg "Overriding config..."
+echo "Copying files to image..."
-fish copy-in "$2" /EFI/OC/
-fish umount-all
+mcopy -bspmQ "$OUT/EFI" "C:"
-mkdir -p /images
-mv "$1" /images/OpenCore.img
+mv -f "$IMG" "$DST/$FILE"
-msg "Finished succesfully!"
+echo "Finished succesfully!"