Support building recovery and full installer for macOS Monterey

* Ensure Big Sur script doesn't download recovery for Monterey

  (by picking a board ID that Monterey doesn't support)

* Support Monterey (final) recovery and full install
This commit is contained in:
Nicholas Sherlock 2021-10-26 17:48:51 +13:00 committed by Dhiru Kholia
parent 1cc6430f96
commit 26ce72f258
3 changed files with 56 additions and 11 deletions

View file

@ -70,13 +70,14 @@ catalogs = {
"DeveloperSeed": "https://swscan.apple.com/content/catalogs/others/index-10.16seed-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog",
"PublicSeed": "https://swscan.apple.com/content/catalogs/others/index-10.16beta-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog",
"PublicRelease": "https://swscan.apple.com/content/catalogs/others/index-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog",
"20": "https://swscan.apple.com/content/catalogs/others/index-11-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
"20": "https://swscan.apple.com/content/catalogs/others/index-11-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog",
'21': "https://swscan.apple.com/content/catalogs/others/index-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog",
}
def get_default_catalog():
'''Returns the default softwareupdate catalog for the current OS'''
return catalogs["20"]
return catalogs["21"]
# return catalogs["PublicRelease"]
# return catalogs["DeveloperSeed"]
@ -101,9 +102,9 @@ def replicate_url(full_url,
# hack
print("[+] Fetching %s" % full_url)
if installer and "BaseSystem.dmg" not in full_url and "Big Sur" not in product_title:
if installer and "BaseSystem.dmg" not in full_url and "Big Sur" not in product_title and "Monterey" not in product_title:
return
if "Big Sur" in product_title and "InstallAssistant.pkg" not in full_url:
if ("Big Sur" in product_title or "Monterey" in product_title) and "InstallAssistant.pkg" not in full_url:
return
attempt_resume = True
# path = urllib.parse.urlsplit(full_url)[2]

View file

@ -55,7 +55,7 @@ else
endif
BaseSystem.dmg :
../../fetch-macOS-v2.py --action download --board-id Mac-E43C1C25D4880AD6
../../fetch-macOS-v2.py --action download --board-id Mac-2BD1B31983FE1663
InstallAssistant.pkg :
../../backups/fetch-macOS.py --version latest --title "macOS Big Sur"

View file

@ -1,19 +1,63 @@
# Builds a full installer (Monterey-full.img) for Monterey Developer Beta.
# Builds either a recovery image (Monterey-recovery.img) or a full installer (Monterey-full.img) for Monterey.
# You need to opt-in to the Developer beta program first and get the Monterey installer app using System Update
# To build the full installer you must run this on macOS.
# The recovery can be built on either macOS or Linux.
MONTEREY_APP=/Applications/Install\ macOS\ 12\ Beta.app
# For Ubuntu (or similar Linux distribution) you'll need to run this first to get the required packages:
# sudo apt install qemu-utils make
all: Monterey-full.img
# 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
%.img : %.dmg
ln $< $@ || cp $< $@
ifeq ($(OS),MACOS)
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
hdiutil detach "/Volumes/Install macOS 12 Beta"
hdiutil detach "/Volumes/Install macOS Monterey"
else
Monterey-full.dmg :
$(error "Building a full installer requires this script to be run on macOS, run 'make Monterey-recovery.img' instead")
endif
$(MONTEREY_APP) : InstallAssistant.pkg
sudo installer -pkg $< -target /
Monterey-recovery.dmg : BaseSystem.dmg
rm -f $@
ifeq ($(OS),MACOS)
hdiutil convert $< -format UDRW -o $@
else
qemu-img convert $< -O raw $@
endif
BaseSystem.dmg :
../../fetch-macOS-v2.py --action download --board-id Mac-7BA5B2D9E42DDD94 --os latest
InstallAssistant.pkg :
../../backups/fetch-macOS.py --version latest --title "macOS Monterey"
clean :
rm -f Monterey-recovery.img Monterey-full.img
rm -f BaseSystem.chunklist BaseSystem.dmg SharedSupport.dmg InstallAssistant.pkg Monterey-recovery.img Monterey-full.img
rm -rf content