moved the catalog to dependencies

probably belongs there
This commit is contained in:
img2tab
2019-03-29 18:35:24 +00:00
committed by GitHub
parent 49fb1f81ba
commit 1a2ec208e4
+22 -20
View File
@@ -2,7 +2,7 @@
# One-key semi-automatic installer of macOS on VirtualBox # One-key semi-automatic installer of macOS on VirtualBox
# (c) img2tab, licensed under GPL2.0 or higher # (c) img2tab, licensed under GPL2.0 or higher
# url: https://github.com/img2tab/macos-guest-virtualbox # url: https://github.com/img2tab/macos-guest-virtualbox
# version 0.51 # version 0.52
# Requirements: 33.5GB available storage on host # Requirements: 33.5GB available storage on host
# Dependencies: bash>=4.0, unzip, wget, dmg2img, # Dependencies: bash>=4.0, unzip, wget, dmg2img,
@@ -125,6 +125,24 @@ if [ -z "$(dmg2img -d 2>/dev/null)" ]; then
chmod +x "dmg2img.exe" chmod +x "dmg2img.exe"
fi fi
fi fi
# Find the correct download URL in the Apple catalog
echo "Downloading Apple macOS Mojave software update catalog"
wget -c 'http://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog' -O 'apple.sucatalog.tmp'
echo "Finding latest macOS InstallAssistant entry"
tac "apple.sucatalog.tmp" | csplit - '/InstallAssistantAuto.smd/+1' -f "applecatalog.tmp." -s
urlbase="$(tail -n 1 "applecatalog.tmp.00")"
urlbase="$(expr match "${urlbase}" '.*\(http://[^<]*/\)')"
if [ -z "${urlbase}" ]; then
printf "Couldn't find the download URL in the Apple catalog. Please report this issue
on https://github.com/img2tab/macos-guest-virtualbox/issues
or update the URL yourself from the catalog found
on https://gist.github.com/nuomi1/16133b89c2b38b7eb197
or http://swscan.apple.com/content/catalogs/others/
index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog'
exit
fi
echo "Found BaseSystem.dmg URL: ${urlbase}BaseSystem.dmg"
} }
# Done with dependencies # Done with dependencies
@@ -167,25 +185,10 @@ function create_basesystem_vdi() {
if [ -r "BaseSystem.vdi" ]; then if [ -r "BaseSystem.vdi" ]; then
echo "BaseSystem.vdi bootstrap virtual disk image ready." echo "BaseSystem.vdi bootstrap virtual disk image ready."
else else
# Find the correct download URL in the Apple catalog
echo "Downloading Apple macOS Mojave software update catalog"
wget -c 'http://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog' -O 'apple.sucatalog.tmp'
echo "Finding latest macOS InstallAssistant entry"
tac "apple.sucatalog.tmp" | csplit - '/InstallAssistantAuto.smd/+1' -f "applecatalog.tmp." -s
urlbase="$(tail -n 1 "applecatalog.tmp.00")"
urlbase="$(expr match "${urlbase}" '.*\(http://[^<]*/\)')"
echo "Found BaseSystem.dmg URL: ${urlbase}BaseSystem.dmg"
echo "${urlbase}" > urlbase.tmp
echo "Downloading BaseSystem.dmg from swcdn.apple.com" echo "Downloading BaseSystem.dmg from swcdn.apple.com"
wget -c "${urlbase}BaseSystem.dmg" -O "BaseSystem.dmg" 2>/dev/tty wget -c "${urlbase}BaseSystem.dmg" -O "BaseSystem.dmg" 2>/dev/tty
if [ ! -s BaseSystem.dmg ]; then if [ ! -s BaseSystem.dmg ]; then
printf ${whiteonred}'Could not download BaseSystem.dmg'${defaultcolor}'. Please report this issue printf ${whiteonred}'Could not download BaseSystem.dmg'${defaultcolor}'.'
on https://github.com/img2tab/macos-guest-virtualbox/issues
or update the URL yourself from the catalog found
on https://gist.github.com/nuomi1/16133b89c2b38b7eb197
or http://swscan.apple.com/content/catalogs/others/
index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog'
exit exit
fi fi
echo "Downloaded BaseSystem.dmg. Converting to BaseSystem.img" echo "Downloaded BaseSystem.dmg. Converting to BaseSystem.img"
@@ -483,7 +486,6 @@ echo ""
echo "Downloading macOS Mojave 10.14 installer." echo "Downloading macOS Mojave 10.14 installer."
# downloading macOS # downloading macOS
urlbase="$(cat urlbase.tmp)"
kbstring='urlbase="'"${urlbase}"'"; for filename in BaseSystem.chunklist InstallInfo.plist AppleDiagnostics.dmg AppleDiagnostics.chunklist BaseSystem.dmg InstallESDDmg.pkg; do curl "${urlbase}${filename}" -o "/Volumes/'"${vmname}"'/${filename}"; done' kbstring='urlbase="'"${urlbase}"'"; for filename in BaseSystem.chunklist InstallInfo.plist AppleDiagnostics.dmg AppleDiagnostics.chunklist BaseSystem.dmg InstallESDDmg.pkg; do curl "${urlbase}${filename}" -o "/Volumes/'"${vmname}"'/${filename}"; done'
sendkeys sendkeys
promptterminalready promptterminalready
@@ -655,9 +657,9 @@ echo ""
if [ "${delete}" == "y" ]; then if [ "${delete}" == "y" ]; then
# temporary files cleanup # temporary files cleanup
VBoxManage closemedium "${wsldir}BaseSystem.vdi" VBoxManage closemedium "${wsldir}BaseSystem.vdi"
VBoxManage closemedium "Install_${wsldir}${vmname}.vdi" VBoxManage closemedium "${wsldir}Install_${vmname}.vdi"
rm "BaseSystem.vdi" "Install_${vmname}.vdi" rm "BaseSystem.vdi" "Install_${vmname}.vdi"
rm "apple.sucatalog.tmp" "applecatalog.tmp.00" "applecatalog.tmp.01" "urlbase.tmp" rm "apple.sucatalog.tmp" "applecatalog.tmp.00" "applecatalog.tmp.01"
fi fi
printf 'macOS Mojave 10.14 installation should complete in a few minutes. printf 'macOS Mojave 10.14 installation should complete in a few minutes.