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"/>
|
||||
<tabViewItems>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@ -307,7 +307,7 @@
|
||||
</view>
|
||||
</tabViewItem>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@ -490,7 +490,7 @@
|
||||
<font key="font" metaFont="system"/>
|
||||
<tabViewItems>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@ -586,7 +586,7 @@
|
||||
</view>
|
||||
</tabViewItem>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@ -617,7 +617,7 @@
|
||||
</connections>
|
||||
</slider>
|
||||
<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"/>
|
||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Startup Sound" id="Vif-FP-OaO">
|
||||
<font key="font" metaFont="menu" size="11"/>
|
||||
@ -649,7 +649,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<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"/>
|
||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Device:" id="sIi-by-bNC">
|
||||
<font key="font" metaFont="menu" size="11"/>
|
||||
@ -657,6 +657,15 @@
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</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>
|
||||
</view>
|
||||
</tabViewItem>
|
||||
|
@ -198,7 +198,6 @@ class Installer: NSObject {
|
||||
exit("Error: you don't have root permissions.")
|
||||
}
|
||||
|
||||
|
||||
if (backUpPath != nil) {
|
||||
log("Backup made at:\n\(backUpPath!).")
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
let daemonVersion = "1.1.0"
|
||||
let daemonVersion = "1.1.1"
|
||||
|
||||
let fm = FileManager.default
|
||||
|
||||
@ -443,118 +443,123 @@ func main() {
|
||||
let myPath = CommandLine.arguments[0]
|
||||
let myName = (myPath as NSString).lastPathComponent
|
||||
|
||||
if CommandLine.arguments[1] == "--install" {
|
||||
print("Installing daemon...")
|
||||
// build the launch daemon
|
||||
let launch = NSMutableDictionary()
|
||||
launch.setValue(true, forKey: "KeepAlive")
|
||||
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 CommandLine.arguments.count > 1 {
|
||||
if CommandLine.arguments[1] == "--install" {
|
||||
print("Installing daemon...")
|
||||
// build the launch daemon
|
||||
let launch = NSMutableDictionary()
|
||||
launch.setValue(true, forKey: "KeepAlive")
|
||||
launch.setValue(true, forKey: "RunAtLoad")
|
||||
launch.setValue("com.slice.CloverDaemonNew", forKey: "Label")
|
||||
|
||||
if fm.fileExists(atPath: launchPlistPath) {
|
||||
try fm.removeItem(atPath: launchPlistPath)
|
||||
}
|
||||
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardErrorPath")
|
||||
launch.setValue("/Library/Logs/CloverEFI/clover.daemon.log", forKey: "StandardOutPath")
|
||||
|
||||
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
||||
try fm.removeItem(atPath: cloverDaemonNewPath)
|
||||
}
|
||||
let ProgramArguments = NSArray(object: cloverDaemonNewPath)
|
||||
|
||||
launch.write(toFile: launchPlistPath, atomically: true)
|
||||
launch.setValue(ProgramArguments, forKey: "ProgramArguments")
|
||||
|
||||
try fm.copyItem(atPath: myPath, toPath: cloverDaemonNewPath)
|
||||
|
||||
try fm.setAttributes(execAttr(),
|
||||
ofItemAtPath: cloverDaemonNewPath)
|
||||
|
||||
|
||||
let logouthookSrc = myPath.deletingLastPath.addPath(cloverLogOut.lastPath)
|
||||
if fm.fileExists(atPath: cloverLogOut) {
|
||||
try fm.removeItem(atPath: cloverLogOut)
|
||||
}
|
||||
|
||||
if fm.fileExists(atPath: logouthookSrc) {
|
||||
try fm.copyItem(atPath: logouthookSrc,
|
||||
toPath: cloverLogOut)
|
||||
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) {
|
||||
try fm.removeItem(atPath: launchPlistPath)
|
||||
}
|
||||
|
||||
if fm.fileExists(atPath: cloverDaemonNewPath) {
|
||||
try fm.removeItem(atPath: cloverDaemonNewPath)
|
||||
}
|
||||
|
||||
launch.write(toFile: launchPlistPath, atomically: true)
|
||||
|
||||
try fm.copyItem(atPath: myPath, toPath: cloverDaemonNewPath)
|
||||
|
||||
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
|
||||
ofItemAtPath: cloverDaemonNewPath)
|
||||
|
||||
|
||||
let logouthookSrc = myPath.deletingLastPath.addPath(cloverLogOut.lastPath)
|
||||
if fm.fileExists(atPath: cloverLogOut) {
|
||||
try fm.removeItem(atPath: cloverLogOut)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
if needsLogoutHook {
|
||||
installHook()
|
||||
} else {
|
||||
} 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)
|
||||
}
|
||||
|
||||
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] == "--CLOVER" {
|
||||
let installer = Installer()
|
||||
installer.realTimeOutPut = true
|
||||
installer.install()
|
||||
RunLoop.current.run()
|
||||
} else {
|
||||
print("Nothing to do bro'")
|
||||
}
|
||||
} 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 {
|
||||
// be the Daemon
|
||||
main()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user