Skip to content

Commit

Permalink
Clover.app v1.02 Beta
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vectorsigma72 committed Nov 9, 2019
1 parent 59c4a08 commit b06c4d4
Show file tree
Hide file tree
Showing 18 changed files with 375 additions and 803 deletions.
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CloverApp/Clover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
Expand Down
2 changes: 0 additions & 2 deletions CloverApp/Clover/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions CloverApp/Clover/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
18 changes: 15 additions & 3 deletions CloverApp/Clover/Disks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)!
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions CloverApp/Clover/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
13 changes: 9 additions & 4 deletions CloverApp/Clover/Installer/Installer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion CloverApp/Clover/NVRAM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!
Expand All @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion CloverApp/Clover/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -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>";
Expand Down Expand Up @@ -122,6 +129,7 @@
TargetAttributes = {
953DBFDA236F037400B0C4FB = {
CreatedOnToolsVersion = 11.2;
LastSwiftMigration = 1120;
};
};
};
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -275,19 +284,34 @@
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;
};
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Loading

0 comments on commit b06c4d4

Please sign in to comment.