Skip to content

Commit

Permalink
better better apfs/hfs
Browse files Browse the repository at this point in the history
  • Loading branch information
Samgisaninja committed Apr 24, 2019
1 parent b1cc811 commit 9f3dca5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
Binary file not shown.
10 changes: 10 additions & 0 deletions SuccessionRestore/HomePageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ @implementation HomePageViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[[self navigationController] navigationBar] setHidden:TRUE];

NSString *fstab = [NSString stringWithContentsOfFile:@"/etc/fstab" encoding:NSUTF8StringEncoding error:nil];
if ([fstab containsString:@"apfs"]) {
NSLog(@"SUCCESSIONTESTING: detected APFS!");
} else if ([fstab containsString:@"hfs"]) {
NSLog(@"SUCCESSIONTESTING: detected HFS!");
} else {
NSLog(@"SUCCESSIONTESTING: unable to detect filesystem!");
}

// Create a size_t and set it to the size used to allocate modelChar
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
Expand Down
2 changes: 1 addition & 1 deletion SuccessionRestore/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.2</string>
<string>1.1.3</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
36 changes: 5 additions & 31 deletions SuccessionRestore/RestoreViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ - (void) attachRestoreDisk {
[[NSFileManager defaultManager] createDirectoryAtPath:@"/private/var/MobileSoftwareUpdate/mnt1/" withIntermediateDirectories:TRUE attributes:nil error:nil];
char thedisk[11];
NSString *bootstrap = @"/var/mobile/Media/Succession/rfs.dmg";
if (kCFCoreFoundationVersionNumber > 1349.56 && [self is64bitHardware]) {
NSString *fstab = [NSString stringWithContentsOfFile:@"/etc/fstab" encoding:NSUTF8StringEncoding error:nil];
if ([fstab containsString:@"apfs"]) {
_filesystemType = @"apfs";
} else {
} else if ([fstab containsString:@"hfs"]) {
_filesystemType = @"hfs";
} else {
[self errorAlert:@"Unable to detect filesystem type"];
}
attach([bootstrap UTF8String], thedisk, sizeof(thedisk));
NSMutableArray *changedDevContents = [NSMutableArray arrayWithArray:[[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/dev/" error:nil]];
Expand Down Expand Up @@ -321,33 +324,4 @@ -(void)errorAlert:(NSString *)message{
[self presentViewController:errorAlertController animated:TRUE completion:nil];
}


- (BOOL) is64bitHardware
{
#if __LP64__
// The app has been compiled for 64-bit intel and runs as 64-bit intel
return YES;
#endif

// Use some static variables to avoid performing the tasks several times.
static BOOL sHardwareChecked = NO;
static BOOL sIs64bitHardware = NO;

if(!sHardwareChecked)
{
sHardwareChecked = YES;
// The app runs on a real iOS device: ask the kernel for the host info.
struct host_basic_info host_basic_info;
unsigned int count;
kern_return_t returnValue = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count);
if(returnValue != KERN_SUCCESS)
{
sIs64bitHardware = NO;
}

sIs64bitHardware = (host_basic_info.cpu_type == CPU_TYPE_ARM64);
}

return sIs64bitHardware;
}
@end
2 changes: 1 addition & 1 deletion Template/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.samgisaninja.SuccessionRestore
Name: Succession
Version: 1.1.2
Version: 1.1.3
Architecture: iphoneos-arm
Description: Restore without updating via rootfilesystem DMG
Maintainer: Samg_is_a_Ninja
Expand Down

0 comments on commit 9f3dca5

Please sign in to comment.