|
@@ -16,7 +16,7 @@
|
|
|
#import <sys/utsname.h>
|
|
|
#import "HelperClass.h"
|
|
|
|
|
|
-#define OPTION_FLAGS "o:i:ld:hcrbp:su:"
|
|
|
+#define OPTION_FLAGS "o:i:ld:hcrbp:su:y"
|
|
|
|
|
|
char *progname;
|
|
|
char *path;
|
|
@@ -33,6 +33,7 @@ static struct option longopts[] = {
|
|
|
{ "prefix", required_argument, NULL, 'p' },
|
|
|
{ "skip", no_argument, NULL, 's' },
|
|
|
{ "unique", required_argument, NULL, 'u' },
|
|
|
+ { "yes", no_argument, NULL, 'y' },
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
};
|
|
|
|
|
@@ -48,7 +49,9 @@ void cmd_help(void){
|
|
|
printf(" -r, --repackage\t\trepackage to fix bad locations and to change architecture\n");
|
|
|
printf(" -b, --bump\t\t\trepackage and bump by one - number (ie 1.0-1 -> 1.0-2)\n");
|
|
|
printf(" -s, --skip\t\t\tskip code signature checks when bumping and repackaging\n");
|
|
|
+ printf(" -y, --yes\t\t\talways answer yes to prompts to overwrite files\n");
|
|
|
printf(" -p, --prefix\t\t\tthe prefix to append to all packages when repackaging or bumping a version number\n");
|
|
|
+
|
|
|
printf("\n");
|
|
|
}
|
|
|
|
|
@@ -70,6 +73,15 @@ int main(int argc, char **argv) {
|
|
|
BOOL skip = FALSE;
|
|
|
BOOL bump = FALSE;
|
|
|
BOOL clean = FALSE;
|
|
|
+ BOOL forceYes = FALSE;
|
|
|
+ /*
|
|
|
+ NSString *searchPathString = @"/Users/bradleyk/.rbenv/shims:/Users/bradleyk/Library/Python/3.9/bin:/Users/bradleyk/Library/Python/3.8/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/lib/ruby/gems/bin:/usr/local/opt/ruby/bin:/opt/local/bin:/opt/local/sbin:/Users/bradleyk/local/bin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/Users/bradleyk/Projects/goprojects/bin:/Users/bradleyk/Projects/theos/bin:/usr/local/bin/:/usr/local/bin:/bin/:/sbin/:/usr/sbin/";
|
|
|
+ NSString *target = @"dpkg-deb";
|
|
|
+ NSString *gotIm = [target pathForBin:target searchPaths:searchPathString];
|
|
|
+ DLog(@"gotIm: %@", gotIm);
|
|
|
+ return 0;
|
|
|
+ */
|
|
|
+ NSString *up = nil;
|
|
|
while ((flag = getopt_long(argc, argv, OPTION_FLAGS, longopts, NULL)) != -1) {
|
|
|
switch(flag) {
|
|
|
case 'o':
|
|
@@ -79,6 +91,9 @@ int main(int argc, char **argv) {
|
|
|
case 'i':
|
|
|
debFile = [NSString stringWithUTF8String:optarg];
|
|
|
break;
|
|
|
+ case 'y':
|
|
|
+ forceYes = TRUE;
|
|
|
+ break;
|
|
|
|
|
|
case 'l':
|
|
|
listPackage = TRUE;
|
|
@@ -122,7 +137,7 @@ int main(int argc, char **argv) {
|
|
|
argc -= optind;
|
|
|
argv += optind;
|
|
|
bootstrapPath = [NSString stringWithUTF8String:argv[0]];
|
|
|
- DLog(@"bootstrap path: %@?", bootstrapPath);
|
|
|
+ //yDLog(@"bootstrap path: %@?", bootstrapPath);
|
|
|
//return 0;
|
|
|
}
|
|
|
|
|
@@ -210,7 +225,7 @@ int main(int argc, char **argv) {
|
|
|
StatusPackageModel *model = [[installedPackages filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"package == %@", deletePackage]] lastObject];
|
|
|
if (model) {
|
|
|
NSString *listName = [NSString stringWithFormat:@"%@.list", deletePackage];
|
|
|
- NSString *infoPath = [bootstrapPath stringByAppendingPathComponent:@"Library/dpkg/info"];
|
|
|
+ NSString *infoPath = [bootstrapPath relativeInfoFolderPath];
|
|
|
NSString *listFile = [infoPath stringByAppendingPathComponent:listName];
|
|
|
NSArray *listFiles = [FM contentsOfDirectoryAtPath:infoPath error:nil];
|
|
|
NSPredicate *blockPred = [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
|
|
@@ -254,7 +269,6 @@ int main(int argc, char **argv) {
|
|
|
[FM removeItemAtPath:obj error:nil];
|
|
|
}];
|
|
|
|
|
|
- //TODO: delete the files here!
|
|
|
NSString *statusFile = [bootstrapPath relativeStatusFilePath];
|
|
|
[FM copyItemAtPath:statusFile toPath:[statusFile stringByAppendingPathExtension:@"bak"] error:nil];
|
|
|
__block NSMutableString *newStatusFile = [NSMutableString new];
|
|
@@ -306,6 +320,7 @@ int main(int argc, char **argv) {
|
|
|
if (debFile && bootstrapPath) {
|
|
|
DLog(@"\nProcessing file: %@\n", debFile);
|
|
|
InputPackage *output = [HelperClass packageForDeb:debFile];
|
|
|
+ output.forceOverwrite = forceYes;
|
|
|
return [output installToBootstrapPath:bootstrapPath];
|
|
|
|
|
|
} else if (debFile) {
|