mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-28 14:04:49 -04:00
Add macOS Sierra 10.12 createinstallmedia workaround (#100)
This commit is contained in:
parent
a89a39f173
commit
f17690b98b
3 changed files with 56 additions and 0 deletions
|
@ -131,6 +131,7 @@
|
|||
39FF05FA285985DD00A86670 /* SettingsAboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FF05F9285985DD00A86670 /* SettingsAboutView.swift */; };
|
||||
573A23622A28711C00EC9470 /* Architecture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573A23612A28711C00EC9470 /* Architecture.swift */; };
|
||||
573A23642A28791F00EC9470 /* Scene+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573A23632A28791F00EC9470 /* Scene+Extension.swift */; };
|
||||
574199D22AED15420086493F /* PropertyListUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 574199D12AED15420086493F /* PropertyListUpdater.swift */; };
|
||||
575812BA2A373A4F00425BAF /* FirmwareAlertType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 575812B92A373A4F00425BAF /* FirmwareAlertType.swift */; };
|
||||
575812BC2A37406300425BAF /* ListRowDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 575812BB2A37406300425BAF /* ListRowDetail.swift */; };
|
||||
575812BE2A3743E300425BAF /* InstallerSheetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 575812BD2A3743E300425BAF /* InstallerSheetType.swift */; };
|
||||
|
@ -283,6 +284,7 @@
|
|||
39FF05F9285985DD00A86670 /* SettingsAboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsAboutView.swift; sourceTree = "<group>"; };
|
||||
573A23612A28711C00EC9470 /* Architecture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Architecture.swift; sourceTree = "<group>"; };
|
||||
573A23632A28791F00EC9470 /* Scene+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Scene+Extension.swift"; sourceTree = "<group>"; };
|
||||
574199D12AED15420086493F /* PropertyListUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyListUpdater.swift; sourceTree = "<group>"; };
|
||||
575812B92A373A4F00425BAF /* FirmwareAlertType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirmwareAlertType.swift; sourceTree = "<group>"; };
|
||||
575812BB2A37406300425BAF /* ListRowDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRowDetail.swift; sourceTree = "<group>"; };
|
||||
575812BD2A3743E300425BAF /* InstallerSheetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallerSheetType.swift; sourceTree = "<group>"; };
|
||||
|
@ -406,6 +408,7 @@
|
|||
39CF56322862B7A2006FB5D2 /* PackageCreator.swift */,
|
||||
393F35BD2864197F005B7165 /* PrivilegedHelperTool.swift */,
|
||||
3935F4CC286C6A5D00760AB0 /* ProcessKiller.swift */,
|
||||
574199D12AED15420086493F /* PropertyListUpdater.swift */,
|
||||
3935F4C6286B54E200760AB0 /* SparkleUpdater.swift */,
|
||||
398734C328600E6E00B4C357 /* TaskManager.swift */,
|
||||
398734C5286011C300B4C357 /* Validator.swift */,
|
||||
|
@ -842,6 +845,7 @@
|
|||
390451D02856F63700E0B563 /* Installer.swift in Sources */,
|
||||
3935F47628643AF000760AB0 /* UNNotificationAction+Extension.swift in Sources */,
|
||||
39252AB3285C5D7700956C74 /* SettingsGeneralUpdatesView.swift in Sources */,
|
||||
574199D22AED15420086493F /* PropertyListUpdater.swift in Sources */,
|
||||
39CA25E32941D8BB0030711E /* FileAttributesUpdater.swift in Sources */,
|
||||
575812C42A3821A900425BAF /* InstallerVolumeSelectionInformationView.swift in Sources */,
|
||||
3935F4AB286B04BC00760AB0 /* HelperToolInfoPropertyList.swift in Sources */,
|
||||
|
|
45
Mist/Helpers/PropertyListUpdater.swift
Normal file
45
Mist/Helpers/PropertyListUpdater.swift
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// PropertyListUpdater.swift
|
||||
// Mist
|
||||
//
|
||||
// Created by Nindi Gill on 28/10/2023.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Helper struct to update a Property List key-pair value.
|
||||
struct PropertyListUpdater {
|
||||
|
||||
/// Edit a key-pair value in a Property List.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - url: The URL of the property list to be updated.
|
||||
/// - key: The key in the property list to be updated.
|
||||
/// - value: The value to update within the property list.
|
||||
///
|
||||
/// - Throws: An `Error` if the command failed to execute.
|
||||
static func update(_ url: URL, key: String, value: AnyHashable) throws {
|
||||
|
||||
let input: String = try String(contentsOf: url, encoding: .utf8)
|
||||
|
||||
guard var data: Data = input.data(using: .utf8) else {
|
||||
throw MistError.invalidData
|
||||
}
|
||||
|
||||
var format: PropertyListSerialization.PropertyListFormat = .xml
|
||||
|
||||
guard var propertyList: [String: Any] = try PropertyListSerialization.propertyList(from: data, options: [.mutableContainers], format: &format) as? [String: Any] else {
|
||||
throw MistError.invalidData
|
||||
}
|
||||
|
||||
propertyList[key] = value
|
||||
|
||||
data = try PropertyListSerialization.data(fromPropertyList: propertyList, format: .xml, options: .bitWidth)
|
||||
|
||||
guard let output = String(data: data, encoding: .utf8) else {
|
||||
throw MistError.invalidData
|
||||
}
|
||||
|
||||
try output.write(to: url, atomically: true, encoding: .utf8)
|
||||
}
|
||||
}
|
|
@ -441,6 +441,13 @@ class TaskManager: ObservableObject {
|
|||
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")
|
||||
}
|
||||
|
||||
try await InstallMediaCreator.create(createInstallMediaURL, mountPoint: installer.temporaryISOMountPointURL, sierraOrOlder: installer.sierraOrOlder)
|
||||
},
|
||||
MistTask(type: .unmount, description: "temporary Disk Image") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue