Skip to content

Commit

Permalink
Add Apex and Amethyst, support userspace reboot based on the installe…
Browse files Browse the repository at this point in the history
…d jailbreak
  • Loading branch information
staturnzz committed Nov 14, 2024
1 parent c615ab4 commit 86310d7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,24 @@ - (NSArray *)utilitySources {
@"url" : @"https://ellekit.space/",
@"icon": @"https://ellekit.space/CydiaIcon.png"}];
break;

case ZBJailbreakAmethyst:
[result addObject:@{@"type": @"utility",
@"name": @"Procursus",
@"url" : @"https://apt.procurs.us/",
@"icon": @"https://apt.procurs.us/CydiaIcon.png"}];
break;

case ZBJailbreakApex:
[result addObject:@{@"type": @"utility",
@"name": @"Procursus",
@"url" : @"https://apt.procurs.us/",
@"icon": @"https://apt.procurs.us/CydiaIcon.png"}];
[result addObject:@{@"type": @"utility",
@"name": @"Odyssey Repo",
@"url" : @"https://repo.theodyssey.dev/",
@"icon": @"https://repo.theodyssey.dev/CydiaIcon.png"}];
break;


default:
Expand Down
5 changes: 4 additions & 1 deletion Zebra/ZBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ typedef NS_ENUM(NSUInteger, ZBJailbreak) {
ZBJailbreakMineekJB64,
ZBJailbreakMineekJB,
ZBJailbreakBakera1n,
ZBJailbreakP0insettia
ZBJailbreakP0insettia,
ZBJailbreakAmethyst,
ZBJailbreakApex
};

typedef NS_ENUM(NSUInteger, ZBBootstrap) {
Expand Down Expand Up @@ -75,6 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)debianArchitecture;
+ (nullable NSString *)packageManagementBinary;
+ (NSString *)path;
+ (BOOL)supportsUserspaceReboot;

+ (void)hapticButton;

Expand Down
25 changes: 24 additions & 1 deletion Zebra/ZBDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ + (BOOL)needsSimulation {
#endif
}

+ (BOOL)supportsUserspaceReboot {
// all detectable iOS 14+ jailbreaks support userspace reboots
if (@available(iOS 14, *)) {
if (self.jailbreak != ZBJailbreakUnknown && self.jailbreak != ZBJailbreakSimulated) {
return YES;
}
}

switch (self.jailbreak) {
case ZBJailbreakCheckra1n:
case ZBJailbreakChimera:
case ZBJailbreakOdyssey:
case ZBJailbreakAmethyst: return YES;
default: break;
}
return NO;
}

+ (BOOL)isSlingshotBroken:(NSError *_Nullable*_Nullable)error {
#if TARGET_OS_SIMULATOR
return NO; //Since simulated devices don't have su/sling, it isn't broken!
Expand Down Expand Up @@ -247,7 +265,7 @@ + (void)restartSpringBoard {

+ (void)restartDevice {
if (![self needsSimulation]) {
if (@available(iOS 15, *)) {
if ([self supportsUserspaceReboot]) {
// Try userspace reboot
NSLog(@"[Zebra] Trying userspace reboot");
if ([ZBCommand execute:@"launchctl" withArguments:@[@"reboot", @"userspace"] asRoot:YES]) {
Expand Down Expand Up @@ -345,7 +363,10 @@ + (ZBJailbreak)_jailbreak {
@"/.installed_g0blin": @(ZBJailbreakG0blin),
@"/.installed_p0insettia": @(ZBJailbreakP0insettia),
@"/cores/binpack/.installed_overlay": @(ZBJailbreakBakera1n),
@"/.installed_amethyst": @(ZBJailbreakAmethyst),
@"/.installed_apex": @(ZBJailbreakApex)
};

NSDictionary <NSString *, NSNumber *> *jailbreakInstalledDirs = @{
@"/binpack": @(ZBJailbreakCheckra1n),
@"/electra": @(ZBJailbreakElectra),
Expand Down Expand Up @@ -439,6 +460,8 @@ + (NSString *)jailbreakName {
case ZBJailbreakMineekJB: return @"mineekJB";
case ZBJailbreakBakera1n: return @"bakera1n";
case ZBJailbreakP0insettia: return @"p0insettia";
case ZBJailbreakAmethyst: return @"Amethyst";
case ZBJailbreakApex: return @"Apex";
}
}

Expand Down

0 comments on commit 86310d7

Please sign in to comment.