Browse Source

processes /var/mobile/Applications apps and moves them to the proper location now

Kevin Bradley 5 years ago
parent
commit
de7b364bf2

+ 2 - 0
bootstrapTool.xcodeproj/project.pbxproj

@@ -285,6 +285,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CODE_SIGN_STYLE = Automatic;
+				DEPLOYMENT_LOCATION = YES;
 				DEVELOPMENT_TEAM = 9EUFEA5U7G;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "$(SRCROOT)/bootstrapTool/Classes/Defines.h";
@@ -296,6 +297,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CODE_SIGN_STYLE = Automatic;
+				DEPLOYMENT_LOCATION = YES;
 				DEVELOPMENT_TEAM = 9EUFEA5U7G;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "$(SRCROOT)/bootstrapTool/Classes/Defines.h";

BIN
bootstrapTool.xcodeproj/project.xcworkspace/xcuserdata/kevinbradley.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
bootstrapTool/Classes/HelperClass.h

@@ -6,5 +6,6 @@
 + (InputPackage *)packageForDeb:(NSString *)debFile;
 + (NSString *)octalFromSymbols:(NSString *)theSymbols;
 + (NSArray <StatusPackageModel*>*)statusInstalledPackagesFromFile:(NSString *)statusFile;
++ (NSString *)singleLineReturnForProcess:(NSString *)call;
 
 @end

+ 7 - 2
bootstrapTool/Classes/HelperClass.m

@@ -63,6 +63,11 @@
     
 }
 
++ (NSString *)singleLineReturnForProcess:(NSString *)call
+{
+    return [[self returnForProcess:call] componentsJoinedByString:@"\n"];
+}
+
 + (NSArray *)returnForProcess:(NSString *)call
 {
     if (call==nil)
@@ -249,8 +254,8 @@
 
 + (InputPackage *)packageForDeb:(NSString *)debFile {
     
-    NSString *packageName = [[self returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -f %@ Package", debFile]] componentsJoinedByString:@"\n"];
-    NSString *packageVersion = [[self returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -f %@ Version", debFile]] componentsJoinedByString:@"\n"];
+    NSString *packageName = [self singleLineReturnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -f %@ Package", debFile]];
+    NSString *packageVersion = [self singleLineReturnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -f %@ Version", debFile]];
     NSArray <InputPackageFile *> *fileList = [self returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -c %@", debFile]];
     
     __block NSMutableArray *finalArray = [NSMutableArray new];

+ 13 - 3
bootstrapTool/Classes/InputPackage.m

@@ -38,8 +38,8 @@
 
 - (void)repackageInCurrentDirectoryWithArch:(NSString *)newArch {
 
-    NSString *fakeRoot = [[HelperClass returnForProcess:@"/usr/bin/which fakeroot"] componentsJoinedByString:@"\n"];
-    NSString *pwd = [[HelperClass returnForProcess:@"/bin/pwd"] componentsJoinedByString:@"\n"];
+    NSString *fakeRoot = [HelperClass singleLineReturnForProcess:@"/usr/bin/which fakeroot"];
+    NSString *pwd = [HelperClass singleLineReturnForProcess:@"/bin/pwd"];
     DLog(@"\nProcessing file: %@\n", self.path);
     InputPackage *output = self;
     
@@ -75,6 +75,16 @@
         
         if (obj.type == BSPackageFileTypeFile || obj.type == BSPackageFileTypeDirectory){
             
+            //DLog(@"processing path: %@", obj.path);
+            if ([obj.path isEqualToString:@"/private/var/mobile/Applications/"]){
+                
+                NSString *badPath = [tmpPath stringByAppendingPathComponent:obj.path];
+                NSString *newPath = [tmpPath stringByAppendingPathComponent:@"Applications"];
+                DLog(@"\n [INFO] Moving %@ to %@...", badPath, newPath);
+                [FM moveItemAtPath:badPath toPath:newPath error:nil];
+                [FM removeItemAtPath:[tmpPath stringByAppendingPathComponent:@"private"] error:nil];
+                *stop = TRUE;
+            }
             
             NSString *fullPath = [tmpPath stringByAppendingPathComponent:obj.path];
             
@@ -90,7 +100,7 @@
             {
                 
                 NSString *rootPath = [pathComponents objectAtIndex:1];
-                DLog(@"\n Checking root path: %@ for file %@\n", rootPath, obj.path);
+                //DLog(@"\n Checking root path: %@ for file %@\n", rootPath, obj.path);
                 if ([forbiddenRoots containsObject:rootPath])
                 {
                     DLog(@"\n [ERROR] package file: '%@' would overwrite symbolic link at '%@'\n\n", obj.path, rootPath);