|
@@ -97,9 +97,8 @@
|
|
NSString *packageVersion = [HelperClass singleLineReturnForProcess:@"%@ -f %@ Version", dpkg, debFile];
|
|
NSString *packageVersion = [HelperClass singleLineReturnForProcess:@"%@ -f %@ Version", dpkg, debFile];
|
|
NSString *architecture = [HelperClass singleLineReturnForProcess:@"%@ -f %@ Architecture", dpkg, debFile];
|
|
NSString *architecture = [HelperClass singleLineReturnForProcess:@"%@ -f %@ Architecture", dpkg, debFile];
|
|
NSArray <InputPackageFile *> *fileList = [HelperClass returnForProcess:[NSString stringWithFormat:@"%@ -c %@", dpkg, debFile]];
|
|
NSArray <InputPackageFile *> *fileList = [HelperClass returnForProcess:[NSString stringWithFormat:@"%@ -c %@", dpkg, debFile]];
|
|
-
|
|
|
|
__block NSMutableArray *finalArray = [NSMutableArray new];
|
|
__block NSMutableArray *finalArray = [NSMutableArray new];
|
|
-
|
|
|
|
|
|
+ NSArray *excludeArray = [excludesFile excludeArrayFromFile];
|
|
[fileList enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
[fileList enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
InputPackageFile *file = [InputPackage packageFileFromLine:obj];
|
|
InputPackageFile *file = [InputPackage packageFileFromLine:obj];
|
|
if (file) {
|
|
if (file) {
|
|
@@ -107,7 +106,6 @@
|
|
[finalArray addObject:file];
|
|
[finalArray addObject:file];
|
|
}
|
|
}
|
|
}];
|
|
}];
|
|
-
|
|
|
|
InputPackage *pkg = [InputPackage new];
|
|
InputPackage *pkg = [InputPackage new];
|
|
pkg.excludeFile = excludesFile;
|
|
pkg.excludeFile = excludesFile;
|
|
pkg.files = finalArray;
|
|
pkg.files = finalArray;
|
|
@@ -116,6 +114,20 @@
|
|
pkg.version = packageVersion;
|
|
pkg.version = packageVersion;
|
|
pkg.architecture = architecture;
|
|
pkg.architecture = architecture;
|
|
pkg.validLDIDPath = [HelperClass validLDIDPath];
|
|
pkg.validLDIDPath = [HelperClass validLDIDPath];
|
|
|
|
+ if (excludeArray) {
|
|
|
|
+ __block NSMutableArray *filesToRemove = [NSMutableArray new];
|
|
|
|
+ [excludeArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
+ if ([obj length] > 0){
|
|
|
|
+ NSArray *items = [fileList filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF LIKE[c] %@", obj]];
|
|
|
|
+ if (items.count > 0) {
|
|
|
|
+ //DLog(@"found items to remove: %@", items);
|
|
|
|
+ [filesToRemove addObjectsFromArray:items];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }];
|
|
|
|
+ //DLog(@"\nShould remove the following: %@", filesToRemove);
|
|
|
|
+ pkg.excludedFiles = filesToRemove;
|
|
|
|
+ }
|
|
return pkg;
|
|
return pkg;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -134,7 +146,6 @@
|
|
|
|
|
|
}];
|
|
}];
|
|
return [NSString stringWithFormat:@"%@ = %@", orig, details];
|
|
return [NSString stringWithFormat:@"%@ = %@", orig, details];
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- (NSArray *)rootPaths {
|
|
- (NSArray *)rootPaths {
|
|
@@ -155,9 +166,11 @@
|
|
[self.files enumerateObjectsUsingBlock:^(InputPackageFile * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
[self.files enumerateObjectsUsingBlock:^(InputPackageFile * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
|
if ([obj.fileType isEqualToString:@"link"]){ //does this need to handle things differently?
|
|
if ([obj.fileType isEqualToString:@"link"]){ //does this need to handle things differently?
|
|
- [outFiles addObject:obj.linkDestination];
|
|
|
|
|
|
+ [outFiles addObject:[obj.linkDestination substringFromIndex:1]];
|
|
} else {
|
|
} else {
|
|
- [outFiles addObject:obj.path];
|
|
|
|
|
|
+ if (obj.path.length > 1){
|
|
|
|
+ [outFiles addObject:obj.path];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}];
|
|
}];
|
|
return [outFiles componentsJoinedByString:@"\n"];
|
|
return [outFiles componentsJoinedByString:@"\n"];
|
|
@@ -253,33 +266,23 @@
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
ErrorReturn *safePackage = [self errorReturnForBootstrap:bootstrapPath];
|
|
ErrorReturn *safePackage = [self errorReturnForBootstrap:bootstrapPath];
|
|
-
|
|
|
|
- if (safePackage.returnStatus != 0) { //zero is success
|
|
|
|
-
|
|
|
|
- if (safePackage.returnStatus == 1) //ovewrwrites, just warnings!
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
|
|
+ if (safePackage.returnStatus != ErrorReturnTypeNone) {
|
|
|
|
+ if (safePackage.returnStatus == ErrorReturnTypeOverwriteWarnings) {
|
|
NSString *error = [NSString stringWithFormat:@" [WARNING] %@ will overwrite the following files: \n\n\t%@\n\n", self.path.lastPathComponent, [safePackage.overwriteFiles componentsJoinedByString:@"\n\t"]];
|
|
NSString *error = [NSString stringWithFormat:@" [WARNING] %@ will overwrite the following files: \n\n\t%@\n\n", self.path.lastPathComponent, [safePackage.overwriteFiles componentsJoinedByString:@"\n\t"]];
|
|
if (!self.forceOverwrite) {
|
|
if (!self.forceOverwrite) {
|
|
if(![HelperClass shouldContinueWithPrompt:error]){
|
|
if(![HelperClass shouldContinueWithPrompt:error]){
|
|
-
|
|
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else if (safePackage.returnStatus == 2) //bail!!"
|
|
|
|
- {
|
|
|
|
|
|
+ } else if (safePackage.returnStatus == ErrorReturnTypeForbiddenFailure) {
|
|
if (![self forceInstall]) {
|
|
if (![self forceInstall]) {
|
|
- return 2;
|
|
|
|
|
|
+ return ErrorReturnTypeForbiddenFailure;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
NSString *pwd = [[HelperClass returnForProcess:@"/bin/pwd"] componentsJoinedByString:@"\n"];
|
|
NSString *pwd = [[HelperClass returnForProcess:@"/bin/pwd"] componentsJoinedByString:@"\n"];
|
|
|
|
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:self.packageName];
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:self.packageName];
|
|
@@ -288,14 +291,13 @@
|
|
DLog(@"\nExtracting deb for processing...\n");
|
|
DLog(@"\nExtracting deb for processing...\n");
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"%@ -x %@ %@", dpkg, self.path, tmpPath]];
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"%@ -x %@ %@", dpkg, self.path, tmpPath]];
|
|
|
|
|
|
- NSArray *fileList = [self getFileListing];
|
|
|
|
-
|
|
|
|
- if (fileList.count > 0) {
|
|
|
|
|
|
+ NSString *listOutput = [self listfile];
|
|
|
|
+ if (listOutput.length > 10) {
|
|
|
|
|
|
NSString *baseFile = [NSString stringWithFormat:@"%@.list", self.packageName];
|
|
NSString *baseFile = [NSString stringWithFormat:@"%@.list", self.packageName];
|
|
|
|
|
|
NSString *listFile = [bootstrapPath.relativeInfoFolderPath stringByAppendingPathComponent:baseFile];
|
|
NSString *listFile = [bootstrapPath.relativeInfoFolderPath stringByAppendingPathComponent:baseFile];
|
|
- NSString *listOutput = [fileList componentsJoinedByString:@"\n"];
|
|
|
|
|
|
+ //NSString *listOutput = [fileList componentsJoinedByString:@"\n"];
|
|
DLog(@"\nCreating list file '%@'...\n", listFile);
|
|
DLog(@"\nCreating list file '%@'...\n", listFile);
|
|
//DLog(@"list: %@", listOutput);
|
|
//DLog(@"list: %@", listOutput);
|
|
[[listOutput stringByAppendingString:@"\n"] writeToFile:listFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
[[listOutput stringByAppendingString:@"\n"] writeToFile:listFile atomically:TRUE encoding:NSUTF8StringEncoding error:nil];
|
|
@@ -310,17 +312,6 @@
|
|
*/
|
|
*/
|
|
//NSString *md5s = [bootstrapInfoPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.md5sums", self.packageName]];
|
|
//NSString *md5s = [bootstrapInfoPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.md5sums", self.packageName]];
|
|
|
|
|
|
- //DLog(@"\nCreating list file '%@'...\n", listFile);
|
|
|
|
-
|
|
|
|
- //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"
|
|
//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];
|
|
//[self.listfile writeToFile:listFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
|
|
@@ -365,8 +356,7 @@
|
|
|
|
|
|
//[controlFile replaceOccurrencesOfString:@"iphoneos-arm" withString:@"appletvos-arm64" options:NSLiteralSearch range:NSMakeRange(0, [controlFile length])];
|
|
//[controlFile replaceOccurrencesOfString:@"iphoneos-arm" withString:@"appletvos-arm64" options:NSLiteralSearch range:NSMakeRange(0, [controlFile length])];
|
|
|
|
|
|
- NSString *controlString = self.unpack ? @"Status: install ok unpacked" : @"Status: install ok installed";
|
|
|
|
-
|
|
|
|
|
|
+ NSString *controlString = self.unpack ? @"Status: install ok unpacked\n" : @"Status: install ok installed\n";
|
|
[controlFile appendString:controlString];
|
|
[controlFile appendString:controlString];
|
|
|
|
|
|
//DLog(@"control file: -%@-\n", controlFile);
|
|
//DLog(@"control file: -%@-\n", controlFile);
|
|
@@ -374,9 +364,9 @@
|
|
NSString *statusFile = [bootstrapPath relativeStatusFilePath];
|
|
NSString *statusFile = [bootstrapPath relativeStatusFilePath];
|
|
|
|
|
|
[FM copyItemAtPath:statusFile toPath:[statusFile stringByAppendingPathExtension:@"bak"] error:nil];
|
|
[FM copyItemAtPath:statusFile toPath:[statusFile stringByAppendingPathExtension:@"bak"] error:nil];
|
|
-
|
|
|
|
- NSMutableString *statusContents = [[NSMutableString alloc] initWithContentsOfFile:statusFile encoding:NSASCIIStringEncoding error:nil];
|
|
|
|
-
|
|
|
|
|
|
+ NSString *statusCont = [[NSString stringWithContentsOfFile:statusFile encoding:NSASCIIStringEncoding error:nil] sanitizedControlString];
|
|
|
|
+ NSMutableString *statusContents = [statusCont mutableCopy];//[[NSMutableString alloc] initWithContentsOfFile:statusFile encoding:NSASCIIStringEncoding error:nil];
|
|
|
|
+ //[statusContents sanitizedControlString];
|
|
if (model) { //we found the package model, just replace the old string with our new one
|
|
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");
|
|
DLog(@"Updating status file for new package version...\n\n");
|
|
|
|
|
|
@@ -388,6 +378,7 @@
|
|
|
|
|
|
//DLog(@"down here??: -%@-\n", controlFile);
|
|
//DLog(@"down here??: -%@-\n", controlFile);
|
|
[statusContents appendFormat:@"%@\n", controlFile];
|
|
[statusContents appendFormat:@"%@\n", controlFile];
|
|
|
|
+
|
|
//DLog(@"\nnew status file: %@\n", statusContents);
|
|
//DLog(@"\nnew status file: %@\n", statusContents);
|
|
//[statusContents writeToFileWithoutAttributes:statusFile];
|
|
//[statusContents writeToFileWithoutAttributes:statusFile];
|
|
[statusContents writeToFile:statusFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
|
|
[statusContents writeToFile:statusFile atomically:TRUE encoding:NSASCIIStringEncoding error:nil];
|
|
@@ -833,7 +824,7 @@
|
|
- (ErrorReturn *)errorReturnForBootstrap:(NSString *)bootstrapPath {
|
|
- (ErrorReturn *)errorReturnForBootstrap:(NSString *)bootstrapPath {
|
|
NSArray *ignoreFiles = @[@".fauxsu", @".DS_Store"];
|
|
NSArray *ignoreFiles = @[@".fauxsu", @".DS_Store"];
|
|
NSArray *forbiddenRoots = @[@"etc", @"var", @"tmp"];
|
|
NSArray *forbiddenRoots = @[@"etc", @"var", @"tmp"];
|
|
- __block NSInteger returnValue = 0; //0 = good to go 1 = over write warning, 2 = no go
|
|
|
|
|
|
+ __block NSInteger returnValue = ErrorReturnTypeNone; //0 = good to go 1 = over write warning, 2 = no go
|
|
__block NSMutableArray *_overwriteArray = [NSMutableArray new];
|
|
__block NSMutableArray *_overwriteArray = [NSMutableArray new];
|
|
[self.files enumerateObjectsUsingBlock:^(InputPackageFile * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
[self.files enumerateObjectsUsingBlock:^(InputPackageFile * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if ([obj.fileType isEqualToString:@"file"]){
|
|
if ([obj.fileType isEqualToString:@"file"]){
|
|
@@ -842,7 +833,7 @@
|
|
//DLog(@"[WARNING] overwriting a file that already exists and isn't DS_Store or .fauxsu: %@", fullPath);
|
|
//DLog(@"[WARNING] overwriting a file that already exists and isn't DS_Store or .fauxsu: %@", fullPath);
|
|
[_overwriteArray addObject:obj.path];
|
|
[_overwriteArray addObject:obj.path];
|
|
//*stop = TRUE;//return FALSE;
|
|
//*stop = TRUE;//return FALSE;
|
|
- returnValue = 1;
|
|
|
|
|
|
+ returnValue = ErrorReturnTypeOverwriteWarnings;
|
|
}
|
|
}
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
if ([pathComponents count] > 1) {
|
|
if ([pathComponents count] > 1) {
|
|
@@ -850,7 +841,7 @@
|
|
if ([forbiddenRoots containsObject:rootPath]) {
|
|
if ([forbiddenRoots containsObject:rootPath]) {
|
|
DLog(@"\n [ERROR] package file: '%@' would overwrite symbolic link at '%@'! Exiting!\n\n", obj.path, rootPath);
|
|
DLog(@"\n [ERROR] package file: '%@' would overwrite symbolic link at '%@'! Exiting!\n\n", obj.path, rootPath);
|
|
*stop = TRUE;
|
|
*stop = TRUE;
|
|
- returnValue = 2;
|
|
|
|
|
|
+ returnValue = ErrorReturnTypeForbiddenFailure;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|