mirror of
https://github.com/thewesker/osx-iso.git
synced 2025-12-20 12:21:06 -05:00
Support High Sierra
Restructured the code; it's still gross, but it works :P
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
# OSX-ISO
|
# OSX-ISO
|
||||||
|
|
||||||
Create a bootable ISO of OS X / macOS, from the installation app file.
|
> Create a bootable ISO of OS X / macOS, from the installation app file.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
The appropriate installation file(s) must be located in `/Applications` i.e.
|
The appropriate installation file(s) must be located in `/Applications` i.e.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
/Applications/Install macOS High Sierra.app
|
||||||
/Applications/Install macOS Sierra.app
|
/Applications/Install macOS Sierra.app
|
||||||
/Applications/Install OS X El Capitan.app
|
/Applications/Install OS X El Capitan.app
|
||||||
/Applications/Install OS X Yosemite.app
|
/Applications/Install OS X Yosemite.app
|
||||||
@@ -24,14 +25,14 @@ $ bpkg install busterc/osx-iso
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ osxiso <Sierra|"El Capitan"|Yosemite|Mavericks>
|
$ osxiso <"High Sierra"|Sierra|"El Capitan"|Yosemite|Mavericks>
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
ISC License (ISC)
|
ISC License (ISC)
|
||||||
|
|
||||||
Copyright © 2015, Buster Collings
|
Copyright © 2015-2017, Buster Collings
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
|||||||
110
osxiso
110
osxiso
@@ -11,51 +11,98 @@ function osxiso() {
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
$ ${0##*/} <Sierra|"El Capitan"|Yosemite|Mavericks>
|
$ ${0##*/} <"High Sierra"|Sierra|"El Capitan"|Yosemite|Mavericks>
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
|
||||||
|
The installation app file(s) must be unaltered and located at:
|
||||||
|
"/Applications/Install macOS High Sierra.app"
|
||||||
|
"/Applications/Install macOS Sierra.app"
|
||||||
|
"/Applications/Install OS X El Capitan.app"
|
||||||
|
"/Applications/Install OS X Yosemite.app"
|
||||||
|
"/Applications/Install OS X Mavericks.app"
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
local temp="$PWD/temp"
|
||||||
local temp="$PWD/temp"
|
local dist="$PWD/dist"
|
||||||
local dist="$PWD/dist"
|
local iso="$dist/$1.iso"
|
||||||
local iso="$dist/$1.iso"
|
local app_mount="/Volumes/install_app"
|
||||||
local app_mount="/Volumes/install_app"
|
local build_mount="/Volumes/install_build"
|
||||||
local build_mount="/Volumes/install_build"
|
local base_mount="/Volumes/OS X Base System"
|
||||||
local base_mount="/Volumes/OS X Base System"
|
local highsierra_mount="/Volumes/Install macOS High Sierra"
|
||||||
|
|
||||||
function detach_mounts() {
|
function detach_mounts() {
|
||||||
echo "Attempting to detach mounts"
|
# Unmount the installer image
|
||||||
|
[[ ! -d "$app_mount" ]] || hdiutil detach "$app_mount"
|
||||||
|
|
||||||
# Unmount the installer image
|
# Unmount the sparse bundle
|
||||||
[[ ! -d "$app_mount" ]] || hdiutil detach "$app_mount"
|
[[ ! -d "$base_mount" ]] || hdiutil detach "$base_mount"
|
||||||
|
|
||||||
# Unmount the sparse bundle
|
# Unmount the High Sierra specific
|
||||||
[[ ! -d "$base_mount" ]] || hdiutil detach "$base_mount"
|
[[ ! -d "$highsierra_mount" ]] || hdiutil detach "$highsierra_mount"
|
||||||
}
|
|
||||||
|
|
||||||
function cleanup() {
|
# Unmount temporary build path
|
||||||
detach_mounts
|
[[ ! -d "$build_mount" ]] || hdiutil detach "$build_mount"
|
||||||
|
}
|
||||||
|
|
||||||
# Remove temp directory
|
function cleanup() {
|
||||||
rm -rf "$temp"
|
detach_mounts
|
||||||
}
|
|
||||||
|
|
||||||
function abort() {
|
# Remove temp directory
|
||||||
printf "\nCommand returned with error, aborting ...\n\n"
|
rm -rf "$temp"
|
||||||
exit 2
|
}
|
||||||
}
|
|
||||||
|
|
||||||
trap cleanup EXIT
|
function abort() {
|
||||||
trap abort ERR
|
printf "\nCommand returned with error, aborting ...\n\n"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
function prep_build() {
|
||||||
# Attempt cleanup of any previous attempts
|
# Attempt cleanup of any previous attempts
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
# Prepare to do work
|
# Prepare to do work
|
||||||
mkdir -p "$temp"
|
mkdir -p "$temp"
|
||||||
mkdir -p "$dist"
|
mkdir -p "$dist"
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_v2() {
|
||||||
|
trap cleanup EXIT
|
||||||
|
trap abort ERR
|
||||||
|
|
||||||
|
prep_build
|
||||||
|
|
||||||
|
# Create a blank ISO of 7316MB with a Single Partition
|
||||||
|
hdiutil create -o "$temp/$1.cdr" -size 7316m -layout SPUD -fs HFS+J
|
||||||
|
|
||||||
|
# Mount the blank ISO
|
||||||
|
hdiutil attach "$temp/$1.cdr.dmg" -noverify -nobrowse -mountpoint "$build_mount"
|
||||||
|
|
||||||
|
printf "<sudo> "
|
||||||
|
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume "$build_mount"
|
||||||
|
|
||||||
|
# Detach mounts
|
||||||
|
detach_mounts
|
||||||
|
|
||||||
|
# Convert the sparse bundle to ISO/CD master
|
||||||
|
hdiutil convert "$temp/$1.cdr.dmg" -format UDTO -o "$temp/$1.iso"
|
||||||
|
|
||||||
|
# Rename the ISO and move it to the distribution "dist" dir
|
||||||
|
mv "$temp/$1.iso.cdr" "$iso"
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
printf "\n========== FINISHED ==========\n\n"
|
||||||
|
printf "ISO is located at '%s'\n\n" "$iso"
|
||||||
|
}
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
trap cleanup EXIT
|
||||||
|
trap abort ERR
|
||||||
|
|
||||||
|
prep_build
|
||||||
|
|
||||||
# Mount the installer image
|
# Mount the installer image
|
||||||
hdiutil attach "$app/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint "$app_mount"
|
hdiutil attach "$app/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint "$app_mount"
|
||||||
@@ -99,10 +146,11 @@ EOF
|
|||||||
Mavericks
|
Mavericks
|
||||||
"El Capitan"
|
"El Capitan"
|
||||||
Sierra
|
Sierra
|
||||||
|
"High Sierra"
|
||||||
)
|
)
|
||||||
for version in "${versions[@]}"; do
|
for version in "${versions[@]}"; do
|
||||||
if [[ "$1" = "$version" ]]; then
|
if [[ "$1" = "$version" ]]; then
|
||||||
if [[ "$1" = "Sierra" ]]; then
|
if [[ "$1" == *"Sierra"* ]]; then
|
||||||
app="/Applications/Install macOS $1.app"
|
app="/Applications/Install macOS $1.app"
|
||||||
else
|
else
|
||||||
app="/Applications/Install OS X $1.app"
|
app="/Applications/Install OS X $1.app"
|
||||||
@@ -113,14 +161,18 @@ EOF
|
|||||||
|
|
||||||
Missing: $app
|
Missing: $app
|
||||||
|
|
||||||
* You can install it with the App Store
|
* You can download it from the App Store
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do Work
|
# Do Work
|
||||||
build "$1"
|
if [[ "$1" == "High Sierra" ]]; then
|
||||||
|
build_v2 "$1"
|
||||||
|
else
|
||||||
|
build "$1"
|
||||||
|
fi
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user