mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
For sandbox testing, we really have to use ad-hoc signing. Which means we have to sign the "new" app after we alter its info.plist file, so that our code signing verifier doesn't (rightfully) complain
33 lines
828 B
Objective-C
33 lines
828 B
Objective-C
//
|
|
// SUAdHocCodeSigning.m
|
|
// Sparkle
|
|
//
|
|
// Created by Mayur Pawashe on 3/4/16.
|
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
|
//
|
|
|
|
#import "SUAdHocCodeSigning.h"
|
|
|
|
@implementation SUAdHocCodeSigning
|
|
|
|
+ (BOOL)codeSignApplicationAtPath:(NSString *)applicationPath
|
|
{
|
|
BOOL success = NO;
|
|
@try
|
|
{
|
|
// ad-hoc signing with the dash
|
|
NSArray *arguments = @[ @"--force", @"--deep", @"--sign", @"-", applicationPath ];
|
|
NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/codesign" arguments:arguments];
|
|
[task waitUntilExit];
|
|
success = (task.terminationStatus == 0);
|
|
}
|
|
@catch (NSException *exception)
|
|
{
|
|
NSLog(@"Failed to code sign application at %@", applicationPath);
|
|
NSLog(@"Exception: %@", exception);
|
|
}
|
|
return success;
|
|
}
|
|
|
|
@end
|