2021-10-26 04:48:51 +00:00
|
|
|
# Builds either a recovery image (Monterey-recovery.img) or a full installer (Monterey-full.img) for Monterey.
|
2021-06-12 06:02:41 +00:00
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
# To build the full installer you must run this on macOS.
|
|
|
|
# The recovery can be built on either macOS or Linux.
|
2021-06-12 06:02:41 +00:00
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
# For Ubuntu (or similar Linux distribution) you'll need to run this first to get the required packages:
|
|
|
|
# sudo apt install qemu-utils make
|
2021-06-12 06:02:41 +00:00
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
# For macOS you'll probably need to run xcode-select --install to get the commandline tools
|
|
|
|
|
|
|
|
MONTEREY_APP=/Applications/Install\ macOS\ Monterey.app
|
|
|
|
|
|
|
|
LINUX_TOOLS = qemu-img
|
|
|
|
|
|
|
|
OS :=
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
OS = MACOS
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If this is Linux make sure we have all our build tools available:
|
|
|
|
ifeq ($(OS),)
|
|
|
|
K := $(foreach exec,$(LINUX_TOOLS),\
|
|
|
|
$(if $(shell which $(exec)),some string,$(error "Missing required $(exec) tool for build")))
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: Monterey-recovery.img
|
2021-06-12 06:02:41 +00:00
|
|
|
|
|
|
|
%.img : %.dmg
|
|
|
|
ln $< $@ || cp $< $@
|
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
ifeq ($(OS),MACOS)
|
2022-03-15 11:31:50 +00:00
|
|
|
|
2021-06-12 06:02:41 +00:00
|
|
|
Monterey-full.dmg : $(MONTEREY_APP)
|
|
|
|
hdiutil create -o "$@" -size 14g -layout GPTSPUD -fs HFS+J
|
|
|
|
hdiutil attach -noverify -mountpoint /Volumes/install_build "$@"
|
|
|
|
sudo "$</Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
|
2021-10-26 04:48:51 +00:00
|
|
|
hdiutil detach "/Volumes/Install macOS Monterey"
|
2022-03-15 11:31:50 +00:00
|
|
|
|
|
|
|
# Avoid redownloading Monterey if the app already exists
|
|
|
|
ifeq (,$(wildcard $(MONTEREY_APP)))
|
|
|
|
$(MONTEREY_APP) : InstallAssistant.pkg
|
|
|
|
sudo installer -pkg $< -target /
|
|
|
|
endif
|
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
else
|
2022-03-15 11:31:50 +00:00
|
|
|
|
2021-10-26 04:48:51 +00:00
|
|
|
Monterey-full.dmg :
|
|
|
|
$(error "Building a full installer requires this script to be run on macOS, run 'make Monterey-recovery.img' instead")
|
|
|
|
|
2022-03-15 11:31:50 +00:00
|
|
|
endif
|
2021-10-26 04:48:51 +00:00
|
|
|
|
2023-11-30 03:53:38 +00:00
|
|
|
Monterey-recovery.dmg : com.apple.recovery.boot/BaseSystem.dmg
|
2021-10-26 04:48:51 +00:00
|
|
|
rm -f $@
|
|
|
|
ifeq ($(OS),MACOS)
|
|
|
|
hdiutil convert $< -format UDRW -o $@
|
|
|
|
else
|
|
|
|
qemu-img convert $< -O raw $@
|
|
|
|
endif
|
|
|
|
|
2023-11-30 03:53:38 +00:00
|
|
|
com.apple.recovery.boot/BaseSystem.dmg :
|
2022-06-20 01:17:06 +00:00
|
|
|
../../fetch-macOS-v2.py --action download --board-id Mac-F60DEB81FF30ACF6 --os latest
|
2021-10-26 04:48:51 +00:00
|
|
|
|
|
|
|
InstallAssistant.pkg :
|
|
|
|
../../backups/fetch-macOS.py --version latest --title "macOS Monterey"
|
2021-06-12 06:02:41 +00:00
|
|
|
|
|
|
|
clean :
|
2023-11-30 03:53:38 +00:00
|
|
|
rm -f SharedSupport.dmg InstallAssistant.pkg Monterey-recovery.img Monterey-full.img
|
|
|
|
rm -rf content com.apple.recovery.boot
|