|
@@ -344,6 +344,11 @@
|
|
|
|
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:output.packageName];
|
|
|
NSString *debian = [tmpPath stringByAppendingPathComponent:@"DEBIAN"];
|
|
|
+ NSString *newRoot = nil;
|
|
|
+ if (self.appendedPrefix) {
|
|
|
+ newRoot = [tmpPath stringByAppendingPathComponent:self.appendedPrefix];
|
|
|
+ [FM createDirectoryAtPath:newRoot withIntermediateDirectories:true attributes:nil error:nil];
|
|
|
+ }
|
|
|
[FM createDirectoryAtPath:tmpPath withIntermediateDirectories:TRUE attributes:nil error:nil];
|
|
|
DLog(@"\nExtracting package contents for processing...\n");
|
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -x %@ %@", self.path, tmpPath]];
|
|
@@ -391,54 +396,42 @@
|
|
|
[FM removeItemAtPath:fullPath error:nil];
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ 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];
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
|
- if ([pathComponents count] > 1)
|
|
|
- {
|
|
|
+ if ([pathComponents count] > 1) {
|
|
|
|
|
|
- NSString *rootPath = [pathComponents objectAtIndex:1];
|
|
|
+ NSString *rootPath = pathComponents[1];
|
|
|
//DLog(@"\n Checking root path: %@ for file %@\n", rootPath, obj.path);
|
|
|
- if ([forbiddenRoots containsObject:rootPath])
|
|
|
- {
|
|
|
+ if ([forbiddenRoots containsObject:rootPath]) {
|
|
|
DLog(@"\n [WARNING] package file: '%@' would overwrite symbolic link at '%@'\n", obj.path, rootPath);
|
|
|
NSString *privateDir = [tmpPath stringByAppendingPathComponent:@"private"];
|
|
|
if (![FM fileExistsAtPath:privateDir]){
|
|
|
[FM createDirectoryAtPath:privateDir withIntermediateDirectories:TRUE attributes:nil error:nil];
|
|
|
-
|
|
|
}
|
|
|
//take <package_name>/[rootPath] (could be etc, var, tmp) and move to <package_name>/private/[rootPath]
|
|
|
NSString *badPath = [tmpPath stringByAppendingPathComponent:rootPath];
|
|
|
NSString *newPath = [privateDir stringByAppendingPathComponent:rootPath];
|
|
|
DLog(@"\n [INFO] Moving %@ to %@...", badPath, newPath);
|
|
|
[FM moveItemAtPath:badPath 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];
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
[[HelperClass returnForProcess:depArchiveInfo] componentsJoinedByString:@"\n"];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
DLog(@"\nDone!\n\n");
|
|
|
-
|
|
|
- //return er;
|
|
|
}
|
|
|
|
|
|
- (void)repackageInCurrentDirectoryWithArch:(NSString *)newArch {
|
|
@@ -452,6 +445,11 @@
|
|
|
|
|
|
NSString *tmpPath = [pwd stringByAppendingPathComponent:output.packageName];
|
|
|
NSString *debian = [tmpPath stringByAppendingPathComponent:@"DEBIAN"];
|
|
|
+ NSString *newRoot = nil;
|
|
|
+ if (self.appendedPrefix) {
|
|
|
+ newRoot = [tmpPath stringByAppendingPathComponent:self.appendedPrefix];
|
|
|
+ [FM createDirectoryAtPath:newRoot withIntermediateDirectories:true attributes:nil error:nil];
|
|
|
+ }
|
|
|
[FM createDirectoryAtPath:tmpPath withIntermediateDirectories:TRUE attributes:nil error:nil];
|
|
|
DLog(@"\nExtracting package contents for processing...\n");
|
|
|
[HelperClass returnForProcess:[NSString stringWithFormat:@"/usr/local/bin/dpkg -x %@ %@", self.path, tmpPath]];
|
|
@@ -551,7 +549,15 @@
|
|
|
[FM removeItemAtPath:fullPath error:nil];
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ 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];
|
|
|
+ }
|
|
|
+ }
|
|
|
NSArray *pathComponents = [obj.path pathComponents];
|
|
|
if ([pathComponents count] > 1)
|
|
|
{
|