Skip to content

Commit

Permalink
Add ISO support for Lion + Mountain Lion (#101)
Browse files Browse the repository at this point in the history
* Add support for Lion + Mountain Lion ISOs on Intel

* Fix typo

* Update compatibility logic
  • Loading branch information
ninxsoft authored Oct 28, 2023
1 parent f17690b commit b72c3e2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
78 changes: 45 additions & 33 deletions Mist/Helpers/TaskManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -433,45 +433,57 @@ class TaskManager: ObservableObject {
let temporaryCDRURL: URL = temporaryDirectoryURL.appendingPathComponent("\(installer.id).cdr")
let isoURL: URL = destinationURL.appendingPathComponent(filename.stringWithSubstitutions(name: installer.name, version: installer.version, build: installer.build))

return [
MistTask(type: .create, description: "temporary Disk Image") {
try await DiskImageCreator.create(temporaryImageURL, size: installer.isoSize)
},
MistTask(type: .mount, description: "temporary Disk Image") {
try await DiskImageMounter.mount(temporaryImageURL, mountPoint: installer.temporaryISOMountPointURL)
},
MistTask(type: .create, description: "macOS Installer in temporary Disk Image") {
if installer.mavericksOrNewer {
return [
MistTask(type: .create, description: "temporary Disk Image") {
try await DiskImageCreator.create(temporaryImageURL, size: installer.isoSize)
},
MistTask(type: .mount, description: "temporary Disk Image") {
try await DiskImageMounter.mount(temporaryImageURL, mountPoint: installer.temporaryISOMountPointURL)
},
MistTask(type: .create, description: "macOS Installer in temporary Disk Image") {

// Workaround to make macOS Sierra 10.12 createinstallmedia work
if installer.version.hasPrefix("10.12") {
let infoPlistURL: URL = installer.temporaryInstallerURL.appendingPathComponent("/Contents/Info.plist")
try PropertyListUpdater.update(infoPlistURL, key: "CFBundleShortVersionString", value: "12.6.03")
}
// Workaround to make macOS Sierra 10.12 createinstallmedia work
if installer.version.hasPrefix("10.12") {
let infoPlistURL: URL = installer.temporaryInstallerURL.appendingPathComponent("/Contents/Info.plist")
try PropertyListUpdater.update(infoPlistURL, key: "CFBundleShortVersionString", value: "12.6.03")
}

try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: installer.temporaryISOMountPointURL, sierraOrOlder: installer.sierraOrOlder)
},
MistTask(type: .unmount, description: "temporary Disk Image") {
if FileManager.default.fileExists(atPath: installer.temporaryISOMountPointURL.path) {
try await DiskImageUnmounter.unmount(installer.temporaryISOMountPointURL)
}
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: installer.temporaryISOMountPointURL, sierraOrOlder: installer.sierraOrOlder)
},
MistTask(type: .unmount, description: "temporary Disk Image") {
if FileManager.default.fileExists(atPath: installer.temporaryISOMountPointURL.path) {
try await DiskImageUnmounter.unmount(installer.temporaryISOMountPointURL)
}

guard let major: Substring = installer.version.split(separator: ".").first else {
return
}
guard let major: Substring = installer.version.split(separator: ".").first else {
return
}

let url: URL = URL(fileURLWithPath: "/Volumes/Install macOS \(major) beta")
let url: URL = URL(fileURLWithPath: "/Volumes/Install macOS \(major) beta")

if FileManager.default.fileExists(atPath: url.path) {
try await DiskImageUnmounter.unmount(url)
if FileManager.default.fileExists(atPath: url.path) {
try await DiskImageUnmounter.unmount(url)
}
},
MistTask(type: .convert, description: "temporary Disk Image to ISO") {
try await ISOConverter.convert(temporaryImageURL, destination: temporaryCDRURL)
},
MistTask(type: .save, description: "ISO to destination") {
try await FileMover.move(temporaryCDRURL, to: isoURL)
}
},
MistTask(type: .convert, description: "temporary Disk Image to ISO") {
try await ISOConverter.convert(temporaryImageURL, destination: temporaryCDRURL)
},
MistTask(type: .save, description: "ISO to destination") {
try await FileMover.move(temporaryCDRURL, to: isoURL)
}
]
]
} else {
let installESDURL: URL = installer.temporaryInstallerURL.appendingPathComponent("/Contents/SharedSupport/InstallESD.dmg")
return [
MistTask(type: .convert, description: "Installer Disk Image to ISO") {
try await ISOConverter.convert(installESDURL, destination: temporaryCDRURL)
},
MistTask(type: .save, description: "ISO to destination") {
try await FileMover.move(temporaryCDRURL, to: isoURL)
}
]
}
}

// swiftlint:disable:next function_parameter_count
Expand Down
14 changes: 2 additions & 12 deletions Mist/Views/List/InstallerExportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,10 @@ struct InstallerExportView: View {
return false
}

return (architecture == .intel && installer.mavericksOrNewer) || (architecture == .appleSilicon && installer.bigSurOrNewer)
return architecture == .intel || (architecture == .appleSilicon && installer.bigSurOrNewer)
}
private var compatibilityMessage: String {

guard let architecture: Architecture = Hardware.architecture else {
return ""
}

switch architecture {
case .appleSilicon:
return "**Note:** ISOs are unavailable for building **macOS Catalina 10.15 and older** on [Apple Silicon Macs](https://support.apple.com/en-us/HT211814)."
case .intel:
return "**Note:** ISOs are unavailable for building **OS X Mountain Lion 10.8 and older** on Intel-based Macs."
}
"**Note:** ISOs are unavailable for building **macOS Catalina 10.15 and older** on [Apple Silicon Macs](https://support.apple.com/en-us/HT211814)."
}

var body: some View {
Expand Down

0 comments on commit b72c3e2

Please sign in to comment.