Add compatibility note, much better error output, support for more devices (silent update pushed to releases)

This commit is contained in:
opa334 2022-09-03 00:00:12 +02:00
parent e4afe70414
commit a8e72590a5
3 changed files with 79 additions and 11 deletions

View File

@ -52,17 +52,25 @@ Installer</string>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Support iOS 15.0 - 15.1.1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s80-eR-fY3">
<rect key="frame" x="114.5" y="249" width="185" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="Wzs-Lb-XiN" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="3hT-dN-t3y"/> <constraint firstItem="Wzs-Lb-XiN" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="3hT-dN-t3y"/>
<constraint firstItem="s80-eR-fY3" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="CRX-Jh-CcX"/>
<constraint firstItem="JVS-Tm-8qS" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="QXJ-WA-nNb"/> <constraint firstItem="JVS-Tm-8qS" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="QXJ-WA-nNb"/>
<constraint firstItem="1a2-Wm-Mcd" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="c2Z-Vi-FvF"/> <constraint firstItem="1a2-Wm-Mcd" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="c2Z-Vi-FvF"/>
<constraint firstItem="Wzs-Lb-XiN" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="gpk-JM-ZKB"/> <constraint firstItem="Wzs-Lb-XiN" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="gpk-JM-ZKB"/>
<constraint firstItem="1a2-Wm-Mcd" firstAttribute="top" secondItem="JVS-Tm-8qS" secondAttribute="bottom" constant="19" id="kjo-EL-B0G"/> <constraint firstItem="1a2-Wm-Mcd" firstAttribute="top" secondItem="JVS-Tm-8qS" secondAttribute="bottom" constant="19" id="kjo-EL-B0G"/>
<constraint firstItem="Xbu-Hl-yex" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="pWV-JU-YTc"/> <constraint firstItem="Xbu-Hl-yex" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="pWV-JU-YTc"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="Xbu-Hl-yex" secondAttribute="bottom" constant="18" id="rj9-jo-r9k"/> <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="Xbu-Hl-yex" secondAttribute="bottom" constant="18" id="rj9-jo-r9k"/>
<constraint firstItem="s80-eR-fY3" firstAttribute="top" secondItem="1a2-Wm-Mcd" secondAttribute="bottom" constant="24.5" id="xcO-OB-aq4"/>
<constraint firstItem="JVS-Tm-8qS" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="yNr-e8-C4N"/> <constraint firstItem="JVS-Tm-8qS" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="yNr-e8-C4N"/>
</constraints> </constraints>
</view> </view>

View File

@ -27,7 +27,19 @@ void badLog(const char* a, ...)
return; return;
} }
int runBinary(NSString* path, NSArray* args) NSString* getNSStringFromFile(int fd)
{
NSMutableString* ms = [NSMutableString new];
ssize_t num_read;
char c;
while((num_read = read(fd, &c, sizeof(c))))
{
[ms appendString:[NSString stringWithFormat:@"%c", c]];
}
return ms.copy;
}
int runBinary(NSString* path, NSArray* args, NSString** output)
{ {
NSMutableArray* argsM = args.mutableCopy; NSMutableArray* argsM = args.mutableCopy;
[argsM insertObject:path.lastPathComponent atIndex:0]; [argsM insertObject:path.lastPathComponent atIndex:0];
@ -41,9 +53,17 @@ int runBinary(NSString* path, NSArray* args)
} }
argsC[argCount] = NULL; argsC[argCount] = NULL;
posix_spawn_file_actions_t action;
posix_spawn_file_actions_init(&action);
int out[2];
pipe(out);
posix_spawn_file_actions_adddup2(&action, out[1], STDERR_FILENO);
posix_spawn_file_actions_addclose(&action, out[0]);
pid_t task_pid; pid_t task_pid;
int status = 0; int status = 0;
int spawnError = posix_spawn(&task_pid, [path UTF8String], NULL, NULL, (char* const*)argsC, NULL); int spawnError = posix_spawn(&task_pid, [path UTF8String], &action, NULL, (char* const*)argsC, NULL);
for (NSUInteger i = 0; i < argCount; i++) for (NSUInteger i = 0; i < argCount; i++)
{ {
free(argsC[i]); free(argsC[i]);
@ -56,13 +76,25 @@ int runBinary(NSString* path, NSArray* args)
return spawnError; return spawnError;
} }
waitpid(task_pid, &status, WEXITED); do
{
if (waitpid(task_pid, &status, 0) != -1) {
//printf("Child status %dn", WEXITSTATUS(status));
} else
{
perror("waitpid");
return -222;
}
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
waitpid(task_pid, NULL, 0); close(out[1]);
NSLog(@"status = %d", status); if(output)
{
*output = getNSStringFromFile(out[0]);
}
return status; return WEXITSTATUS(status);
} }
@ -141,7 +173,7 @@ int dropRoot(void)
int writeRemountPrivatePreboot(void) int writeRemountPrivatePreboot(void)
{ {
return runBinary(@"/sbin/mount", @[@"-u", @"-w", @"/private/preboot"]); return runBinary(@"/sbin/mount", @[@"-u", @"-w", @"/private/preboot"], nil);
} }
- (void)doInstallation - (void)doInstallation
@ -151,9 +183,13 @@ int writeRemountPrivatePreboot(void)
[self updateStatus:@"Exploiting..."]; [self updateStatus:@"Exploiting..."];
// Run Kernel exploit // Run kernel exploit
uint64_t kernel_base; uint64_t kernel_base;
exploit_get_krw_and_kernel_base(&kernel_base); if(exploit_get_krw_and_kernel_base(&kernel_base) != 0)
{
[self updateStatus:@"Exploit failed :("];
return;
}
// Initialize KernelManager // Initialize KernelManager
KernelManager* km = [KernelManager sharedInstance]; KernelManager* km = [KernelManager sharedInstance];
@ -190,7 +226,8 @@ int writeRemountPrivatePreboot(void)
chmod(helperPath.UTF8String, 0755); chmod(helperPath.UTF8String, 0755);
chown(helperPath.UTF8String, 0, 0); chown(helperPath.UTF8String, 0, 0);
int ret = runBinary(helperPath, @[@"install-trollstore", tsTarPath]); NSString* helperOutput;
int ret = runBinary(helperPath, @[@"install-trollstore", tsTarPath], &helperOutput);
[self updateStatus:@"Cleaning up..."]; [self updateStatus:@"Cleaning up..."];
@ -214,6 +251,27 @@ int writeRemountPrivatePreboot(void)
[installedAlertController addAction:closeAction]; [installedAlertController addAction:closeAction];
[self presentViewController:installedAlertController animated:YES completion:nil];
});
}
else
{
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController* installedAlertController = [UIAlertController alertControllerWithTitle:@"Error" message:[NSString stringWithFormat:@"Failed to install TrollStore. trollstore helper exited with code %d. Output:\n:%@", ret, helperOutput ?: @"<none>"] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
exit(0);
}];
UIAlertAction* copyAction = [UIAlertAction actionWithTitle:@"Copy Output" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = helperOutput;
exit(0);
}];
[installedAlertController addAction:closeAction];
[installedAlertController addAction:copyAction];
[self presentViewController:installedAlertController animated:YES completion:nil]; [self presentViewController:installedAlertController animated:YES completion:nil];
}); });
} }

View File

@ -56,11 +56,13 @@ int IOGPU_get_command_queue_extra_refills_needed(void)
// iPhone 11 // iPhone 11
// iPhone 12 // iPhone 12
// iPhone 13 // iPhone 13
// iPad Pro M1(?)
if ( if (
strstr(u.machine, "iPhone9,") strstr(u.machine, "iPhone9,")
|| strstr(u.machine, "iPhone12,") || strstr(u.machine, "iPhone12,")
|| strstr(u.machine, "iPhone13,") || strstr(u.machine, "iPhone13,")
|| strstr(u.machine, "iPhone14,") || strstr(u.machine, "iPhone14,")
|| strstr(u.machine, "iPad13,")
) )
{ {
return 1; return 1;