Bug fixes for Clover.app

Fixed SMBIOS->Version and SMBIOS->SerialNumber generating config.plist.
Fix mount in Sierra and older by sending mount operation in a background thread and updating the UI on the main one.
This commit is contained in:
vectorsigma72 2020-04-30 15:55:31 +02:00
parent 0c88de9390
commit 6017607113
5 changed files with 81 additions and 51 deletions

View File

@ -783,8 +783,8 @@ final class CloverConfig: NSObject {
// SMBIOS TYPE1
SMBIOS["Manufacturer"] = s.value(for: "ManufactureName", type: .CHAR8String)
SMBIOS["ProductName"] = s.value(for: "ProductName", type: .CHAR8String)
SMBIOS["Version"] = s.value(for: "SerialNr", type: .CHAR8String)
SMBIOS["SerialNumber"] = s.value(for: "ReleaseDate", type: .CHAR8String)
SMBIOS["Version"] = s.value(for: "VersionNr", type: .CHAR8String)
SMBIOS["SerialNumber"] = s.value(for: "SerialNr", type: .CHAR8String)
SMBIOS["SmUUID"] = s.value(for: "SmUUID", type: .UUIDString)
SMBIOS["Family"] = s.value(for: "FamilyName", type: .CHAR8String)
// SMBIOS TYPE2

View File

@ -554,13 +554,13 @@ final class InstallerViewController: NSViewController {
self.altBootCheck.state = .off
if let disk = sender?.selectedItem?.representedObject as? String {
if !isMountPoint(path: disk) {
//DispatchQueue.global(qos: .background).async {
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
let cmd = "diskutil mount \(disk)"
let msg = String(format: "Clover wants to mount %@", disk)
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
let task = Process()
if #available(OSX 10.12, *) {
task.launchPath = "/usr/bin/osascript"
task.arguments = ["-e", script]
@ -572,24 +572,31 @@ final class InstallerViewController: NSViewController {
task.terminationHandler = { t in
if t.terminationStatus == 0 {
if isMountPoint(path: disk) {
self.targetVol = getMountPoint(from: disk) ?? ""
DispatchQueue.main.async {
self.targetVol = getMountPoint(from: disk) ?? ""
self.populateTargets()
self.setPreferences(for: self.targetVol)
}
}
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
DispatchQueue.main.async {
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
}
} else {
NSSound.beep()
DispatchQueue.main.async {
if #available(OSX 10.11, *) {
self.driversCollection.reloadData()
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
}
}
}
}
task.launch()
//}
})
} else {
self.targetVol = getMountPoint(from: disk) ?? ""
self.populateTargets()

View File

@ -499,13 +499,13 @@ final class InstallerOutViewController: NSViewController {
self.altBootCheck.state = .off
if let disk = sender?.selectedItem?.representedObject as? String {
if !isMountPoint(path: disk) {
//DispatchQueue.global(qos: .background).async {
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
let cmd = "diskutil mount \(disk)"
let msg = String(format: "Clover wants to mount %@", disk)
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
let task = Process()
if #available(OSX 10.12, *) {
task.launchPath = "/usr/bin/osascript"
task.arguments = ["-e", script]
@ -517,23 +517,30 @@ final class InstallerOutViewController: NSViewController {
task.terminationHandler = { t in
if t.terminationStatus == 0 {
if isMountPoint(path: disk) {
self.targetVol = getMountPoint(from: disk) ?? ""
DispatchQueue.main.async {
self.targetVol = getMountPoint(from: disk) ?? ""
self.populateTargets()
self.setPreferences(for: self.targetVol)
}
}
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
DispatchQueue.main.async {
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
}
} else {
NSSound.beep()
DispatchQueue.main.async {
self.driversOutline.reloadData()
self.expandAllSections()
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
}
}
}
task.launch()
//}
})
} else {
self.targetVol = getMountPoint(from: disk) ?? ""
self.populateTargets()

View File

@ -630,20 +630,15 @@ final class SettingsViewController:
// MARK: Controls actions
@IBAction func openThemeManager(_ sender: NSButton!) {
DispatchQueue.main.async {
if #available(OSX 10.11, *) {
if (AppSD.themeManagerWC == nil) {
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
}
AppSD.themeManagerWC?.showWindow(self)
} else {
if (AppSD.themeManagerWC == nil) {
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
}
AppSD.themeManagerWC?.showWindow(self)
if (AppSD.themeManagerWC == nil) {
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
}
AppSD.themeManagerWC?.showWindow(self)
AppSD.themeManagerWC?.window?.level = .floating
AppSD.themeManagerWC?.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
AppSD.themeManagerWC?.window?.level = .normal
}
}
@ -860,14 +855,21 @@ final class SettingsViewController:
}
AppSD.installerWC?.showWindow(self)
AppSD.installerWC?.window?.level = .floating
AppSD.installerWC?.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
AppSD.installerWC?.window?.level = .normal
} else {
if (AppSD.installerOutWC == nil) {
AppSD.installerOutWC = InstallerOutWindowController.loadFromNib()
}
AppSD.installerOutWC?.showWindow(self)
AppSD.installerOutWC?.window?.level = .floating
AppSD.installerOutWC?.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
AppSD.installerOutWC?.window?.level = .normal
}
//NSApp.activate(ignoringOtherApps: true)
}
}

View File

@ -759,37 +759,51 @@ NSComboBoxDataSource {
@IBAction func targetPopPressed(_ sender: FWPopUpButton!) {
if let disk = sender?.selectedItem?.representedObject as? String {
if !isMountPoint(path: disk) {
//DispatchQueue.global(qos: .background).async {
let cmd = "diskutil mount \(disk)"
let msg = String(format: "Clover wants to mount %@", disk)
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
let task = Process()
if #available(OSX 10.12, *) {
task.launchPath = "/usr/bin/osascript"
task.arguments = ["-e", script]
} else {
task.launchPath = "/usr/sbin/diskutil"
task.arguments = ["mount", disk]
}
task.terminationHandler = { t in
if t.terminationStatus == 0 {
if isMountPoint(path: disk) {
self.targetVolume = getMountPoint(from: disk)
self.installButton.isEnabled = false
self.view.window?.level = .floating
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
let cmd = "diskutil mount \(disk)"
let msg = String(format: "Clover wants to mount %@", disk)
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
let task = Process()
if #available(OSX 10.12, *) {
task.launchPath = "/usr/bin/osascript"
task.arguments = ["-e", script]
} else {
task.launchPath = "/usr/sbin/diskutil"
task.arguments = ["mount", disk]
}
task.terminationHandler = { t in
if t.terminationStatus == 0 {
if isMountPoint(path: disk) {
DispatchQueue.main.async {
self.targetVolume = getMountPoint(from: disk)
self.populateTargets()
self.showInstalledThemes(self.installedThemesCheckBox)
}
}
DispatchQueue.main.async {
self.populateTargets()
self.installButton.isEnabled = true
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
}
} else {
DispatchQueue.main.async {
NSSound.beep()
self.installButton.isEnabled = true
self.view.window?.makeKeyAndOrderFront(nil)
self.view.window?.level = .floating
self.view.window?.level = .normal
self.showInstalledThemes(self.installedThemesCheckBox)
}
}
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
} else {
NSSound.beep()
self.showInstalledThemes(self.installedThemesCheckBox)
}
}
task.launch()
task.launch()
})
//}
} else {
self.targetVolume = getMountPoint(from: disk)