Allow specifying binary paths for persistence helper

This commit is contained in:
alfiecg24 2024-03-30 12:08:58 +00:00
parent e6b5c000a9
commit 4d8982545d
1 changed files with 16 additions and 5 deletions

View File

@ -1310,12 +1310,16 @@ BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePer
return YES; return YES;
} }
void installPersistenceHelper(NSString* systemAppId) void installPersistenceHelper(NSString* systemAppId, NSString *persistenceHelperBinary, NSString *rootHelperBinary)
{ {
if(findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL)) return; if(findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL)) return;
NSString* persistenceHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"PersistenceHelper"]; if (persistenceHelperBinary == nil) {
NSString* rootHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"trollstorehelper"]; persistenceHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"PersistenceHelper"];
}
if (rootHelperBinary == nil) {
rootHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"trollstorehelper"];
}
LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:systemAppId]; LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:systemAppId];
if(!appProxy || ![appProxy.bundleType isEqualToString:@"System"]) return; if(!appProxy || ![appProxy.bundleType isEqualToString:@"System"]) return;
@ -1528,8 +1532,15 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
else if([cmd isEqualToString:@"install-persistence-helper"]) else if([cmd isEqualToString:@"install-persistence-helper"])
{ {
if(args.count < 2) return -3; if(args.count < 2) return -3;
NSString* systemAppId = args.lastObject; NSString* systemAppId = args[1];
installPersistenceHelper(systemAppId); NSString* persistenceHelperBinary;
NSString* rootHelperBinary;
if (args.count == 4) {
persistenceHelperBinary = args[2];
rootHelperBinary = args[3];
}
installPersistenceHelper(systemAppId, persistenceHelperBinary, rootHelperBinary);
} }
else if([cmd isEqualToString:@"uninstall-persistence-helper"]) else if([cmd isEqualToString:@"uninstall-persistence-helper"])
{ {