Unverified Commit 978f7200 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Removed bootmenu (#30)

parent 41383565
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -20,8 +20,9 @@ COPY --chmod=644 ./config.plist /run

ADD $REPO_OPENCORE/releases/download/$VERSION_OPENCORE/OpenCore-$VERSION_OPENCORE.iso.gz /tmp/opencore.iso.gz

RUN gzip -d /tmp/opencore.iso.gz
RUN run/build.sh /tmp/opencore.iso /run/config.plist
RUN gzip -d /tmp/opencore.iso.gz && \
    run/build.sh /tmp/opencore.iso /run/config.plist && \
    rm -rf /tmp/*

FROM scratch AS runner
COPY --from=qemux/qemu-docker:5.11 / /
+2 −2
Original line number Diff line number Diff line
@@ -1033,7 +1033,7 @@
			<key>PollAppleHotKeys</key>
			<true/>
			<key>ShowPicker</key>
			<true/>
			<false/>
			<key>TakeoffDelay</key>
			<integer>0</integer>
			<key>Timeout</key>
@@ -1871,7 +1871,7 @@
			<key>ReloadOptionRoms</key>
			<false/>
			<key>RequestBootVarRouting</key>
			<true/>
			<false/>
			<key>ResizeGpuBars</key>
			<integer>-1</integer>
			<key>ResizeUsePciRbIo</key>
+6 −8
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@ OSX (macOS) inside a Docker container.
## Features

 - KVM acceleration
 - Image downloader
 - Web-based viewer
 - Automatic download

## Usage

@@ -61,8 +61,6 @@ 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.

  - Choose `Disk Utility` and then select the largest `Apple Inc. VirtIO Block Media` disk.

  - Click the `Erase` button to format the disk, and give it any recognizable name you like.
@@ -71,12 +69,8 @@ kubectl apply -f kubernetes.yml
  
  - 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.

  - After all files are copied, select your region, language, and account settings.
  
  - Once you see the desktop, your macOS installation is ready for use.
  
  Enjoy your brand new machine, and don't forget to star this repo!

* ### How do I select the macOS version?
@@ -144,13 +138,17 @@ kubectl apply -f kubernetes.yml

  If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, check the virtualization settings in the BIOS.

* ### How do I run Windows in a container?

  You can use [dockur/windows](https://github.com/dockur/windows) for that. It shares many of the same features, and even has completely automatic installation.

* ### Is this project legal?

  Yes, this project contains only open-source code and does not distribute any copyrighted material. So under all applicable laws, this project will be considered legal.

 ## Acknowledgements

Special thanks to [OSX-KVM](https://github.com/kholia/OSX-KVM), [KVM-Opencore](https://github.com/thenickdude/KVM-Opencore) and [seitenca](https://github.com/seitenca), this project would not exist without their invaluable work.
Special thanks to [seitenca](https://github.com/seitenca), [OSX-KVM](https://github.com/kholia/OSX-KVM) and [KVM-Opencore](https://github.com/thenickdude/KVM-Opencore), this project would not exist without their invaluable work.

## Stars
[![Stars](https://starchart.cc/dockur/macos.svg?variant=adaptive)](https://starchart.cc/dockur/macos)
+9 −3
Original line number Diff line number Diff line
@@ -6,9 +6,6 @@ set -Eeuo pipefail

BOOT_DESC=""
BOOT_OPTS=""
BOOT_DRIVE_ID="OpenCoreBoot"
BOOT_DRIVE="/images/OpenCore.img"

SECURE="off"
OVMF="/usr/share/OVMF"

@@ -62,6 +59,15 @@ BOOT_OPTS+=" -drive if=pflash,format=raw,readonly=on,file=$DEST.rom"
BOOT_OPTS+=" -drive if=pflash,format=raw,file=$DEST.vars"

# OpenCoreBoot
BOOT_DRIVE_ID="OpenCore"
BOOT_DRIVE="$STORAGE/boot.img"

if [ ! -f "$BOOT_DRIVE" ] || [ ! -s "$BOOT_DRIVE" ]; then
  msg="Extracting boot image"
  info "$msg..." && html "$msg..."
  gzip -dkc /images/OpenCore.img.gz > "$BOOT_DRIVE"
fi

DISK_OPTS+=" -device virtio-blk-pci,drive=${BOOT_DRIVE_ID},scsi=off,bus=pcie.0,addr=0x5,iothread=io2,bootindex=$BOOT_INDEX"
DISK_OPTS+=" -drive file=$BOOT_DRIVE,id=$BOOT_DRIVE_ID,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,readonly=on,if=none"

+29 −19
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -Eeuo pipefail

echo "Extracting template image..."

DST="/images"
OUT="/tmp/extract"

@@ -12,56 +10,68 @@ rm -rf "$DST"
mkdir -p "$OUT"
mkdir -p "$DST"

echo "Extracting template image..."

if [ ! -f "$1" ] || [ ! -s "$1" ]; then
  error "Could not find image file \"$1\"." && exit 10
  echo "Could not find image file \"$1\"." && exit 10
fi

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 "Building OpenCore image..."

echo "Creating OpenCore image..."
cp "$2" "$OUT/EFI/OC/"

MB=256
CLUSTER=4
START=2048
COUNT=522207
SIZE=268435456
SECTOR=512
FIRST_LBA=34

FILE="OpenCore.img"
IMG="/tmp/$SIZE.img"
NAME=$(basename "$IMG")
SIZE=$(( MB*1024*1024 ))
OFFSET=$(( START*SECTOR ))
TOTAL=$(( SIZE-(FIRST_LBA*SECTOR) ))
LAST_LBA=$(( TOTAL/SECTOR ))
COUNT=$(( LAST_LBA-(START-1) ))

FILE="OpenCore.img"
IMG="/tmp/$FILE"
rm -f "$IMG"

if ! truncate -s "$SIZE" "$IMG"; then
  rm -f "$IMG"
  error "Could not allocate file $IMG for the OpenCore image." && exit 11
  echo "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 "device: $FILE"
        echo "unit: sectors"
        echo "first-lba: 34"
        echo "last-lba: 524254"
        echo "sector-size: 512"
        echo "first-lba: $FIRST_LBA"
        echo "last-lba: $LAST_LBA"
        echo "sector-size: $SECTOR"
        echo ""
        echo "${NAME}1 : start=$START, size=$COUNT, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=05157F6E-0AE8-4D1A-BEA5-AC172453D02C, name=\"primary\""
        echo "${FILE}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
echo "drive c: file=\"$IMG\" partition=0 offset=$OFFSET" > /etc/mtools.conf

mformat -F -M 512 -c 4 -T "$COUNT" -v "EFI" "C:"
mformat -F -M "$SECTOR" -c "$CLUSTER" -T "$COUNT" -v "EFI" "C:"

echo "Copying files to image..."

mcopy -bspmQ "$OUT/EFI" "C:"
rm -rf "$OUT"

mv -f "$IMG" "$DST/$FILE"
echo "Compressing image..."

gzip -c "$IMG" > "$DST/$FILE.gz"
rm -f "$IMG"

echo "Finished succesfully!"
Loading