mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
29
Commits
analyzer-test
...
2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85d3fa2e0e | ||
|
|
81b281b596 | ||
|
|
ee3f8f3285 | ||
|
|
26f1209fe9 | ||
|
|
2195ee0883 | ||
|
|
92c8142354 | ||
|
|
1d04bd44ab | ||
|
|
017f8f733e | ||
|
|
b37fa239db | ||
|
|
831e9b4eb7 | ||
|
|
0a19f6f30d | ||
|
|
3a64116913 | ||
|
|
1ef42e9d1c | ||
|
|
c500487077 | ||
|
|
acc4674c3e | ||
|
|
39cedd4092 | ||
|
|
4517d61db5 | ||
|
|
18fe269949 | ||
|
|
3a9c257691 | ||
|
|
3fcc87086c | ||
|
|
4b6527424a | ||
|
|
1adbbccf5e | ||
|
|
d792a3a4a9 | ||
|
|
32bc43fa9b | ||
|
|
4b9388d9aa | ||
|
|
c53ed49e5e | ||
|
|
011a7dbb36 | ||
|
|
fb1f5aafbe | ||
|
|
52511a2b1c |
No files matched your search
@@ -32,3 +32,5 @@ https://github.com/sparkle-project/Sparkle#troubleshooting
|
||||
```
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
|
||||
[The more information provided and pasted verbatim, the easier it will be to diagnose an issue. If you can provide the affected application/binary and XML feed to reproduce an issue, share them]
|
||||
@@ -32,3 +32,5 @@ https://github.com/sparkle-project/Sparkle#troubleshooting
|
||||
```
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
|
||||
[The more information provided and pasted verbatim, the easier it will be to diagnose an issue. If you can provide the affected application/binary and XML feed to reproduce an issue, share them]
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
run: |
|
||||
git config user.name Sparkle-Bot
|
||||
git config user.email sparkle.project.bot@gmail.com
|
||||
git tag "${{ github.event.inputs.marketingVersion }}"
|
||||
git tag "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
|
||||
- name: "Build release distribution"
|
||||
run: make release
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
|
||||
- name: "Push the updated Swift package description"
|
||||
- name: "Push the updated package description"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
run: git push
|
||||
@@ -90,8 +90,8 @@ jobs:
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ env.PRERELEASE_VERSION }}
|
||||
name: "Sparkle ${{ github.event.inputs.marketingVersion }}"
|
||||
tag_name: ${{ github.event.inputs.marketingVersion }}
|
||||
name: "Sparkle ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
body_path: latest-changes.txt
|
||||
|
||||
@@ -203,7 +203,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
|
||||
|
||||
// Delta & package updates will require validation before extraction
|
||||
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or DSA keys
|
||||
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or EdDSA keys
|
||||
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||
|
||||
if (needsPrevalidation) {
|
||||
@@ -330,7 +330,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Mark that we have received the installation data
|
||||
// Do not rely on eg: self.ipdateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
|
||||
// Do not rely on eg: self.updateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
|
||||
self.receivedInstallationData = YES;
|
||||
|
||||
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
// Note that kSecCSCheckNestedCode may not work with pre-Mavericks code signing.
|
||||
// See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206
|
||||
// Aditionally, there are several reasons to stay away from deep verification and to prefer DSA signing the download archive instead.
|
||||
// Aditionally, there are several reasons to stay away from deep verification and to prefer EdDSA signing the download archive instead.
|
||||
// See https://github.com/sparkle-project/Sparkle/pull/523#commitcomment-17549302 and https://github.com/sparkle-project/Sparkle/issues/543
|
||||
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError);
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
// get a unique mount point path
|
||||
NSString *mountPoint = nil;
|
||||
NSFileManager *manager;
|
||||
NSError *error;
|
||||
NSArray *contents;
|
||||
NSError *error = nil;
|
||||
NSArray *contents = nil;
|
||||
do
|
||||
{
|
||||
// Using NSUUID would make creating UUIDs be done in Cocoa,
|
||||
@@ -82,8 +82,7 @@
|
||||
// Note: this check does not follow symbolic links, which is what we want
|
||||
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
|
||||
|
||||
NSData *promptData = nil;
|
||||
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||
NSData *promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||
|
||||
NSMutableArray *arguments = [@[@"attach", self.archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"] mutableCopy];
|
||||
|
||||
@@ -102,7 +101,7 @@
|
||||
|
||||
NSData *output = nil;
|
||||
NSInteger taskResult = -1;
|
||||
@try
|
||||
|
||||
{
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = @"/usr/bin/hdiutil";
|
||||
@@ -115,23 +114,55 @@
|
||||
task.standardInput = inputPipe;
|
||||
task.standardOutput = outputPipe;
|
||||
|
||||
[task launch];
|
||||
NSFileHandle *fileStdHandle = outputPipe.fileHandleForReading;
|
||||
NSMutableData *currentOutput = [NSMutableData data];
|
||||
|
||||
fileStdHandle.readabilityHandler = ^(NSFileHandle *file) {
|
||||
[currentOutput appendData:file.availableData];
|
||||
};
|
||||
|
||||
dispatch_semaphore_t terminationSemaphore = dispatch_semaphore_create(0);
|
||||
task.terminationHandler = ^(NSTask *__unused terminatingTask) {
|
||||
fileStdHandle.readabilityHandler = nil;
|
||||
|
||||
dispatch_semaphore_signal(terminationSemaphore);
|
||||
};
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (![task launchAndReturnError:&error]) {
|
||||
goto reportError;
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *) {
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
|
||||
[notifier notifyProgress:0.125];
|
||||
|
||||
[inputPipe.fileHandleForWriting writeData:promptData];
|
||||
|
||||
if (@available(macOS 10.15, *)) {
|
||||
if (![inputPipe.fileHandleForWriting writeData:promptData error:&error]) {
|
||||
goto reportError;
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[inputPipe.fileHandleForWriting writeData:promptData];
|
||||
} @catch (NSException *) {
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
|
||||
[inputPipe.fileHandleForWriting closeFile];
|
||||
|
||||
// Read data to end *before* waiting until the task ends so we don't deadlock if the stdout buffer becomes full if we haven't consumed from it
|
||||
output = [outputPipe.fileHandleForReading readDataToEndOfFile];
|
||||
dispatch_semaphore_wait(terminationSemaphore, DISPATCH_TIME_FOREVER);
|
||||
output = [currentOutput copy];
|
||||
|
||||
[task waitUntilExit];
|
||||
taskResult = task.terminationStatus;
|
||||
}
|
||||
@catch (NSException *)
|
||||
{
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[notifier notifyProgress:0.5];
|
||||
|
||||
@@ -146,14 +177,14 @@
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
manager = [[NSFileManager alloc] init];
|
||||
contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
|
||||
if (error)
|
||||
if (contents == nil)
|
||||
{
|
||||
SULog(SULogLevelError, @"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
double itemsCopied = 0;
|
||||
double totalItems = [contents count];
|
||||
double totalItems = (double)[contents count];
|
||||
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
@@ -190,11 +221,20 @@
|
||||
task.standardOutput = [NSPipe pipe];
|
||||
task.standardError = [NSPipe pipe];
|
||||
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
|
||||
SULog(SULogLevelError, @"Exception: %@", exception);
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *launchCleanupError = nil;
|
||||
if (![task launchAndReturnError:&launchCleanupError]) {
|
||||
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
|
||||
SULog(SULogLevelError, @"Error: %@", launchCleanupError);
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
|
||||
SULog(SULogLevelError, @"Exception: %@", exception);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Can't mount DMG %@", self.archivePath);
|
||||
|
||||
@@ -53,26 +53,46 @@
|
||||
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
|
||||
// Set the $HOME and $USER variables so pre/post install scripts reference the correct user environment
|
||||
task.environment = @{@"HOME": self.homeDirectory, @"USER": self.userName};
|
||||
task.standardError = [NSPipe pipe];
|
||||
task.standardOutput = [NSPipe pipe];
|
||||
task.standardError = nil;
|
||||
task.standardOutput = nil;
|
||||
|
||||
BOOL success = YES;
|
||||
@try {
|
||||
[task launch];
|
||||
[task waitUntilExit];
|
||||
if (task.terminationStatus != EXIT_SUCCESS) {
|
||||
success = NO;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *launchError = nil;
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Guided package installer failed to launch" }];
|
||||
|
||||
if (launchError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = launchError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
} @catch (NSException *) {
|
||||
success = NO;
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }];
|
||||
} else {
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Guided package installer task threw an exception" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
if (task.terminationStatus != EXIT_SUCCESS) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)performCleanup
|
||||
|
||||
+124
-49
@@ -93,7 +93,6 @@
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
@autoreleasepool {
|
||||
NSError *error = nil;
|
||||
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
|
||||
|
||||
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
||||
@@ -101,58 +100,134 @@
|
||||
// Get the file size.
|
||||
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
|
||||
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
|
||||
if (expectedLength > 0) {
|
||||
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
|
||||
|
||||
if (expectedLength == 0) {
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
|
||||
|
||||
NSPipe *pipe = [NSPipe pipe];
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
[task setStandardInput:[pipe fileHandleForReading]];
|
||||
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
|
||||
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
|
||||
[task setLaunchPath:command];
|
||||
[task setArguments:[args arrayByAddingObject:destination]];
|
||||
@try {
|
||||
[task launch];
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||
NSUInteger bytesRead = 0;
|
||||
do {
|
||||
NSData *data = [archiveInput readDataOfLength:256*1024];
|
||||
NSUInteger len = [data length];
|
||||
if (!len) {
|
||||
break;
|
||||
}
|
||||
bytesRead += len;
|
||||
[archiveOutput writeData:data];
|
||||
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
|
||||
}
|
||||
while(bytesRead < expectedLength);
|
||||
|
||||
[archiveOutput closeFile];
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
if ([task terminationStatus] == 0) {
|
||||
if (bytesRead == expectedLength) {
|
||||
[notifier notifySuccess];
|
||||
return;
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
|
||||
|
||||
}
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
|
||||
}
|
||||
[notifier notifyFailureWithError:error];
|
||||
return;
|
||||
}
|
||||
|
||||
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
|
||||
|
||||
NSPipe *pipe = [NSPipe pipe];
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
[task setStandardInput:pipe];
|
||||
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
|
||||
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
|
||||
[task setLaunchPath:command];
|
||||
[task setArguments:[args arrayByAddingObject:destination]];
|
||||
|
||||
NSError *launchError = nil;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
[notifier notifyFailureWithError:launchError];
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *e) {
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
|
||||
[notifier notifyFailureWithError:error];
|
||||
return;
|
||||
}
|
||||
}
|
||||
[notifier notifyFailureWithError:error];
|
||||
|
||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||
NSUInteger bytesWritten = 0;
|
||||
|
||||
BOOL hasIOErrorMethods;
|
||||
if (@available(macOS 10.15, *)) {
|
||||
hasIOErrorMethods = YES;
|
||||
} else {
|
||||
hasIOErrorMethods = NO;
|
||||
}
|
||||
|
||||
do {
|
||||
NSData *data;
|
||||
if (hasIOErrorMethods) {
|
||||
NSError *readError = nil;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
data = [archiveInput readDataUpToLength:256*1024 error:&readError];
|
||||
#pragma clang diagnostic pop
|
||||
if (data == nil) {
|
||||
SULog(SULogLevelError, @"Failed to read data from archive with error %@", readError);
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
data = [archiveInput readDataOfLength:256*1024];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Failed to read data from archive with exception reason %@", exception.reason);
|
||||
data = nil;
|
||||
}
|
||||
}
|
||||
|
||||
NSUInteger len = [data length];
|
||||
if (len == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
NSError *writeError = nil;
|
||||
if (hasIOErrorMethods) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
if (![archiveOutput writeData:data error:&writeError]) {
|
||||
#pragma clang diagnostic pop
|
||||
SULog(SULogLevelError, @"Failed to write data to pipe with error %@", writeError);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[archiveOutput writeData:data];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Failed to write data to pipe with exception reason %@", exception.reason);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bytesWritten += len;
|
||||
|
||||
[notifier notifyProgress:(double)bytesWritten / (double)expectedLength];
|
||||
}
|
||||
while(bytesWritten < expectedLength);
|
||||
|
||||
if (@available(macOS 10.15, *)) {
|
||||
NSError *archiveOutputCloseError = nil;
|
||||
if (![archiveOutput closeAndReturnError:&archiveOutputCloseError]) {
|
||||
SULog(SULogLevelError, @"Failed to close pipe with error %@", archiveOutputCloseError);
|
||||
}
|
||||
} else {
|
||||
[archiveOutput closeFile];
|
||||
}
|
||||
|
||||
if (@available(macOS 10.15, *)) {
|
||||
NSError *archiveInputCloseError = nil;
|
||||
if (![archiveInput closeAndReturnError:&archiveInputCloseError]) {
|
||||
SULog(SULogLevelError, @"Failed to close archive input with error %@", archiveInputCloseError);
|
||||
}
|
||||
} else {
|
||||
[archiveInput closeFile];
|
||||
}
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
if ([task terminationStatus] != 0) {
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
|
||||
|
||||
[notifier notifyFailureWithError:error];
|
||||
return;
|
||||
}
|
||||
|
||||
if (bytesWritten != expectedLength) {
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesWritten, (long)expectedLength]}];
|
||||
|
||||
[notifier notifyFailureWithError:error];
|
||||
return;
|
||||
}
|
||||
|
||||
[notifier notifySuccess];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+108
-79
@@ -86,58 +86,21 @@
|
||||
// The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date
|
||||
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
|
||||
// before being installed
|
||||
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:error]) {
|
||||
NSError *accessTimeError = nil;
|
||||
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:&accessTimeError]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
|
||||
|
||||
if (accessTimeError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = accessTimeError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Create a temporary directory for our new app that resides on our destination's volume
|
||||
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
|
||||
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
|
||||
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
|
||||
|
||||
if (tempNewDirectoryURL == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to make new temporary directory" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
self.temporaryNewDirectory = tempNewDirectoryURL;
|
||||
|
||||
if (progress) {
|
||||
progress(2/10.0);
|
||||
}
|
||||
|
||||
// Move the new app to our temporary directory
|
||||
NSString *newURLLastPathComponent = newURL.lastPathComponent;
|
||||
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
|
||||
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:error]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(3/10.0);
|
||||
}
|
||||
|
||||
// Release our new app from quarantine
|
||||
NSError *quarantineError = nil;
|
||||
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
|
||||
// Not big enough of a deal to fail the entire installation
|
||||
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(4/10.0);
|
||||
}
|
||||
|
||||
NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath];
|
||||
if (oldURL == nil) {
|
||||
// this really shouldn't happen but just in case
|
||||
@@ -148,6 +111,56 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(2/10.0);
|
||||
}
|
||||
|
||||
// Create a temporary directory for our new app that resides on our destination's volume
|
||||
// We use oldURL here instead of installationURL because in the case of normalization, installationURL may not exist
|
||||
// And we don't want to use either of the URL's parent directories because the parent directory could be on a different volume
|
||||
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryAppropriateForDirectoryURL:oldURL error:error];
|
||||
if (tempNewDirectoryURL == nil) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
self.temporaryNewDirectory = tempNewDirectoryURL;
|
||||
|
||||
if (progress) {
|
||||
progress(3/10.0);
|
||||
}
|
||||
|
||||
// Move the new app to our temporary directory
|
||||
NSString *newURLLastPathComponent = newURL.lastPathComponent;
|
||||
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
|
||||
NSError *newTempMoveError = nil;
|
||||
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:&newTempMoveError]) {
|
||||
if (error != NULL) {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path] }];
|
||||
|
||||
if (newTempMoveError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = newTempMoveError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(4/10.0);
|
||||
}
|
||||
|
||||
// Release our new app from quarantine
|
||||
NSError *quarantineError = nil;
|
||||
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
|
||||
// Not big enough of a deal to fail the entire installation
|
||||
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(5/10.0);
|
||||
}
|
||||
|
||||
// Try to preserve Finder Tags
|
||||
NSArray *resourceTags = nil;
|
||||
BOOL retrievedResourceTags = [oldURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
|
||||
@@ -155,6 +168,10 @@
|
||||
[newTempURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(6/10.0);
|
||||
}
|
||||
|
||||
// We must leave moving the app to its destination as the final step in installing it, so that
|
||||
// it's not possible our new app can be left in an incomplete state at the final destination
|
||||
|
||||
@@ -166,7 +183,7 @@
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(5/10.0);
|
||||
progress(7/10.0);
|
||||
}
|
||||
|
||||
NSError *touchError = nil;
|
||||
@@ -177,69 +194,85 @@
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(6/10.0);
|
||||
progress(8/10.0);
|
||||
}
|
||||
|
||||
// First try replacing the application atomically
|
||||
NSError *replaceError = nil;
|
||||
BOOL replacedApp;
|
||||
// First try swapping the application atomically
|
||||
NSError *swapError = nil;
|
||||
BOOL swappedApp;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
// If the app is normalized and the installation path differs, go through the old swap path
|
||||
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && ![oldURL.path isEqual:installationURL.path]) {
|
||||
replacedApp = NO;
|
||||
swappedApp = NO;
|
||||
} else {
|
||||
// Note: in my experience, a clone of the app may still be left at newTempURL
|
||||
// This is OK though because we will be cleaning up the temporary directory later in -performCleanup:
|
||||
replacedApp = [fileManager replaceItemAtURL:installationURL withItemAtURL:newTempURL error:&replaceError];
|
||||
// We will be cleaning up the temporary directory later in -performCleanup:
|
||||
// We don't want to clean it up now because it can take some time
|
||||
swappedApp = [fileManager swapItemAtURL:installationURL withItemAtURL:newTempURL error:&swapError];
|
||||
}
|
||||
} else {
|
||||
replacedApp = NO;
|
||||
swappedApp = NO;
|
||||
}
|
||||
|
||||
if (!replacedApp) {
|
||||
if (!swappedApp) {
|
||||
// Otherwise swap out the old and new applications using the legacy path
|
||||
|
||||
if (replaceError != nil) {
|
||||
SULog(SULogLevelDefault, @"Invoking fallback from failing to replace original item with error: %@", replaceError);
|
||||
if (swapError != nil) {
|
||||
SULog(SULogLevelDefault, @"Invoking fallback from failing to replace original item with error: %@", swapError);
|
||||
}
|
||||
|
||||
// Decide on a destination name we should use for the older app when we move it around the file system
|
||||
NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
|
||||
NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent;
|
||||
|
||||
// Create a temporary directory for our old app that resides on its volume
|
||||
NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent;
|
||||
NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil;
|
||||
NSURL *tempOldDirectoryURL = [fileManager makeTemporaryDirectoryAppropriateForDirectoryURL:oldURL error:error];
|
||||
if (tempOldDirectoryURL == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create temporary directory for old app at %@", oldURL.path] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
self.temporaryOldDirectory = tempOldDirectoryURL;
|
||||
|
||||
if (progress) {
|
||||
progress(7/10.0);
|
||||
progress(9/10.0);
|
||||
}
|
||||
|
||||
NSString *oldURLFilename = oldURL.lastPathComponent;
|
||||
if (oldURLFilename == nil) {
|
||||
// this really shouldn't happen..
|
||||
SULog(SULogLevelError, @"Failed to retrieve last path component from old URL: %@", oldURL.path);
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because the last path component of the old installation URL could not be constructed." }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Move the old app to the temporary directory
|
||||
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
|
||||
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
|
||||
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldURLFilename];
|
||||
NSError *oldMoveError = nil;
|
||||
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:&oldMoveError]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path] }];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path] }];
|
||||
|
||||
if (oldMoveError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = oldMoveError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(8/10.0);
|
||||
progress(9.5/10.0);
|
||||
}
|
||||
|
||||
// Move the new app to its final destination
|
||||
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
|
||||
NSError *installMoveError = nil;
|
||||
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:&installMoveError]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path] }];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path] }];
|
||||
|
||||
if (installMoveError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = installMoveError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
|
||||
// Attempt to restore our old app back the way it was on failure
|
||||
@@ -247,10 +280,6 @@
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(9/10.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
|
||||
@@ -22,6 +22,9 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
|
||||
// Ignore SIGTERM because we are going to catch it ourselves
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
// Ignore SIGPIPE because we won't want read or write failures due to broken pipe to unexpectably
|
||||
// terminate the process (e.g, when extracting archives or performing package installs).
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
|
||||
dispatch_source_set_event_handler(sigtermSource, ^{
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
* Support for writing custom user interfaces (Zorg)
|
||||
* Support for updating external Sparkle-based bundles (Zorg)
|
||||
* Added command line utility to update Sparkle-based bundles (Zorg)
|
||||
* More modern architecture
|
||||
* Modern architecture
|
||||
* Moves extraction, validation, and installation into a submitted launchd agent/daemon with XPC communication (Zorg)
|
||||
* Features faster installs with shorter update/relaunch times (#1802) (Zorg)
|
||||
* Provides more robust installs that need to request user authorization (Zorg)
|
||||
* Adoption of atomic-safe bundle replacing updates leveraging APFS (#1801) (Zorg)
|
||||
* Provides more robust installs when user authorization is needed (Zorg)
|
||||
* Adoption of improved atomic-safe updates leveraging APFS (#1801) (Zorg)
|
||||
* API Changes
|
||||
* Introduced new SPUStandardUpdaterController, SPUUpdater, SPUUserDriver classes/protocols (Zorg)
|
||||
* Decoupled AppKit and UI logic in the framework from core functionality (Zorg)
|
||||
* Ensure (most) API / ABI compatibility with Sparkle 1.x; you can likely test Sparkle 2 in an existing app without any changes (Zorg)
|
||||
* Ensure (most) API / ABI compatibility with Sparkle 1; you can likely test Sparkle 2 in an existing app with little to no changes (Zorg)
|
||||
* Deprecated SUUpdater, albeit it is still functional for testing and transitional purposes (Zorg)
|
||||
* `-bestValidUpdateInAppcast:forUpdater:` delegate method behavior has been refined and discouraged for some cases. Please review its updated header documentation in `SPUUpdaterDelegate.h` if you use this method. (#1838, #1862, #1879, #1880) (Zorg)
|
||||
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`. (Zorg)
|
||||
@@ -24,34 +24,35 @@
|
||||
* Sparkle uses the icon of the bundle to update for its authorization dialog. A 32x32 image representation of the icon is needed. (Zorg)
|
||||
* Sudden termination for silent automatic updates isn't disabled anymore (Zorg)
|
||||
* Policy Changes
|
||||
* Package based updates that are zipped or archived must add sparkle:installationType="package" to the appcast item enclosure (this doesn't apply to bare packages that aren't archived) (Zorg)
|
||||
* Non-bare package based updates that are zipped or archived must add sparkle:installationType="package" to the appcast item enclosure (this doesn't apply to bare packages which aren't archived) (Zorg)
|
||||
* We now recommend using sparkle:version and sparkle:shortVersionString top level elements instead of enclosure attributes (#1878) (Zorg)
|
||||
* The link element in an appcast item is now used for directing users to the product's website if they don't meet minimum system requirements (#1877) (Zorg)
|
||||
* Expose why a new update is unavailable and direct user to prior release notes or website info (#1877, #1886) (Zorg)
|
||||
* Add <sparkle:fullReleaseNotesLink> element allowing Sparkle to show a better stylized and full changelog to the user (#2001) (aONe)
|
||||
* Add delegate API allowing applications to show full in-app or offline version history to the user (#1989) (Billy Gray)
|
||||
* Major/Paid Upgrades Enhancements
|
||||
* Latest minor updates are preferred over major updates (specified by sparkle:minimumAutoupdateVersion) (#1850) (Zorg)
|
||||
* Major updates can be skipped with a user confirmation (#1853) (Zorg)
|
||||
* Informational only and critical updates can be specified selectively by app version (#1862)
|
||||
* Expose why a new update is unavailable and direct user to prior release notes or website info (#1877, #1886) (Zorg)
|
||||
* Add <sparkle:fullReleaseNotesLink> element allowing Sparkle to show a better stylized and full changelog to the user (#2001) (aONe)
|
||||
* Add delegate API allowing applications to show full in-app or offline version history to the user (#1989) (Billy Gray)
|
||||
* Add support for posting updates only on specific channels (eg for supporting beta updates) (#1879) (Zorg)
|
||||
* System profiler privacy and transparency (#1690) (Martin Pilkington)
|
||||
* Support getting app icon from asset catalog (#1694) (Charles Srstka)
|
||||
* Don't hide update alert window now on deactivation (#1804) (Zorg)
|
||||
* Don't bring up authorization just because group ID doesn't match (#1830) (Zorg)
|
||||
* Raise minimum system version to 10.11 (Zorg)
|
||||
* Raise minimum system version to macOS 10.11 (Zorg)
|
||||
* Special thanks to developers using early builds of this release in production and contributors for keeping this running (Kornel, Jonas Zaugg, Gwynne Raskind, Jordan Rose, Tony Arnold, Bryan Jones, Christian Tietze, Jakob Egger, and many more)
|
||||
|
||||
Please visit [Sparkle's website](http://sparkle-project.org) for more information on documentation and migration.
|
||||
|
||||
If you are migrating from earlier alpha versions of Sparkle 2, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with code signing has been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
|
||||
If you are migrating from earlier beta versions of Sparkle 2 and use sandboxing, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with XPC Serviecs and code signing have been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
|
||||
|
||||
# 1.27.1
|
||||
|
||||
* Use px instead of pt when specifying font size to fix default font size in WebView from #1962 (regressed in 1.25.0 with WKWebView adoption) (Daniel Jalkut)
|
||||
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
|
||||
* Add safer handling of applying binary delta files from #1990 (Zorg)
|
||||
* Don't use current date unless necessary when scheduling next update to be more resilient against rapid polling from #1991 (Zorg)
|
||||
* Don't use current date unless necessary when scheduling next update from #1991 (Zorg)
|
||||
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
|
||||
* Backport not hiding update window on deactivation from #2008 (Zorg)
|
||||
|
||||
# 1.27.0
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz"}
|
||||
@@ -39,8 +39,8 @@ SPARKLE_VERSION_PATCH = 0
|
||||
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_SUFFIX = -beta.4
|
||||
CURRENT_PROJECT_VERSION = 2004
|
||||
SPARKLE_VERSION_SUFFIX =
|
||||
CURRENT_PROJECT_VERSION = 2008
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If Carthage is trying to build us, it won't preserve code signing information from our bundled tools properly
|
||||
# Building Sparkle from source with Carthage is thus not supported
|
||||
if [ "$CARTHAGE" = "YES" ]; then
|
||||
echo "Error: Building Sparkle from source using Carthage is not supported. Please visit https://sparkle-project.org/documentation/ for proper Carthage integration."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create symlinks to our helper tools in Sparkle framework bundle
|
||||
# so URLForAuxiliaryExecutable: will pick up the tools. Doing this is supported in the Code Signing in Depth guide.
|
||||
|
||||
|
||||
@@ -73,13 +73,13 @@ if [ "$ACTION" = "" ] ; then
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
|
||||
cd "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
|
||||
if [ -x "$(command -v xz)" ]; then
|
||||
XZ_EXISTS=1
|
||||
else
|
||||
XZ_EXISTS=0
|
||||
fi
|
||||
|
||||
|
||||
rm -rf "/tmp/sparkle-extract"
|
||||
mkdir -p "/tmp/sparkle-extract"
|
||||
|
||||
@@ -106,7 +106,7 @@ if [ "$ACTION" = "" ] ; then
|
||||
|
||||
rm -rf "/tmp/sparkle-extract"
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
|
||||
# Generate zip containing the xcframework for SPM
|
||||
rm -rf "/tmp/sparkle-spm-extract"
|
||||
mkdir -p "/tmp/sparkle-spm-extract"
|
||||
@@ -118,7 +118,7 @@ if [ "$ACTION" = "" ] ; then
|
||||
# This guards against our archives being corrupt / created incorrectly
|
||||
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
|
||||
verify_code_signatures "/tmp/sparkle-spm-extract"
|
||||
|
||||
|
||||
rm -rf "/tmp/sparkle-spm-extract"
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
|
||||
@@ -134,10 +134,12 @@ if [ "$ACTION" = "" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate new Package manifest and podspec
|
||||
# Generate new Package manifest, podspec, and carthage files
|
||||
cd "$CONFIGURATION_BUILD_DIR"
|
||||
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
|
||||
cp "$SRCROOT/Sparkle.podspec" "$CONFIGURATION_BUILD_DIR"
|
||||
cp "$SRCROOT/Carthage-dev.json" "$CONFIGURATION_BUILD_DIR"
|
||||
|
||||
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
|
||||
# is equivalent to shasum -a 256 FILE
|
||||
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
|
||||
@@ -150,16 +152,20 @@ if [ "$ACTION" = "" ] ; then
|
||||
echo "Checksum: $spm_checksum"
|
||||
|
||||
sed -E -i '' -e "/s\.version.+=/ s/\".+\"/\"$MARKETING_VERSION\"/" "Sparkle.podspec"
|
||||
|
||||
"$SRCROOT/Configurations/update-carthage.py" "Carthage-dev.json" "$MARKETING_VERSION"
|
||||
cp "Sparkle.podspec" "$SRCROOT"
|
||||
echo "Sparkle.podspec updated with following values:"
|
||||
# Note the Carthage-dev.json file will finally be copied to the website repo in Carthage/Sparkle.json in the end
|
||||
cp "Carthage-dev.json" "$SRCROOT"
|
||||
echo "Sparkle.podspec and Carthage-dev.json updated with following values:"
|
||||
echo "Version: $MARKETING_VERSION"
|
||||
else
|
||||
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
|
||||
fi
|
||||
|
||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
||||
|
||||
if [ "$XZ_EXISTS" -ne 1 ] ; then
|
||||
echo "WARNING: xz compression is used for official releases but bz2 is being used instead because xz tool is not installed on your system."
|
||||
fi
|
||||
|
||||
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
fi
|
||||
@@ -9,8 +9,8 @@ function move_tag() {
|
||||
long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message
|
||||
long_message=${long_message/$latest_git_tag} # trims tag name
|
||||
long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace
|
||||
git add Package.swift Sparkle.podspec
|
||||
git commit -m "Update Package.swift and Sparkle.podspec for version ${latest_git_tag}"
|
||||
git add Package.swift Sparkle.podspec Carthage-dev.json
|
||||
git commit -m "Update Package management files for version ${latest_git_tag}"
|
||||
git tag -fa $latest_git_tag -m "${long_message}"
|
||||
echo "Package.swift and Sparkle.podspec committed and tag '$latest_git_tag' moved."
|
||||
}
|
||||
@@ -18,16 +18,16 @@ function move_tag() {
|
||||
if [ "$commits_since_tag" -gt 0 ]; then
|
||||
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
|
||||
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
|
||||
echo "Package.swift has not been committed and tag has not been moved."
|
||||
echo "Package management files have not been committed and tag has not been moved."
|
||||
elif [ "$CI" == true ]; then
|
||||
move_tag
|
||||
else
|
||||
# TODO: add sanity check to see if version is actually being updated or not?
|
||||
read -p "Do you want to commit changes to Package.swift and Sparkle.podspec, and force move tag '$latest_git_tag'? (required for official release) [Y/n]" -n 1 -r
|
||||
read -p "Do you want to commit changes to Package.swift, Sparkle.podspec, Carthage-dev.json and force move tag '$latest_git_tag'? (required for official release) [Y/n]" -n 1 -r
|
||||
echo # (optional) move to a new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
move_tag
|
||||
else
|
||||
echo "Package.swift and Sparkle.podspec have not been committed and tag has not been moved."
|
||||
echo "Package.swift, Sparkle.podspec, and Carthage-dev.json have not been committed and tag has not been moved."
|
||||
fi
|
||||
fi
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os, sys, json
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print("Usage: path-to-carthage-file release-tag")
|
||||
sys.exit(1)
|
||||
|
||||
carthage_file = sys.argv[1]
|
||||
release_tag = sys.argv[2]
|
||||
|
||||
with open(carthage_file, "r") as json_file:
|
||||
data = json.load(json_file)
|
||||
if release_tag in data:
|
||||
sys.exit(0)
|
||||
|
||||
with open(carthage_file, "w") as json_file:
|
||||
data[release_tag] = "https://github.com/sparkle-project/Sparkle/releases/download/" + release_tag + "/Sparkle-" + release_tag + ".tar.xz"
|
||||
|
||||
json.dump(data, json_file)
|
||||
@@ -11,21 +11,21 @@
|
||||
## After downloading the update:
|
||||
|
||||
### Launching the Installer
|
||||
SPUCoreBasedUpdateDriver invokes SPUInstallerDriver's extraction method which invokes SUInstallerLauncher's launch installer method. The launcher can be inside a XPC service or running inside the updater/sparkle framework itself. The launcher XPC bundle includes a copy of the installer and agent application in its bundle so it can compute the path to them itself (instead of relying on the updater to pass the paths), which is for security trust reasons.
|
||||
SPUCoreBasedUpdateDriver invokes SPUInstallerDriver's extraction method which invokes SUInstallerLauncher's launch installer method. An XPC Service may be used to launch the installer if necessary for Sandboxed applications.
|
||||
|
||||
First, if the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
|
||||
|
||||
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative dependencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
The launcher then looks for the installer and agent application. If we are inside the XPC Service, a relative path back to the framework auxiliary directory is computed otherwise the bundle's auxiliary directory path is retrieved. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative dependencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
|
||||
The installer is first submitted. If it requires root privileges, it will ask for an admin user name and password. How it determines if root privileges are necessary is based on:
|
||||
|
||||
* If the installation type from the appcast is an interactive package based installer, then no root privileges are necessary because the package installer will ask for them. Note this type of installation is deprecated however.
|
||||
* If the installation type from the appcast is a guided or regular package based installer, then root privileges are necessary because the system installer utility has to run as root.
|
||||
* Otherwise the installation type is a normal application update, and root privileges are only needed if write permission or changing the owner/group is currently insufficient.
|
||||
* Otherwise the installation type is a normal application update, and root privileges are only needed if write permission or changing the owner is currently insufficient.
|
||||
|
||||
The installer makes sure, after extraction, that the expected installation type from the appcast matches the type of installation found within the archive. So this hint from the appcast is not just trusted implicitly.
|
||||
|
||||
If the user cancels submitting the installer on authorization (if it's required), the launcher aborts the installation process silently. If everything does alright, the progress agent application is submitted next. If either of the submissions fail, the installation fails and aborts, otherwise the launcher succeeds and its job is done. Note before the submissions are done, the jobs are removed from launchd, and the jobs are submitted in a way that act as "one-time" jobs. If they fail or succeed, the jobs aren't restarted, and the jobs aren't installed in a system location for launchd to attempt launching again.
|
||||
If the user cancels submitting the installer on authorization (if it's required), the launcher aborts the installation process silently. If everything goes alright, the progress agent application is submitted next. If either of the submissions fail, the installation fails and aborts, otherwise the launcher succeeds and its job is done. Note before the submissions are done, the jobs are removed from launchd, and the jobs are submitted in a way that act as "one-time" jobs. If they fail or succeed, the jobs aren't restarted, and the jobs aren't installed in a system location for launchd to attempt launching again.
|
||||
|
||||
The most important argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Mostly everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
|
||||
|
||||
@@ -37,10 +37,8 @@ If the installer doesn't receive the "hello" message from the agent in a certain
|
||||
|
||||
When the updater attempts to set up a connection to the installer, after a certain threshold, if the installation hasn't progressed from not beginning (i.e, extraction hasn't begun), then the updater aborts the installation.
|
||||
|
||||
Note, we don't have a "version tag" for the installer or agent because they are either bundled inside the framework or in the XPC service, and the XPC service already has a version check of its own.
|
||||
|
||||
### Installation Data
|
||||
After the installer launches, the updater creates a connection to the installer and sends installation data to the installer using the `SPUInstallationData` message. This data includes the bundle application path to relaunch, the path to the bundle to update and replace, DSA signature from the appcast item, decryption password for dmg if available, the path to the downloaded directory and name of the downloaded item, and the type of expected installation.
|
||||
After the installer launches, the updater creates a connection to the installer and sends installation data to the installer using the `SPUInstallationData` message. This data includes the bundle application path to relaunch, the path to the bundle to update and replace, Ed(DSA) signature from the appcast item, decryption password for dmg if available, the path to the downloaded directory and name of the downloaded item, and the type of expected installation.
|
||||
|
||||
The installer takes note of all this information, but it moves the downloaded item into a update directory it chooses for itself. This is for two reasons:
|
||||
|
||||
@@ -52,7 +50,7 @@ After the installer moves the downloaded item, it makes sure the item is not a s
|
||||
### Update Extraction
|
||||
After the installer receives the input installation data, it starts extracting the update. The installer first sends a `SPUExtractionStarted` message.
|
||||
|
||||
If the unarchiver requires DSA validation before extraction (binary delta archives do) or if the expected installation type is a package type, then before starting the unarchiver, validation is checked to make sure the signature for the archive is valid. If the signature is not valid, then a `SPUArchiveExtractionFailed` message is sent to the updater (see below on what happens after that). We can't require validation before extracting for normal application updates because they allow changes to DSA keys. Delta updates are fine however because if those fail, then a full update can be tried.
|
||||
If the unarchiver requires EdDSA validation before extraction (binary delta archives do) or if the expected installation type is a package type, then before starting the unarchiver, validation is checked to make sure the signature for the archive is valid. If the signature is not valid, then a `SPUArchiveExtractionFailed` message is sent to the updater (see below on what happens after that). We can't require validation before extracting for normal application updates because they allow changes to EdDSA keys. Delta updates are fine however because if those fail, then a full update can be tried.
|
||||
|
||||
After extraction starts, one or more `SPUExtractedArchiveWithProgress` messages indicating the unarchival progress are sent back to the updater. On failure, the installer will send `SPUArchiveExtractionFailed`. In the updater, if the update is a delta update and extraction fails, then the full archive is downloaded and we go back to the "Sending Installation Data" section to re-send the data and begin extraction again. If the update is not a delta update and extraction fails on the other hand, then the updater aborts causing the installer to abort as well.
|
||||
|
||||
@@ -134,4 +132,4 @@ When the progress agent exits, it cleans up by removing itself from disk. The in
|
||||
|
||||
* When we terminate the application before doing final installation work, we send an Apple quit event to all running application instances we find under the agent's GUI login session. This does not include running instances from other logged in sessions -- that may require authenticating all the time, so trade off is not worthwhile. Also currently the installer only handles a single process identifier to watch for until termination, and certainly doesn't handle the case if more instances are launched afterwards. Note all of this only applies to instances being launched from the same bundle path, and the consequence may rarely be updating a bundle when a running instance is still left alive.
|
||||
|
||||
* SMJobBless() would be interesting to explore and perhaps more suitable for sparkle-cli than ordinary application updaters because using this API is less approriate for one-off installations. There may be some issues to take account of though (eg: http://www.openradar.me/20446733). Furthermore, the installer would have to change to persist rather than be a one-time install, and may have to handle mutliple connections for installing multiple bundles simutaneously.
|
||||
* SMJobBless() would be interesting to explore and perhaps more suitable for sparkle-cli than ordinary application updaters because using this API is less approriate for one-off installations. Furthermore, the installer would have to change to persist rather than be a one-time install, and may have to handle mutliple connections for installing multiple bundles simutaneously.
|
||||
@@ -32,4 +32,4 @@ For sending Obj-C objects across the wire, we use `SPUSecureCoding` because Coco
|
||||
|
||||
The installer handles extraction, validation, and installation of the update. This was the main reason why other sandboxed-capable forks were rejected from being secure. The point to be stressed anyway is that these all need to be done in the same process; they can't be handed off by some other process. This is also why removing references to `AuthorizationExecuteWithPrivileges` is crucial as well.
|
||||
|
||||
Note that the installer does *not* handle downloading. That is handled by the updater framework. This is ideal because downloading can be done without disrupting the user, allowing it to be done silently without presenting an authorization dialog. The downloading portion of code can also be stuck into a XPC service with just an entitlement for allowing incoming connections. This also means for secure installations the installer cannot know (or trust) what protocol the update was downloaded from (i.e: http vs https). A good installer will not care, which is why applying updates without a DSA signature/key is now deprecated (reminder that Apple's code signature checks are not intended for complete integrity).
|
||||
Note that the installer does *not* handle downloading. That is handled by the updater framework. This is ideal because downloading can be done without disrupting the user, allowing it to be done silently without presenting an authorization dialog. The downloading portion of code can also be stuck into a XPC service with just an entitlement for allowing incoming connections. This also means for secure installations the installer cannot know (or trust) what protocol the update was downloaded from (i.e: http vs https). A good installer will not care, which is why applying updates without a EdDSA signature/key is now deprecated (reminder that Apple's code signature checks are not intended for complete integrity).
|
||||
@@ -340,7 +340,7 @@ BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
|
||||
NSString *tempFilename = @"permission_test" ;
|
||||
|
||||
SUFileManager *suFileManager = [[SUFileManager alloc] init];
|
||||
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
|
||||
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryAppropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
|
||||
|
||||
if (tempDirectoryURL == nil) {
|
||||
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0-beta.4"
|
||||
let version = "2.0.0"
|
||||
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
||||
let tag = "2.0.0-beta.4"
|
||||
let checksum = "4f863dc048e8c4170e0c3fdbdb9a9b03af605adbd778aa11799db3f34068202d"
|
||||
let tag = "2.0.0"
|
||||
let checksum = "bed3158a836fd946bc910f9643ba7878e53ccd05538291f599d8a75456f26818"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+7
-12
@@ -1,21 +1,16 @@
|
||||
# Sparkle 2 (Beta)  []()
|
||||
# Sparkle 2   [](https://github.com/Carthage/Carthage) [](https://cocoapods.org/pods/Sparkle)
|
||||
|
||||
Secure and reliable software update framework for macOS.
|
||||
|
||||
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
|
||||
|
||||
This is the upcoming new version of Sparkle.
|
||||
Major new features are support for sandboxing, custom user interfaces, updating external bundles, and a more modern architecture which includes faster and more reliable installs.
|
||||
Sparkle 2 adds support for application sandboxing, custom user interfaces, updating external bundles, and a more modern architecture which includes faster and more reliable installs.
|
||||
|
||||
For the production ready version of Sparkle, please see the [Sparkle 1.x (master) branch](https://github.com/sparkle-project/Sparkle/tree/master). Note development has shifted to Sparkle 2 and the 1.x branch is now only accepting bug fixes, localization updates, and adoption of critical upcoming OS features.
|
||||
Pre-releases when available can be found on the [Sparkle's Releases](https://github.com/sparkle-project/Sparkle/releases) or on your favorite package manager. More nightly builds can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact.
|
||||
|
||||
Sparkle 2 is currently in beta. Applications, typically sandboxed, have already been using it in production, but some work including testing is still required before an official version can be released. Pre-releases can be found on the [Sparkle's Releases](https://github.com/sparkle-project/Sparkle/releases). More nightly builds can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact.
|
||||
The current status for future versions of Sparkle is tracked by [its roadmap](https://github.com/sparkle-project/Sparkle/milestones).
|
||||
|
||||
The current status of Sparkle 2 is tracked by [its roadmap](https://github.com/sparkle-project/Sparkle/milestone/2).
|
||||
|
||||
If you can help with testing or reviewing over the new changes, please report issues or submit pull requests!
|
||||
|
||||
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes. More internal design documents can be found in [Documentation](Documentation/).
|
||||
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes. More internal design documents to the project can be found in the repository under [Documentation](Documentation/).
|
||||
|
||||
## Features
|
||||
|
||||
@@ -24,7 +19,7 @@ Please visit [Sparkle's website](http://sparkle-project.org) for up to date docu
|
||||
* Fast. Supports delta updates which only patch files that have changed and atomic-safe installs.
|
||||
* Easy to install. Sparkle requires no code in your app, and only needs static files on a web server.
|
||||
* Customizable. Sparkle 2 supports plugging in a custom UI for updates.
|
||||
* Supports applications, package installers, preference panes, and other plug-ins.
|
||||
* Flexible. Supports applications, package installers, preference panes, and other plug-ins. Sparkle 2 supports updating external bundles.
|
||||
* Handles permissions, quarantine, and automatically asks for authentication if needed.
|
||||
* Uses RSS-based appcasts for release information. Appcasts are a de-facto standard supported by 3rd party update-tracking programs and websites.
|
||||
* Stays hidden until second launch for better first impressions.
|
||||
@@ -51,7 +46,7 @@ This repository uses git submodules, and will not build unless you clone recursi
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
* Please check **Console.app**. Sparkle prints detailed information there about all problems it encounters. It often also suggests solutions to the problems, so please read Sparkle's log messages carefully.
|
||||
* Please check **Console.app** for logs under your application. Sparkle prints detailed information there about all problems it encounters. It often also suggests solutions to the problems, so please read Sparkle's log messages carefully.
|
||||
|
||||
* Use the `generate_appcast` tool which creates appcast files, correct signatures, and delta updates automatically.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.0.0-beta.4"
|
||||
s.version = "2.0.0"
|
||||
s.summary = "A software update framework for macOS"
|
||||
s.description = "Sparkle is an easy-to-use software update framework for macOS."
|
||||
s.homepage = "https://sparkle-project.org"
|
||||
|
||||
@@ -326,6 +326,9 @@
|
||||
7293A1B11CEE9B9F00B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
|
||||
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */; };
|
||||
729F7EAC27366353004592DC /* test-links.xml in Resources */ = {isa = PBXBuildFile; fileRef = 729F7EAB27366353004592DC /* test-links.xml */; };
|
||||
729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
729F7EB0273F1840004592DC /* SPUUserAgent+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 729F7EAE273F1840004592DC /* SPUUserAgent+Private.m */; };
|
||||
729F7ECE27409077004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip in Resources */ = {isa = PBXBuildFile; fileRef = 729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */; };
|
||||
72A1C2631CD6849C004CD282 /* SUUpdatePermissionPrompt.h in Headers */ = {isa = PBXBuildFile; fileRef = 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */; };
|
||||
72A450531C69A68900D67EEA /* SUUpdatePermissionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
72A450541C69A68900D67EEA /* SUUpdatePermissionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */; };
|
||||
@@ -356,7 +359,9 @@
|
||||
72B767E31C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767E11C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.m */; };
|
||||
72B767E61C9CFD7200A07552 /* SPUAutomaticUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767E41C9CFD7200A07552 /* SPUAutomaticUpdateDriver.h */; };
|
||||
72B767E71C9CFD7200A07552 /* SPUAutomaticUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767E51C9CFD7200A07552 /* SPUAutomaticUpdateDriver.m */; };
|
||||
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */; };
|
||||
72BEBFEF1D7287570019146B /* SUSpotlightImporterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */; };
|
||||
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */; };
|
||||
72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */; };
|
||||
72D954831CBAD34F006F28BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954821CBAD34F006F28BD /* main.m */; };
|
||||
72D954A21CBB415C006F28BD /* SPUCommandLineDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954A11CBB415C006F28BD /* SPUCommandLineDriver.m */; };
|
||||
@@ -1229,6 +1234,9 @@
|
||||
729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITest.xcconfig; sourceTree = "<group>"; };
|
||||
729F10FE1C65A9B500DFCCC5 /* ConfigUITestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestCoverage.xcconfig; sourceTree = "<group>"; };
|
||||
729F7EAB27366353004592DC /* test-links.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-links.xml"; sourceTree = "<group>"; };
|
||||
729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUUserAgent+Private.h"; sourceTree = "<group>"; };
|
||||
729F7EAE273F1840004592DC /* SPUUserAgent+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SPUUserAgent+Private.m"; sourceTree = "<group>"; };
|
||||
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_extraneous.zip; sourceTree = "<group>"; };
|
||||
72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionResponse.h; sourceTree = "<group>"; };
|
||||
72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionResponse.m; sourceTree = "<group>"; };
|
||||
72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = "<group>"; };
|
||||
@@ -1262,7 +1270,9 @@
|
||||
72B767E11C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUCoreBasedUpdateDriver.m; sourceTree = "<group>"; };
|
||||
72B767E41C9CFD7200A07552 /* SPUAutomaticUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUAutomaticUpdateDriver.h; sourceTree = "<group>"; };
|
||||
72B767E51C9CFD7200A07552 /* SPUAutomaticUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAutomaticUpdateDriver.m; sourceTree = "<group>"; };
|
||||
72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSign_apfs.dmg; sourceTree = "<group>"; };
|
||||
72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUSpotlightImporterTest.swift; sourceTree = "<group>"; };
|
||||
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_header.zip; sourceTree = "<group>"; };
|
||||
72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressAppController.h; path = Sparkle/InstallerProgress/InstallerProgressAppController.h; sourceTree = SOURCE_ROOT; };
|
||||
72D954801CBACC35006F28BD /* InstallerProgressAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressAppController.m; path = Sparkle/InstallerProgress/InstallerProgressAppController.m; sourceTree = SOURCE_ROOT; };
|
||||
72D954821CBAD34F006F28BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sparkle/InstallerProgress/main.m; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1697,9 +1707,12 @@
|
||||
72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */,
|
||||
C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */,
|
||||
72AC6B271B9AAD6700F62325 /* SparkleTestCodeSignApp.tar */,
|
||||
72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */,
|
||||
72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */,
|
||||
72AC6B251B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz */,
|
||||
72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */,
|
||||
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */,
|
||||
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */,
|
||||
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */,
|
||||
14958C6C19AEBC610061B14F /* test-pubkey.pem */,
|
||||
5AF6C74E1AEA46D10014A3AB /* test.pkg */,
|
||||
@@ -1872,6 +1885,8 @@
|
||||
61299B3509CB04E000B7442F /* Sparkle.h */,
|
||||
721BC20C1D1CDE55002BC71E /* SPULocalCacheDirectory.h */,
|
||||
721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */,
|
||||
729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */,
|
||||
729F7EAE273F1840004592DC /* SPUUserAgent+Private.m */,
|
||||
7214B87F1D456A8500CB5CED /* SUBundleIcon.h */,
|
||||
7214B8801D456A8500CB5CED /* SUBundleIcon.m */,
|
||||
61299A5B09CA6D4500B7442F /* SUConstants.h */,
|
||||
@@ -2361,6 +2376,7 @@
|
||||
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */,
|
||||
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */,
|
||||
726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */,
|
||||
729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */,
|
||||
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */,
|
||||
72EF30BE2675CF38008CE987 /* SPUAppcastItemStateResolver.h in Headers */,
|
||||
72EF30C7267C716A008CE987 /* SUAppcastItem+Private.h in Headers */,
|
||||
@@ -2966,13 +2982,16 @@
|
||||
72AC6B2A1B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 in Resources */,
|
||||
72AC6B261B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz in Resources */,
|
||||
72AC6B2C1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz in Resources */,
|
||||
729F7ECE27409077004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip in Resources */,
|
||||
5A5DD41D249F116E0045EB3E /* test-relative-urls.xml in Resources */,
|
||||
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */,
|
||||
5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */,
|
||||
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
|
||||
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
|
||||
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
|
||||
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
|
||||
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
|
||||
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */,
|
||||
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */,
|
||||
7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */,
|
||||
5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */,
|
||||
@@ -3439,6 +3458,7 @@
|
||||
61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */,
|
||||
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */,
|
||||
72A450541C69A68900D67EEA /* SUUpdatePermissionResponse.m in Sources */,
|
||||
729F7EB0273F1840004592DC /* SPUUserAgent+Private.m in Sources */,
|
||||
72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */,
|
||||
724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */,
|
||||
724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "72D9549D1CBB415B006F28BD"
|
||||
BuildableName = "sparkle.app"
|
||||
BlueprintName = "sparkle-cli"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "NO"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "72D9549D1CBB415B006F28BD"
|
||||
BuildableName = "sparkle.app"
|
||||
BlueprintName = "sparkle-cli"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "72D9549D1CBB415B006F28BD"
|
||||
BuildableName = "sparkle.app"
|
||||
BlueprintName = "sparkle-cli"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
Vendored
+2
@@ -125,6 +125,8 @@
|
||||
|
||||
"The update is improperly signed." = "The update is improperly signed.";
|
||||
|
||||
"The update is improperly signed and could not be validated. Please try again later or contact the app developer." = "The update is improperly signed and could not be validated. Please try again later or contact the app developer.";
|
||||
|
||||
"Update Error!" = "Update Error!";
|
||||
|
||||
"Updating %@" = "Updating %@";
|
||||
|
||||
Vendored
+42
-15
@@ -97,6 +97,43 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_reportInstallerError:(nullable NSError *)currentInstallerError genericErrorCode:(NSInteger)genericErrorCode genericUserInfo:(NSDictionary *)genericUserInfo
|
||||
{
|
||||
// First see if there is a good custom error we can show
|
||||
// We only check for signing validation errors currently
|
||||
NSError *customError;
|
||||
if (currentInstallerError != nil) {
|
||||
NSError *underlyingError = currentInstallerError.userInfo[NSUnderlyingErrorKey];
|
||||
if (underlyingError != nil && underlyingError.code == SUValidationError) {
|
||||
NSDictionary *userInfo = @{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"The update is improperly signed and could not be validated. Please try again later or contact the app developer.", nil),
|
||||
NSUnderlyingErrorKey: (NSError * _Nonnull)currentInstallerError
|
||||
};
|
||||
|
||||
customError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
} else {
|
||||
customError = nil;
|
||||
}
|
||||
} else {
|
||||
customError = nil;
|
||||
}
|
||||
|
||||
// Otherwise if there's no custom error, then use a generic installer error to show
|
||||
// and keep the underlying error around for logging
|
||||
NSError *installerError;
|
||||
if (customError != nil) {
|
||||
installerError = customError;
|
||||
} else {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:genericUserInfo];
|
||||
if (currentInstallerError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = currentInstallerError;
|
||||
}
|
||||
installerError = [NSError errorWithDomain:SUSparkleErrorDomain code:genericErrorCode userInfo:userInfo];
|
||||
}
|
||||
|
||||
[self.delegate installerIsRequestingAbortInstallWithError:installerError];
|
||||
}
|
||||
|
||||
- (void)setUpConnection
|
||||
{
|
||||
if (self.installerConnection != nil) {
|
||||
@@ -117,18 +154,12 @@
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
SPUInstallerDriver *strongSelf = weakSelf;
|
||||
if (strongSelf.installerConnection != nil && !strongSelf.aborted) {
|
||||
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{
|
||||
NSDictionary *genericUserInfo = @{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater. For additional details, please check Console logs for "@SPARKLE_RELAUNCH_TOOL_NAME". If your application is sandboxed, please also ensure Installer Connection & Status entitlements are correctly set up: https://sparkle-project.org/documentation/sandboxing/"
|
||||
}];
|
||||
};
|
||||
|
||||
NSError *installerError = strongSelf.installerError;
|
||||
if (installerError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = installerError;
|
||||
}
|
||||
|
||||
[strongSelf.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo]];
|
||||
[strongSelf _reportInstallerError:strongSelf.installerError genericErrorCode:SUInstallationError genericUserInfo:genericUserInfo];
|
||||
}
|
||||
});
|
||||
}];
|
||||
@@ -238,14 +269,10 @@
|
||||
[self.delegate installerDidFailToApplyDeltaUpdate];
|
||||
} else {
|
||||
// Don't have to store current stage because we're going to abort
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) }];
|
||||
NSDictionary *genericUserInfo = @{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) };
|
||||
|
||||
NSError *unarchivedError = (NSError *)SPUUnarchiveRootObjectSecurely(data, [NSError class]);
|
||||
if (unarchivedError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = unarchivedError;
|
||||
}
|
||||
|
||||
[self.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfo]];
|
||||
[self _reportInstallerError:unarchivedError genericErrorCode:SUUnarchivingError genericUserInfo:genericUserInfo];
|
||||
}
|
||||
} else if (identifier == SPUValidationStarted) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
Vendored
+6
-1
@@ -248,7 +248,9 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
By default the user agent string returned is in the format:
|
||||
$(BundleDisplayName)/$(BundleDisplayVersion) Sparkle/$(SparkleDisplayVersion)
|
||||
|
||||
BundleDisplayVersion is derived from the application Info.plist's CFBundleShortVersionString.
|
||||
BundleDisplayVersion is derived from the main application's Info.plist's CFBundleShortVersionString.
|
||||
|
||||
Note if Sparkle is being used to update another application, the bundle information retrieved is from the main application performing the updating.
|
||||
|
||||
This default implementation can be overrided.
|
||||
*/
|
||||
@@ -280,6 +282,9 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
/**
|
||||
Appropriately schedules or cancels the update checking timer according to the preferences for time interval and automatic checks.
|
||||
|
||||
If you change the `updateCheckInterval` or `automaticallyChecksForUpdates` properties, the update cycle will be reset automatically after a short delay.
|
||||
The update cycle is also started automatically after the updater is started. In all these cases, this method should not be called directly.
|
||||
|
||||
This call does not change the date of the next check, but only the internal timer.
|
||||
*/
|
||||
- (void)resetUpdateCycle;
|
||||
|
||||
Vendored
+22
-35
@@ -31,6 +31,7 @@
|
||||
#import "SPUUpdaterTimer.h"
|
||||
#import "SPUResumableUpdate.h"
|
||||
#import "SUSignatures.h"
|
||||
#import "SPUUserAgent+Private.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -50,6 +51,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@property (weak, readonly, nullable) id<SPUUpdaterDelegate> delegate;
|
||||
@property (nonatomic) id <SPUUpdateDriver> driver;
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, readonly) SUHost *mainBundleHost;
|
||||
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
||||
@property (nonatomic, readonly) NSBundle *sparkleBundle;
|
||||
@property (nonatomic, readonly) SPUUpdaterSettings *updaterSettings;
|
||||
@@ -72,10 +74,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize userDriver = _userDriver;
|
||||
@synthesize userAgentString = customUserAgentString;
|
||||
@synthesize userAgentString = _userAgentString;
|
||||
@synthesize httpHeaders;
|
||||
@synthesize driver;
|
||||
@synthesize host = _host;
|
||||
@synthesize mainBundleHost = _mainBundleHost;
|
||||
@synthesize applicationBundle = _applicationBundle;
|
||||
@synthesize updaterSettings = _updaterSettings;
|
||||
@synthesize updaterCycle = _updaterCycle;
|
||||
@@ -117,6 +120,13 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
_userDriver = userDriver;
|
||||
|
||||
_delegate = delegate;
|
||||
|
||||
// Set up default user agent
|
||||
// Use the main bundle rather than the bundle to update for retrieving user agent information from
|
||||
// We want the user agent to reflect the updater that is doing the updating
|
||||
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:[NSBundle mainBundle]];
|
||||
_userAgentString = SPUMakeUserAgentWithHost(mainBundleHost, nil);
|
||||
_mainBundleHost = mainBundleHost;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -208,11 +218,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
SUHost *mainBundleHost = self.mainBundleHost;
|
||||
if (validateXPCServices) {
|
||||
// Check that all enabled XPC Services are embedded
|
||||
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
|
||||
|
||||
NSArray<NSString *> *xpcServiceIDs = @[@INSTALLER_LAUNCHER_BUNDLE_ID, @DOWNLOADER_BUNDLE_ID, @INSTALLER_CONNECTION_BUNDLE_ID, @INSTALLER_STATUS_BUNDLE_ID];
|
||||
NSArray<NSString *> *xpcServiceEnabledKeys = @[SUEnableInstallerLauncherServiceKey, SUEnableDownloaderServiceKey, SUEnableInstallerConnectionServiceKey, SUEnableInstallerStatusServiceKey];
|
||||
NSUInteger xpcServiceCount = xpcServiceIDs.count;
|
||||
@@ -234,7 +242,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
|
||||
// Make sure the app isn't bundling XPC Services directly
|
||||
NSURL *mainBundleXPCServiceURL = [[[mainBundle.bundleURL URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
|
||||
NSURL *mainBundleXPCServiceURL = [[[mainBundleHost.bundle.bundleURL URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
|
||||
|
||||
if ([mainBundleXPCServiceURL checkResourceIsReachableAndReturnError:NULL]) {
|
||||
if (error != NULL) {
|
||||
@@ -258,14 +266,13 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
|
||||
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundleHost.bundle];
|
||||
|
||||
if (feedURL != nil) {
|
||||
servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
|
||||
if (!servingOverHttps && !self.loggedATSWarning) {
|
||||
BOOL foundXPCDownloaderService = NO;
|
||||
|
||||
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
|
||||
NSBundle *downloaderBundle;
|
||||
if ([mainBundleHost boolForInfoDictionaryKey:SUEnableDownloaderServiceKey]) {
|
||||
NSURL *downloaderServiceBundleURL = [[[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:@DOWNLOADER_BUNDLE_ID] URLByAppendingPathExtension:@"xpc"];
|
||||
@@ -278,7 +285,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
BOOL foundATSMainBundleIssue = NO;
|
||||
if (!foundATSPersistentIssue && !foundXPCDownloaderService) {
|
||||
BOOL foundATSIssue = ([mainBundle objectForInfoDictionaryKey:@"NSAppTransportSecurity"] == nil);
|
||||
BOOL foundATSIssue = ([mainBundleHost objectForInfoDictionaryKey:@"NSAppTransportSecurity"] == nil);
|
||||
|
||||
if (updatingMainBundle) {
|
||||
// The only way we'll know for sure if there is an issue is if the main bundle is the same as the one we're updating
|
||||
@@ -402,7 +409,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// We start the update checks and register as observer for changes after the prompt finishes
|
||||
} else {
|
||||
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +439,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
|
||||
// Note this method is never called when sessionInProgress is YES
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentTime:(BOOL)usingCurrentTime
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentDate:(BOOL)usingCurrentDate
|
||||
{
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
@@ -480,7 +487,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
NSTimeInterval intervalSinceCheck;
|
||||
if (usingCurrentTime) {
|
||||
if (usingCurrentDate) {
|
||||
// How long has it been since last we checked for an update?
|
||||
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||
@@ -688,7 +695,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
if (shouldScheduleNextUpdateCheck) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:NO];
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:NO];
|
||||
} else {
|
||||
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
|
||||
}
|
||||
@@ -739,7 +746,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentTime:NO];
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentDate:NO];
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -765,7 +772,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
abortUpdateDriver([NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }], NO);
|
||||
} else {
|
||||
// Check for new updates
|
||||
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders]];
|
||||
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:self.userAgentString httpHeaders:[self httpHeaders]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -784,7 +791,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
if (!self.sessionInProgress) {
|
||||
[self cancelNextUpdateCycle];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,26 +902,6 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return feedURL;
|
||||
}
|
||||
|
||||
- (NSString *)userAgentString
|
||||
{
|
||||
if (customUserAgentString) {
|
||||
return customUserAgentString;
|
||||
}
|
||||
|
||||
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], @""MARKETING_VERSION];
|
||||
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
||||
|
||||
NSString *result = @"";
|
||||
if (cleanedAgent != nil) {
|
||||
NSString *cleanedAgentString = [[NSString alloc] initWithData:(NSData * _Nonnull)cleanedAgent encoding:NSASCIIStringEncoding];
|
||||
if (cleanedAgentString != nil) {
|
||||
result = cleanedAgentString;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile
|
||||
{
|
||||
[self.host setBool:sendsSystemProfile forUserDefaultsKey:SUSendProfileInfoKey];
|
||||
|
||||
Vendored
+11
-4
@@ -68,11 +68,15 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
Returns whether to allow Sparkle to check for updates.
|
||||
|
||||
For example, this may be used to prevent Sparkle from interrupting a setup assistant.
|
||||
Alternatively, you may want to consider starting the updater after eg: the setup assistant finishes
|
||||
Alternatively, you may want to consider starting the updater after eg: the setup assistant finishes.
|
||||
|
||||
Note in Swift, this method returns Void and is marked with the throws keyword. If this method
|
||||
doesn't throw an error, the updater may perform an update check. Otherwise if an error is thrown (we recommend using an NSError),
|
||||
then the updater may not perform an update check.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateCheck The type of update check that will be performed if the updater is allowed to check for updates.
|
||||
@param error The (optionally) populated error object if the updater may not perform a new update check.
|
||||
@param error The populated error object if the updater may not perform a new update check. The @c NSLocalizedDescriptionKey user info key should be populated indicating a description of the error.
|
||||
@return @c YES if the updater is allowed to check for updates, otherwise @c NO
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater mayPerformUpdateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
|
||||
@@ -227,10 +231,13 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
|
||||
If you return @c NO and populate the @c error, the user is not shown this @c updateItem nor is the update downloaded or installed.
|
||||
|
||||
Note in Swift, this method returns Void and is marked with the throws keyword. If this method doesn't throw an error, the updater will proceed with the update.
|
||||
Otherwise if an error is thrown (we recommend using an NSError), then the will not proceed with the update.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateItem The selected update item to proceed with.
|
||||
@param updateCheck The type of update check that would be performed if proceeded.
|
||||
@param error An error object that must be populated by the delegate if the updater should not proceed with the update.
|
||||
@param error An error object that must be populated by the delegate if the updater should not proceed with the update. The @c NSLocalizedDescriptionKey user info key should be populated indicating a description of the error.
|
||||
@return @c YES if the updater should proceed with @c updateItem, otherwise @c NO if the updater should not proceed with the update with an @c error populated.
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldProceedWithUpdate:(SUAppcastItem *)updateItem updateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
|
||||
@@ -366,7 +373,7 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
|
||||
Automatic update checks need to be enabled for this to trigger.
|
||||
|
||||
@param delay The delay in seconds until the next scheduled update will occur.
|
||||
@param delay The delay in seconds until the next scheduled update will occur. This is an approximation and may vary due to system state.
|
||||
|
||||
@param updater The updater instance.
|
||||
*/
|
||||
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// SPUUserAgent+Private.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 11/12/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class SUHost;
|
||||
|
||||
SU_EXPORT NSString *SPUMakeUserAgentWithHost(SUHost *responsibleHost, NSString * _Nullable displayNameSuffix);
|
||||
|
||||
SU_EXPORT NSString *SPUMakeUserAgentWithBundle(NSBundle *responsibleBundle, NSString * _Nullable displayNameSuffix);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// SPUUserAgent+Private.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 11/12/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SPUUserAgent+Private.h"
|
||||
#import "SUHost.h"
|
||||
|
||||
NSString *SPUMakeUserAgentWithBundle(NSBundle *responsibleBundle, NSString * _Nullable displayNameSuffix)
|
||||
{
|
||||
SUHost *responsibleHost = [[SUHost alloc] initWithBundle:responsibleBundle];
|
||||
return SPUMakeUserAgentWithHost(responsibleHost, displayNameSuffix);
|
||||
}
|
||||
|
||||
NSString *SPUMakeUserAgentWithHost(SUHost *responsibleHost, NSString * _Nullable displayNameSuffix)
|
||||
{
|
||||
NSString *displayVersion = responsibleHost.displayVersion;
|
||||
|
||||
NSString *userAgent = [NSString stringWithFormat:@"%@%@/%@ Sparkle/%@", responsibleHost.name, (displayNameSuffix != nil ? displayNameSuffix : @""), (displayVersion.length > 0 ? displayVersion : @"?"), @""MARKETING_VERSION];
|
||||
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
||||
|
||||
NSString *result;
|
||||
if (cleanedAgent != nil) {
|
||||
NSString *cleanedAgentString = [[NSString alloc] initWithData:(NSData * _Nonnull)cleanedAgent encoding:NSASCIIStringEncoding];
|
||||
if (cleanedAgentString != nil) {
|
||||
result = cleanedAgentString;
|
||||
} else {
|
||||
result = @"";
|
||||
}
|
||||
} else {
|
||||
result = @"";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Vendored
+3
-4
@@ -27,7 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Creates a temporary directory on the same volume as a provided URL
|
||||
* @param preferredName A name that may be used when creating the temporary directory. Note that in the uncothirdStageErrormmon case this name is used, the temporary directory will be created inside the directory pointed by appropriateURL
|
||||
* @param appropriateURL A URL to a directory that resides on the volume that the temporary directory will be created on. In the uncommon case, the temporary directory may be created inside this directory.
|
||||
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
|
||||
* @return A URL pointing to the newly created temporary directory, or nil with a populated error object if an error occurs.
|
||||
@@ -35,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* When moving an item from a source to a destination, it is desirable to create a temporary intermediate destination on the same volume as the destination to ensure
|
||||
* that the item will be moved, and not copied, from the intermediate point to the final destination. This ensures file atomicity.
|
||||
*/
|
||||
- (NSURL * _Nullable)makeTemporaryDirectoryWithPreferredName:(NSString *)preferredName appropriateForDirectoryURL:(NSURL *)appropriateURL error:(NSError * __autoreleasing *)error;
|
||||
- (NSURL * _Nullable)makeTemporaryDirectoryAppropriateForDirectoryURL:(NSURL *)appropriateURL error:(NSError * __autoreleasing *)error;
|
||||
|
||||
/**
|
||||
* Creates a directory at the target URL
|
||||
@@ -60,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError **)error;
|
||||
|
||||
/**
|
||||
* Replaces an original item with a new item atomically.
|
||||
* Swaps an original item with a new item atomically.
|
||||
* @param originalItemURL A URL pointing to the original item to replace. The item at this URL must exist.
|
||||
* @param newItemURL A URL pointing to the new item that will replace the original item.
|
||||
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
|
||||
@@ -70,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Otherwise on failure you may need to re-try using move operations. This operation will fail on non-apfs volumes or volumes that don't support rename swapping.
|
||||
* Both originalItemURL and newItemURL must exist.
|
||||
*/
|
||||
- (BOOL)replaceItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error __OSX_AVAILABLE(10.13);
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error __OSX_AVAILABLE(10.13);
|
||||
|
||||
/**
|
||||
* Copies an item from a source to a destination
|
||||
|
||||
Vendored
+3
-19
@@ -311,7 +311,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return [_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:error];
|
||||
}
|
||||
|
||||
- (BOOL)replaceItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error __OSX_AVAILABLE(10.13)
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error __OSX_AVAILABLE(10.13)
|
||||
{
|
||||
char originalPath[PATH_MAX] = {0};
|
||||
if (![originalItemURL.path getFileSystemRepresentation:originalPath maxLength:sizeof(originalPath)]) {
|
||||
@@ -641,25 +641,9 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSURL *)makeTemporaryDirectoryWithPreferredName:(NSString *)preferredName appropriateForDirectoryURL:(NSURL *)directoryURL error:(NSError * __autoreleasing *)error
|
||||
- (NSURL *)makeTemporaryDirectoryAppropriateForDirectoryURL:(NSURL *)directoryURL error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
NSError *tempError = nil;
|
||||
NSURL *tempURL = [_fileManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:directoryURL create:YES error:&tempError];
|
||||
|
||||
if (tempURL != nil) {
|
||||
return tempURL;
|
||||
}
|
||||
|
||||
// It is pretty unlikely in my testing we will get here, but just in case we do, we should create a directory inside
|
||||
// the directory pointed by directoryURL, using the preferredName
|
||||
|
||||
NSURL *desiredURL = [directoryURL URLByAppendingPathComponent:preferredName];
|
||||
NSUInteger tagIndex = 1;
|
||||
while ([self _itemExistsAtURL:desiredURL] && tagIndex <= 9999) {
|
||||
desiredURL = [directoryURL URLByAppendingPathComponent:[preferredName stringByAppendingFormat:@" (%lu)", (unsigned long)++tagIndex]];
|
||||
}
|
||||
|
||||
return [self makeDirectoryAtURL:desiredURL error:error] ? desiredURL : nil;
|
||||
return [_fileManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:directoryURL create:YES error:error];
|
||||
}
|
||||
|
||||
- (BOOL)removeItemAtURL:(NSURL *)url error:(NSError * __autoreleasing *)error
|
||||
|
||||
Vendored
+2
@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithBundle:(NSBundle *)aBundle;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@property (readonly, copy) NSString *bundlePath;
|
||||
@property (readonly, copy) NSString *name;
|
||||
@property (readonly, copy) NSString *version;
|
||||
|
||||
Vendored
+1
-1
@@ -127,7 +127,7 @@
|
||||
/**
|
||||
* If the update is a bundle, then it must meet any one of:
|
||||
*
|
||||
* * old and new DSA public keys are the same and valid (it allows change of Code Signing identity), or
|
||||
* * old and new Ed(DSA) public keys are the same and valid (it allows change of Code Signing identity), or
|
||||
*
|
||||
* * old and new Code Signing identity are the same and valid
|
||||
*
|
||||
|
||||
Vendored
+3
@@ -161,6 +161,9 @@
|
||||
/* (No Comment) */
|
||||
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "Das Aktualisierungsprogramm wurde nicht richtig gestartet. Du solltest den App-Entwickler kontaktieren, um diesen Fehler zu melden und zu prüfen, ob du die neueste Version hast.";
|
||||
|
||||
/* (No Comment) */
|
||||
"The update is improperly signed and could not be validated. Please try again later or contact the app developer." = "Das Update ist nicht ordnungsgemäß signiert und konnte nicht überprüft werden. Bitte versuche es später erneut oder kontaktiere den App-Entwickler.";
|
||||
|
||||
/* (No Comment) */
|
||||
"The update is improperly signed." = "Das Update ist nicht ordnungsgemäß signiert.";
|
||||
|
||||
|
||||
Vendored
+3
@@ -161,6 +161,9 @@
|
||||
/* (No Comment) */
|
||||
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "Het bijwerkprogramma is niet goed gestart. Je kunt wellicht met de app-ontwikkelaar contact opnemen om de fout te melden en te controleren dat je de nieuwste versie hebt";
|
||||
|
||||
/* (No Comment) */
|
||||
"The update is improperly signed and could not be validated. Please try again later or contact the app developer." = "De update is onjuist gesigneerd en kan niet worden gecontroleerd. Probeer het later opnieuw of neem contact op met de app-ontwikkelaar.";
|
||||
|
||||
/* (No Comment) */
|
||||
"The update is improperly signed." = "De update is onjuist gesigneerd.";
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -53,7 +53,7 @@
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||
|
||||
NSError *tempError = nil;
|
||||
NSURL *tempDir = [fileManager makeTemporaryDirectoryWithPreferredName:unitTestBundleIdentifier appropriateForDirectoryURL:[NSURL fileURLWithPath:zippedAppURL] error:&tempError];
|
||||
NSURL *tempDir = [fileManager makeTemporaryDirectoryAppropriateForDirectoryURL:[NSURL fileURLWithPath:zippedAppURL] error:&tempError];
|
||||
|
||||
if (tempDir == nil) {
|
||||
XCTFail(@"Failed to create temporary directory with error: %@", tempError);
|
||||
|
||||
@@ -13,8 +13,8 @@ class SUFileManagerTest: XCTestCase
|
||||
func makeTempFiles(_ testBlock: (SUFileManager, URL, URL, URL, URL, URL, URL) -> Void)
|
||||
{
|
||||
let fileManager = SUFileManager()
|
||||
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectory(withPreferredName: "Sparkle Unit Test Data", appropriateForDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectoryAppropriate(forDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
|
||||
defer {
|
||||
try! fileManager.removeItem(at: tempDirectoryURL)
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
{
|
||||
uid_t uid = getuid();
|
||||
|
||||
if (uid) {
|
||||
NSLog(@"Test must be run as root: sudo xctest -XCTest SUInstallerTest 'Sparkle Unit Tests.xctest'");
|
||||
if (uid != 0) {
|
||||
NSLog(@"Test must be run as root: sudo xcodebuild -project Sparkle.xcodeproj -scheme Sparkle '-only-testing:Sparkle Unit Tests/SUInstallerTest/testInstallIfRoot' test");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class SUSpotlightImporterTest: XCTestCase
|
||||
func testUpdatingSpotlightBundles()
|
||||
{
|
||||
let fileManager = SUFileManager()
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectory(withPreferredName: "Sparkle Unit Test Data", appropriateForDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectoryAppropriate(forDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
|
||||
let bundleDirectory = tempDirectoryURL.appendingPathComponent("bundle.app")
|
||||
try! fileManager.makeDirectory(at: bundleDirectory)
|
||||
|
||||
@@ -10,7 +10,7 @@ import XCTest
|
||||
|
||||
class SUUnarchiverTest: XCTestCase
|
||||
{
|
||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, password: String? = nil, resourceName: String = "SparkleTestCodeSignApp", expectingInstallationType installationType: String = SPUInstallationTypeApplication, expectingSuccess: Bool = true) {
|
||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, password: String? = nil, resourceName: String = "SparkleTestCodeSignApp", extractedAppName: String = "SparkleTestCodeSignApp", expectingInstallationType installationType: String = SPUInstallationTypeApplication, expectingSuccess: Bool = true) {
|
||||
let appName = resourceName
|
||||
let archiveResourceURL = Bundle(for: type(of: self)).url(forResource: appName, withExtension: archiveExtension)!
|
||||
|
||||
@@ -25,14 +25,14 @@ class SUUnarchiverTest: XCTestCase
|
||||
let unarchivedFailureExpectation = super.expectation(description: "Unarchived Failure (format: \(archiveExtension))")
|
||||
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent(archiveResourceURL.lastPathComponent)
|
||||
let extractedAppURL = tempDirectoryURL.appendingPathComponent(appName).appendingPathExtension("app")
|
||||
let extractedAppURL = tempDirectoryURL.appendingPathComponent(extractedAppName).appendingPathExtension("app")
|
||||
|
||||
self.unarchiveTestAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, tempArchiveURL: tempArchiveURL, archiveResourceURL: archiveResourceURL, password: password, expectingInstallationType: installationType, expectingSuccess: expectingSuccess, testExpectation: unarchivedSuccessExpectation)
|
||||
self.unarchiveNonExistentFileTestFailureAppWithExtension(archiveExtension, tempDirectoryURL: tempDirectoryURL, password: password, expectingInstallationType: installationType, testExpectation: unarchivedFailureExpectation)
|
||||
|
||||
super.waitForExpectations(timeout: 30.0, handler: nil)
|
||||
|
||||
if !archiveExtension.hasSuffix("pkg") {
|
||||
if !archiveExtension.hasSuffix("pkg") && expectingSuccess {
|
||||
XCTAssertTrue(fileManager.fileExists(atPath: extractedAppURL.path))
|
||||
XCTAssertEqual("6a60ab31430cfca8fb499a884f4a29f73e59b472", hashOfTree(extractedAppURL.path))
|
||||
}
|
||||
@@ -71,6 +71,29 @@ class SUUnarchiverTest: XCTestCase
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("zip")
|
||||
}
|
||||
|
||||
// This zip file has extraneous zero bytes added at the very end
|
||||
func testUnarchivingBadZipWithExtaneousTrailingBytes() {
|
||||
// We may receive a SIGPIPE error when writing data to a pipe
|
||||
// The Autoupdate installer ignores SIGPIPE too
|
||||
// We need to ignore it otherwise the xctest will terminate unexpectedly with exit code 13
|
||||
signal(SIGPIPE, SIG_IGN)
|
||||
|
||||
self.unarchiveTestAppWithExtension("zip", resourceName: "SparkleTestCodeSignApp_bad_extraneous", extractedAppName: "SparkleTestCodeSignApp", expectingSuccess: false)
|
||||
|
||||
signal(SIGPIPE, SIG_DFL)
|
||||
}
|
||||
|
||||
func testUnarchivingBadZipWithMissingHeaderBytes() {
|
||||
// We may receive a SIGPIPE error when writing data to a pipe
|
||||
// The Autoupdate installer ignores SIGPIPE too
|
||||
// We need to ignore it otherwise the xctest will terminate unexpectedly with exit code 13
|
||||
signal(SIGPIPE, SIG_IGN)
|
||||
|
||||
self.unarchiveTestAppWithExtension("zip", resourceName: "SparkleTestCodeSignApp_bad_header", extractedAppName: "SparkleTestCodeSignApp", expectingSuccess: false)
|
||||
|
||||
signal(SIGPIPE, SIG_DFL)
|
||||
}
|
||||
|
||||
func testUnarchivingTarDotGz()
|
||||
{
|
||||
@@ -92,16 +115,21 @@ class SUUnarchiverTest: XCTestCase
|
||||
self.unarchiveTestAppWithExtension("tar.xz")
|
||||
}
|
||||
|
||||
func testUnarchivingDmg()
|
||||
func testUnarchivingHFSDmgWithLicenseAgreement()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("dmg")
|
||||
}
|
||||
|
||||
func testUnarchivingEncryptedDmg()
|
||||
func testUnarchivingEncryptedDmgWithLicenseAgreement()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("enc.dmg", password: "testpass")
|
||||
}
|
||||
|
||||
func testUnarchivingAPFSDMG()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("dmg", resourceName: "SparkleTestCodeSign_apfs")
|
||||
}
|
||||
|
||||
func testUnarchivingFlatPackage()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("pkg", resourceName: "test", expectingInstallationType: SPUInstallationTypeGuidedPackage)
|
||||
|
||||
@@ -26,6 +26,10 @@ class SUTestApplicationTest: XCTestCase
|
||||
func testRegularUpdate()
|
||||
{
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = [
|
||||
"-AppleLanguages",
|
||||
"(en)"
|
||||
]
|
||||
app.launch()
|
||||
|
||||
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
||||
|
||||
@@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? {
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
||||
|
||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
@@ -168,6 +168,12 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
||||
item.addChild(linkElement)
|
||||
}
|
||||
|
||||
if let fullReleaseNotesLink = fullReleaseNotesLink,
|
||||
let fullReleaseNotesElement = XMLElement.element(withName: SUAppcastElementFullReleaseNotesLink, uri: sparkleNS) as? XMLElement {
|
||||
fullReleaseNotesElement.setChildren([text(fullReleaseNotesLink)])
|
||||
item.addChild(fullReleaseNotesElement)
|
||||
}
|
||||
|
||||
// Set new channel name
|
||||
if let newChannelName = newChannel,
|
||||
let channelNameElement = XMLElement.element(withName: SUAppcastElementChannel, uri: sparkleNS) as? XMLElement {
|
||||
|
||||
@@ -72,6 +72,9 @@ struct GenerateAppcast: ParsableCommand {
|
||||
@Option(name: .customLong("release-notes-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for constructing URLs for release notes.", valueName: "url"), transform: { URL(string: $0) })
|
||||
var releaseNotesURLPrefix : URL?
|
||||
|
||||
@Option(name: .customLong("full-release-notes-url"), help: ArgumentHelp("A URL that will be used for the full release notes.", valueName: "url"))
|
||||
var fullReleaseNotesURL: String?
|
||||
|
||||
@Option(name: .long, help: ArgumentHelp("A URL to the application's website which Sparkle may use for directing users to if they cannot download a new update from within the application. This will be used for new generated update items. By default, no product link is used.", valueName: "link"))
|
||||
var link: String?
|
||||
|
||||
@@ -220,7 +223,7 @@ struct GenerateAppcast: ParsableCommand {
|
||||
relativeTo: archivesSourceDir)
|
||||
|
||||
// Write the appcast
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
|
||||
// Inform the user, pluralizing "update" if necessary
|
||||
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }
|
||||
|
||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUCommandLineDriver : NSObject
|
||||
|
||||
- (nullable instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose;
|
||||
- (nullable instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL userAgentName:(nullable NSString *)userAgentName updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose;
|
||||
|
||||
- (void)runAndCheckForUpdatesNow:(BOOL)checkForUpdatesNow;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import "SPUCommandLineDriver.h"
|
||||
#import <Sparkle/Sparkle.h>
|
||||
#import <Sparkle/SUInstallerLauncher+Private.h>
|
||||
#import <Sparkle/SPUUserAgent+Private.h>
|
||||
#import "SPUCommandLineUserDriver.h"
|
||||
|
||||
#define SPARKLE_CLI_ERROR_DOMAIN @"sparkle-cli"
|
||||
@@ -51,7 +52,7 @@ typedef NS_ENUM(int, CLIErrorExitStatus) {
|
||||
@synthesize customFeedURL = _customFeedURL;
|
||||
@synthesize updatePermissionResponse = _updatePermissionResponse;
|
||||
|
||||
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose
|
||||
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL userAgentName:(nullable NSString *)customUserAgentName updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -79,6 +80,34 @@ typedef NS_ENUM(int, CLIErrorExitStatus) {
|
||||
|
||||
id <SPUUserDriver> userDriver = [[SPUCommandLineUserDriver alloc] initWithUpdatePermissionResponse:updatePermissionResponse deferInstallation:deferInstallation verbose:verbose];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
|
||||
|
||||
{
|
||||
// Retrieve a suitable user agent.
|
||||
NSString *userAgentString;
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
if (customUserAgentName != nil) {
|
||||
// Let's use the user agent name that the user passed to us
|
||||
userAgentString = SPUMakeUserAgentWithBundle(mainBundle, [NSString stringWithFormat:@" (%@)", customUserAgentName]);
|
||||
} else {
|
||||
// Are we embedded inside of another responsible app?
|
||||
NSURL *parentDirectoryURL = mainBundle.bundleURL.URLByDeletingLastPathComponent;
|
||||
NSURL *parentParentDirectoryURL = parentDirectoryURL.URLByDeletingLastPathComponent;
|
||||
|
||||
if ([parentParentDirectoryURL.lastPathComponent isEqualToString:@"Contents"] && ([parentDirectoryURL.lastPathComponent isEqualToString:@"Resources"] || [parentDirectoryURL.lastPathComponent isEqualToString:@"MacOS"] || [parentDirectoryURL.lastPathComponent isEqualToString:@"Helpers"])) {
|
||||
NSURL *responsibleApplicationURL = parentParentDirectoryURL.URLByDeletingLastPathComponent;
|
||||
NSBundle *responsibleBundle = [NSBundle bundleWithURL:responsibleApplicationURL];
|
||||
if (responsibleBundle == nil) {
|
||||
userAgentString = SPUMakeUserAgentWithBundle(mainBundle, nil);
|
||||
} else {
|
||||
userAgentString = SPUMakeUserAgentWithBundle(responsibleBundle, @" (sparkle)");
|
||||
}
|
||||
} else {
|
||||
userAgentString = SPUMakeUserAgentWithBundle(mainBundle, nil);
|
||||
}
|
||||
}
|
||||
|
||||
_updater.userAgentString = userAgentString;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
- (void)showDownloadDidStartExtractingUpdate
|
||||
{
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Extracting update...\n");
|
||||
fprintf(stderr, "Extracting Update...\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-3
@@ -22,10 +22,11 @@
|
||||
#define FEED_URL_FLAG "feed-url"
|
||||
#define CHANNELS_FLAG "channels"
|
||||
#define ALLOW_MAJOR_UPGRADES_FLAG "allow-major-upgrades"
|
||||
#define USER_AGENT_NAME "user-agent-name"
|
||||
|
||||
static void printUsage(char **argv)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s bundle [--%s app-path] [--%s] [--%s] [--%s chan1,chan2,…] [--%s feed-url] [--%s] [--%s] [--%s] [--%s] [--%s] [--%s]\n", argv[0], APPLICATION_FLAG, CHECK_NOW_FLAG, PROBE_FLAG, CHANNELS_FLAG, FEED_URL_FLAG, GRANT_AUTOMATIC_CHECKING_FLAG, SEND_PROFILE_FLAG, DEFER_FLAG, INTERACTIVE_FLAG, ALLOW_MAJOR_UPGRADES_FLAG, VERBOSE_FLAG);
|
||||
fprintf(stderr, "Usage: %s bundle [--%s app-path] [--%s] [--%s] [--%s chan1,chan2,…] [--%s feed-url] [--%s display-name] [--%s] [--%s] [--%s] [--%s] [--%s] [--%s]\n", argv[0], APPLICATION_FLAG, CHECK_NOW_FLAG, PROBE_FLAG, CHANNELS_FLAG, FEED_URL_FLAG, USER_AGENT_NAME, GRANT_AUTOMATIC_CHECKING_FLAG, SEND_PROFILE_FLAG, DEFER_FLAG, INTERACTIVE_FLAG, ALLOW_MAJOR_UPGRADES_FLAG, VERBOSE_FLAG);
|
||||
fprintf(stderr, "Description:\n");
|
||||
fprintf(stderr, " Check if any new updates for a Sparkle supported bundle need to be installed.\n\n");
|
||||
fprintf(stderr, " If any new updates need to be installed, the user application\n is terminated and the update is installed immediately unless --%s\n is specified. If the application was alive, then it will be relaunched after.\n\n", DEFER_FLAG);
|
||||
@@ -33,7 +34,8 @@ static void printUsage(char **argv)
|
||||
fprintf(stderr, " if no updates are available now, or if the last update check was recently\n (unless --%s is specified) then nothing is done.\n\n", CHECK_NOW_FLAG);
|
||||
fprintf(stderr, " If update permission is requested and --%s is not\n specified, then checking for updates is aborted.\n\n", GRANT_AUTOMATIC_CHECKING_FLAG);
|
||||
fprintf(stderr, " Unless --%s is specified, this tool will not request for escalated\n authorization. Running as root is not supported.\n\n", INTERACTIVE_FLAG);
|
||||
fprintf(stderr, " If --%s is specified, this tool will exit leaving a spawned process\n for finishing the installation after the target application terminates.\n", DEFER_FLAG);
|
||||
fprintf(stderr, " If --%s is specified, this tool will exit leaving a spawned process\n for finishing the installation after the target application terminates.\n\n", DEFER_FLAG);
|
||||
fprintf(stderr, " Please specify --%s if you intend to use this tool in an automated way.\n", USER_AGENT_NAME);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " --%s\n Path to the application to watch for termination and to relaunch.\n If not provided, this is assumed to be the same as the bundle.\n", APPLICATION_FLAG);
|
||||
fprintf(stderr, " --%s\n Immediately checks for updates to install.\n Without this, updates are checked only when needed on a scheduled basis.\n", CHECK_NOW_FLAG);
|
||||
@@ -41,6 +43,7 @@ static void printUsage(char **argv)
|
||||
fprintf(stderr, " --%s\n Allows probing and installing major upgrades. Without passing this, an exit\n status of 2 is returned if a major upgrade is found.\n", ALLOW_MAJOR_UPGRADES_FLAG);
|
||||
fprintf(stderr, " --%s\n List of allowed Sparkle channels to look for updates in. By default,\n only the default channel is used.\n", CHANNELS_FLAG);
|
||||
fprintf(stderr, " --%s\n URL for appcast feed. This URL will be used for the feed instead of the one\n in the bundle's Info.plist or in the bundle's user defaults.\n", FEED_URL_FLAG);
|
||||
fprintf(stderr, " --%s\n Display name that will be included as a part of the User-Agent string.\n We encourage setting this so developers know what is querying their feed.\n Otherwise, this value may be set and inferred automatically.\n", USER_AGENT_NAME);
|
||||
fprintf(stderr, " --%s\n Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges, or allows performing an interactive\n installer package. Without passing this, an exit status of 3 is returned\n if an update requires user interaction. An exit status of 5 is returned\n if the user cancels the authorization prompt.\n", INTERACTIVE_FLAG);
|
||||
fprintf(stderr, " --%s\n If update permission is requested, this enables automatic update checks.\n Note that this behavior may overwrite the user's defaults for the bundle.\n This option has no effect if --%s is passed, or if the\n user has replied to this request already, or if the developer configured\n to skip it. Without passing this, an exit status of 6 is returned\n if permission is needed.\n", GRANT_AUTOMATIC_CHECKING_FLAG, CHECK_NOW_FLAG);
|
||||
fprintf(stderr, " --%s\n Choose to send system profile information if update permission is requested.\n This option can only take effect if --%s is passed.\n", SEND_PROFILE_FLAG, GRANT_AUTOMATIC_CHECKING_FLAG);
|
||||
@@ -61,6 +64,7 @@ int main(int argc, char **argv)
|
||||
{APPLICATION_FLAG, required_argument, NULL, 0},
|
||||
{CHANNELS_FLAG, required_argument, NULL, 0},
|
||||
{FEED_URL_FLAG, required_argument, NULL, 0},
|
||||
{USER_AGENT_NAME, required_argument, NULL, 0},
|
||||
{DEFER_FLAG, no_argument, NULL, 0},
|
||||
{VERBOSE_FLAG, no_argument, NULL, 0},
|
||||
{CHECK_NOW_FLAG, no_argument, NULL, 0},
|
||||
@@ -74,6 +78,7 @@ int main(int argc, char **argv)
|
||||
|
||||
NSString *applicationPath = nil;
|
||||
NSString *feedURL = nil;
|
||||
NSString *userAgentName = nil;
|
||||
NSSet<NSString *> *channels = [NSSet set];
|
||||
BOOL deferInstall = NO;
|
||||
BOOL verbose = NO;
|
||||
@@ -108,6 +113,14 @@ int main(int argc, char **argv)
|
||||
printUsage(argv);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} else if (strcmp(USER_AGENT_NAME, longOptions[optionIndex].name) == 0) {
|
||||
assert(optarg != NULL);
|
||||
|
||||
userAgentName = [[NSString alloc] initWithUTF8String:optarg];
|
||||
if (userAgentName == nil) {
|
||||
printUsage(argv);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} else if (strcmp(CHANNELS_FLAG, longOptions[optionIndex].name) == 0) {
|
||||
assert(optarg != NULL);
|
||||
|
||||
@@ -168,7 +181,7 @@ int main(int argc, char **argv)
|
||||
updatePermissionResponse = [[SUUpdatePermissionResponse alloc] initWithAutomaticUpdateChecks:YES sendSystemProfile:sendProfile];
|
||||
}
|
||||
|
||||
SPUCommandLineDriver *driver = [[SPUCommandLineDriver alloc] initWithUpdateBundlePath:updatePath applicationBundlePath:applicationPath allowedChannels:channels customFeedURL:feedURL updatePermissionResponse:updatePermissionResponse deferInstallation:deferInstall interactiveInstallation:interactive allowMajorUpgrades:allowMajorUpgrades verbose:verbose];
|
||||
SPUCommandLineDriver *driver = [[SPUCommandLineDriver alloc] initWithUpdateBundlePath:updatePath applicationBundlePath:applicationPath allowedChannels:channels customFeedURL:feedURL userAgentName:userAgentName updatePermissionResponse:updatePermissionResponse deferInstallation:deferInstall interactiveInstallation:interactive allowMajorUpgrades:allowMajorUpgrades verbose:verbose];
|
||||
if (driver == nil) {
|
||||
fprintf(stderr, "Error: Failed to initialize updater. Are the bundle paths provided valid?\n");
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Reference in new issue
Block a user