Kevin Bradley 5 years ago
parent
commit
805d13907c

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


+ 1 - 1
bootstrapTool/Classes/HelperClass.m

@@ -12,7 +12,7 @@
     }
     NSString *packageString = [NSString stringWithContentsOfFile:statusFile encoding:NSUTF8StringEncoding error:nil];
     NSArray *lineArray = [packageString componentsSeparatedByString:@"\n\n"];
-    //DDLogInfo(@"lineArray: %@", lineArray);
+    //DLog(@"lineArray: %@", lineArray);
     NSMutableArray *mutableList = [[NSMutableArray alloc] init];
     //NSMutableDictionary *mutableDict = [[NSMutableDictionary alloc] init];
     for (id currentItem in lineArray)

+ 21 - 9
bootstrapTool/Classes/InputPackage.m

@@ -110,15 +110,26 @@
     
     DLog(@"\nCreating list file '%@'...\n", listFile);
     
-    [self.listfile writeToFile:listFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
+    NSString *listString = [NSString stringWithFormat:@"/usr/bin/find %@ -type f -not -path \"*.DS_Store*\" | /usr/bin/sed \"s|%@||g\" >> \"%@\"", tmpPath, tmpPath, listFile];
+    NSString *listOutput = [HelperClass singleLineReturnForProcess:listString];
+    
+    //DLog(@"list output: %@", listOutput);
+    
+    //[listOutput writeToFile:listFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
+    
+    //find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" | sed "s|$BUILD_ROOT/$WORKING_DIR/deb||g" >> "$SKEL_PREFIX/var/lib/dpkg/info/$PKG_NAME.list"
+    
+    //find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" -exec $MD5 {} \; |  awk '{ print $1 "  " $2 }' | sed "s|$BUILD_ROOT/$WORKING_DIR/deb/||g" >> "$SKEL_PREFIX/var/lib/dpkg/info/$PKG_NAME.md5sums"
+    
+    //[self.listfile writeToFile:listFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
     
     DLog(@"\nGenerating md5sums...\n");
-    NSString *runString = [NSString stringWithFormat:@"/usr/bin/find %@ -type f -not -path \"*.DS_Store*\" -exec /sbin/md5 -r {} \\; |  /usr/bin/awk '{ print $1 \"  \" $2 }' | /usr/bin/sed \"s|%@||g\"", tmpPath, tmpPath];
+    NSString *runString = [NSString stringWithFormat:@"/usr/bin/find %@ -type f -not -path \"*.DS_Store*\" -exec /sbin/md5 -r {} \\; |  /usr/bin/awk '{ print $1 \"  \" $2 }' | /usr/bin/sed \"s|%@||g\" >> \"%@\"", tmpPath, tmpPath, md5s];
     NSString *outputs = [[HelperClass returnForProcess:runString] componentsJoinedByString:@"\n"];
     
     DLog(@"\nCreating md5sum file '%@'...\n", md5s);
     
-    [outputs writeToFile:md5s atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
+    //[outputs writeToFile:md5s atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
     
     [man createDirectoryAtPath:debian withIntermediateDirectories:TRUE attributes:nil error:nil];
     
@@ -151,7 +162,7 @@
        
         } else {
             
-            NSMutableString *controlFile = [[NSMutableString alloc] initWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil];
+            NSMutableString *controlFile = [[NSMutableString alloc] initWithContentsOfFile:fullPath encoding:NSASCIIStringEncoding error:nil];
             
             [controlFile replaceOccurrencesOfString:@"iphoneos-arm" withString:@"appletvos-arm64" options:NSLiteralSearch range:NSMakeRange(0, [controlFile length])];
             
@@ -163,7 +174,7 @@
             
             [FM copyItemAtPath:statusFile toPath:[statusFile stringByAppendingPathExtension:@"bak"] error:nil];
             
-            NSMutableString *statusContents = [[NSMutableString alloc] initWithContentsOfFile:statusFile encoding:NSUTF8StringEncoding error:nil];
+            NSMutableString *statusContents = [[NSMutableString alloc] initWithContentsOfFile:statusFile encoding:NSASCIIStringEncoding error:nil];
             
             if (model) { //we found the package model, just replace the old string with our new one
                 
@@ -173,7 +184,7 @@
                 [statusContents replaceOccurrencesOfString:model.rawString withString:controlFile options:NSLiteralSearch range:NSMakeRange(0, [statusContents length])];
                 
                 //[statusContents writeToFileWithoutAttributes:statusFile];
-                [statusContents writeToFile:statusFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
+                [statusContents writeToFile:statusFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
                 
                 
             } else {
@@ -190,7 +201,7 @@
                 
                 //[statusContents writeToFileWithoutAttributes:statusFile];
                 
-                [statusContents writeToFile:statusFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
+                [statusContents writeToFile:statusFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
                 
             }
             
@@ -210,11 +221,12 @@
         
         DLog(@"\n [WARNING] We found a postinst file, will not run this due to potential unexpected consequences in your run environment! Displaying contents so you can determine if any additional steps are necessary. Contents will be delimited by a line -----\n");
         
-        DLog(@"\n%@ Contents:\n\n---------------------\n\n%@\n\n---------------------\n\n", postInstFile, [NSString stringWithContentsOfFile:postInstFile encoding:NSUTF8StringEncoding error:nil]);
+        DLog(@"\n%@ Contents:\n\n---------------------\n\n%@\n\n---------------------\n\n", postInstFile, [NSString stringWithContentsOfFile:postInstFile encoding:NSASCIIStringEncoding error:nil]);
         
         
     }
     
+    [FM removeItemAtPath:tmpPath error:nil];
     
     DLog(@"Done!\n\n");
     return 0;
@@ -245,7 +257,7 @@
         
         NSString *controlPath = [debian stringByAppendingPathComponent:@"control"];
         
-        NSMutableString *controlFile = [[NSMutableString alloc] initWithContentsOfFile:controlPath encoding:NSUTF8StringEncoding error:nil];
+        NSMutableString *controlFile = [[NSMutableString alloc] initWithContentsOfFile:controlPath encoding:NSASCIIStringEncoding error:nil];
         //@"appletvos-arm64"
         [controlFile replaceOccurrencesOfString:@"iphoneos-arm" withString:newArch options:NSLiteralSearch range:NSMakeRange(0, [controlFile length])];
         

+ 10 - 7
bootstrapTool/Classes/StatusPackageModel.m

@@ -63,13 +63,16 @@
     for (id depend in dependsArray)
     {
         NSArray *spaceDelimitedArray = [depend componentsSeparatedByString:@" "];
-        NSString *isolatedDependency = [[spaceDelimitedArray objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-        if ([isolatedDependency length] == 0)
-            isolatedDependency = [[spaceDelimitedArray objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-        
-        NSDictionary *dependDict = [self dependencyDictionaryFromString:depend];
-        //DLog(@"depend dict: %@", dependDict);
-        [cleanArray addObject:dependDict];
+        if (spaceDelimitedArray.count > 1){
+            NSString *isolatedDependency = [[spaceDelimitedArray objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+            if ([isolatedDependency length] == 0)
+                isolatedDependency = [[spaceDelimitedArray objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+            
+            NSDictionary *dependDict = [self dependencyDictionaryFromString:depend];
+            //DLog(@"depend dict: %@", dependDict);
+            [cleanArray addObject:dependDict];
+        }
+       
     }
     
     return cleanArray;