mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
CloevrDaemonNew v1.1.1
Fixed bug in CloverDaemonNew introduced in v1.0.9
This commit is contained in:
parent
183514b27d
commit
654616cdd6
@ -249,7 +249,7 @@
|
|||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<tabViewItems>
|
<tabViewItems>
|
||||||
<tabViewItem label="Tab" identifier="" id="BAk-3x-mLp">
|
<tabViewItem label="Tab" identifier="" id="BAk-3x-mLp">
|
||||||
<view key="view" id="ENG-5U-eLE">
|
<view key="view" ambiguous="YES" id="ENG-5U-eLE">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="342" height="120"/>
|
<rect key="frame" x="0.0" y="0.0" width="342" height="120"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
@ -307,7 +307,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
<tabViewItem label="View" identifier="" id="0yV-f2-RVT">
|
<tabViewItem label="View" identifier="" id="0yV-f2-RVT">
|
||||||
<view key="view" ambiguous="YES" id="P12-rN-3e4">
|
<view key="view" id="P12-rN-3e4">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="342" height="120"/>
|
<rect key="frame" x="0.0" y="0.0" width="342" height="120"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
@ -490,7 +490,7 @@
|
|||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<tabViewItems>
|
<tabViewItems>
|
||||||
<tabViewItem identifier="Mount" id="F4n-I1-4Gq">
|
<tabViewItem identifier="Mount" id="F4n-I1-4Gq">
|
||||||
<view key="view" ambiguous="YES" id="E05-QZ-1bf">
|
<view key="view" id="E05-QZ-1bf">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="342" height="113"/>
|
<rect key="frame" x="0.0" y="0.0" width="342" height="113"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
@ -586,7 +586,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
<tabViewItem identifier="Sound" id="T2L-eV-Vwg">
|
<tabViewItem identifier="Sound" id="T2L-eV-Vwg">
|
||||||
<view key="view" id="0ws-um-xJI">
|
<view key="view" ambiguous="YES" id="0ws-um-xJI">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="342" height="113"/>
|
<rect key="frame" x="0.0" y="0.0" width="342" height="113"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
@ -617,7 +617,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</slider>
|
</slider>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ok2-So-CvK">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ok2-So-CvK">
|
||||||
<rect key="frame" x="15" y="91" width="292" height="14"/>
|
<rect key="frame" x="18" y="94" width="306" height="14"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Startup Sound" id="Vif-FP-OaO">
|
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Startup Sound" id="Vif-FP-OaO">
|
||||||
<font key="font" metaFont="menu" size="11"/>
|
<font key="font" metaFont="menu" size="11"/>
|
||||||
@ -649,7 +649,7 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D50-Ay-tcj">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D50-Ay-tcj">
|
||||||
<rect key="frame" x="18" y="79" width="292" height="14"/>
|
<rect key="frame" x="18" y="79" width="241" height="14"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Device:" id="sIi-by-bNC">
|
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Device:" id="sIi-by-bNC">
|
||||||
<font key="font" metaFont="menu" size="11"/>
|
<font key="font" metaFont="menu" size="11"/>
|
||||||
@ -657,6 +657,15 @@
|
|||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gTt-3E-huL">
|
||||||
|
<rect key="frame" x="263" y="80" width="61" height="11"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" alignment="right" title="r5102 +" id="JZg-ju-g1k">
|
||||||
|
<font key="font" metaFont="label" size="9"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
|
@ -198,7 +198,6 @@ class Installer: NSObject {
|
|||||||
exit("Error: you don't have root permissions.")
|
exit("Error: you don't have root permissions.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (backUpPath != nil) {
|
if (backUpPath != nil) {
|
||||||
log("Backup made at:\n\(backUpPath!).")
|
log("Backup made at:\n\(backUpPath!).")
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
let daemonVersion = "1.1.0"
|
let daemonVersion = "1.1.1"
|
||||||
|
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
|
|
||||||
@ -443,118 +443,123 @@ func main() {
|
|||||||
let myPath = CommandLine.arguments[0]
|
let myPath = CommandLine.arguments[0]
|
||||||
let myName = (myPath as NSString).lastPathComponent
|
let myName = (myPath as NSString).lastPathComponent
|
||||||
|
|
||||||
if CommandLine.arguments[1] == "--install" {
|
if CommandLine.arguments.count > 1 {
|
||||||
print("Installing daemon...")
|
if CommandLine.arguments[1] == "--install" {
|
||||||
// build the launch daemon
|
print("Installing daemon...")
|
||||||
let launch = NSMutableDictionary()
|
// build the launch daemon
|
||||||
launch.setValue(true, forKey: "KeepAlive")
|
let launch = NSMutableDictionary()
|
||||||
launch.setValue(true, forKey: "RunAtLoad")
|
launch.setValue(true, forKey: "KeepAlive")
|
||||||
launch.setValue("com.slice.CloverDaemonNew", forKey: "Label")
|
launch.setValue(true, forKey: "RunAtLoad")
|
||||||
|
launch.setValue("com.slice.CloverDaemonNew", forKey: "Label")
|
||||||
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardErrorPath")
|
|
||||||
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardOutPath")
|
|
||||||
|
|
||||||
let ProgramArguments = NSArray(object: cloverDaemonNewPath)
|
|
||||||
|
|
||||||
launch.setValue(ProgramArguments, forKey: "ProgramArguments")
|
|
||||||
|
|
||||||
removeCloverRCScripts()
|
|
||||||
do {
|
|
||||||
if !fm.fileExists(atPath: "/Library/Application Support/Clover") {
|
|
||||||
try fm.createDirectory(atPath: "/Library/Application Support/Clover",
|
|
||||||
withIntermediateDirectories: false,
|
|
||||||
attributes: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: launchPlistPath) {
|
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardErrorPath")
|
||||||
try fm.removeItem(atPath: launchPlistPath)
|
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardOutPath")
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
let ProgramArguments = NSArray(object: cloverDaemonNewPath)
|
||||||
try fm.removeItem(atPath: cloverDaemonNewPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
launch.write(toFile: launchPlistPath, atomically: true)
|
launch.setValue(ProgramArguments, forKey: "ProgramArguments")
|
||||||
|
|
||||||
try fm.copyItem(atPath: myPath, toPath: cloverDaemonNewPath)
|
removeCloverRCScripts()
|
||||||
|
do {
|
||||||
try fm.setAttributes(execAttr(),
|
if !fm.fileExists(atPath: "/Library/Application Support/Clover") {
|
||||||
ofItemAtPath: cloverDaemonNewPath)
|
try fm.createDirectory(atPath: "/Library/Application Support/Clover",
|
||||||
|
withIntermediateDirectories: false,
|
||||||
|
attributes: nil)
|
||||||
let logouthookSrc = myPath.deletingLastPath.addPath(cloverLogOut.lastPath)
|
}
|
||||||
if fm.fileExists(atPath: cloverLogOut) {
|
|
||||||
try fm.removeItem(atPath: cloverLogOut)
|
if fm.fileExists(atPath: launchPlistPath) {
|
||||||
}
|
try fm.removeItem(atPath: launchPlistPath)
|
||||||
|
}
|
||||||
if fm.fileExists(atPath: logouthookSrc) {
|
|
||||||
try fm.copyItem(atPath: logouthookSrc,
|
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
||||||
toPath: cloverLogOut)
|
try fm.removeItem(atPath: cloverDaemonNewPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
launch.write(toFile: launchPlistPath, atomically: true)
|
||||||
|
|
||||||
|
try fm.copyItem(atPath: myPath, toPath: cloverDaemonNewPath)
|
||||||
|
|
||||||
try fm.setAttributes(execAttr(),
|
try fm.setAttributes(execAttr(),
|
||||||
ofItemAtPath: cloverLogOut)
|
ofItemAtPath: cloverDaemonNewPath)
|
||||||
}
|
|
||||||
|
|
||||||
var needsLogoutHook = isLegacyFirmware()
|
let logouthookSrc = myPath.deletingLastPath.addPath(cloverLogOut.lastPath)
|
||||||
if !needsLogoutHook {
|
if fm.fileExists(atPath: cloverLogOut) {
|
||||||
if let nvram = getNVRAM() {
|
try fm.removeItem(atPath: cloverLogOut)
|
||||||
if (nvram.object(forKey: "EmuVariableUefiPresent") != nil ||
|
}
|
||||||
nvram.object(forKey: "TestEmuVariableUefiPresent") != nil) {
|
|
||||||
needsLogoutHook = true
|
if fm.fileExists(atPath: logouthookSrc) {
|
||||||
|
try fm.copyItem(atPath: logouthookSrc,
|
||||||
|
toPath: cloverLogOut)
|
||||||
|
try fm.setAttributes(execAttr(),
|
||||||
|
ofItemAtPath: cloverLogOut)
|
||||||
|
}
|
||||||
|
|
||||||
|
var needsLogoutHook = isLegacyFirmware()
|
||||||
|
if !needsLogoutHook {
|
||||||
|
if let nvram = getNVRAM() {
|
||||||
|
if (nvram.object(forKey: "EmuVariableUefiPresent") != nil ||
|
||||||
|
nvram.object(forKey: "TestEmuVariableUefiPresent") != nil) {
|
||||||
|
needsLogoutHook = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if needsLogoutHook {
|
||||||
|
installHook()
|
||||||
|
} else {
|
||||||
|
unInstallHook()
|
||||||
|
}
|
||||||
|
|
||||||
|
try fm.setAttributes(launchAttr(), ofItemAtPath: launchPlistPath)
|
||||||
|
if fm.fileExists(atPath: launchPlistPath) {
|
||||||
|
run(cmd: "launchctl unload \(launchPlistPath)")
|
||||||
|
}
|
||||||
|
run(cmd: "launchctl load \(launchPlistPath)")
|
||||||
|
run(cmd: "launchctl start \(launchPlistPath)")
|
||||||
|
exit(EXIT_SUCCESS)
|
||||||
|
} catch {
|
||||||
|
print(error)
|
||||||
}
|
}
|
||||||
|
} else if CommandLine.arguments[1] == "--uninstall" {
|
||||||
if needsLogoutHook {
|
print("uninstalling daemon...")
|
||||||
installHook()
|
do {
|
||||||
} else {
|
if fm.fileExists(atPath: launchPlistPath) {
|
||||||
|
run(cmd: "launchctl unload \(launchPlistPath)")
|
||||||
|
try fm.removeItem(atPath: launchPlistPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
||||||
|
try fm.removeItem(atPath: cloverDaemonNewPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if fm.fileExists(atPath: cloverLogOut) {
|
||||||
|
try fm.removeItem(atPath: cloverLogOut)
|
||||||
|
}
|
||||||
|
|
||||||
|
if fm.fileExists(atPath: wrapperPath) {
|
||||||
|
try fm.removeItem(atPath: wrapperPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if fm.fileExists(atPath: frameworksPath) {
|
||||||
|
try fm.removeItem(atPath: frameworksPath)
|
||||||
|
}
|
||||||
|
|
||||||
unInstallHook()
|
unInstallHook()
|
||||||
|
exit(EXIT_SUCCESS)
|
||||||
|
} catch {
|
||||||
|
print(error)
|
||||||
}
|
}
|
||||||
|
} else if CommandLine.arguments[1] == "--CLOVER" {
|
||||||
try fm.setAttributes(launchAttr(), ofItemAtPath: launchPlistPath)
|
let installer = Installer()
|
||||||
if fm.fileExists(atPath: launchPlistPath) {
|
installer.realTimeOutPut = true
|
||||||
run(cmd: "launchctl unload \(launchPlistPath)")
|
installer.install()
|
||||||
}
|
RunLoop.current.run()
|
||||||
run(cmd: "launchctl load \(launchPlistPath)")
|
} else {
|
||||||
run(cmd: "launchctl start \(launchPlistPath)")
|
print("Nothing to do bro'")
|
||||||
exit(EXIT_SUCCESS)
|
|
||||||
} catch {
|
|
||||||
print(error)
|
|
||||||
}
|
}
|
||||||
} else if CommandLine.arguments[1] == "--uninstall" {
|
|
||||||
print("uninstalling daemon...")
|
|
||||||
do {
|
|
||||||
if fm.fileExists(atPath: launchPlistPath) {
|
|
||||||
run(cmd: "launchctl unload \(launchPlistPath)")
|
|
||||||
try fm.removeItem(atPath: launchPlistPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
|
||||||
try fm.removeItem(atPath: cloverDaemonNewPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: cloverLogOut) {
|
|
||||||
try fm.removeItem(atPath: cloverLogOut)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: wrapperPath) {
|
|
||||||
try fm.removeItem(atPath: wrapperPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fm.fileExists(atPath: frameworksPath) {
|
|
||||||
try fm.removeItem(atPath: frameworksPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
unInstallHook()
|
|
||||||
exit(EXIT_SUCCESS)
|
|
||||||
} catch {
|
|
||||||
print(error)
|
|
||||||
}
|
|
||||||
} else if CommandLine.arguments[1] == "--CLOVER" {
|
|
||||||
let installer = Installer()
|
|
||||||
installer.realTimeOutPut = true
|
|
||||||
installer.install()
|
|
||||||
RunLoop.current.run()
|
|
||||||
} else {
|
} else {
|
||||||
|
// be the Daemon
|
||||||
main()
|
main()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user