From eed1d42792d4dcd47abe45e1020a74ea2ca2f952 Mon Sep 17 00:00:00 2001
From: Dhinak G <17605561+dhinakg@users.noreply.github.com>
Date: Sat, 30 Dec 2023 13:23:54 -0500
Subject: [PATCH] Fix rebooting
reboot3 requires platformization. Use FrontBoardServices to do it instead
---
RootHelper/devmode.m | 2 ++
RootHelper/entitlements.plist | 4 ++++
RootHelper/main.m | 8 ++++----
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/RootHelper/devmode.m b/RootHelper/devmode.m
index 42761d8..241ad0e 100644
--- a/RootHelper/devmode.m
+++ b/RootHelper/devmode.m
@@ -63,6 +63,8 @@ BOOL getDeveloperModeState(xpc_connection_t connection) {
return NO;
}
+ NSLog(@"[getDeveloperModeState] got reply %@", reply);
+
NSObject* success = reply[@"success"];
if (!success || ![success isKindOfClass:[NSNumber class]] || ![(NSNumber*)success boolValue]) {
NSLog(@"[getDeveloperModeState] request failed with error %@", reply[@"error"]);
diff --git a/RootHelper/entitlements.plist b/RootHelper/entitlements.plist
index 70c45bc..3319af0 100644
--- a/RootHelper/entitlements.plist
+++ b/RootHelper/entitlements.plist
@@ -44,5 +44,9 @@
Uninstall
UpdatePlaceholderMetadata
+ com.apple.private.amfi.developer-mode-control
+
+ com.apple.frontboard.shutdown
+
diff --git a/RootHelper/main.m b/RootHelper/main.m
index 8a62337..c178ce9 100644
--- a/RootHelper/main.m
+++ b/RootHelper/main.m
@@ -21,6 +21,7 @@
#endif
#import
+#import
#import
#ifdef EMBEDDED_ROOT_HELPER
@@ -50,8 +51,6 @@ typedef CFDictionaryRef (*_CFPreferencesCopyMultipleWithContainerType)(CFArrayRe
BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePersistenceHelper, NSString* sourceRootHelper);
-extern int reboot3(uint64_t flags, ...);
-
NSArray* applicationsWithGroupId(NSString* groupId)
{
LSEnumerator* enumerator = [LSEnumerator enumeratorForApplicationProxiesWithOptions:0];
@@ -1529,8 +1528,9 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
}
else if([cmd isEqualToString:@"reboot"])
{
- sync();
- ret = reboot3(0); // do a normal reboot
+ [[FBSSystemService sharedService] reboot];
+ // Give the system some time to reboot
+ sleep(1);
}
NSLog(@"trollstorehelper returning %d", ret);