diff --git a/Mist/Helpers/Generator.swift b/Mist/Helpers/Generator.swift index cf1f747..0ff4025 100644 --- a/Mist/Helpers/Generator.swift +++ b/Mist/Helpers/Generator.swift @@ -391,6 +391,11 @@ enum Generator { var arguments: [String] = ["\(installer.temporaryInstallerURL.path)/Contents/Resources/createinstallmedia"] if !installer.bigSurOrNewer { + + if FileManager.default.fileExists(atPath: installer.temporaryInstallerWithAdHocCodeSignaturesURL.path) { + try FileManager.default.removeItem(at: installer.temporaryInstallerWithAdHocCodeSignaturesURL) + } + // swiftlint:disable:next line_length !options.quiet ? PrettyPrint.print("Copying '\(installer.temporaryInstallerURL.path)' to '\(installer.temporaryInstallerWithAdHocCodeSignaturesURL.path)'...", noAnsi: options.noAnsi) : Mist.noop() try FileManager.default.copyItem(at: installer.temporaryInstallerURL, to: installer.temporaryInstallerWithAdHocCodeSignaturesURL) @@ -399,7 +404,7 @@ enum Generator { arguments = ["\(installer.temporaryInstallerWithAdHocCodeSignaturesURL.path)/Contents/Resources/createinstallmedia"] } - arguments += ["--volume", installer.temporaryISOMountPointURL.path, "--nointeraction"] + arguments += ["--volume", volume, "--nointeraction"] if installer.sierraOrOlder { arguments += ["--applicationpath", installer.temporaryInstallerURL.path] diff --git a/Mist/Helpers/InstallerCreator.swift b/Mist/Helpers/InstallerCreator.swift index 0ed2225..bf7f721 100644 --- a/Mist/Helpers/InstallerCreator.swift +++ b/Mist/Helpers/InstallerCreator.swift @@ -75,6 +75,13 @@ enum InstallerCreator { _ = try Shell.execute(arguments, environment: variables) } + if installer.highSierraOrNewer, !installer.bigSurOrNewer { + arguments = ["ditto", "/Applications/Install \(installer.name).app", "\(installer.temporaryDiskImageMountPointURL.path)/Applications/Install \(installer.name).app"] + _ = try Shell.execute(arguments) + arguments = ["rm", "-r", "/Applications/Install \(installer.name).app"] + _ = try Shell.execute(arguments) + } + if installer.catalinaOrNewer { arguments = ["ditto", "\(installer.temporaryDiskImageMountPointURL.path)Applications", "\(installer.temporaryDiskImageMountPointURL.path)/Applications"] _ = try Shell.execute(arguments) diff --git a/Mist/Model/Installer.swift b/Mist/Model/Installer.swift index 66e0077..e8f7b5d 100644 --- a/Mist/Model/Installer.swift +++ b/Mist/Model/Installer.swift @@ -614,6 +614,10 @@ struct Installer: Decodable { version.range(of: "^10\\.([7-9]|1[0-2])\\.", options: .regularExpression) != nil } + var highSierraOrNewer: Bool { + bigSurOrNewer || version.range(of: "^10\\.1[3-5]\\.", options: .regularExpression) != nil + } + var catalinaOrNewer: Bool { bigSurOrNewer || version.range(of: "^10\\.15\\.", options: .regularExpression) != nil }