mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-11 00:11:27 +01:00
Clover.app v1.02 Beta
Clver.app: Corrected a bug that was causing the installer to fail on unknown drivers. CloverDaemonNew : Now is registered with the Power notifications (sleep and wake), so that can clean up nvram.plist files created by third partu kexts. At shut down it now delete the following nvram keys: efi-backup-boot-device efi-backup-boot-device-data install-product-url previous-system-uuid Clover.app promoted to Beta.
This commit is contained in:
parent
59c4a084eb
commit
b06c4d4d41
11
.gitignore
vendored
11
.gitignore
vendored
@ -115,8 +115,9 @@ CloverUpdater.strings
|
||||
CloverPrefpane.strings
|
||||
#CloverPackage/CloverPrefpane/src/*.lproj
|
||||
|
||||
BaseTools/Source/Python/build/BuildReport.pyc
|
||||
Conf/BuildEnv.sh
|
||||
Conf/.AutoGenIdFile.txt
|
||||
CloverPackage/revision
|
||||
CloverPackage/version
|
||||
BaseTools/Source/Python/build/BuildReport.pyc
|
||||
Conf/BuildEnv.sh
|
||||
Conf/.AutoGenIdFile.txt
|
||||
CloverPackage/revision
|
||||
CloverPackage/version
|
||||
tools
|
||||
|
@ -283,13 +283,13 @@
|
||||
95E68ABD235B862F002B37A5 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9542ABC12373786700DC03E6 /* CloverV2 */,
|
||||
95E68AC8235B862F002B37A5 /* Clover */,
|
||||
9542ABB82373780C00DC03E6 /* boot1-inst.xcodeproj */,
|
||||
958505B4236594C000BCB4A3 /* Cloverhelper.xcodeproj */,
|
||||
95C51577236B21AE00E4A3A8 /* CloverRunAtLogin.xcodeproj */,
|
||||
9552D740236F33A700C93377 /* CloverDaemonNew.xcodeproj */,
|
||||
95C5C0A22365D2250049940D /* Lang.bundle */,
|
||||
9542ABC12373786700DC03E6 /* CloverV2 */,
|
||||
95E68AC7235B862F002B37A5 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
|
@ -35,8 +35,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
|
||||
}
|
||||
|
||||
func applicationWillFinishLaunching(_ notification: Notification) {
|
||||
|
||||
|
||||
/*
|
||||
do not activate the following code: is for debug only
|
||||
.. it delete stored preferences in the User Default dictionary
|
||||
|
@ -709,6 +709,20 @@
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bin-KD-gd6">
|
||||
<rect key="frame" x="189" y="136" width="102" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Main Clover.app" id="wA3-rG-VSC">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="bin-KD-gd6" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="118" id="Gq7-iF-XhI"/>
|
||||
<constraint firstItem="bin-KD-gd6" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="QvJ-BT-zsH"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
|
@ -141,8 +141,8 @@ func getDiskUUID(from diskOrMtp: String) -> String? {
|
||||
}
|
||||
|
||||
/// Get Media Name (kDADiskDescriptionMediaNameKey).
|
||||
func getMediaName(from diskOrMtp: String) -> String {
|
||||
var name : String = kNotAvailable
|
||||
func getMediaName(from diskOrMtp: String) -> String? {
|
||||
var name : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaNameKey) != nil) {
|
||||
name = (dict.object(forKey: kDADiskDescriptionMediaNameKey) as? String)!
|
||||
@ -151,7 +151,6 @@ func getMediaName(from diskOrMtp: String) -> String {
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
/// Get Media Name (kDADiskDescriptionDeviceProtocolKey).
|
||||
func getDeviceProtocol(from diskOrMtp: String) -> String {
|
||||
var prot : String = kNotAvailable
|
||||
@ -258,6 +257,19 @@ func getListOfMountedEsp() -> [String] {
|
||||
return mounted
|
||||
}
|
||||
|
||||
/// get and array of currently mounted volumes
|
||||
func getVolumes() -> [String] {
|
||||
var mounted : [String] = [String]()
|
||||
let all = getAlldisks().allKeys
|
||||
for b in all {
|
||||
let bsd : String = b as! String
|
||||
if let mp = getMountPoint(from: bsd) {
|
||||
mounted.append(mp)
|
||||
}
|
||||
}
|
||||
return mounted
|
||||
}
|
||||
|
||||
/// Find the BSDName of the given mount point.
|
||||
func getBSDName(of mountpoint: String) -> String? {
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: mountpoint) {
|
||||
|
@ -36,9 +36,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.01</string>
|
||||
<string>1.02</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.01</string>
|
||||
<string>1.02</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
@ -90,6 +90,9 @@ class ItemTextField: NSTextField {
|
||||
}
|
||||
|
||||
private func showDescription() {
|
||||
if AppSD.isInstalling {
|
||||
return
|
||||
}
|
||||
if let info = self.cell?.representedObject as? String {
|
||||
if let ivc = self.target as? InstallerViewController {
|
||||
ivc.post(text: info, add: false, color: nil, scroll: false)
|
||||
@ -966,10 +969,12 @@ class InstallerViewController: NSViewController {
|
||||
if driver.state == .off {
|
||||
toDelete.add(fullDest as NSString)
|
||||
} else if driver.state == .on {
|
||||
if driver.kind == .uefi {
|
||||
UEFI.add(driver.src as NSString)
|
||||
} else {
|
||||
BIOS.add(driver.src as NSString)
|
||||
if driver.isFromClover {
|
||||
if driver.kind == .uefi {
|
||||
UEFI.add(driver.src as NSString)
|
||||
} else {
|
||||
BIOS.add(driver.src as NSString)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import Cocoa
|
||||
let nvram_cmd = "/usr/sbin/nvram"
|
||||
|
||||
// MARK: Get NVRAM
|
||||
func getNVRAM() -> NSDictionary? {
|
||||
func getNVRAM() -> NSMutableDictionary? {
|
||||
var ref: io_registry_entry_t
|
||||
var masterPort = mach_port_t()
|
||||
var oResult: kern_return_t
|
||||
@ -38,6 +38,7 @@ func getNVRAM() -> NSDictionary? {
|
||||
}
|
||||
|
||||
// MARK: set NVRAM key
|
||||
@available(OSX 10.10, *)
|
||||
func setNVRAM(key: String, stringValue: String) {
|
||||
var cmd : String = "do shell script \""
|
||||
cmd += "sudo \(nvram_cmd) \(key)=\(stringValue)" // sudo required otherwise wont work!
|
||||
@ -54,6 +55,7 @@ func setNVRAM(key: String, stringValue: String) {
|
||||
}
|
||||
|
||||
// MARK: delete NVRAM key
|
||||
@available(OSX 10.10, *)
|
||||
func deleteNVRAM(key: String) {
|
||||
var cmd : String = "do shell script \""
|
||||
cmd += "sudo \(nvram_cmd) -d \(key)" // sudo required otherwise wont work!
|
||||
|
@ -46,7 +46,7 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
|
||||
// MARK: View customization
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String + " (Alpha)"
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String + " Beta"
|
||||
self.appVersionField.stringValue = "v\(appVersion)"
|
||||
localize(view: self.view)
|
||||
self.view.wantsLayer = true
|
||||
|
@ -10,8 +10,9 @@
|
||||
953B8DEE2370BB1A007E36E3 /* bdmesg.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953B8DED2370BB1A007E36E3 /* bdmesg.swift */; };
|
||||
953B8DF02370BB5D007E36E3 /* NVRAM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953B8DEF2370BB5C007E36E3 /* NVRAM.swift */; };
|
||||
953B8DF22370BF5B007E36E3 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953B8DF12370BF5A007E36E3 /* Extensions.swift */; };
|
||||
953D98872377094A003B369E /* Disks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953D98862377094A003B369E /* Disks.swift */; };
|
||||
953DBFDF236F037400B0C4FB /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953DBFDE236F037400B0C4FB /* main.swift */; };
|
||||
954277B9237118B6007857FF /* Disks_session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954277B8237118B5007857FF /* Disks_session.swift */; };
|
||||
9546F0EB2376F94100A3D053 /* PowerObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 9546F0EA2376F94100A3D053 /* PowerObserver.m */; };
|
||||
954FF20E2371B13C00C3D94C /* DiskArbitration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 954FF20D2371B13C00C3D94C /* DiskArbitration.framework */; };
|
||||
954FF2102371B16300C3D94C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 954FF20F2371B16300C3D94C /* IOKit.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -32,9 +33,12 @@
|
||||
953B8DED2370BB1A007E36E3 /* bdmesg.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = bdmesg.swift; path = ../../Clover/bdmesg.swift; sourceTree = "<group>"; };
|
||||
953B8DEF2370BB5C007E36E3 /* NVRAM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NVRAM.swift; path = ../../Clover/NVRAM.swift; sourceTree = "<group>"; };
|
||||
953B8DF12370BF5A007E36E3 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = ../../Clover/Extensions.swift; sourceTree = "<group>"; };
|
||||
953D98862377094A003B369E /* Disks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Disks.swift; path = ../../Clover/Disks.swift; sourceTree = "<group>"; };
|
||||
953DBFDB236F037400B0C4FB /* CloverDaemonNew */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CloverDaemonNew; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
953DBFDE236F037400B0C4FB /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
954277B8237118B5007857FF /* Disks_session.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Disks_session.swift; sourceTree = "<group>"; };
|
||||
9546F0E82376F94100A3D053 /* CloverDaemonNew-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CloverDaemonNew-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
9546F0E92376F94100A3D053 /* PowerObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PowerObserver.h; sourceTree = "<group>"; };
|
||||
9546F0EA2376F94100A3D053 /* PowerObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PowerObserver.m; sourceTree = "<group>"; };
|
||||
954FF20D2371B13C00C3D94C /* DiskArbitration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiskArbitration.framework; path = System/Library/Frameworks/DiskArbitration.framework; sourceTree = SDKROOT; };
|
||||
954FF20F2371B16300C3D94C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
@ -73,10 +77,13 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
953DBFDE236F037400B0C4FB /* main.swift */,
|
||||
954277B8237118B5007857FF /* Disks_session.swift */,
|
||||
953D98862377094A003B369E /* Disks.swift */,
|
||||
953B8DEF2370BB5C007E36E3 /* NVRAM.swift */,
|
||||
953B8DED2370BB1A007E36E3 /* bdmesg.swift */,
|
||||
953B8DF12370BF5A007E36E3 /* Extensions.swift */,
|
||||
9546F0E92376F94100A3D053 /* PowerObserver.h */,
|
||||
9546F0EA2376F94100A3D053 /* PowerObserver.m */,
|
||||
9546F0E82376F94100A3D053 /* CloverDaemonNew-Bridging-Header.h */,
|
||||
);
|
||||
path = CloverDaemonNew;
|
||||
sourceTree = "<group>";
|
||||
@ -122,6 +129,7 @@
|
||||
TargetAttributes = {
|
||||
953DBFDA236F037400B0C4FB = {
|
||||
CreatedOnToolsVersion = 11.2;
|
||||
LastSwiftMigration = 1120;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -149,10 +157,11 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
953B8DF22370BF5B007E36E3 /* Extensions.swift in Sources */,
|
||||
9546F0EB2376F94100A3D053 /* PowerObserver.m in Sources */,
|
||||
953D98872377094A003B369E /* Disks.swift in Sources */,
|
||||
953DBFDF236F037400B0C4FB /* main.swift in Sources */,
|
||||
953B8DF02370BB5D007E36E3 /* NVRAM.swift in Sources */,
|
||||
953B8DEE2370BB1A007E36E3 /* bdmesg.swift in Sources */,
|
||||
954277B9237118B6007857FF /* Disks_session.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -275,9 +284,17 @@
|
||||
953DBFE3236F037400B0C4FB /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "CloverDaemonNew/CloverDaemonNew-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
@ -285,9 +302,16 @@
|
||||
953DBFE4236F037400B0C4FB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "CloverDaemonNew/CloverDaemonNew-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -0,0 +1,5 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#import "PowerObserver.h"
|
@ -1,548 +0,0 @@
|
||||
//
|
||||
// Disks.swift
|
||||
// Clover
|
||||
//
|
||||
// Created by vector sigma on 19/10/2019.
|
||||
// Copyright © 2019 CloverHackyColor. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import IOKit
|
||||
import IOKit.serial
|
||||
import IOKit.kext
|
||||
import CoreFoundation
|
||||
import DiskArbitration
|
||||
import SystemConfiguration
|
||||
|
||||
let kNotAvailable : String = "N/A"
|
||||
|
||||
func getSession() -> DASession? {
|
||||
if (gSession != nil) {
|
||||
return gSession
|
||||
}
|
||||
return DASessionCreate(kCFAllocatorDefault)!
|
||||
}
|
||||
|
||||
/// Get DADisk dictionary from DiskArbitration from the given disk name or mount point.
|
||||
func getDAdiskDescription(from diskOrMtp: String) -> NSDictionary? {
|
||||
var dict : NSDictionary? = nil
|
||||
let allocator = kCFAllocatorDefault
|
||||
let newsession = DASessionCreate(allocator)
|
||||
if let session = ((newsession == nil) ? gSession1 : newsession) {
|
||||
if diskOrMtp.hasPrefix("/") &&
|
||||
!diskOrMtp.hasPrefix("/dev/disk") &&
|
||||
FileManager.default.fileExists(atPath: diskOrMtp) {
|
||||
let volume : CFURL = URL(fileURLWithPath: diskOrMtp) as CFURL
|
||||
if let disk = DADiskCreateFromVolumePath(allocator, session, volume) {
|
||||
dict = DADiskCopyDescription(disk)
|
||||
}
|
||||
} else if diskOrMtp.hasPrefix("/dev/disk") ||
|
||||
diskOrMtp.hasPrefix("disk") {
|
||||
var ndisk = diskOrMtp
|
||||
if ndisk.hasPrefix("/dev/disk") {
|
||||
ndisk = (ndisk as NSString).replacingOccurrences(of: "/dev/", with: "")
|
||||
}
|
||||
if let disk = DADiskCreateFromBSDName(allocator, session, ndisk) {
|
||||
dict = DADiskCopyDescription(disk)
|
||||
}
|
||||
}
|
||||
}
|
||||
return dict
|
||||
}
|
||||
|
||||
/// Check disk or mount point is writable (kDADiskDescriptionMediaWritableKey).
|
||||
func isWritable(diskOrMtp: String) -> Bool {
|
||||
var isWritable : Bool = false
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if let val = dict.object(forKey: kDADiskDescriptionMediaWritableKey) as? NSNumber {
|
||||
isWritable = val.boolValue
|
||||
}
|
||||
}
|
||||
|
||||
return isWritable
|
||||
}
|
||||
|
||||
/// Get the media content name (kDADiskDescriptionMediaContentKey).
|
||||
func getMediaContent(from diskOrMtp: String) -> String? {
|
||||
var content : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaContentKey) != nil) {
|
||||
content = dict.object(forKey: kDADiskDescriptionMediaContentKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
/// get the Partition Scheme Map from the parent disk (kDADiskDescriptionMediaContentKey).
|
||||
func getPartitionSchemeMap(from diskOrMtp: String) -> String? {
|
||||
var sheme : String? = nil
|
||||
if let dadisk = getBSDParent(of: diskOrMtp) {
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: dadisk) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaContentKey) != nil) {
|
||||
sheme = dict.object(forKey: kDADiskDescriptionMediaContentKey) as? String
|
||||
}
|
||||
}
|
||||
}
|
||||
return sheme
|
||||
}
|
||||
|
||||
/// Find the mountpoint for the given disk object. You can pass also a mount point to se if it is valid.
|
||||
func getMountPoint(from diskOrMtp: String) -> String? {
|
||||
// kDADiskDescriptionVolumePathKey
|
||||
var mountPoint : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionVolumePathKey) != nil) {
|
||||
let temp : AnyObject = dict.object(forKey: kDADiskDescriptionVolumePathKey) as AnyObject
|
||||
if temp is NSURL {
|
||||
mountPoint = (dict.object(forKey: kDADiskDescriptionVolumePathKey) as? URL)?.path
|
||||
} else if temp is NSString {
|
||||
mountPoint = dict.object(forKey: kDADiskDescriptionVolumePathKey) as? String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mountPoint
|
||||
}
|
||||
|
||||
/// get and array of currently mounted volumes
|
||||
func getVolumes() -> [String] {
|
||||
var mounted : [String] = [String]()
|
||||
let all = getAlldisks().allKeys
|
||||
for b in all {
|
||||
let bsd : String = b as! String
|
||||
if let mp = getMountPoint(from: bsd) {
|
||||
mounted.append(mp)
|
||||
}
|
||||
}
|
||||
return mounted
|
||||
}
|
||||
|
||||
/// Find the Volume name: be aware that this is not the mount point name.
|
||||
func getVolumeName(from diskOrMtp: String) -> String? {
|
||||
// kDADiskDescriptionVolumeNameKey
|
||||
var name : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionVolumeNameKey) != nil) {
|
||||
name = dict.object(forKey: kDADiskDescriptionVolumeNameKey) as? String
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
/// Get partition UUID for the given volume: This is not a disk UUID.
|
||||
func getVolumeUUID(from diskOrMtp: String) -> String? {
|
||||
// kDADiskDescriptionVolumeUUIDKey
|
||||
var uuid : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionVolumeUUIDKey) != nil) {
|
||||
|
||||
let cfuuid :CFUUID = dict.object(forKey: kDADiskDescriptionVolumeUUIDKey) as! CFUUID
|
||||
uuid = CFUUIDCreateString(kCFAllocatorDefault, cfuuid)! as String
|
||||
//print(uuid!)
|
||||
}
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
/// Get disk uuid for the given diskx. This is not a Volume UUID but a media UUID.
|
||||
func getDiskUUID(from diskOrMtp: String) -> String? {
|
||||
// kDADiskDescriptionVolumeUUIDKey
|
||||
var uuid : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: getBSDParent(of: diskOrMtp)!) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaUUIDKey) != nil) {
|
||||
let temp : AnyObject = dict.object(forKey: kDADiskDescriptionMediaUUIDKey) as AnyObject
|
||||
if temp is NSUUID {
|
||||
uuid = (dict.object(forKey: kDADiskDescriptionMediaUUIDKey) as? UUID)?.uuidString
|
||||
} else if temp is NSString {
|
||||
uuid = dict.object(forKey: kDADiskDescriptionMediaUUIDKey) as? String
|
||||
}
|
||||
}
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
/// Get Media Name (kDADiskDescriptionMediaNameKey).
|
||||
func getMediaName(from diskOrMtp: String) -> String? {
|
||||
var name : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaNameKey) != nil) {
|
||||
name = (dict.object(forKey: kDADiskDescriptionMediaNameKey) as? String)!
|
||||
}
|
||||
}
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
/// Get Media Name (kDADiskDescriptionDeviceProtocolKey).
|
||||
func getDeviceProtocol(from diskOrMtp: String) -> String {
|
||||
var prot : String = kNotAvailable
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionDeviceProtocolKey) != nil) {
|
||||
prot = (dict.object(forKey: kDADiskDescriptionDeviceProtocolKey) as? String)!
|
||||
}
|
||||
}
|
||||
|
||||
return prot
|
||||
}
|
||||
|
||||
/// Get all BSDName in the System.
|
||||
func getAlldisks() -> NSDictionary {
|
||||
let match_dictionary: CFMutableDictionary = IOServiceMatching("IOMedia")
|
||||
var entry_iterator: io_iterator_t = 0
|
||||
let allDisks = NSMutableDictionary()
|
||||
if IOServiceGetMatchingServices(kIOMasterPortDefault, match_dictionary, &entry_iterator) == kIOReturnSuccess {
|
||||
//let serviceObject: io_registry_entry_t
|
||||
//var serviceObject : UnsafeMutablePointer<io_registry_entry_t>
|
||||
var serviceObject : io_registry_entry_t = 0
|
||||
|
||||
repeat {
|
||||
serviceObject = IOIteratorNext(entry_iterator)
|
||||
if serviceObject != 0 {
|
||||
var serviceDictionary : Unmanaged<CFMutableDictionary>?
|
||||
if (IORegistryEntryCreateCFProperties(serviceObject,
|
||||
&serviceDictionary,
|
||||
kCFAllocatorDefault,
|
||||
0) != kIOReturnSuccess) {
|
||||
IOObjectRelease(serviceObject)
|
||||
continue
|
||||
}
|
||||
|
||||
let d : NSDictionary = (serviceDictionary?.takeRetainedValue())!
|
||||
|
||||
if (d.object(forKey: kIOBSDNameKey) != nil) {
|
||||
allDisks.setValue(d, forKey: (d.object(forKey: kIOBSDNameKey) as! String))
|
||||
}
|
||||
}
|
||||
} while serviceObject != 0
|
||||
IOObjectRelease(entry_iterator)
|
||||
}
|
||||
|
||||
return allDisks
|
||||
}
|
||||
|
||||
/// Get FileSystem for the given disk or mount point.
|
||||
func getFS(from diskOrMtp: String) -> String? {
|
||||
var fs : String? = nil
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
var temp : String = ""
|
||||
if (dict.object(forKey: kDADiskDescriptionVolumeKindKey) != nil) {
|
||||
temp = dict.object(forKey: kDADiskDescriptionVolumeKindKey) as! String
|
||||
|
||||
// if msdos we would know if is fat32, exfat etc..
|
||||
if temp.lowercased() == "msdos" {
|
||||
// Since last few OSes (..on 10.13) the DAVolumeType
|
||||
// contains a string like ""MS-DOS (FAT32)" so that we can identify the real fs
|
||||
// w/o using statfs.
|
||||
if (dict.object(forKey: kDADiskDescriptionVolumeTypeKey) != nil) {
|
||||
let volType : String = dict.object(forKey: kDADiskDescriptionVolumeTypeKey) as! String
|
||||
|
||||
if (volType.lowercased().range(of: "exfat") != nil) {
|
||||
temp = "exFAT"
|
||||
} else if (volType.lowercased().range(of: "fat16") != nil) {
|
||||
temp = "FAT16"
|
||||
} else if (volType.lowercased().range(of: "fat32") != nil) {
|
||||
temp = "FAT32"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fs = temp
|
||||
}
|
||||
}
|
||||
return fs
|
||||
}
|
||||
|
||||
/// Get all ESP (EFI System Partition) in the System.
|
||||
func getAllESPs() -> [String] {
|
||||
var allEsps : [String] = [String]()
|
||||
for disk in getAlldisks().allKeys {
|
||||
let mediaContent = getMediaContent(from: disk as! String) ?? ""
|
||||
if getMediaName(from: disk as! String) == "EFI System Partition" &&
|
||||
mediaContent == "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"{
|
||||
if !allEsps.contains(disk as! String) {
|
||||
allEsps.append(disk as! String)
|
||||
}
|
||||
}
|
||||
}
|
||||
return allEsps
|
||||
}
|
||||
|
||||
/// Get a list of ESP that have a mount point.
|
||||
func getListOfMountedEsp() -> [String] {
|
||||
var mounted : [String] = [String]()
|
||||
for bsdName in getAllESPs() {
|
||||
if isMountPoint(path: bsdName) {
|
||||
mounted.append(bsdName)
|
||||
}
|
||||
}
|
||||
|
||||
return mounted
|
||||
}
|
||||
|
||||
/// Find the BSDName of the given mount point.
|
||||
func getBSDName(of mountpoint: String) -> String? {
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: mountpoint) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaBSDNameKey) != nil) {
|
||||
return dict.object(forKey: kDADiskDescriptionMediaBSDNameKey) as? String
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/// Find the BSDName of the given parent disk.
|
||||
func getBSDParent(of mountpointORDevDisk: String) -> String? {
|
||||
// DAMediaBSDUnit
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: mountpointORDevDisk) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaBSDUnitKey) != nil) {
|
||||
return "disk" + ((dict.object(forKey: kDADiskDescriptionMediaBSDUnitKey) as? NSNumber)?.stringValue)!
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/// Return the partition slice number (as string) for the given disk or mount point.
|
||||
func getPartitionSlice(of mountpointORDevDisk: String) -> String? {
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: mountpointORDevDisk) {
|
||||
if (dict.object(forKey: kDADiskDescriptionMediaBSDNameKey) != nil) {
|
||||
let disk = (dict.object(forKey: kDADiskDescriptionMediaBSDNameKey) as? String)!
|
||||
if (disk.range(of: "s") != nil) {
|
||||
let arr : [String] = disk.components(separatedBy: "s")
|
||||
if arr.count == 3 { /* dis k0s 1 */
|
||||
return arr.last
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/// Return the image (NSImage) for the given mount point or disk object.
|
||||
func getIconFor(volume mountpointORDevDisk: String) -> NSImage? {
|
||||
var image : NSImage? = nil
|
||||
// get a customized icon.. if any
|
||||
if isMountPoint(path: mountpointORDevDisk) {
|
||||
let mtp : String = getMountPoint(from: mountpointORDevDisk)!
|
||||
if FileManager.default.fileExists(atPath: mtp + "/.VolumeIcon.icns") {
|
||||
image = NSImage(byReferencingFile: mtp + "/.VolumeIcon.icns")
|
||||
return image
|
||||
}
|
||||
}
|
||||
// .. otherwise get a System icon
|
||||
if let daDict : NSDictionary = getDAdiskDescription(from: mountpointORDevDisk) {
|
||||
if let iconDict = daDict.object(forKey: kDADiskDescriptionMediaIconKey) as? NSDictionary,
|
||||
let iconName = iconDict.object(forKey: kIOBundleResourceFileKey ) as? String {
|
||||
let identifier = iconDict.object(forKey: kCFBundleIdentifierKey as String) as! CFString
|
||||
|
||||
let url : CFURL = Unmanaged.takeRetainedValue(KextManagerCreateURLForBundleIdentifier(kCFAllocatorDefault, identifier))()
|
||||
//print(url)
|
||||
if let kb = Bundle(url: url as URL) {
|
||||
image = NSImage(byReferencingFile:
|
||||
kb.path(forResource: iconName.deletingFileExtension, ofType: iconName.fileExtension) ?? "")
|
||||
}
|
||||
}
|
||||
}
|
||||
return image
|
||||
}
|
||||
|
||||
/// Boolean value indicanting if the given mount point or disk is internal.
|
||||
func isInternalDevice(diskOrMtp: String) -> Bool {
|
||||
if let dict : NSDictionary = getDAdiskDescription(from: diskOrMtp) {
|
||||
if (dict.object(forKey: kDADiskDescriptionDeviceInternalKey) != nil) {
|
||||
return ((dict.object(forKey: kDADiskDescriptionDeviceInternalKey) as? NSNumber)?.boolValue)!
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/// Boolean value indicanting if the given path is a valid mount point for a disk object.
|
||||
func isMountPoint(path: String) -> Bool {
|
||||
let mtp : String? = getMountPoint(from: path)
|
||||
return (mtp != nil)
|
||||
}
|
||||
|
||||
/// try to mount the given disk object. "path:" is the optional mount point otherwise one will be created.
|
||||
func mount(disk bsdName: String, at path: String?) {
|
||||
var disk : String = bsdName
|
||||
if disk.hasPrefix("disk") || disk.hasPrefix("/dev/disk") {
|
||||
if disk.hasPrefix("/dev/disk") {
|
||||
disk = disk.components(separatedBy: "dev/")[1]
|
||||
}
|
||||
|
||||
if disk.components(separatedBy: "s").count == 3 { /* di s k0 s 1 */
|
||||
let mountpoint : String? = getMountPoint(from: disk)
|
||||
if ((mountpoint != nil) && FileManager.default.fileExists(atPath: mountpoint!)) {
|
||||
// already mounted
|
||||
return
|
||||
}
|
||||
|
||||
let allocator = kCFAllocatorDefault
|
||||
let newsession = DASessionCreate(allocator)
|
||||
if let session = ((newsession == nil) ? gSession2 : newsession) {
|
||||
if let bsd = DADiskCreateFromBSDName(allocator, session, disk) {
|
||||
//let str = "nobrowse" as CFString
|
||||
//var unmgd : Unmanaged<CFString> = Unmanaged.passRetained(str)
|
||||
//var args = [/*"rdonly", "noowners", "nobrowse", "-j",*/ str]/*.map { Unmanaged.passRetained($0 as! CFString) }*/
|
||||
var url : CFURL? = nil
|
||||
if (path != nil) {
|
||||
url = CFURLCreateFromFileSystemRepresentation(allocator, path?.toPointer(), (path?.count)!, true)
|
||||
}
|
||||
|
||||
var context = UnsafeMutablePointer<Int>.allocate(capacity: 1)
|
||||
context.initialize(repeating: 0, count: 1)
|
||||
context.pointee = 0
|
||||
|
||||
DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
DADiskMountWithArguments(bsd, url, DADiskMountOptions(kDADiskMountOptionDefault), { (o, dis, ctx) in
|
||||
if (dis != nil) && (ctx != nil) {
|
||||
print("mount failure: " + printDAReturn(r: DADissenterGetStatus(dis!)))
|
||||
}
|
||||
}, &context, nil)
|
||||
DASessionUnscheduleFromRunLoop(session,
|
||||
CFRunLoopGetCurrent(),
|
||||
CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
context.deallocate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mount(disk bsdName: String, at path: String?, reply: @escaping (Bool) -> ()) {
|
||||
var disk : String = bsdName
|
||||
if disk.hasPrefix("disk") || disk.hasPrefix("/dev/disk") {
|
||||
if disk.hasPrefix("/dev/disk") {
|
||||
disk = disk.components(separatedBy: "dev/")[1]
|
||||
}
|
||||
|
||||
if disk.components(separatedBy: "s").count == 3 {
|
||||
let mountpoint : String? = getMountPoint(from: disk)
|
||||
if ((mountpoint != nil) && FileManager.default.fileExists(atPath: mountpoint!)) {
|
||||
// already mounted
|
||||
reply(true)
|
||||
return
|
||||
}
|
||||
|
||||
let allocator = kCFAllocatorDefault
|
||||
let newsession = DASessionCreate(allocator)
|
||||
if let session = ((newsession == nil) ? gSession3 : newsession) {
|
||||
if let bsd = DADiskCreateFromBSDName(allocator, session, disk) {
|
||||
var url : CFURL? = nil
|
||||
if (path != nil) {
|
||||
url = CFURLCreateFromFileSystemRepresentation(allocator, path?.toPointer(), (path?.count)!, true)
|
||||
}
|
||||
var context = UnsafeMutablePointer<Int>.allocate(capacity: 1)
|
||||
context.initialize(repeating: 0, count: 1)
|
||||
context.pointee = 0
|
||||
DASessionScheduleWithRunLoop(session,
|
||||
CFRunLoopGetCurrent(),
|
||||
CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
DADiskMountWithArguments(bsd, url, DADiskMountOptions(kDADiskMountOptionDefault), { (o, dis, ctx) in
|
||||
if (dis != nil) && (ctx != nil) {
|
||||
print("mount failure: " + printDAReturn(r: DADissenterGetStatus(dis!)))
|
||||
}
|
||||
}, &context, nil)
|
||||
|
||||
DASessionUnscheduleFromRunLoop(session,
|
||||
CFRunLoopGetCurrent(),
|
||||
CFRunLoopMode.defaultMode.rawValue)
|
||||
let result : Bool = (context.pointee == 0)
|
||||
context.deallocate()
|
||||
reply(result)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
reply(false)
|
||||
}
|
||||
|
||||
/// umount the given disk object or mount point. "force" option is to force the umount even if busy by some else process.
|
||||
func umount(disk diskOrMtp: String, force: Bool, reply: @escaping (Bool) -> ()) {
|
||||
let disk : String = diskOrMtp
|
||||
let mtp : String? = getMountPoint(from: diskOrMtp)
|
||||
if (mtp == nil) || (mtp == "/private/var/vm" || mtp == "/") {
|
||||
reply(false)
|
||||
return
|
||||
}
|
||||
|
||||
if disk.hasPrefix("disk") {
|
||||
var isLeaf : Bool = false
|
||||
let dict : NSDictionary? = getAlldisks().object(forKey: disk) as? NSDictionary
|
||||
isLeaf = (dict?.object(forKey: "Leaf") != nil) && (dict?.object(forKey: "Leaf") as! NSNumber).boolValue
|
||||
|
||||
if disk.components(separatedBy: "s").count == 3 && isLeaf { /* di s k0 s 1 */
|
||||
let mountpoint : String? = getMountPoint(from: disk)
|
||||
if (mountpoint == nil) {
|
||||
reply(true)
|
||||
return
|
||||
}
|
||||
|
||||
let allocator = kCFAllocatorDefault
|
||||
let newsession = DASessionCreate(allocator)
|
||||
if let session = ((newsession == nil) ? gSession4 : newsession) {
|
||||
if let bsd = DADiskCreateFromBSDName(allocator, session, disk) {
|
||||
var context = UnsafeMutablePointer<Int>.allocate(capacity: 1)
|
||||
context.initialize(repeating: 0, count: 1)
|
||||
context.pointee = 0
|
||||
DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
DADiskUnmount(bsd, DADiskUnmountOptions(force ? kDADiskUnmountOptionForce : kDADiskUnmountOptionDefault), { (dadisk, dissenter, ctx) in
|
||||
if (dissenter != nil) && (ctx != nil) {
|
||||
print("un mount failure: " + printDAReturn(r: DADissenterGetStatus(dissenter!)))
|
||||
}
|
||||
}, &context)
|
||||
|
||||
// CFRunLoopRun() // we already have a run loop
|
||||
DASessionUnscheduleFromRunLoop(session, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
let result : Bool = (context.pointee == 0)
|
||||
context.deallocate()
|
||||
reply(result)
|
||||
|
||||
} else {
|
||||
print("mount: DADiskCreateFromBSDName() is null")
|
||||
}
|
||||
} else {
|
||||
print("mount: session is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
reply(false)
|
||||
}
|
||||
|
||||
func printDAReturn(r: DAReturn) -> String {
|
||||
switch Int(r) {
|
||||
case kDAReturnError:
|
||||
return "Error"
|
||||
case kDAReturnBusy:
|
||||
return "Busy"
|
||||
case kDAReturnBadArgument:
|
||||
return "Bad Argument"
|
||||
case kDAReturnExclusiveAccess:
|
||||
return "Exclusive Access"
|
||||
case kDAReturnNoResources:
|
||||
return "No Resources"
|
||||
case kDAReturnNotFound:
|
||||
return "Not Found"
|
||||
case kDAReturnNotMounted:
|
||||
return "Not Mounted"
|
||||
case kDAReturnNotPermitted:
|
||||
return "Not Permitted"
|
||||
case kDAReturnNotPrivileged:
|
||||
return "Not Privileged"
|
||||
case kDAReturnNotReady:
|
||||
return "Not Ready"
|
||||
case kDAReturnNotWritable:
|
||||
return "Not Writable"
|
||||
case kDAReturnUnsupported:
|
||||
return "Unsupported"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
24
CloverApp/CloverDaemonNew/CloverDaemonNew/PowerObserver.h
Normal file
24
CloverApp/CloverDaemonNew/CloverDaemonNew/PowerObserver.h
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// PowerObserver.h
|
||||
// CloverDaemonNew
|
||||
//
|
||||
// Created by vector sigma on 09/11/2019.
|
||||
// Copyright © 2019 CloverHackyColor. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <IOKit/pwr_mgt/IOPMLib.h>
|
||||
#import <IOKit/IOMessage.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PowerObserver : NSObject {
|
||||
io_connect_t root_port;
|
||||
io_object_t notifier;
|
||||
}
|
||||
- (void)registerPowerNotifications;
|
||||
- (void)powerDidReceiveMessage:(natural_t)type argument:(void *)argument;
|
||||
|
||||
- (void)removeNVRAMPlist;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
74
CloverApp/CloverDaemonNew/CloverDaemonNew/PowerObserver.m
Normal file
74
CloverApp/CloverDaemonNew/CloverDaemonNew/PowerObserver.m
Normal file
@ -0,0 +1,74 @@
|
||||
//
|
||||
// PowerObserver.m
|
||||
// CloverDaemonNew
|
||||
//
|
||||
// Created by vector sigma on 09/11/2019.
|
||||
// Copyright © 2019 CloverHackyColor. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PowerObserver.h"
|
||||
|
||||
void powerCallback(void *refCon, io_service_t service, natural_t type, void *argument)
|
||||
{
|
||||
[(PowerObserver *)CFBridgingRelease(refCon)powerDidReceiveMessage: type argument: argument];
|
||||
}
|
||||
|
||||
|
||||
@implementation PowerObserver
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self registerPowerNotifications];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)registerPowerNotifications {
|
||||
printf("Registering for Power notifications..\n");
|
||||
IONotificationPortRef notificationPort;
|
||||
root_port = IORegisterForSystemPower((void *)CFBridgingRetain(self),
|
||||
¬ificationPort,
|
||||
powerCallback,
|
||||
¬ifier);
|
||||
if (root_port) {
|
||||
CFRunLoopAddSource(CFRunLoopGetCurrent(),
|
||||
IONotificationPortGetRunLoopSource(notificationPort),
|
||||
kCFRunLoopDefaultMode);
|
||||
} else {
|
||||
printf("Can't register for Power notification.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)powerDidReceiveMessage:(natural_t)type argument:(void *)argument {
|
||||
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
|
||||
[formatter setDateFormat:@"yyyy-MMM-dd HH:mm:ss"];
|
||||
NSString *date = [formatter stringFromDate:[NSDate new]];
|
||||
|
||||
switch (type) {
|
||||
case kIOMessageSystemWillSleep:{
|
||||
printf("System Sleep called at %s\n", [date UTF8String]);
|
||||
break;
|
||||
}
|
||||
case kIOMessageSystemHasPoweredOn:{
|
||||
printf("System awaken at %s\n", [date UTF8String]);
|
||||
// who will come first? ..I don't know so do that after 3 seconds
|
||||
[self performSelector:@selector(removeNVRAMPlist) withObject:nil afterDelay:3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeNVRAMPlist {
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:@"/nvram.plist"]) {
|
||||
printf("Found /nvram.plist after waking from sleep, removing it:\n");
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:@"/nvram.plist" error:&error];
|
||||
if (error == nil) {
|
||||
printf("/nvram.plist correctly removed.\n");
|
||||
} else {
|
||||
printf("%s\n", [[error localizedFailureReason] UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@end
|
@ -10,24 +10,18 @@ import Foundation
|
||||
import CoreFoundation
|
||||
|
||||
let fm = FileManager.default
|
||||
//let runLoop = CFRunLoopGetCurrent()
|
||||
|
||||
/*
|
||||
Store a session reference to contact Disk Arbitration,
|
||||
..it will be usefull during the shut down.
|
||||
this is weird, but make some chances for the last stand (SIGTERM)
|
||||
*/
|
||||
let gSession = DASessionCreate(kCFAllocatorDefault)
|
||||
let gSession1 = DASessionCreate(kCFAllocatorDefault)
|
||||
let gSession2 = DASessionCreate(kCFAllocatorDefault)
|
||||
let gSession3 = DASessionCreate(kCFAllocatorDefault)
|
||||
let gSession4 = DASessionCreate(kCFAllocatorDefault)
|
||||
let gSession5 = DASessionCreate(kCFAllocatorDefault)
|
||||
|
||||
var BootDeviceUUID : String? = nil
|
||||
var BootDeviceFS : String? = nil
|
||||
var BootDevice : String? = nil
|
||||
|
||||
|
||||
func execAttr() -> [FileAttributeKey : Any] {
|
||||
var attributes = [FileAttributeKey : Any]()
|
||||
attributes[.posixPermissions] = NSNumber(value: 755) //NSNumber object. Use the int16Value method to retrieve the integer value for the permissions.
|
||||
@ -77,20 +71,7 @@ func doJob() {
|
||||
nvram.object(forKey: "TestEmuVariableUefiPresent") != nil) {
|
||||
// mount -t "$filesystem" "$bootdev" "$mnt_pt"
|
||||
if let bootDevice = BootDevice, let fs = BootDeviceFS {
|
||||
let uuid = (BootDeviceUUID != nil) ? "\(BootDeviceUUID!)" : "NO UUID"
|
||||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
let mp = "/Volumes/\(String((0..<10).map{ _ in letters.randomElement()! }))"
|
||||
let type : String = (fs.hasPrefix("fat") || fs.hasPrefix("exf")) ? "msdos" : fs
|
||||
|
||||
let cmd = "if [[ $(LC_ALL=C mount | egrep \"^/dev/\(bootDevice) on\" | sed 's/^.* on *//;s/ ([^(]*//') == \"/\"* ]]; then nvram -x -p > $(LC_ALL=C mount | egrep \"^/dev/\(bootDevice) on\" | sed 's/^.* on *//;s/ ([^(]*//')/nvram.plist; echo 'nvram saved to am disk with UUID \(uuid)'; else mkdir -p \(mp); mount -t \(type) /dev/\(bootDevice) \(mp); nvram -x -p > \(mp)/nvram.plist; echo 'nvram saved to u disk with UUID \(uuid)'; fi"
|
||||
|
||||
let task = Process()
|
||||
task.launchPath = "/bin/bash"
|
||||
task.arguments = ["-c", cmd]
|
||||
|
||||
task.launch()
|
||||
} else {
|
||||
saveNVRAM(volume: "/", nvram: nvram)
|
||||
saveNVRAM(bootDevice: bootDevice, filesystem: fs, nvram: nvram)
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,88 +82,63 @@ func doJob() {
|
||||
exit(EXIT_SUCCESS)
|
||||
}
|
||||
|
||||
func mountSaveNVRAM(disk bsdName: String, at path: String?, nvram: NSDictionary) {
|
||||
print("mount called for \(bsdName)")
|
||||
var disk : String = bsdName
|
||||
if disk.hasPrefix("disk") || disk.hasPrefix("/dev/disk") {
|
||||
if disk.hasPrefix("/dev/disk") {
|
||||
disk = disk.components(separatedBy: "dev/")[1]
|
||||
}
|
||||
|
||||
let allocator = kCFAllocatorDefault
|
||||
let newsession = DASessionCreate(allocator)
|
||||
if let session = ((newsession == nil) ? gSession5 : newsession) {
|
||||
if let bsd = DADiskCreateFromBSDName(allocator, session, disk) {
|
||||
var url : CFURL? = nil
|
||||
if (path != nil) {
|
||||
url = CFURLCreateFromFileSystemRepresentation(allocator, path?.toPointer(), (path?.count)!, true)
|
||||
}
|
||||
var context = UnsafeMutablePointer<Int>.allocate(capacity: 1)
|
||||
context.initialize(repeating: 0, count: 1)
|
||||
context.pointee = 0
|
||||
|
||||
DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
DADiskMountWithArguments(bsd, url, DADiskMountOptions(kDADiskMountOptionDefault), { (o, dis, ctx) in
|
||||
if (dis != nil) && (ctx != nil) {
|
||||
print("mount failure: " + printDAReturn(r: DADissenterGetStatus(dis!)))
|
||||
}
|
||||
}, &context, nil)
|
||||
//CFRunLoopRun()
|
||||
let result : Bool = (context.pointee == 0)
|
||||
print("\(bsdName) mounted: \(result)")
|
||||
if result {
|
||||
let mountpoint = getMountPoint(from: disk)
|
||||
if ((mountpoint != nil)) {
|
||||
// already mounted
|
||||
saveNVRAM(volume: mountpoint!, nvram: nvram)
|
||||
}
|
||||
} else {
|
||||
saveNVRAM(volume: "/", nvram: nvram)
|
||||
}
|
||||
|
||||
DASessionUnscheduleFromRunLoop(session,
|
||||
CFRunLoopGetCurrent(),
|
||||
CFRunLoopMode.defaultMode.rawValue)
|
||||
|
||||
context.deallocate()
|
||||
} else {
|
||||
print("DADiskCreateFromBSDName() is null.")
|
||||
saveNVRAM(volume: "/", nvram: nvram)
|
||||
}
|
||||
} else {
|
||||
print("gSession in null.")
|
||||
saveNVRAM(volume: "/", nvram: nvram)
|
||||
}
|
||||
|
||||
}
|
||||
func saveNVRAM(bootDevice: String, filesystem: String, nvram: NSMutableDictionary) {
|
||||
nvram.removeObject(forKey: "efi-backup-boot-device")
|
||||
nvram.removeObject(forKey: "efi-backup-boot-device-data")
|
||||
nvram.removeObject(forKey: "install-product-url")
|
||||
nvram.removeObject(forKey: "previous-system-uuid")
|
||||
nvram.write(toFile: "/tmp/nvramsaved.plist", atomically: false)
|
||||
|
||||
let uuid = (BootDeviceUUID != nil) ? "\(BootDeviceUUID!)" : "NO UUID"
|
||||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
let mp = "/Volumes/\(String((0..<10).map{ _ in letters.randomElement()! }))"
|
||||
let type : String = (filesystem.hasPrefix("fat") || filesystem.hasPrefix("exf")) ? "msdos" : filesystem
|
||||
|
||||
let cmd = """
|
||||
if [[ ! -f /tmp/nvramsaved.plist ]]; then
|
||||
echo "Error: nvram not found to a temporary location."
|
||||
exit 0
|
||||
fi
|
||||
mp=$(LC_ALL=C mount | egrep "^/dev/\(bootDevice) on" | sed 's/^.* on *//;s/ ([^(]*//')
|
||||
if [[ "${mp}" == "/"* ]]; then
|
||||
cat /tmp/nvramsaved.plist > "${mp}"/nvram.plist
|
||||
echo 'nvram saved to disk with UUID \(uuid)'
|
||||
else
|
||||
mkdir -p '\(mp)'
|
||||
mount -t \(type) /dev/\(bootDevice) '\(mp)'
|
||||
if [ $? -eq 0 ]; then
|
||||
cat /tmp/nvramsaved.plist > '\(mp)/nvram.plist'
|
||||
echo 'nvram saved to disk with UUID \(uuid)'
|
||||
umount -f \(bootDevice) 2>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
rm -rf '\(mp)'
|
||||
fi
|
||||
else
|
||||
echo "Error: \(bootDevice) doesn't want to mount, try to save in /."
|
||||
cat /tmp/nvramsaved.plist > /nvram.plist
|
||||
fi
|
||||
fi
|
||||
"""
|
||||
let task = Process()
|
||||
task.launchPath = "/bin/bash"
|
||||
task.arguments = ["-c", cmd]
|
||||
|
||||
task.launch()
|
||||
}
|
||||
|
||||
|
||||
func saveNVRAM(volume: String, nvram: NSDictionary) {
|
||||
let withSlash = (volume == "/") ? volume : "\(volume)/"
|
||||
if !fm.isWritableFile(atPath: withSlash) {
|
||||
print("saveNVRAM(): '\(volume)' is read-only..\n")
|
||||
run(cmd: "mount -uw /")
|
||||
}
|
||||
if (nvram.object(forKey: "EmuVariableUefiPresent") != nil ||
|
||||
nvram.object(forKey: "TestEmuVariableUefiPresent") != nil) {
|
||||
if nvram.write(toFile: volume.addPath("nvram.plist"), atomically: true) {
|
||||
print("nvram saved correctly at '\(volume.addPath("nvram.plist"))'.")
|
||||
run(cmd: "chmod 644 \(volume.addPath("nvram.plist"))")
|
||||
} else {
|
||||
print("nvram not saved.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func checkSleepProxyClient(nvram: NSDictionary) {
|
||||
let mDNSResponderPath = "/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist"
|
||||
let disableOption = "-DisableSleepProxyClient"
|
||||
|
||||
if let nvdata = nvram.object(forKey: "Clover.DisableSleepProxyClient") as? Data {
|
||||
let value = String(decoding: nvdata, as: UTF8.self)
|
||||
|
||||
if value == "true" {
|
||||
if !fm.fileExists(atPath: mDNSResponderPath) {
|
||||
print("Error: cannot found \(mDNSResponderPath)")
|
||||
return
|
||||
}
|
||||
if !fm.isWritableFile(atPath: "/") {
|
||||
print("try to making '/' writable as Clover.DisableSleepProxyClient=true.")
|
||||
run(cmd: "mount -uw /")
|
||||
@ -220,6 +176,7 @@ func main() {
|
||||
print("--------------------------------------------")
|
||||
print("- System start at \(now)")
|
||||
print("--------------------------------------------")
|
||||
var powerObserver : PowerObserver? = PowerObserver()
|
||||
if let volname = getMediaName(from: "/") {
|
||||
print("root mount point is '/Volumes/\(volname)'")
|
||||
}
|
||||
@ -238,7 +195,7 @@ func main() {
|
||||
}
|
||||
|
||||
/*
|
||||
Clean some lines fro clover.daemon.log.
|
||||
Clean some lines from clover.daemon.log.
|
||||
This is not going to go into the System log and is not
|
||||
controllable by the nvram.
|
||||
*/
|
||||
@ -284,19 +241,26 @@ func main() {
|
||||
checkSleepProxyClient(nvram: nvram)
|
||||
}
|
||||
|
||||
// Clean old nvram.plist user may have
|
||||
/*
|
||||
Clean old nvram.plist user may have in other volumes,
|
||||
but not if it is our boot device
|
||||
*/
|
||||
for v in getVolumes() {
|
||||
let nvramtPath = v.addPath("nvram.plist")
|
||||
if fm.fileExists(atPath: nvramtPath) {
|
||||
if fm.isDeletableFile(atPath: nvramtPath) {
|
||||
do {
|
||||
try fm.removeItem(atPath: nvramtPath)
|
||||
print("old '\(nvramtPath)' removed.")
|
||||
} catch {
|
||||
print("Error: can't remove '\(nvramtPath)'.")
|
||||
let bootDevice = findBootPartitionDevice()
|
||||
let vbsd = getBSDName(of: v)
|
||||
if vbsd != bootDevice {
|
||||
if fm.fileExists(atPath: nvramtPath) {
|
||||
if fm.isDeletableFile(atPath: nvramtPath) {
|
||||
do {
|
||||
try fm.removeItem(atPath: nvramtPath)
|
||||
print("old '\(nvramtPath)' removed.")
|
||||
} catch {
|
||||
print("Error: can't remove '\(nvramtPath)'.")
|
||||
}
|
||||
} else {
|
||||
print("Error: '\(nvramtPath)' is not deletable.")
|
||||
}
|
||||
} else {
|
||||
print("Error: '\(nvramtPath)' is not deletable.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,11 +272,12 @@ func main() {
|
||||
now = df.string(from: Date())
|
||||
print("")
|
||||
print("- System power off at \(now)")
|
||||
powerObserver = nil // no longer needed
|
||||
doJob()
|
||||
}
|
||||
termSource.resume()
|
||||
//CFRunLoopRun()
|
||||
dispatchMain()
|
||||
RunLoop.current.run()
|
||||
//dispatchMain()
|
||||
}
|
||||
|
||||
let myPath = CommandLine.arguments[0]
|
||||
|
@ -709,6 +709,20 @@
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qro-3I-AzH">
|
||||
<rect key="frame" x="187" y="127" width="107" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Main RunAtLogin" id="97q-mb-A90">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="qro-3I-AzH" firstAttribute="centerY" secondItem="m2S-Jp-Qdl" secondAttribute="centerY" id="Jex-1e-kgM"/>
|
||||
<constraint firstItem="qro-3I-AzH" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="kGh-7H-EFR"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
|
@ -11,153 +11,153 @@
|
||||
*/
|
||||
|
||||
/* top bar menu */
|
||||
"N/A" = "N/D"; // not available (please be short)
|
||||
"Install Clover" = "Install Clover";
|
||||
"Current Clover revision" = "Current Clover revision";
|
||||
"Boot device" = "Boot Device";
|
||||
"config path:" = "config path:";
|
||||
"N/A" = "알수없음"; // not available (please be short)
|
||||
"Install Clover" = "클로버 설치하기";
|
||||
"Current Clover revision" = "현재 클로버 리비전";
|
||||
"Boot device" = "부트 장치";
|
||||
"config path:" = "config 경로:";
|
||||
|
||||
"Clover wants to mount %@" = "Clover wants to mount %@";
|
||||
"Clover wants to umount %@" = "Clover wants to umount %@";
|
||||
"Mount" = "Mount";
|
||||
"umount" = "umount";
|
||||
"mount point" = "mount point";
|
||||
"Clover wants to mount %@" = "클로버는 다음 디스크를 마운트: %@";
|
||||
"Clover wants to umount %@" = "클로버는 다음 디스크를 언마운트: %@";
|
||||
"Mount" = "마운트";
|
||||
"umount" = "언마운트";
|
||||
"mount point" = "마운트 포인트";
|
||||
|
||||
"true" = "true";
|
||||
"false" = "false";
|
||||
"true" = "예";
|
||||
"false" = "아니오";
|
||||
|
||||
"Theme:" = "Theme:";
|
||||
"Sound:" = "Sound:";
|
||||
"*Make filesystem read-write" = "*Make filesystem read-write";
|
||||
"*Disable Sleep Proxy Client" = "*Disable Sleep Proxy Client";
|
||||
"*Require CloverDaemon" = "*Require CloverDaemon";
|
||||
"Read daemon log" = "Read daemon log";
|
||||
"Read bdmesg" = "Read boot log";
|
||||
"Theme:" = "테마:";
|
||||
"Sound:" = "사운드:";
|
||||
"*Make filesystem read-write" = "*파일시스템을 읽기-쓰기로 변경;
|
||||
"*Disable Sleep Proxy Client" = "*잠자기 프록시 클라이언트 비활성화";
|
||||
"*Require CloverDaemon" = "*클로버데몬 필요";
|
||||
"Read daemon log" = "데몬 로그 읽기";
|
||||
"Read bdmesg" = "부트 로그 읽기";
|
||||
|
||||
"Install CloverDaemonNew" = "Install CloverDaemonNew";
|
||||
"Uninstall CloverDaemonNew" = "Uninstall CloverDaemonNew";
|
||||
"Install CloverDaemonNew" = "새로운 클로버데몬 설치";
|
||||
"Uninstall CloverDaemonNew" = "새로운 클로버데몬 제거";
|
||||
|
||||
"Update" = "Update";
|
||||
"Update to r%d" = "Update to r%d"; // "Update to r5101"
|
||||
"Check update:" = "Check update:";
|
||||
"Check now" = "Check now";
|
||||
"Update" = "업데이트";
|
||||
"Update to r%d" = "r%d로 업데이트"; // "Update to r5101"
|
||||
"Check update:" = "업데이트 체크:";
|
||||
"Check now" = "지금 체크하기";
|
||||
|
||||
"never" = "never";
|
||||
"daily" = "daily";
|
||||
"weekly" = "weekly";
|
||||
"monthly" = "monthly";
|
||||
"last checked:" = "last checked:"; // last date update was checked. Please be short.
|
||||
"never" = "사용 안 함";
|
||||
"daily" = "매일";
|
||||
"weekly" = "매주";
|
||||
"monthly" = "매달";
|
||||
"last checked:" = "마지막 체크:"; // last date update was checked. Please be short.
|
||||
|
||||
"Run at login" = "Run at login";
|
||||
"Close" = "Close"; // Close the Clover.app
|
||||
"Run at login" = "로그인 시 실행";
|
||||
"Close" = "닫기"; // Close the Clover.app
|
||||
|
||||
/* Installer */
|
||||
"Clover Installer" = "Clover Installer";
|
||||
"Select a disk.." = "Select a disk..";
|
||||
"Install" = "Install";
|
||||
"Uninstall" = "Uninstall";
|
||||
"AltBoot" = "Alternative boot";
|
||||
"Clover Installer" = "클로버 설치";
|
||||
"Select a disk.." = "디스크 선택하기..";
|
||||
"Install" = "설치";
|
||||
"Uninstall" = "제거";
|
||||
"AltBoot" = "대체 부팅";
|
||||
|
||||
/* Drivers */
|
||||
"UEFI mandatory" = "UEFI mandatory";
|
||||
"BIOS mandatory" = "BIOS mandatory";
|
||||
"UEFI/Other" = "UEFI/Other";
|
||||
"BIOS/Other" = "BIOS/Other";
|
||||
"UEFI, but not from this installer" = "UEFI, but not from this installer";
|
||||
"BIOS, but not from this installer" = "BIOS, but not from this installer";
|
||||
"UEFI mandatory" = "UEFI 필수";
|
||||
"BIOS mandatory" = "BIOS 필수";
|
||||
"UEFI/Other" = "UEFI/추가";
|
||||
"BIOS/Other" = "BIOS/추가";
|
||||
"UEFI, but not from this installer" = "이 설치 프로그램이 아닌 UEFI";
|
||||
"BIOS, but not from this installer" = "이 설치 프로그램이 아닌 BIOS";
|
||||
|
||||
"UEFI/FileSystem" = "UEFI, filesystem drivers";
|
||||
"BIOS/FileSystem" = "BIOS, filesystem drivers";
|
||||
"UEFI/FileSystem" = "UEFI, 파일시스템 드라이버";
|
||||
"BIOS/FileSystem" = "BIOS, 파일시스템 드라이버";
|
||||
|
||||
"UEFI/HID" = "UEFI, Human Interface Devices";
|
||||
"BIOS/HID" = "BIOS, Human Interface Devices";
|
||||
"UEFI/HID" = "UEFI, 휴먼 인터페이스 장치";
|
||||
"BIOS/HID" = "BIOS, 휴먼 인터페이스 장치";
|
||||
|
||||
"UEFI/FileVault2" = "UEFI, FileVault 2 drivers";
|
||||
"BIOS/FileVault2" = "BIOS, FileVault 2 drivers";
|
||||
"UEFI/FileVault2" = "UEFI, FileVault 2 드라이버";
|
||||
"BIOS/FileVault2" = "BIOS, FileVault 2 드라이버";
|
||||
|
||||
"UEFI/MemoryFix" = "UEFI, memory fix drivers";
|
||||
"UEFI/MemoryFix" = "UEFI, 메모리 오류 수정 드라이버";
|
||||
|
||||
"ApfsDriverLoader.efi" = "Supports APFS filesystem driver from container for macOS 10.13 and newers";
|
||||
"ApfsDriverLoader.efi" = "10.13 이상의 macOS에서 컨테이너으로부터 APFS 파일 시스템을 로드하기 위한 드라이버";
|
||||
|
||||
"AppleImageCodec.efi" = "Decode PNG and BMP for FileVault2.";
|
||||
"AppleImageCodec.efi" = "FileVault 2 용 PNG 및 BMP 디코딩 지원";
|
||||
|
||||
"AppleImageLoader.efi" = "Secure AppleEfiFat binary driver with implementation of AppleLoadImage protocol with EfiBinary signature verification.";
|
||||
"AppleImageLoader.efi" = "EfiBinary 서명 확인을 사용하여 AppleLoadImage 프로토콜을 구현한 보안 AppleEfiFat 바이너리 드라이버";
|
||||
|
||||
"AppleKeyAggregator.efi" = "Support for boot UI dialog for FileVault2.";
|
||||
"AppleKeyAggregator.efi" = "FileVault 2 용 부팅 UI 대화 상자 지원";
|
||||
|
||||
"AppleKeyFeeder.efi" = "Support for PS/2 keyboard to use with FileVault 2.";
|
||||
"AppleKeyFeeder.efi" = "FileVault 2 용 PS/2 키보드 사용을 지원";
|
||||
|
||||
"AppleUISupport.efi" = "Set of protocols for support EfiLoginUi for FileVault.";
|
||||
"AppleUISupport.efi" = "FileVault 용 EfiLoginUi 지원을 위한 프로토콜 설정";
|
||||
|
||||
"AppleUITheme.efi" = "Create boot UI Themes support for FileVault2.";
|
||||
"AppleUITheme.efi" = "FileVault 2 용 부팅 UI 테마를 지원";
|
||||
|
||||
"AptioInputFix.efi" = "Driver to fix input problems on UEFI firmware such as AMI Aptio.";
|
||||
"AptioInputFix.efi" = "AMI Aptio와 같은 UEFI 펌웨어의 입력 문제를 해결하는 드라이버";
|
||||
|
||||
"AptioMemoryFix.efi" = "Preferred driver to fix Memory problems on UEFI firmware such as AMI Aptio. Do not use with other AptioFix together.";
|
||||
"AptioMemoryFix.efi" = "AMI Aptio와 같은 UEFI 펌웨어에서 메모리 문제를 해결하기 위해 선호되는 64비트 드라이버";
|
||||
|
||||
"AudioDxe.efi" = "HDA driver to play Startup Sound during Clover boot.
|
||||
Configure it via Startup sound output from Option menu, including:
|
||||
Volume and Audio device (for supported IOAudio devices only).";
|
||||
"AudioDxe.efi" = "시동시 시동 음을 재생하는 HDA 드라이버.
|
||||
옵션 메뉴에서 시동 음의 출력 설정:
|
||||
볼륨 및 오디오 장치 (IOAudio를 지원하는 장치만 해당).";
|
||||
|
||||
"FirmwareVolume.efi" = "Create FirmwareVolume with cursor images for FileVault2.";
|
||||
"FirmwareVolume.efi" = "FileVault 2 용 커서 이미지와 함께 FirmwareVolume을 만듭니다.";
|
||||
|
||||
"FSInject.efi" = "Provide injection of kernel extensions from Clover folder.";
|
||||
"FSInject.efi" = "Clover 폴더로부터 kexts의 인젝션을 제공";
|
||||
|
||||
"GrubEXFAT.efi" = "ExFAT filesystem driver from GRUB.";
|
||||
"GrubEXFAT.efi" = "GRUB의 ExFAT 파일 시스템 드라이버";
|
||||
|
||||
"GrubISO9660.efi" = "ISO 9600 filesystem driver from GRUB.";
|
||||
"GrubISO9660.efi" = "GRUB의 ISO 9600 파일 시스템 드라이버";
|
||||
|
||||
"GrubNTFS.efi" = "NTFS filesystem driver from GRUB.";
|
||||
"GrubNTFS.efi" = "GRUB의 NTFS 파일 시스템 드라이버";
|
||||
|
||||
"GrubUDF.efi" = "UDF filesystem driver from GRUB.";
|
||||
"GrubUDF.efi" = "GRUB의 UDF 파일 시스템 드라이버";
|
||||
|
||||
"SMCHelper.efi" = "Restore SMC keys left in NVRAM by FakeSMC.";
|
||||
"SMCHelper.efi" = "FakeSMC가 NVRAM에 남긴 SMC 키를 복원";
|
||||
|
||||
"XhciDxe.efi" = "USB 3.0 driver";
|
||||
"XhciDxe.efi" = "USB 3.0 드라이버";
|
||||
|
||||
"AppleEvent.uefi" = "Create AppleEvent protocol for FileVault2.";
|
||||
"AppleEvent.uefi" = "FileVault 2 용 AppleEvent 프로토콜을 만듭니다.";
|
||||
|
||||
"AppleGraphicsConfig.uefi" = "Create optional AppleGraphicsConfig protocol.";
|
||||
"AppleGraphicsConfig.uefi" = "선택적 AppleGraphicsConfig 프로토콜을 만듭니다.";
|
||||
|
||||
"CsmVideoDxe.efi" = "Video Driver for Clover GUI allowing to choose more resolutions. It is based on CSM module in UEFI BIOS and required CSM will be enabled.
|
||||
Clover may not started with it and you may have wake problem in system. Use with precautions.";
|
||||
"CsmVideoDxe.efi" = "Clover GUI를 위한 비디오 드라이버는 더 다양한 해상도 설정을 가능하게 합니다. UEFI BIOS의 CSM모듈에 기반해있으므로 CSM이 활성화 되어야 합니다.
|
||||
Clover는 깨어나기에 문제가 있는 시스템에서는 정상적으로 시작하지 않을 수 있습니다. 주의해서 사용해주시기 바랍니다.";
|
||||
|
||||
"DataHubDxe.efi" = "This is DataHub protocol support mandatory for macOS.
|
||||
Usually it is already present but sometime it may be missed. In this case you should see warning on screen.";
|
||||
"DataHubDxe.efi" = "macOS에 필수적인 DataHub 프로토콜 지원합니다.
|
||||
대개 이미 존재하지만 간혹 없는 경우가 있습니다. 그러한 경우에는 화면에서 경고를 발견하실 수 있습니다.";
|
||||
|
||||
"EmuVariableUefi.efi" = "Workaround for store NVRAM variables for systems without UEFI hardware.
|
||||
Mostly UEFI boot uses hardware NVRAM but in some rare cases this driver is needed. Use it only if you have a problem without it";
|
||||
"EmuVariableUefi.efi" = "UEFI 하드웨어가 없는 시스템의 NVRAM 변수 저장에 대한 해결 방법.
|
||||
대체로 UEFI 부트는 하드웨어 NVRAM을 이용하지만 간혹 이 드라이버가 필요할 수 있습니다. 본 드라이버 없이는 문제가 있는 경우에 한해서 사용하십시오.";
|
||||
|
||||
"EnglishDxe.efi" = "Support for UnicodeCollation protocol used by EFI Shell if it missed in UEFI.";
|
||||
"EnglishDxe.efi" = "EFI 셸이 UEFI에서 누락 된 경우 사용되는 유니코드 조합 프로토콜 지원";
|
||||
|
||||
"Fat.efi" = "FAT filesystem driver.";
|
||||
"Fat.efi" = "FAT 파일 시스템 드라이버";
|
||||
|
||||
"HashServiceFix.efi" = "Fix Hash support if absent in native UEFI BIOS.";
|
||||
"HashServiceFix.efi" = "기본 UEFI BIOS에 해시가 없으면 지원되도록 고칩니다.";
|
||||
|
||||
"HFSPlus.efi" = "Alternate HFS+ filesystem driver.";
|
||||
"HFSPlus.efi" = "순정 HFS+ 파일 시스템 드라이버";
|
||||
|
||||
"NvmExpressDxe.efi" = "Driver for support NVM Express devices.";
|
||||
"NvmExpressDxe.efi" = "NVM Express 장치 지원용 드라이버";
|
||||
|
||||
"OsxAptioFix3Drv.efi" = "Alternate driver (v3) to fix Memory problems on UEFI firmware. Do not use with other AptioFix together.";
|
||||
"OsxAptioFix3Drv.efi" = "대체 드라이버 (v3)를 사용하여 UEFI 펌웨어의 메모리 문제를 해결하십시오. 다른 AptioFix와 함께 사용하지 마십시오.";
|
||||
|
||||
"OsxAptioFixDrv.efi" = "Old Driver to fix Memory problems on UEFI firmware such as AMI Aptio. Do not use with other AptioFix together.";
|
||||
"OsxAptioFixDrv.efi" = "이전 64 비트 드라이버로 AMI Aptio와 같은 UEFI 펌웨어의 메모리 문제를 해결할 수 있습니다. 다른 AptioFix와 함께 사용하지 마십시오.";
|
||||
|
||||
"OsxFatBinaryDrv.efi" = "Driver for support FAT Binary executables for OS X 10.9 and older.";
|
||||
"OsxFatBinaryDrv.efi" = "10.9 이하의 OS X를 위한 FAT 바이너리 실행 드라이버";
|
||||
|
||||
"OsxLowMemFixDrv.efi" = "Simplified variant of OsxAptioFixDrv. Do not use with other AptioFix together.";
|
||||
"OsxLowMemFixDrv.efi" = "OsxAptioFixDrv의 간소화 형태. 간소화되지 않는 버전과 함께 사용하지 마십시오.";
|
||||
|
||||
"PartitionDxe.efi" = "Driver to support non-usual partition maps such as: hybrid GPT/MBR or Apple Partition Map.";
|
||||
"PartitionDxe.efi" = "GPT/MBR 또는 Apple 파티션 맵과 같은 희귀 파티션맵을 지원하기 위한 드라이버";
|
||||
|
||||
"Ps2MouseDxe.efi" = "PS/2 mouse driver";
|
||||
"Ps2MouseDxe.efi" = "PS/2 마우스 드라이버";
|
||||
|
||||
"UsbKbDxe.efi" = "Keyboard driver for boot UI support.";
|
||||
"UsbKbDxe.efi" = "부팅 UI 지원을 위한 키보드 드라이버";
|
||||
|
||||
"UsbMouseDxe.efi" = "USB mouse driver";
|
||||
"UsbMouseDxe.efi" = "USB 마우스 드라이버";
|
||||
|
||||
"VBoxExt2.efi" = "EXT2/3 filesystem driver from VirtualBox.";
|
||||
"VBoxExt2.efi" = "Virtualbox 용 Ext2/3 파일 시스템 드라이버";
|
||||
|
||||
"VBoxExt4.efi" = "EXT4 filesystem driver from VirtualBox.";
|
||||
"VBoxExt4.efi" = "Virtualbox 용 Ext4 파일 시스템 드라이버";
|
||||
|
||||
"VBoxHfs.efi" = "HFS+ filesystem driver.";
|
||||
"VBoxHfs.efi" = "오픈소스 HFS+ 파일 시스템 드라이버";
|
||||
|
||||
"VBoxIso9600.efi" = "ISO 9600 filesystem driver.";
|
||||
"VBoxIso9600.efi" = "ISO 9600 파일 시스템 드라이버";
|
||||
|
@ -30,27 +30,6 @@ void cleanUp() {
|
||||
[task setArguments:@[ @"-c", @"rm -f /tmp/Clover* && rm -f /tmp/boot0* && rm -f /tmp/boot1*" ]];
|
||||
|
||||
[task launch];
|
||||
/*
|
||||
NSArray *files = [kfm contentsOfDirectoryAtPath:@"/tmp" error:nil];
|
||||
if (files != nil) {
|
||||
for (int i = 0; i < [files count]; i++) {
|
||||
NSString *file = [files objectAtIndex:i];
|
||||
NSString *fullPath = [@"/tmp" stringByAppendingPathComponent:file];
|
||||
if ([file hasPrefix:@"Clover"]
|
||||
|| [file hasPrefix:@"boo0"]
|
||||
|| [file hasPrefix:@"boo1"]
|
||||
|| [file hasPrefix:@"boosec"]) {
|
||||
if ([kfm fileExistsAtPath:fullPath]) {
|
||||
printf("cleanUp %s\n", [fullPath UTF8String]);
|
||||
NSError *err = nil;
|
||||
[kfm removeItemAtPath:fullPath error:&err];
|
||||
if (err != nil) {
|
||||
printf("%s\n", [err.localizedFailureReason UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void exitWithMessage(const char *format, ...)
|
||||
@ -147,7 +126,10 @@ int main(int argc, char * const * argv) {
|
||||
}
|
||||
}
|
||||
|
||||
printf("bootSectorsInstallSrc = %s\n", [bootSectorsInstallSrc UTF8String]);
|
||||
if (bootSectorsInstallSrc != nil) {
|
||||
printf("bootSectorsInstallSrc = %s\n", [bootSectorsInstallSrc UTF8String]);
|
||||
}
|
||||
|
||||
BOOL alt = NO;
|
||||
if ([CloverappDict objectForKey:@"alt"] != nil) {
|
||||
alt = [[CloverappDict objectForKey:@"alt"] boolValue];
|
||||
|
Loading…
Reference in New Issue
Block a user