|
@@ -324,7 +324,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)validateSignaturesInPath:(NSString *)thePath {
|
|
|
-
|
|
|
+ if (self.skipSignatureChecks) { return; }
|
|
|
[self.files enumerateObjectsUsingBlock:^(InputPackageFile * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
NSString *file = [thePath stringByAppendingPathComponent:obj.path];
|
|
|
NSLog(@"check sig file: %@", file);
|
|
@@ -339,7 +339,7 @@
|
|
|
NSString *pwd = [HelperClass singleLineReturnForProcess:@"/bin/pwd"];
|
|
|
DLog(@"\nProcessing file: %@\n", self.path);
|
|
|
InputPackage *output = self;
|
|
|
-
|
|
|
+ NSMutableArray *moveRoot = [NSMutableArray new];
|
|
|
DLog(@"\nFound package: '%@' at version: '%@'...\n", output.packageName, output.version );
|
|
|
|
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:output.packageName];
|
|
@@ -396,19 +396,15 @@
|
|
|
[FM removeItemAtPath:fullPath error:nil];
|
|
|
|
|
|
}
|
|
|
- if (self.appendedPrefix.length > 0) {
|
|
|
+
|
|
|
+ if (self.appendedPrefix.length > 0 && [obj.path properPathComponents].count == 1) {
|
|
|
if (![obj.path containsString:self.appendedPrefix]){
|
|
|
+ [moveRoot addObject:obj.path];
|
|
|
DLog(@"[INFO] %@ doesnt have the prefix!", obj.path);
|
|
|
- NSString *oldPath = [tmpPath stringByAppendingPathComponent:obj.path];
|
|
|
- NSString *newPath = [newRoot stringByAppendingPathComponent:obj.path];
|
|
|
- DLog(@"[INFO] moving %@ to %@", oldPath, newPath);
|
|
|
- [FM moveItemAtPath:oldPath toPath:newPath error:nil];
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
|
if ([pathComponents count] > 1) {
|
|
|
-
|
|
|
NSString *rootPath = pathComponents[1];
|
|
|
//DLog(@"\n Checking root path: %@ for file %@\n", rootPath, obj.path);
|
|
|
if ([forbiddenRoots containsObject:rootPath]) {
|
|
@@ -426,6 +422,12 @@
|
|
|
}
|
|
|
}
|
|
|
}];
|
|
|
+ [moveRoot enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ NSString *oldPath = [tmpPath stringByAppendingPathComponent:obj];
|
|
|
+ NSString *newPath = [newRoot stringByAppendingPathComponent:obj];
|
|
|
+ DLog(@"[INFO] moving %@ to %@", oldPath, newPath);
|
|
|
+ [FM moveItemAtPath:oldPath toPath:newPath error:nil];
|
|
|
+ }];
|
|
|
NSString *depArchiveInfo = [NSString stringWithFormat:@"/usr/local/bin/dpkg -b %@", self.packageName];
|
|
|
if (fakeRoot) {
|
|
|
depArchiveInfo = [NSString stringWithFormat:@"%@ /usr/local/bin/dpkg -b %@", fakeRoot, self.packageName];
|
|
@@ -446,6 +448,7 @@
|
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:output.packageName];
|
|
|
NSString *debian = [tmpPath stringByAppendingPathComponent:@"DEBIAN"];
|
|
|
NSString *newRoot = nil;
|
|
|
+ NSMutableArray *moveRoot = [NSMutableArray new];
|
|
|
if (self.appendedPrefix) {
|
|
|
newRoot = [tmpPath stringByAppendingPathComponent:self.appendedPrefix];
|
|
|
[FM createDirectoryAtPath:newRoot withIntermediateDirectories:true attributes:nil error:nil];
|
|
@@ -552,10 +555,7 @@
|
|
|
if (self.appendedPrefix.length > 0) {
|
|
|
if (![obj.path containsString:self.appendedPrefix]){
|
|
|
DLog(@"[INFO] %@ doesnt have the prefix!", obj.path);
|
|
|
- NSString *oldPath = [tmpPath stringByAppendingPathComponent:obj.path];
|
|
|
- NSString *newPath = [newRoot stringByAppendingPathComponent:obj.path];
|
|
|
- DLog(@"[INFO] moving %@ to %@", oldPath, newPath);
|
|
|
- [FM moveItemAtPath:oldPath toPath:newPath error:nil];
|
|
|
+ [moveRoot addObject:obj.path];
|
|
|
}
|
|
|
}
|
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
@@ -577,18 +577,16 @@
|
|
|
NSString *newPath = [privateDir stringByAppendingPathComponent:rootPath];
|
|
|
DLog(@"\n [INFO] Moving %@ to %@...", badPath, newPath);
|
|
|
[FM moveItemAtPath:badPath toPath:newPath error:nil];
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}];
|
|
|
-
|
|
|
-
|
|
|
+ [moveRoot enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ NSString *oldPath = [tmpPath stringByAppendingPathComponent:obj];
|
|
|
+ NSString *newPath = [newRoot stringByAppendingPathComponent:obj];
|
|
|
+ DLog(@"[INFO] moving %@ to %@", oldPath, newPath);
|
|
|
+ [FM moveItemAtPath:oldPath toPath:newPath error:nil];
|
|
|
+ }];
|
|
|
NSString *depArchiveInfo = [NSString stringWithFormat:@"/usr/local/bin/dpkg -b %@", self.packageName];
|
|
|
|
|
|
if (fakeRoot) {
|