|
@@ -106,7 +106,7 @@ typedef NS_ENUM(NSInteger, BSPackageFileType)
|
|
|
@property (nonatomic, copy) NSString *tag;
|
|
|
@property (nonatomic, copy) NSString *architecture;
|
|
|
@property (nonatomic, copy) NSString *section;
|
|
|
-
|
|
|
+@property (nonatomic, copy) NSString *rawString;
|
|
|
|
|
|
|
|
|
- (instancetype)initWithRawControlString:(NSString *)controlString;
|
|
@@ -244,6 +244,7 @@ typedef NS_ENUM(NSInteger, BSPackageFileType)
|
|
|
if ([[currentPackage allKeys] count] > 4)
|
|
|
{
|
|
|
self = [super init];
|
|
|
+ self.rawString = controlString;
|
|
|
[self mapDictionaryToProperties:currentPackage];
|
|
|
return self;
|
|
|
}
|
|
@@ -566,7 +567,7 @@ typedef NS_ENUM(NSInteger, BSPackageFileType)
|
|
|
|
|
|
+ (BOOL)shouldContinueWithError:(NSString *)errorMessage {
|
|
|
|
|
|
- NSString *errorString = [NSString stringWithFormat:@"\n%@Are you sure you want to continue? [y/n]?", errorMessage];
|
|
|
+ NSString *errorString = [NSString stringWithFormat:@"\n%@ Are you sure you want to continue? [y/n]?", errorMessage];
|
|
|
|
|
|
char c;
|
|
|
printf("%s", [errorString UTF8String] );
|
|
@@ -581,10 +582,10 @@ typedef NS_ENUM(NSInteger, BSPackageFileType)
|
|
|
|
|
|
if (c == 'n')
|
|
|
{
|
|
|
- DLog(@"\nsmart move... exiting\n");
|
|
|
+ DLog(@"\n smart move... exiting\n\n");
|
|
|
return FALSE;
|
|
|
} else if (c == 'y') {
|
|
|
- DLog(@"\nits your funeral....\n");
|
|
|
+ DLog(@"\n its your funeral....\n\n");
|
|
|
}
|
|
|
|
|
|
return TRUE;
|
|
@@ -957,7 +958,7 @@ int main(int argc, const char * argv[]) {
|
|
|
|
|
|
//DLog(@"installedPackages: %@", installedPackages);
|
|
|
|
|
|
- DLog(@"\n\nProcessing file: %@\n", debFile);
|
|
|
+ DLog(@"\nProcessing file: %@\n", debFile);
|
|
|
Package *output = [HelperClass packageForDeb:debFile];
|
|
|
|
|
|
DLog(@"\nFound package: '%@' at version: '%@'...\n", output.packageName, output.version );
|
|
@@ -999,7 +1000,7 @@ int main(int argc, const char * argv[]) {
|
|
|
if (safePackage.returnStatus == 1) //ovewrwrites, just warnings!
|
|
|
{
|
|
|
|
|
|
- NSString *error = [NSString stringWithFormat:@" [WARNING] %@ may overwrite the following files: %@\n\n", debFile.lastPathComponent, [safePackage.overwriteFiles componentsJoinedByString:@"\n"]];
|
|
|
+ NSString *error = [NSString stringWithFormat:@" [WARNING] %@ will overwrite the following files: \n\n\t%@\n\n", debFile.lastPathComponent, [safePackage.overwriteFiles componentsJoinedByString:@"\n\t"]];
|
|
|
|
|
|
if(![HelperClass shouldContinueWithError:error]){
|
|
|
|
|
@@ -1042,26 +1043,30 @@ int main(int argc, const char * argv[]) {
|
|
|
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 *outputs = [[HelperClass returnForProcess:runString] componentsJoinedByString:@"\n"];
|
|
|
|
|
|
- DLog(@"\nCreating md5sum file '%@'...\n", listFile);
|
|
|
+ DLog(@"\nCreating md5sum file '%@'...\n", md5s);
|
|
|
|
|
|
[outputs writeToFile:md5s atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
|
|
[man createDirectoryAtPath:debian withIntermediateDirectories:TRUE attributes:nil error:nil];
|
|
|
|
|
|
+ DLog(@"\nExtracting DEBIAN files for processing...\n");
|
|
|
+
|
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -e %@ %@", debFile, debian]];
|
|
|
//NSString *nextPath = [tmpPath stringByAppendingPathComponent:@"DEBIAN"];
|
|
|
|
|
|
+ DLog(@"\nCopying any necessary DEBIAN files to new locations...\n\n");
|
|
|
+
|
|
|
NSArray *files = [man contentsOfDirectoryAtPath:debian error:nil];
|
|
|
[files enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
|
NSString *fullPath = [debian stringByAppendingPathComponent:obj];
|
|
|
if (![obj isEqualToString:@"control"]){
|
|
|
|
|
|
- DLog(@"fullPath: %@", fullPath);
|
|
|
+ DLog(@"Copying file... %@\n\n", fullPath);
|
|
|
NSString *fileName = [NSString stringWithFormat:@"%@.%@", output.packageName, obj];
|
|
|
NSString *newPath = [bootstrapPath stringByAppendingPathComponent:@"Library/dpkg/info"];
|
|
|
newPath = [newPath stringByAppendingPathComponent:fileName];
|
|
|
- DLog(@"newPath: %@", newPath);
|
|
|
+ //DLog(@"newPath: %@", newPath);
|
|
|
[man copyItemAtPath:fullPath toPath:newPath error:nil];
|
|
|
} else {
|
|
|
|
|
@@ -1070,18 +1075,59 @@ int main(int argc, const char * argv[]) {
|
|
|
|
|
|
[controlFile replaceOccurrencesOfString:@"iphoneos-arm" withString:@"appletvos-arm64" options:NSLiteralSearch range:NSMakeRange(0, [controlFile length])];
|
|
|
|
|
|
- DLog(@"control file: %@", controlFile);
|
|
|
+ [controlFile appendString:@"Status: install ok installed"];
|
|
|
|
|
|
+ //DLog(@"control file: -%@-\n", controlFile);
|
|
|
|
|
|
NSString *statusFile = [bootstrapPath stringByAppendingPathComponent:@"Library/dpkg/status"];
|
|
|
|
|
|
+ [FM copyItemAtPath:statusFile toPath:[statusFile stringByAppendingPathExtension:@"bak"] error:nil];
|
|
|
+
|
|
|
NSMutableString *statusContents = [[NSMutableString alloc] initWithContentsOfFile:statusFile encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
|
|
- DLog(@"status contents: %@", statusContents);
|
|
|
+ if (model) { //we found the package model, just replace the old string with our new one
|
|
|
+
|
|
|
+
|
|
|
+ DLog(@"Updating status file for new package version...\n\n");
|
|
|
+
|
|
|
+ [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];
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ DLog(@"Updating status file for new package...\n\n");
|
|
|
+
|
|
|
+ //DLog(@"down here??: -%@-\n", controlFile);
|
|
|
+
|
|
|
+ [statusContents appendFormat:@"%@\n", controlFile];
|
|
|
+
|
|
|
+ //DLog(@"\nnew status file: %@\n", statusContents);
|
|
|
+
|
|
|
+ //[statusContents writeToFileWithoutAttributes:statusFile];
|
|
|
+
|
|
|
+ [statusContents writeToFile:statusFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //DLog(@"\n\nwe down here??\n\n");
|
|
|
+
|
|
|
+ //NSString *newString = [[HelperClass returnForProcess:[NSString stringWithFormat:@"/bin/cat %@", statusFile]] componentsJoinedByString:@"\n"];
|
|
|
+
|
|
|
+ //DLog(@"%@", newString);
|
|
|
|
|
|
- [statusContents appendFormat:@"%@\n", controlFile];
|
|
|
+ //DLog(@"status contents: %@", statusContents);
|
|
|
|
|
|
- [statusContents writeToFile:statusFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// [statusContents writeToFile:statusFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
|
|
|
|
|
|
|
@@ -1091,11 +1137,16 @@ int main(int argc, const char * argv[]) {
|
|
|
}];
|
|
|
|
|
|
//finally actually install the package onto the bootstrap
|
|
|
+
|
|
|
+ DLog(@"Extracting package onto bootstrap folder...\n\n");
|
|
|
+
|
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -x %@ %@", debFile, bootstrapPath]];
|
|
|
//DLog(@"outputs: %@", outputs);
|
|
|
|
|
|
///usr/bin/find "$TARGET_DIR" -type f -not -path "$TARGET_DIR/DEBIAN/*" -exec "/sbin/md5 -r" {} \; | /usr/bin/awk '{ print $1 " " $2 }' | /usr/bin/sed "s|$TARGET_DIR/||g"
|
|
|
|
|
|
+ DLog(@"Done!\n\n");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|