mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75d16851c1 | ||
|
|
4cb6719c6b | ||
|
|
2c81393ec2 | ||
|
|
983d19580b | ||
|
|
6cbe8444a0 | ||
|
|
45a9099082 | ||
|
|
aa72b3f639 | ||
|
|
372f0504a5 | ||
|
|
470296a90e | ||
|
|
242ae2c392 |
No files matched your search
@@ -2,9 +2,9 @@ name: Build & Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 2.x, 2.2.x, master ]
|
||||
branches: [ 2.x, master ]
|
||||
pull_request:
|
||||
branches: [ 2.x, 2.2.x, master ]
|
||||
branches: [ 2.x, master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
+44
-47
@@ -34,6 +34,7 @@
|
||||
|
||||
#define FIRST_UPDATER_MESSAGE_TIMEOUT 18ull
|
||||
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 8ull
|
||||
#define UPDATER_APPCAST_ITEM_REGISTRATION_TIMEOUT 8ull
|
||||
|
||||
/**
|
||||
* Show display progress UI after a delay from starting the final part of the installation.
|
||||
@@ -59,7 +60,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@property (nonatomic, readonly) NSString *userName;
|
||||
@property (nonatomic) SUHost *host;
|
||||
@property (nonatomic, copy) NSString *updateDirectoryPath;
|
||||
@property (nonatomic, copy) NSString *extractionDirectory;
|
||||
@property (nonatomic, copy) NSString *downloadName;
|
||||
@property (nonatomic, copy) NSString *decryptionPassword;
|
||||
@property (nonatomic, strong) SUSignatures *signatures;
|
||||
@@ -95,7 +95,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@synthesize updateValidator = _updateValidator;
|
||||
@synthesize host = _host;
|
||||
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||
@synthesize extractionDirectory = _extractionDirectory;
|
||||
@synthesize downloadName = _downloadName;
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
@synthesize signatures = _signatures;
|
||||
@@ -195,7 +194,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
|
||||
|
||||
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
|
||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath extractionDirectory:self.extractionDirectory updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
|
||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
|
||||
|
||||
NSError *unarchiverError = nil;
|
||||
BOOL success = NO;
|
||||
@@ -228,7 +227,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
|
||||
|
||||
NSError *validationError = nil;
|
||||
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.extractionDirectory error:&validationError];
|
||||
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
|
||||
|
||||
if (!validationSuccess) {
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]];
|
||||
@@ -278,7 +277,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
// but may as well set other fields to nil too
|
||||
[self clearUpdateDirectory];
|
||||
self.downloadName = nil;
|
||||
self.extractionDirectory = nil;
|
||||
self.decryptionPassword = nil;
|
||||
self.signatures = nil;
|
||||
self.relaunchPath = nil;
|
||||
@@ -410,13 +408,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *extractionDirectory = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:cacheInstallationPath];
|
||||
if (extractionDirectory == nil) {
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to create installation extraction directory in %@", cacheInstallationPath] }]];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Carry these properities separately rather than using the SUInstallationInputData object
|
||||
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
|
||||
self.installationType = installationType;
|
||||
@@ -424,7 +415,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
self.downloadName = installationData.downloadName;
|
||||
self.signatures = installationData.signatures;
|
||||
self.updateDirectoryPath = cacheInstallationPath;
|
||||
self.extractionDirectory = extractionDirectory;
|
||||
self.host = [[SUHost alloc] initWithBundle:hostBundle];
|
||||
|
||||
[self extractAndInstallUpdate];
|
||||
@@ -432,11 +422,36 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
} else if (identifier == SPUSentUpdateAppcastItemData) {
|
||||
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
|
||||
if (updateItem != nil) {
|
||||
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
|
||||
// Note: older versions of Sparkle had interactive based pkg installers which could not be silently installed
|
||||
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:YES];
|
||||
|
||||
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
|
||||
if (archivedData != nil) {
|
||||
[self.agentConnection.agent registerInstallationInfoData:archivedData];
|
||||
__block BOOL notifiedRegistrationCompleted = NO;
|
||||
|
||||
[self.agentConnection.agent registerInstallationInfoData:archivedData completionHandler:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!notifiedRegistrationCompleted) {
|
||||
notifiedRegistrationCompleted = YES;
|
||||
|
||||
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallerRegisteredAppcastItem data:[NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)]];
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
// Not receiving that we've registered the appcast item in a timely manner is not a fatal issue
|
||||
// If this operation takes too long, just let assume the item will be registered
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(UPDATER_APPCAST_ITEM_REGISTRATION_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (!notifiedRegistrationCompleted) {
|
||||
notifiedRegistrationCompleted = YES;
|
||||
|
||||
SULog(SULogLevelError, @"Warning: did not receive appcast item registration from Updater in timely manner. Proceeding..");
|
||||
|
||||
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallerRegisteredAppcastItem data:[NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)]];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
|
||||
@@ -445,7 +460,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
uint8_t showsUI = *((const uint8_t *)data.bytes + 1);
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
|
||||
// This flag has an impact on showing UI progress during non-interactive installations
|
||||
self.shouldShowUI = (BOOL)showsUI;
|
||||
// Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
|
||||
self.shouldRelaunch = (BOOL)relaunch;
|
||||
@@ -474,7 +489,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
dispatch_async(self.installerQueue, ^{
|
||||
NSError *installerError = nil;
|
||||
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.extractionDirectory homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
|
||||
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
|
||||
|
||||
if (installer == nil) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@@ -493,18 +508,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.installer = installer;
|
||||
|
||||
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||
|
||||
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
|
||||
|
||||
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
|
||||
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:[NSData data]];
|
||||
|
||||
self.performedStage1Installation = YES;
|
||||
|
||||
@@ -521,27 +528,18 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL performedSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
|
||||
if (performedSecondStage) {
|
||||
self.performedStage2Installation = YES;
|
||||
self.performedStage2Installation = YES;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||
|
||||
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
|
||||
|
||||
// Don't check if the target is already terminated, leave that to the progress agent
|
||||
// We could be slightly off if there were multiple instances running
|
||||
[self.agentConnection.agent sendTerminationSignal];
|
||||
});
|
||||
} else {
|
||||
self.installer = nil;
|
||||
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently" }]];
|
||||
});
|
||||
}
|
||||
// Don't check if the target is already terminated, leave that to the progress agent
|
||||
// We could be slightly off if there were multiple instances running
|
||||
[self.agentConnection.agent sendTerminationSignal];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)finishInstallationAfterHostTermination
|
||||
@@ -553,9 +551,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
}
|
||||
|
||||
// Show our installer progress UI tool if only after a certain amount of time passes,
|
||||
// and if our installer is silent (i.e, doesn't show progress on its own)
|
||||
__block BOOL shouldShowUIProgress = YES;
|
||||
if (self.shouldShowUI && [self.installer canInstallSilently]) {
|
||||
if (self.shouldShowUI) {
|
||||
// Ask the updater if it is still alive
|
||||
// If they are, we will receive a pong response back
|
||||
// Reset if we received a pong just to be on the safe side
|
||||
|
||||
@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
|
||||
|
||||
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
|
||||
|
||||
// Always YES in newer versions of Sparkle but kept around for compatibility
|
||||
@property (nonatomic, readonly) BOOL canSilentlyInstall;
|
||||
|
||||
@property (nonatomic) BOOL systemDomain;
|
||||
|
||||
@@ -23,7 +23,8 @@ typedef NS_ENUM(int32_t, SPUInstallerMessageType)
|
||||
SPUInstallationFinishedStage2 = 7,
|
||||
SPUInstallationFinishedStage3 = 8,
|
||||
SPUUpdaterAlivePing = 9,
|
||||
SPUInstallerError = 10
|
||||
SPUInstallerError = 10,
|
||||
SPUInstallerRegisteredAppcastItem = 11,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
|
||||
{
|
||||
BOOL legal;
|
||||
BOOL legal = NO;
|
||||
switch (newMessageType) {
|
||||
case SPUInstallerNotStarted:
|
||||
legal = (oldMessageType == SPUInstallerNotStarted);
|
||||
@@ -45,7 +45,7 @@ BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUI
|
||||
legal = (oldMessageType == SPUInstallationStartedStage1);
|
||||
break;
|
||||
case SPUInstallationFinishedStage2:
|
||||
legal = (oldMessageType == SPUInstallationFinishedStage1);
|
||||
legal = (oldMessageType == SPUInstallationFinishedStage1 || oldMessageType == SPUInstallerRegisteredAppcastItem);
|
||||
break;
|
||||
case SPUInstallationFinishedStage3:
|
||||
legal = (oldMessageType == SPUInstallationFinishedStage2);
|
||||
@@ -56,6 +56,9 @@ BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUI
|
||||
// So just always allow these type of messages
|
||||
legal = YES;
|
||||
break;
|
||||
case SPUInstallerRegisteredAppcastItem:
|
||||
legal = (oldMessageType == SPUInstallationFinishedStage1);
|
||||
break;
|
||||
}
|
||||
return legal;
|
||||
}
|
||||
|
||||
@@ -559,6 +559,8 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
|
||||
if ((commands & SPUDeltaItemCommandBinaryDiff) != 0 || S_ISREG(mode)) {
|
||||
// Regular files
|
||||
|
||||
[fileManager removeItemAtPath:itemFilePath error:NULL];
|
||||
|
||||
char itemFilePathString[PATH_MAX + 1] = {0};
|
||||
if (![itemFilePath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
|
||||
self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path to extract cannot be decoded and expressed as a file system representation: %@", itemFilePath] }];
|
||||
|
||||
@@ -282,6 +282,21 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
|
||||
clonedRelativePath = nil;
|
||||
}
|
||||
|
||||
// Decide if we need to preserve original file permissions from the original file
|
||||
// applyBinaryDeltaToFile() normally preserves file permissions on the file it's replacing.
|
||||
// However this is not possible if the destination file we're patching is not writable.
|
||||
// We also need to preserve permissions for clones except when we'll be changing permissions later anyway.
|
||||
BOOL needsToCopyFilePermissions;
|
||||
if (![fileManager isWritableFileAtPath:destinationFilePath]) {
|
||||
// Remove the file non-writable we're patching that may cause issues
|
||||
[fileManager removeItemAtPath:destinationFilePath error:NULL];
|
||||
|
||||
// We will need to preserve permissons if there is no need to make permission changes later on
|
||||
needsToCopyFilePermissions = (commands & SPUDeltaItemCommandModifyPermissions) == 0;
|
||||
} else {
|
||||
needsToCopyFilePermissions = ((commands & SPUDeltaItemCommandClone) != 0) && ((commands & SPUDeltaItemCommandModifyPermissions) == 0);
|
||||
}
|
||||
|
||||
if (!applyBinaryDeltaToFile(tempDiffFile, sourceDiffFilePath, destinationFilePath)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
@@ -293,12 +308,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
|
||||
return;
|
||||
}
|
||||
|
||||
// Preserve original file permissions from the original file
|
||||
// Only necessary for clones because applyBinaryDeltaToFile() otherwise preserves
|
||||
// file permissions on the file it's replacing. Also not necessary if we're going to
|
||||
// change permissions later
|
||||
if ((commands & SPUDeltaItemCommandClone) != 0 && (commands & SPUDeltaItemCommandModifyPermissions) == 0) {
|
||||
|
||||
if (needsToCopyFilePermissions) {
|
||||
struct stat sourceFileInfo = {0};
|
||||
if (lstat(sourceDiffFilePath.fileSystemRepresentation, &sourceFileInfo) != 0) {
|
||||
if (verbose) {
|
||||
@@ -398,32 +408,17 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
|
||||
|
||||
NSTask *dittoTask = [[NSTask alloc] init];
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
|
||||
} else {
|
||||
dittoTask.launchPath = @"/usr/bin/ditto";
|
||||
}
|
||||
|
||||
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
|
||||
dittoTask.arguments = @[@"--hfsCompression", destination, finalDestination];
|
||||
|
||||
// If we fail to apply file system compression, we will try falling back to not doing this
|
||||
BOOL failedToApplyFileSystemCompression = NO;
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *launchError = nil;
|
||||
if (![dittoTask launchAndReturnError:&launchError]) {
|
||||
failedToApplyFileSystemCompression = YES;
|
||||
|
||||
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", launchError.localizedDescription.UTF8String);
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[dittoTask launch];
|
||||
} @catch (NSException *exception) {
|
||||
failedToApplyFileSystemCompression = YES;
|
||||
|
||||
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", exception.reason.UTF8String);
|
||||
}
|
||||
NSError *launchError = nil;
|
||||
if (![dittoTask launchAndReturnError:&launchError]) {
|
||||
failedToApplyFileSystemCompression = YES;
|
||||
|
||||
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", launchError.localizedDescription.UTF8String);
|
||||
}
|
||||
|
||||
if (!failedToApplyFileSystemCompression) {
|
||||
|
||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath;
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
|
||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,7 +27,6 @@
|
||||
|
||||
@synthesize archivePath = _archivePath;
|
||||
@synthesize updateHostBundlePath = _updateHostBundlePath;
|
||||
@synthesize extractionDirectory = _extractionDirectory;
|
||||
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
@@ -75,13 +73,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_archivePath = [archivePath copy];
|
||||
_updateHostBundlePath = [updateHostBundlePath copy];
|
||||
_extractionDirectory = [extractionDirectory copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -99,7 +96,7 @@
|
||||
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
|
||||
{
|
||||
NSString *sourcePath = self.updateHostBundlePath;
|
||||
NSString *targetPath = [self.extractionDirectory stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
|
||||
NSError *applyDiffError = nil;
|
||||
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
|
||||
|
||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
|
||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@@ -25,7 +24,6 @@
|
||||
|
||||
@synthesize archivePath = _archivePath;
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
@synthesize extractionDirectory = _extractionDirectory;
|
||||
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
@@ -37,13 +35,12 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_archivePath = [archivePath copy];
|
||||
_decryptionPassword = [decryptionPassword copy];
|
||||
_extractionDirectory = [extractionDirectory copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -131,16 +128,8 @@
|
||||
dispatch_semaphore_signal(terminationSemaphore);
|
||||
};
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (![task launchAndReturnError:&error]) {
|
||||
goto reportError;
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *) {
|
||||
goto reportError;
|
||||
}
|
||||
if (![task launchAndReturnError:&error]) {
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[notifier notifyProgress:0.125];
|
||||
@@ -192,7 +181,7 @@
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [self.extractionDirectory stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
itemsCopied += 1.0;
|
||||
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
||||
@@ -224,20 +213,10 @@
|
||||
task.standardOutput = [NSPipe pipe];
|
||||
task.standardError = [NSPipe pipe];
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
NSError *launchCleanupError = nil;
|
||||
if (![task launchAndReturnError:&launchCleanupError]) {
|
||||
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
|
||||
SULog(SULogLevelError, @"Error: %@", launchCleanupError);
|
||||
}
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Can't mount DMG %@", self.archivePath);
|
||||
|
||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// An unarchiver for flat packages that doesn't really do any unarchiving
|
||||
@interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||
|
||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath extractionDirectory:(NSString *)extractionDirectory expectingInstallationType:(NSString *)installationType;
|
||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
@property (nonatomic, readonly) NSString *flatPackagePath;
|
||||
@property (nonatomic, readonly) NSString *expectedInstallationType;
|
||||
@property (nonatomic, readonly) NSString *extractionDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@@ -26,7 +25,6 @@
|
||||
|
||||
@synthesize flatPackagePath = _flatPackagePath;
|
||||
@synthesize expectedInstallationType = _expectedInstallationType;
|
||||
@synthesize extractionDirectory = _extractionDirectory;
|
||||
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||
{
|
||||
@@ -38,13 +36,12 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath extractionDirectory:(NSString *)extractionDirectory expectingInstallationType:(NSString *)installationType
|
||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_flatPackagePath = [flatPackagePath copy];
|
||||
_expectedInstallationType = [installationType copy];
|
||||
_extractionDirectory = [extractionDirectory copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -53,27 +50,14 @@
|
||||
{
|
||||
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
|
||||
|
||||
// Flat packages must use guided package installs, not interactive
|
||||
BOOL isDirectory = NO;
|
||||
if (![self.expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not have guided installation type but %@ instead", self.expectedInstallationType]}]];
|
||||
} else if (![[NSFileManager defaultManager] fileExistsAtPath:self.flatPackagePath isDirectory:&isDirectory] || isDirectory) {
|
||||
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", self.flatPackagePath]}]];
|
||||
} else {
|
||||
// Copying the flat package should be very fast, especially on APFS
|
||||
NSError *copyError = nil;
|
||||
if (![[NSFileManager defaultManager] copyItemAtPath:self.flatPackagePath toPath:[self.extractionDirectory stringByAppendingPathComponent:self.flatPackagePath.lastPathComponent] error:©Error]) {
|
||||
NSMutableDictionary *userInfoDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package (%@) cannot be copied to extraction directory (%@)", self.flatPackagePath, self.extractionDirectory]}];
|
||||
|
||||
if (copyError != nil) {
|
||||
userInfoDictionary[NSUnderlyingErrorKey] = copyError;
|
||||
}
|
||||
|
||||
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfoDictionary]];
|
||||
} else {
|
||||
[notifier notifyProgress:1.0];
|
||||
[notifier notifySuccess];
|
||||
}
|
||||
[notifier notifyProgress:1.0];
|
||||
[notifier notifySuccess];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,30 +56,18 @@
|
||||
task.standardError = nil;
|
||||
task.standardOutput = nil;
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *launchError = nil;
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
if (error != NULL) {
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
[task launch];
|
||||
} @catch (NSException *) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Guided package installer task threw an exception" }];
|
||||
NSError *launchError = nil;
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
if (error != NULL) {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Guided package installer failed to launch" }];
|
||||
|
||||
if (launchError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = launchError;
|
||||
}
|
||||
|
||||
return NO;
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
[task waitUntilExit];
|
||||
@@ -99,9 +87,4 @@
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
|
||||
|
||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
|
||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+16
-54
@@ -8,7 +8,6 @@
|
||||
|
||||
#import "SUInstaller.h"
|
||||
#import "SUPlainInstaller.h"
|
||||
#import "SUPackageInstaller.h"
|
||||
#import "SUGuidedPackageInstaller.h"
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
@@ -22,7 +21,16 @@
|
||||
|
||||
@implementation SUInstaller
|
||||
|
||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
|
||||
+ (BOOL)isAliasFolderAtPath:(NSString *)path
|
||||
{
|
||||
NSNumber *aliasFlag = nil;
|
||||
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
|
||||
NSNumber *directoryFlag = nil;
|
||||
[[NSURL fileURLWithPath:path] getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:nil];
|
||||
return aliasFlag.boolValue && directoryFlag.boolValue;
|
||||
}
|
||||
|
||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr
|
||||
{
|
||||
NSParameterAssert(inUpdateFolder);
|
||||
NSParameterAssert(host);
|
||||
@@ -33,41 +41,12 @@
|
||||
*bundleFileName = [[host bundlePath] lastPathComponent],
|
||||
*alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]];
|
||||
BOOL isPackage = NO;
|
||||
BOOL isGuided = YES;
|
||||
NSString *fallbackPackagePath = nil;
|
||||
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:inUpdateFolder];
|
||||
NSString *bundleFileNameNoExtension = [bundleFileName stringByDeletingPathExtension];
|
||||
|
||||
while ((currentFile = [dirEnum nextObject])) {
|
||||
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
|
||||
|
||||
// Ignore all symbolic links and aliases
|
||||
{
|
||||
NSURL *currentPathURL = [NSURL fileURLWithPath:currentPath];
|
||||
|
||||
NSNumber *symbolicLinkFlag = nil;
|
||||
[currentPathURL getResourceValue:&symbolicLinkFlag forKey:NSURLIsSymbolicLinkKey error:NULL];
|
||||
if (symbolicLinkFlag.boolValue) {
|
||||
// NSDirectoryEnumerator won't recurse into symlinked directories
|
||||
continue;
|
||||
}
|
||||
|
||||
NSNumber *aliasFlag = nil;
|
||||
[currentPathURL getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:NULL];
|
||||
|
||||
if (aliasFlag.boolValue) {
|
||||
NSNumber *directoryFlag = nil;
|
||||
[currentPathURL getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:NULL];
|
||||
|
||||
// Some DMGs have symlinks into /Applications! That's no good!
|
||||
if (directoryFlag.boolValue) {
|
||||
[dirEnum skipDescendents];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *currentFilename = [currentFile lastPathComponent];
|
||||
NSString *currentExtension = [currentFile pathExtension];
|
||||
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
|
||||
@@ -97,6 +76,10 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Some DMGs have symlinks into /Applications! That's no good!
|
||||
if ([self isAliasFolderAtPath:currentPath])
|
||||
[dirEnum skipDescendents];
|
||||
}
|
||||
|
||||
// We don't have a valid path. Try to use the fallback package.
|
||||
@@ -106,20 +89,8 @@
|
||||
newAppDownloadPath = fallbackPackagePath;
|
||||
}
|
||||
|
||||
if (isPackage) {
|
||||
// Guided (or now "normal") installs used to be opt-in (i.e, Sparkle would detect foo.sparkle_guided.pkg or foo.sparkle_guided.mpkg),
|
||||
// but to get an interactive (or "unguided") install, the developer now must opt-out of guided installations.
|
||||
|
||||
// foo.app -> foo.sparkle_interactive.pkg or foo.sparkle_interactive.mpkg
|
||||
if ([[[newAppDownloadPath stringByDeletingPathExtension] pathExtension] isEqualToString:@"sparkle_interactive"]) {
|
||||
isGuided = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPackagePtr)
|
||||
*isPackagePtr = isPackage;
|
||||
if (isGuidedPtr)
|
||||
*isGuidedPtr = isGuided;
|
||||
|
||||
if (!newAppDownloadPath) {
|
||||
SULog(SULogLevelError, @"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
|
||||
@@ -130,8 +101,7 @@
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
BOOL isGuided = NO;
|
||||
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:&isGuided];
|
||||
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage];
|
||||
|
||||
if (newDownloadPath == nil) {
|
||||
if (error != NULL) {
|
||||
@@ -144,7 +114,7 @@
|
||||
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
|
||||
// ahead of time whether or not this installer tool should be ran as root or not
|
||||
id <SUInstallerProtocol> installer = nil;
|
||||
if (isPackage && isGuided) {
|
||||
if (isPackage) {
|
||||
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found guided package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeGuidedPackage] }];
|
||||
@@ -152,14 +122,6 @@
|
||||
} else {
|
||||
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath homeDirectory:homeDirectory userName:userName];
|
||||
}
|
||||
} else if (isPackage) {
|
||||
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeInteractivePackage] }];
|
||||
}
|
||||
} else {
|
||||
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
|
||||
}
|
||||
} else {
|
||||
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||
if (error != NULL) {
|
||||
|
||||
@@ -28,11 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Should be able to be called from any thread
|
||||
- (void)performCleanup;
|
||||
|
||||
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
|
||||
// If this returns NO, then the installation can fail if the user did not directly request for the install to occur.
|
||||
// Should be thread safe
|
||||
- (BOOL)canInstallSilently;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// SUPackageInstaller.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUInstallerProtocol.h"
|
||||
|
||||
// This is the deprecated package installation type, aka the "interactive" package installer
|
||||
// For a more supported package installation, see SUGuidedPackageInstaller
|
||||
|
||||
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath;
|
||||
|
||||
@end
|
||||
@@ -1,82 +0,0 @@
|
||||
//
|
||||
// SUPackageInstaller.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUPackageInstaller.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SULog.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@interface SUPackageInstaller ()
|
||||
|
||||
@property (nonatomic, readonly, copy) NSString *packagePath;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUPackageInstaller
|
||||
|
||||
static NSString *SUOpenUtilityPath = @"/usr/bin/open";
|
||||
|
||||
@synthesize packagePath = _packagePath;
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_packagePath = [packagePath copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
|
||||
{
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:SUOpenUtilityPath]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:@{ NSLocalizedDescriptionKey: @"Couldn't find Apple's installer tool!" }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError *__autoreleasing*)error
|
||||
{
|
||||
// Run installer using the "open" command to ensure it is launched in front of current application.
|
||||
// -W = wait until the app has quit.
|
||||
// -n = Open another instance if already open.
|
||||
// -b = app bundle identifier
|
||||
NSArray *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", self.packagePath];
|
||||
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
@try {
|
||||
NSTask *installer = [NSTask launchedTaskWithLaunchPath:SUOpenUtilityPath arguments:args];
|
||||
[installer waitUntilExit];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Error: Failed to launch package installer: %@", exception);
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Package installer failed to launch." }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)performCleanup
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory;
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -17,14 +17,12 @@
|
||||
@interface SUPipedUnarchiver ()
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUPipedUnarchiver
|
||||
|
||||
@synthesize archivePath = _archivePath;
|
||||
@synthesize extractionDirectory = _extractionDirectory;
|
||||
|
||||
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
|
||||
{
|
||||
@@ -65,12 +63,11 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory
|
||||
- (instancetype)initWithArchivePath:(NSString *)archivePath
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_archivePath = [archivePath copy];
|
||||
_extractionDirectory = [extractionDirectory copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -96,7 +93,7 @@
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
@autoreleasepool {
|
||||
NSString *destination = self.extractionDirectory;
|
||||
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
|
||||
|
||||
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
||||
|
||||
@@ -122,19 +119,9 @@
|
||||
[task setArguments:[args arrayByAddingObject:destination]];
|
||||
|
||||
NSError *launchError = nil;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
[notifier notifyFailureWithError:launchError];
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@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;
|
||||
}
|
||||
if (![task launchAndReturnError:&launchError]) {
|
||||
[notifier notifyFailureWithError:launchError];
|
||||
return;
|
||||
}
|
||||
|
||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||
|
||||
@@ -200,17 +200,13 @@
|
||||
// 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]) {
|
||||
swappedApp = NO;
|
||||
} else {
|
||||
// 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 {
|
||||
// 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]) {
|
||||
swappedApp = NO;
|
||||
} else {
|
||||
// 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];
|
||||
}
|
||||
|
||||
if (!swappedApp) {
|
||||
@@ -334,9 +330,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUUnarchiver : NSObject
|
||||
|
||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType;
|
||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -18,21 +18,21 @@
|
||||
|
||||
@implementation SUUnarchiver
|
||||
|
||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType
|
||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType
|
||||
{
|
||||
if ([SUPipedUnarchiver canUnarchivePath:path]) {
|
||||
return [[SUPipedUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory];
|
||||
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
|
||||
|
||||
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
|
||||
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory decryptionPassword:decryptionPassword];
|
||||
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
|
||||
|
||||
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
|
||||
assert(hostPath != nil);
|
||||
NSString *nonNullHostPath = hostPath;
|
||||
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory updateHostBundlePath:nonNullHostPath];
|
||||
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
|
||||
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
|
||||
// Flat packages are only supported for guided packaage installs
|
||||
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path extractionDirectory:extractionDirectory expectingInstallationType:installationType];
|
||||
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path expectingInstallationType:installationType];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+8
-43
@@ -12,18 +12,15 @@
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
#define REPLY_STATUS_INFO_TIMEOUT 2
|
||||
|
||||
@interface StatusInfo () <NSXPCListenerDelegate>
|
||||
|
||||
@property (nonatomic) NSXPCListener *xpcListener;
|
||||
|
||||
@end
|
||||
|
||||
@implementation StatusInfo
|
||||
{
|
||||
NSXPCListener *_xpcListener;
|
||||
NSMutableDictionary *_pendingReplies;
|
||||
NSUInteger _pendingReplyCounter;
|
||||
}
|
||||
|
||||
@synthesize xpcListener = _xpcListener;
|
||||
@synthesize installationInfoData = _installationInfoData;
|
||||
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier
|
||||
@@ -32,20 +29,19 @@
|
||||
if (self != nil) {
|
||||
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
|
||||
_xpcListener.delegate = self;
|
||||
_pendingReplies = [NSMutableDictionary dictionary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)startListener
|
||||
{
|
||||
[_xpcListener resume];
|
||||
[self.xpcListener resume];
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
[_xpcListener invalidate];
|
||||
_xpcListener = nil;
|
||||
[self.xpcListener invalidate];
|
||||
self.xpcListener = nil;
|
||||
}
|
||||
|
||||
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
|
||||
@@ -58,41 +54,10 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setInstallationInfoData:(NSData *)installationInfoData
|
||||
{
|
||||
_installationInfoData = installationInfoData;
|
||||
|
||||
// Respond to all of our pending replies
|
||||
for (NSNumber *replyKey in _pendingReplies) {
|
||||
void (^replyBlock)(NSData * _Nullable) = self->_pendingReplies[replyKey];
|
||||
replyBlock(_installationInfoData);
|
||||
}
|
||||
|
||||
[_pendingReplies removeAllObjects];
|
||||
}
|
||||
|
||||
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable))reply
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self->_installationInfoData != nil) {
|
||||
reply(self->_installationInfoData);
|
||||
} else {
|
||||
// If we don't have the installation info data currently, we may receive it in a very short window afterwards
|
||||
// In this case wait a bit for the reply. If we receive the data it will be in -setInstallationInfoData:
|
||||
NSUInteger currentReplyCounter = self->_pendingReplyCounter;
|
||||
self->_pendingReplyCounter++;
|
||||
|
||||
NSNumber *currentReplyCounterKey = @(currentReplyCounter);
|
||||
self->_pendingReplies[currentReplyCounterKey] = [reply copy];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(REPLY_STATUS_INFO_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
void (^replyBlock)(NSData * _Nullable) = self->_pendingReplies[currentReplyCounterKey];
|
||||
if (replyBlock != nil) {
|
||||
replyBlock(self->_installationInfoData);
|
||||
[self->_pendingReplies removeObjectForKey:currentReplyCounterKey];
|
||||
}
|
||||
});
|
||||
}
|
||||
reply(self.installationInfoData);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-5
@@ -28,11 +28,7 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
|
||||
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
|
||||
dispatch_source_set_event_handler(sigtermSource, ^{
|
||||
// Don't clear the update directory because the installer may be in middle of installing an update
|
||||
// We still need to set an event handler for receiving SIGTERM though, otherwise our job may not terminate
|
||||
// (This is also recommended from the developer documentation).
|
||||
// Simply exit with SIGTERM if we recieve this signal
|
||||
exit(SIGTERM);
|
||||
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
|
||||
});
|
||||
dispatch_resume(sigtermSource);
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# 2.2.2
|
||||
|
||||
* Critical update alerts may not show up as promptly as they should when they are being automatically installed (#2230) (Zorg)
|
||||
* Remove module imports from framework headers (#2217) (Zorg)
|
||||
* Update Portuguese localization (#2224) (Kent Sutherland)
|
||||
* Update zh_TW localization (#2246) (Chiahong)
|
||||
|
||||
# 2.2.1
|
||||
|
||||
* Make scroll bar dark in dark theme for Release Notes by default (#2187) (Pavel Moiseenko)
|
||||
|
||||
+1
-1
@@ -1 +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", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz"}
|
||||
{"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", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz"}
|
||||
@@ -43,12 +43,12 @@ SPARKLE_ICON_NAME = AppIcon
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_MAJOR = 2
|
||||
SPARKLE_VERSION_MINOR = 2
|
||||
SPARKLE_VERSION_PATCH = 2
|
||||
SPARKLE_VERSION_PATCH = 1
|
||||
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_SUFFIX =
|
||||
CURRENT_PROJECT_VERSION = 2017.1
|
||||
CURRENT_PROJECT_VERSION = 2017
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
@@ -56,7 +56,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
||||
ARCHS = $(ARCHS_STANDARD)
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
PRODUCT_NAME = ${TARGET_NAME}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ The launcher then looks for the installer and agent application. If we are insid
|
||||
|
||||
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.
|
||||
* If the installation type from the appcast is a guided 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 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.
|
||||
@@ -69,28 +68,29 @@ When the installer gets the process identifier, it begins the installation. At t
|
||||
|
||||
### Starting the Installation
|
||||
|
||||
The installer figures out what kind of installer to use (regular, guided pkg, interactive pkg) based on the type of file inside the archive. If the type of file doesn't match the expected installation type from the input installation data, then the installer aborts causing the updater to abort as well.
|
||||
The installer figures out what kind of installer to use (regular, guided pkg) based on the type of file inside the archive. If the type of file doesn't match the expected installation type from the input installation data, then the installer aborts causing the updater to abort as well.
|
||||
|
||||
Once the type of installer is found, the first stage of installation is performed:
|
||||
|
||||
* Regular application installer 1st stage: Makes sure this update is not a downgrade.
|
||||
* Guided Package installer 1st stage: Does nothing.
|
||||
* Interactive Package installer (deprecated) 1st stage: Makes sure /usr/bin/open utility is available.
|
||||
|
||||
If the first stage fails, the installer aborts causing the updater to abort the update.
|
||||
|
||||
Otherwise a `SPUInstallationFinishedStage1` message is sent back to the updater along with some data. This data includes whether the application bundle to relaunch is currently terminated, and whether the installation at later stages can be performed silently (that is, with no user interaction allowed). If we reach here, only the interactive package installer can't be performed silently.
|
||||
Otherwise a `SPUInstallationFinishedStage1` message is sent back to the updater.
|
||||
|
||||
The installer then listens and waits for the target application to relaunch terminates. If it is already terminated, then it resumes to stage 2 and 3 of the installation immediately on the assumption that the installer does not have permission to show UI interaction to the user. Thus if the installer has to show user interaction here and hasn't received an OK from the updater (it won't if the target application is already terminated), the install will fail. If the target is already terminated, the installer will also assume that the target should not be relaunched after installation.
|
||||
|
||||
### Installation Waiting Period
|
||||
The updater receives `SPUInstallationFinishedStage1` message. The updater sends a message `SPUSentUpdateAppcastItemData` with the appcast data in case the updater may request for it later (due to installer resumability, discussed later). It also reads if the target has already been terminated (implying that the installer will continue installing the update immediately), and if the installation will be done silently.
|
||||
The updater receives `SPUInstallationFinishedStage1` message. The updater sends a message `SPUSentUpdateAppcastItemData` with the appcast data in case the updater may request for it later (due to installer resumability, discussed later).
|
||||
|
||||
The updater waits to receive a `SPUInstallerRegisteredAppcastItem` message indicating the installer registered receiving the appcast item data (it waits for this registration to avoid a race of asking for it later and not being provided with info). The updater also reads if the target has already been terminated (implying that the installer will continue installing the update immediately).
|
||||
|
||||
For UI based update drivers, the updater tells the user driver to show that the application is ready to be relaunched - the user can continue to install & relaunch the app. The user driver is only alerted however if the installation isn't happening immediately (that is, if the target application to relaunch is still alive). The user driver can decide whether to a) install b) install & relaunch or c) delay installation. If installation is delayed, it can be resumed later, or if the target application terminates, the installer will try to continue installation if it is capable to without user interaction.
|
||||
|
||||
For automatic based drivers, if the update is not going to be installed immediately and if it can be installed silently, the updater's delegate has a choice to handle the immediate installation of the update. If the delegate handles the installation, it can invoke a block that will trigger the automatic update driver to tell the installer to resume to stage 2 as detailed in step the "Continue to Installation" section - except without displaying any user interface and by relaunching the application afterwards. If the delegate handles the immediate installation, the automatic update driver will not abort, it will just leave the driver running until the installer requests for the app to be terminated later. This means the update can't be resumed later and the user driver won't be involved.
|
||||
For automatic based drivers, if the update is not going to be installed immediately, the updater's delegate has a choice to handle the immediate installation of the update. If the delegate handles the installation, it can invoke a block that will trigger the automatic update driver to tell the installer to resume to stage 2 as detailed in step the "Continue to Installation" section - except without displaying any user interface and by relaunching the application afterwards. If the delegate handles the immediate installation, the automatic update driver will not abort, it will just leave the driver running until the installer requests for the app to be terminated later. This means the update can't be resumed later and the user driver won't be involved.
|
||||
|
||||
Otherwise if the updater delegate doesn't handle immediate installation for automatic based drivers (assuming still the update is not going to be installed immediately), the update driver is aborted; the installer will still wait for the target to terminate however. If the update cannot be silently installed or if the update is marked as critical from the appcast, the update procedure is actually 'resumed' as a scheduled UI based update driver immediately. The update driver can also be 'resumed' later when the user initiates for an update manually or when a long duration (I think a week) has passed by without the user terminating the application. Note automatic based drivers are unable to do a resume, so only UI based ones can.
|
||||
Otherwise if the updater delegate doesn't handle immediate installation for automatic based drivers (assuming still the update is not going to be installed immediately), the update driver is aborted; the installer will still wait for the target to terminate however. If the update is marked as critical from the appcast, the update procedure is actually 'resumed' as a scheduled UI based update driver immediately. The update driver can also be 'resumed' later when the user initiates for an update manually or when a long duration (I think a week) has passed by without the user terminating the application. Note automatic based drivers are unable to do a resume, so only UI based ones can.
|
||||
|
||||
If an update driver is resumed (which cannot happen if the target applicaton is already terminated by the way), then the updater first requests the installer for the appcast item data that the installer received before. The updater does this by creating a temporary distinct connection for the purpose of querying for the installation status. The connection will give up if a short timeout passes. If the updater fails to retrieve resume data, it assumes that there's no update to resume and will start back from the beginning. The updater can use this data for showing release notes, etc. Note the updater and target application don't have to live in the same process, and the updater could choose to terminate and resume later as a new process - so having the installer keep the appcast item data is nice.
|
||||
|
||||
|
||||
@@ -375,14 +375,11 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, NSString *installat
|
||||
if (!rootUser) {
|
||||
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
return YES;
|
||||
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
return NO;
|
||||
} else {
|
||||
return SPUSystemNeedsAuthorizationAccessForBundlePath(path);
|
||||
}
|
||||
} else {
|
||||
// If we are the root user we use the system domain even if we don't need escalated authorization.
|
||||
// Note interactive package installations are not supported as root.
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.2.2"
|
||||
let version = "2.2.1"
|
||||
// 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.2.2"
|
||||
let checksum = "aafce90805ca50d099c32e744636b2524a7382629f8f7e14ff21c84634125a44"
|
||||
let tag = "2.2.1"
|
||||
let checksum = "ce1e73dccebfd06c638ea9fc37451a690ea3137e1333406ec5dddb9e11b4e1b5"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ Please visit [Sparkle's website](http://sparkle-project.org) for up to date docu
|
||||
|
||||
## Requirements
|
||||
|
||||
* Runtime: macOS 10.11 or greater
|
||||
* Runtime: macOS 10.13 or greater for 2.3, macOS 10.11 or greater for 2.2.x
|
||||
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less.
|
||||
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
|
||||
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ADP2,1</key>
|
||||
<string>Developer Transition Kit</string>
|
||||
<key>iMac1,1</key>
|
||||
<string>iMac G3 (Rev A-D)</string>
|
||||
<key>iMac4,1</key>
|
||||
<string>iMac (Core Duo)</string>
|
||||
<key>iMac4,2</key>
|
||||
<string>iMac for Education (17 inch, Core Duo)</string>
|
||||
<key>iMac5,1</key>
|
||||
<string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string>
|
||||
<key>iMac5,2</key>
|
||||
<string>iMac (Core 2 Duo, 17 inch, Combo Drive)</string>
|
||||
<key>iMac6,1</key>
|
||||
<string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string>
|
||||
<key>iMac7,1</key>
|
||||
<string>iMac Intel Core 2 Duo (aluminum enclosure)</string>
|
||||
<key>iMac8,1</key>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early 2008 )</string>
|
||||
<key>iMac9,1</key>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early or Mid 2009 )</string>
|
||||
<key>iMac10,1</key>
|
||||
<string>iMac (Core 2 Duo, 21.5 or 27 inch, Late 2009 )</string>
|
||||
<key>iMac11,1</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2009)</string>
|
||||
<key>iMac11,2</key>
|
||||
<string>21.5" iMac (mid 2010)</string>
|
||||
<key>iMac11,3</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2010)</string>
|
||||
<key>iMac12,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Mid 2010 or Late 2011)</string>
|
||||
<key>iMac12,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2011)</string>
|
||||
<key>iMac13,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Late 2012 or Early 2013)</string>
|
||||
<key>iMac13,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2012)</string>
|
||||
<key>iMac14,1</key>
|
||||
<string>iMac (Core i5, 21.5 inch Late 2013)</string>
|
||||
<key>iMac14,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2013)</string>
|
||||
<key>iMac14,3</key>
|
||||
<string>iMac (Core i5 or i7, 21.5 inch Late 2013)</string>
|
||||
<key>iMac14,4</key>
|
||||
<string>iMac (Core i5, 21.5 inch Mid 2014)</string>
|
||||
<key>iMac15,1</key>
|
||||
<string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2014 or Mid 2015)</string>
|
||||
<key>iMac16,1</key>
|
||||
<string>iMac (Core i5, 21,5 inch Late 2015)</string>
|
||||
<key>iMac16,2</key>
|
||||
<string>iMac (Retina 4K Core i5 or i7, 21.5 inch Late 2015)</string>
|
||||
<key>iMac17,1</key>
|
||||
<string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2015)</string>
|
||||
<key>MacBook1,1</key>
|
||||
<string>MacBook (Core Duo)</string>
|
||||
<key>MacBook2,1</key>
|
||||
<string>MacBook (Core 2 Duo)</string>
|
||||
<key>MacBook4,1</key>
|
||||
<string>MacBook (Core 2 Duo Feb 2008)</string>
|
||||
<key>MacBook5,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2008, Unibody)</string>
|
||||
<key>MacBook5,2</key>
|
||||
<string>MacBook (Core 2 Duo, Early 2009, White)</string>
|
||||
<key>MacBook6,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2009, Unibody)</string>
|
||||
<key>MacBook7,1</key>
|
||||
<string>MacBook (Core 2 Duo, Mid 2010, White)</string>
|
||||
<key>MacBook8,1</key>
|
||||
<string>MacBook (Core M, 12 inch, Early 2015)</string>
|
||||
<key>MacBookAir1,1</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Early 2008)</string>
|
||||
<key>MacBookAir2,1</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Mid 2009)</string>
|
||||
<key>MacBookAir3,1</key>
|
||||
<string>MacBook Air (Core 2 Duo, 11 inch, Late 2010)</string>
|
||||
<key>MacBookAir3,2</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Late 2010)</string>
|
||||
<key>MacBookAir4,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2011)</string>
|
||||
<key>MacBookAir4,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2011)</string>
|
||||
<key>MacBookAir5,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2012)</string>
|
||||
<key>MacBookAir5,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2012)</string>
|
||||
<key>MacBookAir6,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookAir6,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookAir7,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Early 2015)</string>
|
||||
<key>MacBookAir7,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Early 2015)</string>
|
||||
<key>MacBookPro1,1</key>
|
||||
<string>MacBook Pro Core Duo (15-inch)</string>
|
||||
<key>MacBookPro1,2</key>
|
||||
<string>MacBook Pro Core Duo (17-inch)</string>
|
||||
<key>MacBookPro2,1</key>
|
||||
<string>MacBook Pro Core 2 Duo (17-inch)</string>
|
||||
<key>MacBookPro2,2</key>
|
||||
<string>MacBook Pro Core 2 Duo (15-inch)</string>
|
||||
<key>MacBookPro3,1</key>
|
||||
<string>MacBook Pro Core 2 Duo (15-inch LED, Core 2 Duo)</string>
|
||||
<key>MacBookPro3,2</key>
|
||||
<string>MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo)</string>
|
||||
<key>MacBookPro4,1</key>
|
||||
<string>MacBook Pro (Core 2 Duo Feb 2008)</string>
|
||||
<key>MacBookPro5,1</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
|
||||
<key>MacBookPro5,2</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
|
||||
<key>MacBookPro5,3</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
|
||||
<key>MacBookPro5,4</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
|
||||
<key>MacBookPro5,5</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
|
||||
<key>MacBookPro6,1</key>
|
||||
<string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string>
|
||||
<key>MacBookPro6,2</key>
|
||||
<string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string>
|
||||
<key>MacBookPro7,1</key>
|
||||
<string>MacBook Pro Intel Core 2 Duo (mid 2010)</string>
|
||||
<key>MacBookPro8,1</key>
|
||||
<string>MacBook Pro Intel Core i5, Intel Core i7, 13" (early 2011)</string>
|
||||
<key>MacBookPro8,2</key>
|
||||
<string>MacBook Pro Intel Core i7, 15" (early 2011)</string>
|
||||
<key>MacBookPro8,3</key>
|
||||
<string>MacBook Pro Intel Core i7, 17" (early 2011)</string>
|
||||
<key>MacBookPro9,1</key>
|
||||
<string>MacBook Pro (15-inch, Mid 2012)</string>
|
||||
<key>MacBookPro9,2</key>
|
||||
<string>MacBook Pro (13-inch, Mid 2012)</string>
|
||||
<key>MacBookPro10,1</key>
|
||||
<string>MacBook Pro (Retina, Mid 2012)</string>
|
||||
<key>MacBookPro10,2</key>
|
||||
<string>MacBook Pro (Retina, 13-inch, Late 2012)</string>
|
||||
<key>MacBookPro11,1</key>
|
||||
<string>MacBook Pro (Retina, 13-inch, Late 2013)</string>
|
||||
<key>MacBookPro11,2</key>
|
||||
<string>MacBook Pro (Retina, 15-inch, Late 2013)</string>
|
||||
<key>MacBookPro11,3</key>
|
||||
<string>MacBook Pro (Retina, 15-inch, Late 2013)</string>
|
||||
<key>MacbookPro11,4</key>
|
||||
<string>MacBook Pro (Retina, 15-inch, Mid 2015)</string>
|
||||
<key>MacbookPro11,5</key>
|
||||
<string>MacBook Pro (Retina, 15-inch, Mid 2015)</string>
|
||||
<key>MacbookPro12,1 </key>
|
||||
<string>MacBook Pro (Retina, 13-inch, Early 2015)</string>
|
||||
<key>Macmini1,1</key>
|
||||
<string>Mac Mini (Core Solo/Duo)</string>
|
||||
<key>Macmini2,1</key>
|
||||
<string>Mac mini Intel Core</string>
|
||||
<key>Macmini3,1</key>
|
||||
<string>Mac mini Intel Core</string>
|
||||
<key>Macmini4,1</key>
|
||||
<string>Mac mini Intel Core (Mid 2010)</string>
|
||||
<key>Macmini5,1</key>
|
||||
<string>Mac mini (Core i5, Mid 2011)</string>
|
||||
<key>Macmini5,2</key>
|
||||
<string>Mac mini (Core i5 or Core i7, Mid 2011)</string>
|
||||
<key>Macmini5,3</key>
|
||||
<string>Mac mini (Core i7, Server, Mid 2011)</string>
|
||||
<key>Macmini6,1</key>
|
||||
<string>Mac mini (Core i5, Late 2012)</string>
|
||||
<key>Macmini6,2</key>
|
||||
<string>Mac mini (Core i7, Normal or Server, Late 2012)</string>
|
||||
<key>Macmini7,1</key>
|
||||
<string>Mac mini (Core i5 or Core i7, Late 2014)</string>
|
||||
<key>MacPro1,1,Quad</key>
|
||||
<string>Mac Pro</string>
|
||||
<key>MacPro1,1</key>
|
||||
<string>Mac Pro (four-core)</string>
|
||||
<key>MacPro2,1</key>
|
||||
<string>Mac Pro (eight-core)</string>
|
||||
<key>MacPro3,1</key>
|
||||
<string>Mac Pro (January 2008 4- or 8- core "Harpertown")</string>
|
||||
<key>MacPro4,1</key>
|
||||
<string>Mac Pro (March 2009)</string>
|
||||
<key>MacPro5,1</key>
|
||||
<string>Mac Pro (2010 or 2012)</string>
|
||||
<key>MacPro6,1</key>
|
||||
<string>Mac Pro (Late 2013)</string>
|
||||
<key>PowerBook1,1</key>
|
||||
<string>PowerBook G3</string>
|
||||
<key>PowerBook2,1</key>
|
||||
<string>iBook G3</string>
|
||||
<key>PowerBook2,2</key>
|
||||
<string>iBook G3 (FireWire)</string>
|
||||
<key>PowerBook2,3</key>
|
||||
<string>iBook G3</string>
|
||||
<key>PowerBook2,4</key>
|
||||
<string>iBook G3</string>
|
||||
<key>PowerBook3,1</key>
|
||||
<string>PowerBook G3 (FireWire)</string>
|
||||
<key>PowerBook3,2</key>
|
||||
<string>PowerBook G4</string>
|
||||
<key>PowerBook3,3</key>
|
||||
<string>PowerBook G4 (Gigabit Ethernet)</string>
|
||||
<key>PowerBook3,4</key>
|
||||
<string>PowerBook G4 (DVI)</string>
|
||||
<key>PowerBook3,5</key>
|
||||
<string>PowerBook G4 (1GHz / 867MHz)</string>
|
||||
<key>PowerBook4,1</key>
|
||||
<string>iBook G3 (Dual USB, Late 2001)</string>
|
||||
<key>PowerBook4,2</key>
|
||||
<string>iBook G3 (16MB VRAM)</string>
|
||||
<key>PowerBook4,3</key>
|
||||
<string>iBook G3 Opaque 16MB VRAM, 32MB VRAM, Early 2003)</string>
|
||||
<key>PowerBook5,1</key>
|
||||
<string>PowerBook G4 (17 inch)</string>
|
||||
<key>PowerBook5,2</key>
|
||||
<string>PowerBook G4 (15 inch FW 800)</string>
|
||||
<key>PowerBook5,3</key>
|
||||
<string>PowerBook G4 (17-inch 1.33GHz)</string>
|
||||
<key>PowerBook5,4</key>
|
||||
<string>PowerBook G4 (15 inch 1.5/1.33GHz)</string>
|
||||
<key>PowerBook5,5</key>
|
||||
<string>PowerBook G4 (17-inch 1.5GHz)</string>
|
||||
<key>PowerBook5,6</key>
|
||||
<string>PowerBook G4 (15 inch 1.67GHz/1.5GHz)</string>
|
||||
<key>PowerBook5,7</key>
|
||||
<string>PowerBook G4 (17-inch 1.67GHz)</string>
|
||||
<key>PowerBook5,8</key>
|
||||
<string>PowerBook G4 (Double layer SD, 15 inch)</string>
|
||||
<key>PowerBook5,9</key>
|
||||
<string>PowerBook G4 (Double layer SD, 17 inch)</string>
|
||||
<key>PowerBook6,1</key>
|
||||
<string>PowerBook G4 (12 inch)</string>
|
||||
<key>PowerBook6,2</key>
|
||||
<string>PowerBook G4 (12 inch, DVI)</string>
|
||||
<key>PowerBook6,3</key>
|
||||
<string>iBook G4</string>
|
||||
<key>PowerBook6,4</key>
|
||||
<string>PowerBook G4 (12 inch 1.33GHz)</string>
|
||||
<key>PowerBook6,5</key>
|
||||
<string>iBook G4 (Early-Late 2004)</string>
|
||||
<key>PowerBook6,7</key>
|
||||
<string>iBook G4 (Mid 2005)</string>
|
||||
<key>PowerBook6,8</key>
|
||||
<string>PowerBook G4 (12 inch 1.5GHz)</string>
|
||||
<key>PowerMac1,1</key>
|
||||
<string>Power Macintosh G3 (Blue & White)</string>
|
||||
<key>PowerMac1,2</key>
|
||||
<string>Power Macintosh G4 (PCI Graphics)</string>
|
||||
<key>PowerMac2,1</key>
|
||||
<string>iMac G3 (Slot-loading CD-ROM)</string>
|
||||
<key>PowerMac2,2</key>
|
||||
<string>iMac G3 (Summer 2000)</string>
|
||||
<key>PowerMac3,1</key>
|
||||
<string>Power Macintosh G4 (AGP Graphics)</string>
|
||||
<key>PowerMac3,2</key>
|
||||
<string>Power Macintosh G4 (AGP Graphics)</string>
|
||||
<key>PowerMac3,3</key>
|
||||
<string>Power Macintosh G4 (Gigabit Ethernet)</string>
|
||||
<key>PowerMac3,4</key>
|
||||
<string>Power Macintosh G4 (Digital Audio)</string>
|
||||
<key>PowerMac3,5</key>
|
||||
<string>Power Macintosh G4 (Quick Silver)</string>
|
||||
<key>PowerMac3,6</key>
|
||||
<string>Power Macintosh G4 (Mirrored Drive Door)</string>
|
||||
<key>PowerMac4,1</key>
|
||||
<string>iMac G3 (Early/Summer 2001)</string>
|
||||
<key>PowerMac4,2</key>
|
||||
<string>iMac G4 (Flat Panel)</string>
|
||||
<key>PowerMac4,4</key>
|
||||
<string>eMac</string>
|
||||
<key>PowerMac4,5</key>
|
||||
<string>iMac G4 (17-inch Flat Panel)</string>
|
||||
<key>PowerMac5,1</key>
|
||||
<string>Power Macintosh G4 Cube</string>
|
||||
<key>PowerMac5,2</key>
|
||||
<string>Power Mac G4 Cube</string>
|
||||
<key>PowerMac6,1</key>
|
||||
<string>iMac G4 (USB 2.0)</string>
|
||||
<key>PowerMac6,3</key>
|
||||
<string>iMac G4 (20-inch Flat Panel)</string>
|
||||
<key>PowerMac6,4</key>
|
||||
<string>eMac (USB 2.0, 2005)</string>
|
||||
<key>PowerMac7,2</key>
|
||||
<string>Power Macintosh G5</string>
|
||||
<key>PowerMac7,3</key>
|
||||
<string>Power Macintosh G5</string>
|
||||
<key>PowerMac8,1</key>
|
||||
<string>iMac G5</string>
|
||||
<key>PowerMac8,2</key>
|
||||
<string>iMac G5 (Ambient Light Sensor)</string>
|
||||
<key>PowerMac9,1</key>
|
||||
<string>Power Macintosh G5 (Late 2005)</string>
|
||||
<key>PowerMac10,1</key>
|
||||
<string>Mac Mini G4</string>
|
||||
<key>PowerMac10,2</key>
|
||||
<string>Mac Mini (Late 2005)</string>
|
||||
<key>PowerMac11,2</key>
|
||||
<string>Power Macintosh G5 (Late 2005)</string>
|
||||
<key>PowerMac12,1</key>
|
||||
<string>iMac G5 (iSight)</string>
|
||||
<key>RackMac1,1</key>
|
||||
<string>Xserve G4</string>
|
||||
<key>RackMac1,2</key>
|
||||
<string>Xserve G4 (slot-loading, cluster node)</string>
|
||||
<key>RackMac3,1</key>
|
||||
<string>Xserve G5</string>
|
||||
<key>Xserve1,1</key>
|
||||
<string>Xserve (Intel Xeon)</string>
|
||||
<key>Xserve2,1</key>
|
||||
<string>Xserve (January 2008 quad-core)</string>
|
||||
<key>Xserve3,1</key>
|
||||
<string>Xserve (early 2009)</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -16,7 +16,7 @@
|
||||
</sparkle:fullReleaseNotesLink>
|
||||
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
|
||||
<enclosure url="https://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
@@ -31,7 +31,7 @@
|
||||
</sparkle:fullReleaseNotesLink>
|
||||
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
|
||||
<enclosure url="https://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
|
||||
@@ -48,7 +48,7 @@
|
||||
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
|
||||
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
|
||||
<enclosure url="https://you.com/app/Your%20Great%20App%201.4.zip" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.2.2"
|
||||
s.version = "2.2.1"
|
||||
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"
|
||||
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
||||
'Andy Matuschak' => 'andy@andymatuschak.org',
|
||||
}
|
||||
|
||||
s.platform = :osx, '10.11'
|
||||
s.platform = :osx, '10.13'
|
||||
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.xz" }
|
||||
s.source_files = 'Sparkle.framework/Versions/B/Headers/*.h'
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
61299A6009CA6EB100B7442F /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
|
||||
61299B3609CB04E000B7442F /* Sparkle.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299B3509CB04E000B7442F /* Sparkle.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */ = {isa = PBXBuildFile; fileRef = 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */; };
|
||||
615AE3D00D64DC40001CA7BD /* SUModelTranslation.plist in Resources */ = {isa = PBXBuildFile; fileRef = 615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */; };
|
||||
6196CFF909C72148000DC222 /* SUStatusController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6196CFE309C71ADE000DC222 /* SUStatusController.h */; settings = {ATTRIBUTES = (); }; };
|
||||
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; };
|
||||
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A2259C0D1C495D00430CCD /* SUVersionComparisonProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -263,7 +262,6 @@
|
||||
7267E5B81D3D8AEE00D1BF90 /* SPUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */; };
|
||||
7267E5C21D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */; };
|
||||
7267E5C31D3D8B2700D1BF90 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BD1D3D8B2700D1BF90 /* SUInstaller.m */; };
|
||||
7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */; };
|
||||
7267E5C51D3D8B2700D1BF90 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */; };
|
||||
7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 721BC20A1D17A5AD002BC71E /* CoreServices.framework */; };
|
||||
7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
|
||||
@@ -292,7 +290,6 @@
|
||||
7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; };
|
||||
7267E5F21D3D918000D1BF90 /* SUSignatureVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUSignatureVerifier.m */; };
|
||||
7267E5F41D3D918B00D1BF90 /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */; };
|
||||
7267E5F51D3D918B00D1BF90 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */; };
|
||||
7267E5F61D3D919000D1BF90 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */; };
|
||||
7267E5F71D3D919600D1BF90 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */; };
|
||||
7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; };
|
||||
@@ -654,6 +651,55 @@
|
||||
remoteGlobalIDString = 72B398D11D3D879300EE297F;
|
||||
remoteInfo = Autoupdate;
|
||||
};
|
||||
72CCCC14287B3D1900E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
|
||||
remoteInfo = Sparkle;
|
||||
};
|
||||
72CCCC16287B3D3400E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E280E22B64522004AA304;
|
||||
remoteInfo = bsdiff;
|
||||
};
|
||||
72CCCC18287B3D3D00E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E282C22B660BE004AA304;
|
||||
remoteInfo = ed25519;
|
||||
};
|
||||
72CCCC1A287B3D9000E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E282C22B660BE004AA304;
|
||||
remoteInfo = ed25519;
|
||||
};
|
||||
72CCCC1C287B3D9600E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E282C22B660BE004AA304;
|
||||
remoteInfo = ed25519;
|
||||
};
|
||||
72CCCC1E287B3DA100E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E282C22B660BE004AA304;
|
||||
remoteInfo = ed25519;
|
||||
};
|
||||
72CCCC20287B3DA400E7156B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E280E22B64522004AA304;
|
||||
remoteInfo = bsdiff;
|
||||
};
|
||||
72D954B91CBB6E27006F28BD /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
@@ -916,7 +962,6 @@
|
||||
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionPrompt.m; sourceTree = "<group>"; };
|
||||
613151B20FB4946A000DCD59 /* is */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
615409C4103BBC4000125AF1 /* cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SUModelTranslation.plist; sourceTree = "<group>"; };
|
||||
6186554310D7484E00B1E074 /* pt-PT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Sparkle.strings"; sourceTree = "<group>"; };
|
||||
618915730E35937600B5E981 /* sv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
6195D4920E404AD700D41A50 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
@@ -1215,8 +1260,6 @@
|
||||
7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUGuidedPackageInstaller.m; path = Autoupdate/SUGuidedPackageInstaller.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5BC1D3D8B2700D1BF90 /* SUInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstaller.h; path = Autoupdate/SUInstaller.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5BD1D3D8B2700D1BF90 /* SUInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUInstaller.m; path = Autoupdate/SUInstaller.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5BE1D3D8B2700D1BF90 /* SUPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUPackageInstaller.h; path = Autoupdate/SUPackageInstaller.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUPackageInstaller.m; path = Autoupdate/SUPackageInstaller.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5C01D3D8B2700D1BF90 /* SUPlainInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUPlainInstaller.h; path = Autoupdate/SUPlainInstaller.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUPlainInstaller.m; path = Autoupdate/SUPlainInstaller.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5CF1D3D8C8500D1BF90 /* SecurityFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SecurityFoundation.framework; path = System/Library/Frameworks/SecurityFoundation.framework; sourceTree = SDKROOT; };
|
||||
@@ -1717,7 +1760,6 @@
|
||||
1420DF4F196247F900203BB0 /* Images.xcassets */,
|
||||
14732BBC1960EFB500593899 /* README.markdown */,
|
||||
14732BB91960EEEE00593899 /* SampleAppcast.xml */,
|
||||
615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */,
|
||||
1EAA4C8A2132C7BF00604473 /* ReleaseNotesColorStyle.css */,
|
||||
);
|
||||
path = Resources;
|
||||
@@ -1929,8 +1971,6 @@
|
||||
722FB7E3260EE53F00EB571C /* SUNormalization.h */,
|
||||
722FB7E4260EE53F00EB571C /* SUNormalization.m */,
|
||||
7267E5B91D3D8B0B00D1BF90 /* SUInstallerProtocol.h */,
|
||||
7267E5BE1D3D8B2700D1BF90 /* SUPackageInstaller.h */,
|
||||
7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */,
|
||||
7267E5C01D3D8B2700D1BF90 /* SUPlainInstaller.h */,
|
||||
7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */,
|
||||
);
|
||||
@@ -2575,6 +2615,8 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
72CCCC19287B3D3D00E7156B /* PBXTargetDependency */,
|
||||
72CCCC17287B3D3400E7156B /* PBXTargetDependency */,
|
||||
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
|
||||
726E4A201C86C88F00C57C6A /* PBXTargetDependency */,
|
||||
);
|
||||
@@ -2594,6 +2636,8 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
72CCCC21287B3DA400E7156B /* PBXTargetDependency */,
|
||||
72CCCC1F287B3DA100E7156B /* PBXTargetDependency */,
|
||||
);
|
||||
name = generate_appcast;
|
||||
packageProductDependencies = (
|
||||
@@ -2716,6 +2760,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
72CCCC15287B3D1900E7156B /* PBXTargetDependency */,
|
||||
);
|
||||
name = TestAppHelper;
|
||||
productName = TestAppHelper;
|
||||
@@ -2834,6 +2879,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
72CCCC1B287B3D9000E7156B /* PBXTargetDependency */,
|
||||
);
|
||||
name = generate_keys;
|
||||
packageProductDependencies = (
|
||||
@@ -2854,6 +2900,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
72CCCC1D287B3D9600E7156B /* PBXTargetDependency */,
|
||||
);
|
||||
name = sign_update;
|
||||
packageProductDependencies = (
|
||||
@@ -3133,7 +3180,6 @@
|
||||
61AAE8280A321A7F00D8810D /* Sparkle.strings in Resources */,
|
||||
1EAA4C8B2132C7BF00604473 /* ReleaseNotesColorStyle.css in Resources */,
|
||||
723ABD38259A9BA500BDB4FA /* SUUpdateAlert.xib in Resources */,
|
||||
615AE3D00D64DC40001CA7BD /* SUModelTranslation.plist in Resources */,
|
||||
55C14BEF136EF21700649790 /* SUStatus.xib in Resources */,
|
||||
723ABD6C259A9CBC00BDB4FA /* SUUpdatePermissionPrompt.xib in Resources */,
|
||||
);
|
||||
@@ -3260,7 +3306,6 @@
|
||||
7267E5EC1D3D912900D1BF90 /* SUInstaller.m in Sources */,
|
||||
5AF6C7541AEA49840014A3AB /* SUInstallerTest.m in Sources */,
|
||||
14652F8219A9746000959E44 /* SULog.m in Sources */,
|
||||
7267E5F51D3D918B00D1BF90 /* SUPackageInstaller.m in Sources */,
|
||||
7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */,
|
||||
7267E5F71D3D919600D1BF90 /* SUPlainInstaller.m in Sources */,
|
||||
72BEBFEF1D7287570019146B /* SUSpotlightImporterTest.swift in Sources */,
|
||||
@@ -3458,7 +3503,6 @@
|
||||
5A6DD17123FE1FFC000AEF33 /* SUSignatures.m in Sources */,
|
||||
721D5A8525C65D3F00D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
||||
7267E5CE1D3D8C7500D1BF90 /* SULog.m in Sources */,
|
||||
7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */,
|
||||
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */,
|
||||
7267E5C51D3D8B2700D1BF90 /* SUPlainInstaller.m in Sources */,
|
||||
7267E5D81D3D8D4400D1BF90 /* SUStandardVersionComparator.m in Sources */,
|
||||
@@ -3726,6 +3770,41 @@
|
||||
target = 72B398D11D3D879300EE297F /* Autoupdate */;
|
||||
targetProxy = 72A5D5AB1D6929260009E5AC /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC15287B3D1900E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
|
||||
targetProxy = 72CCCC14287B3D1900E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC17287B3D3400E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E280E22B64522004AA304 /* bsdiff */;
|
||||
targetProxy = 72CCCC16287B3D3400E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC19287B3D3D00E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E282C22B660BE004AA304 /* ed25519 */;
|
||||
targetProxy = 72CCCC18287B3D3D00E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC1B287B3D9000E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E282C22B660BE004AA304 /* ed25519 */;
|
||||
targetProxy = 72CCCC1A287B3D9000E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC1D287B3D9600E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E282C22B660BE004AA304 /* ed25519 */;
|
||||
targetProxy = 72CCCC1C287B3D9600E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC1F287B3DA100E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E282C22B660BE004AA304 /* ed25519 */;
|
||||
targetProxy = 72CCCC1E287B3DA100E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72CCCC21287B3DA400E7156B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E280E22B64522004AA304 /* bsdiff */;
|
||||
targetProxy = 72CCCC20287B3DA400E7156B /* PBXContainerItemProxy */;
|
||||
};
|
||||
72D954BA1CBB6E27006F28BD /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 721C24441CB753E6005440CB /* Installer Progress */;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
buildImplicitDependencies = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
buildImplicitDependencies = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
buildImplicitDependencies = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
buildImplicitDependencies = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
|
||||
Vendored
+3
-3
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21208.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21208.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -20,7 +20,7 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window identifier="SUUpdateAlert" title="Software Update" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUUpdateAlert" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
|
||||
<window identifier="SUUpdateAlert" title="Software Update" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
|
||||
|
||||
@@ -284,7 +284,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)registerInstallationInfoData:(NSData *)installationInfoData
|
||||
- (void)registerInstallationInfoData:(NSData *)installationInfoData completionHandler:(void (^)(void))completionHandler
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.statusInfo.installationInfoData == nil && installationInfoData != nil) {
|
||||
@@ -297,6 +297,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
|
||||
SULog(SULogLevelError, @"Error: Failed to decode initial installation info from installer: %@", installationInfoData);
|
||||
}
|
||||
}
|
||||
|
||||
completionHandler();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)registerApplicationBundlePath:(NSString *)applicationBundlePath reply:(void (^)(NSNumber * _Nullable processIdentifier))reply;
|
||||
|
||||
- (void)registerInstallationInfoData:(NSData *)installationInfoData;
|
||||
- (void)registerInstallationInfoData:(NSData *)installationInfoData completionHandler:(void (^)(void))completionHandler;
|
||||
|
||||
- (void)sendTerminationSignal;
|
||||
|
||||
|
||||
Vendored
+3
-7
@@ -26,7 +26,6 @@
|
||||
@property (nonatomic, readonly, weak, nullable) id updaterDelegate;
|
||||
@property (nonatomic, readonly) SPUCoreBasedUpdateDriver *coreDriver;
|
||||
@property (nonatomic) SUAppcastItem* updateItem;
|
||||
@property (nonatomic) BOOL willInstallSilently;
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
@synthesize updaterDelegate = _updaterDelegate;
|
||||
@synthesize coreDriver = _coreDriver;
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize willInstallSilently = _willInstallSilently;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
{
|
||||
@@ -100,14 +98,12 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately
|
||||
{
|
||||
self.willInstallSilently = willInstallSilently;
|
||||
|
||||
if (!willInstallImmediately) {
|
||||
BOOL installationHandledByDelegate = NO;
|
||||
id<SPUUpdaterDelegate> updaterDelegate = self.updaterDelegate;
|
||||
if (self.willInstallSilently && [updaterDelegate respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationBlock:)]) {
|
||||
if ([updaterDelegate respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationBlock:)]) {
|
||||
__weak SPUAutomaticUpdateDriver *weakSelf = self;
|
||||
installationHandledByDelegate = [updaterDelegate updater:self.updater willInstallUpdateOnQuit:self.updateItem immediateInstallationBlock:^{
|
||||
[weakSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:NO];
|
||||
@@ -139,7 +135,7 @@
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!self.willInstallSilently || self.updateItem.criticalUpdate || self.updateItem.isInformationOnlyUpdate);
|
||||
BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (self.updateItem.criticalUpdate || self.updateItem.isInformationOnlyUpdate);
|
||||
|
||||
[self.coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error];
|
||||
}
|
||||
|
||||
Vendored
+4
-11
@@ -141,18 +141,11 @@
|
||||
{
|
||||
if (!self.aborted) {
|
||||
if (!resuming) {
|
||||
// interactive pkg based updates are not supported under root user
|
||||
if ([updateItem.installationType isEqualToString:SPUInstallationTypeInteractivePackage] && geteuid() == 0) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationRootInteractiveError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Interactive based packages cannot be installed as the root user.", nil) }]];
|
||||
// Give the delegate a chance to bail
|
||||
NSError *shouldNotProceedError = nil;
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
|
||||
return;
|
||||
} else {
|
||||
// Give the delegate a chance to bail
|
||||
|
||||
NSError *shouldNotProceedError = nil;
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem;
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately;
|
||||
|
||||
- (void)coreDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -294,9 +294,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately
|
||||
{
|
||||
[self.delegate installerDidFinishPreparationAndWillInstallImmediately:willInstallImmediately silently:willInstallSilently];
|
||||
[self.delegate installerDidFinishPreparationAndWillInstallImmediately:willInstallImmediately];
|
||||
}
|
||||
|
||||
- (void)finishInstallationWithResponse:(SPUUserUpdateChoice)response displayingUserInterface:(BOOL)displayingUserInterface
|
||||
|
||||
Vendored
+1
-2
@@ -11,9 +11,8 @@
|
||||
|
||||
#define SPUInstallationTypeApplication @"application" // the default installation type for ordinary application updates
|
||||
#define SPUInstallationTypeGuidedPackage @"package" // the preferred installation type for package installations
|
||||
#define SPUInstallationTypeInteractivePackage @"interactive-package" // the deprecated installation type; use guided package instead
|
||||
|
||||
#define SPUInstallationTypesArray (@[SPUInstallationTypeApplication, SPUInstallationTypeGuidedPackage, SPUInstallationTypeInteractivePackage])
|
||||
#define SPUInstallationTypesArray (@[SPUInstallationTypeApplication, SPUInstallationTypeGuidedPackage])
|
||||
#define SPUValidInstallationType(x) ((x != nil) && [SPUInstallationTypesArray containsObject:(NSString * _Nonnull)x])
|
||||
|
||||
#endif /* SPUInstallationType_h */
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||
- (void)installerDidStartExtracting;
|
||||
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately;
|
||||
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch;
|
||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunch acknowledgement:(void(^)(void))acknowledgement;
|
||||
|
||||
|
||||
Vendored
+4
-7
@@ -316,18 +316,15 @@
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Error: Archived data to send for appcast item is nil");
|
||||
}
|
||||
|
||||
BOOL canInstallSilently = NO;
|
||||
if (data.length >= sizeof(uint8_t)) {
|
||||
canInstallSilently = (BOOL)*(const uint8_t *)data.bytes;
|
||||
}
|
||||
} else if (identifier == SPUInstallerRegisteredAppcastItem) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
BOOL hasTargetTerminated = NO;
|
||||
if (data.length >= sizeof(uint8_t) * 2) {
|
||||
if (data.length >= sizeof(uint8_t)) {
|
||||
hasTargetTerminated = (BOOL)*((const uint8_t *)data.bytes + 1);
|
||||
}
|
||||
|
||||
[self.delegate installerDidFinishPreparationAndWillInstallImmediately:hasTargetTerminated silently:canInstallSilently];
|
||||
[self.delegate installerDidFinishPreparationAndWillInstallImmediately:hasTargetTerminated];
|
||||
} else if (identifier == SPUInstallationFinishedStage2) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
|
||||
Vendored
+10
-48
@@ -16,58 +16,20 @@ static NSString *SURootObjectArchiveKey = @"SURootObjectArchive";
|
||||
|
||||
NSData * _Nullable SPUArchiveRootObjectSecurely(id<NSSecureCoding> rootObject)
|
||||
{
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rootObject requiringSecureCoding:YES error:&error];
|
||||
if (data == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely archiving object: %@", error);
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
||||
#pragma clang diagnostic pop
|
||||
keyedArchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
[keyedArchiver encodeObject:rootObject forKey:SURootObjectArchiveKey];
|
||||
[keyedArchiver finishEncoding];
|
||||
return [data copy];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely archiving object: %@", exception);
|
||||
[keyedArchiver finishEncoding];
|
||||
return nil;
|
||||
}
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rootObject requiringSecureCoding:YES error:&error];
|
||||
if (data == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely archiving object: %@", error);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
id<NSSecureCoding> _Nullable SPUUnarchiveRootObjectSecurely(NSData *data, Class klass)
|
||||
{
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *error = nil;
|
||||
id<NSSecureCoding> rootObject = [NSKeyedUnarchiver unarchivedObjectOfClass:klass fromData:data error:&error];
|
||||
if (rootObject == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely unarchiving object: %@", error);
|
||||
}
|
||||
return rootObject;
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
|
||||
#pragma clang diagnostic pop
|
||||
unarchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
id<NSSecureCoding> rootObject = [unarchiver decodeObjectOfClass:klass forKey:SURootObjectArchiveKey];
|
||||
[unarchiver finishDecoding];
|
||||
return rootObject;
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely unarchiving object: %@", exception);
|
||||
[unarchiver finishDecoding];
|
||||
return nil;
|
||||
}
|
||||
NSError *error = nil;
|
||||
id<NSSecureCoding> rootObject = [NSKeyedUnarchiver unarchivedObjectOfClass:klass fromData:data error:&error];
|
||||
if (rootObject == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely unarchiving object: %@", error);
|
||||
}
|
||||
return rootObject;
|
||||
}
|
||||
Vendored
+1
-1
@@ -340,7 +340,7 @@
|
||||
[self.userDriver showExtractionReceivedProgress:progress];
|
||||
}
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)__unused willInstallSilently
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately
|
||||
{
|
||||
if (!willInstallImmediately) {
|
||||
[self.userDriver showReadyToInstallAndRelaunch:^(SPUUserUpdateChoice choice) {
|
||||
|
||||
Vendored
+5
-4
@@ -347,10 +347,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
} else if (publicKeys.ed25519PubKey == nil) {
|
||||
// No EdDSA key is available, so app must be using DSA
|
||||
if (updatingMainBundle && !self.loggedNoSecureKeyWarning) {
|
||||
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key is insecure and deprecated. DSA support may be removed in a future Sparkle release. Please migrate to using EdDSA (ed25519). Visit Sparkle's documentation for migration information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
|
||||
|
||||
self.loggedNoSecureKeyWarning = YES;
|
||||
if (updatingMainBundle) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key for %@. Please migrate to using EdDSA (ed25519). Visit Sparkle's documentation for migration information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns.", hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -174,7 +174,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
|
||||
This version string should contain three period-separated components.
|
||||
|
||||
Example: @c 10.12.0
|
||||
Example: @c 10.13.0
|
||||
|
||||
Use `minimumOperatingSystemVersionIsOK` property to test if the current running system passes this requirement.
|
||||
|
||||
@@ -194,7 +194,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
|
||||
This version string should contain three period-separated components.
|
||||
|
||||
Example: @c 10.13.0
|
||||
Example: @c 10.14.0
|
||||
|
||||
Use `maximumOperatingSystemVersionIsOK` property to test if the current running system passes this requirement.
|
||||
|
||||
@@ -224,7 +224,6 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
This may be:
|
||||
- @c application - indicates this is a regular application update.
|
||||
- @c package - indicates this is a guided package installer update.
|
||||
- @c interactive-package - indicates this is an interactive package installer update (deprecated; use "package" instead)
|
||||
|
||||
This is extracted from the @c sparkle:installationType attribute in the @c <enclosure> element.
|
||||
|
||||
|
||||
Vendored
-5
@@ -533,7 +533,6 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
NSString *chosenInstallationType;
|
||||
if (attributeInstallationType == nil) {
|
||||
// If we have a flat package, assume installation type is guided
|
||||
// (flat / non-archived interactive packages are not supported)
|
||||
// Otherwise assume we have a normal application inside an archive
|
||||
if ([_fileURL.pathExtension isEqualToString:@"pkg"] || [_fileURL.pathExtension isEqualToString:@"mpkg"]) {
|
||||
chosenInstallationType = SPUInstallationTypeGuidedPackage;
|
||||
@@ -545,10 +544,6 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
*error = [NSString stringWithFormat:@"Feed item's enclosure lacks valid %@ (found %@)", SUAppcastAttributeInstallationType, attributeInstallationType];
|
||||
}
|
||||
return nil;
|
||||
} else if ([attributeInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
SULog(SULogLevelDefault, @"warning: '%@' for %@ is deprecated. Use '%@' instead.", SPUInstallationTypeInteractivePackage, SUAppcastAttributeInstallationType, SPUInstallationTypeGuidedPackage);
|
||||
|
||||
chosenInstallationType = attributeInstallationType;
|
||||
} else {
|
||||
chosenInstallationType = attributeInstallationType;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -69,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)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error API_AVAILABLE(macos(10.13));
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error;
|
||||
|
||||
/**
|
||||
* Copies an item from a source to a destination
|
||||
|
||||
Vendored
+1
-3
@@ -19,9 +19,7 @@ typedef NS_ENUM(uint8_t, SULogLevel) {
|
||||
SULogLevelError
|
||||
};
|
||||
|
||||
// Logging utlity function that is thread-safe
|
||||
// On 10.12 or later this uses os_log
|
||||
// Otherwise on older systems this uses ASL
|
||||
// Logging utlity function that is thread-safe and uses os_log
|
||||
// For debugging command line tools, you may have to use Console.app or log(1) to view log messages
|
||||
// Try to keep log messages as compact/short as possible
|
||||
void SULog(SULogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
|
||||
|
||||
Vendored
+17
-113
@@ -7,135 +7,39 @@
|
||||
//
|
||||
|
||||
#include "SULog.h"
|
||||
|
||||
#include <asl.h>
|
||||
#include <Availability.h>
|
||||
#include <os/log.h>
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
// For converting constants to string literals using the preprocessor
|
||||
#define STRINGIFY(x) #x
|
||||
#define TO_STRING(x) STRINGIFY(x)
|
||||
|
||||
void SULog(SULogLevel level, NSString *format, ...)
|
||||
{
|
||||
static aslclient client;
|
||||
static dispatch_queue_t queue;
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
static os_log_t logger;
|
||||
static BOOL hasOSLogging;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
|
||||
if (@available(macOS 10.12, *)) {
|
||||
hasOSLogging = YES;
|
||||
} else {
|
||||
hasOSLogging = NO;
|
||||
}
|
||||
|
||||
if (hasOSLogging) {
|
||||
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
// This creates a thread-safe object
|
||||
logger = os_log_create(subsystem, "Sparkle");
|
||||
#pragma clang diagnostic pop
|
||||
} else {
|
||||
uint32_t options = ASL_OPT_NO_DELAY;
|
||||
// Act the same way os_log() does; don't log to stderr if a terminal device is attached
|
||||
if (!isatty(STDERR_FILENO)) {
|
||||
options |= ASL_OPT_STDERR;
|
||||
}
|
||||
|
||||
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
|
||||
#pragma clang diagnostic pop
|
||||
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||
}
|
||||
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
|
||||
// This creates a thread-safe object
|
||||
logger = os_log_create(subsystem, "Sparkle");
|
||||
});
|
||||
|
||||
if (!hasOSLogging && client == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
NSString *logMessage = [[NSString alloc] initWithFormat:format arguments:ap];
|
||||
va_end(ap);
|
||||
|
||||
// Use os_log if available (on 10.12+)
|
||||
if (hasOSLogging) {
|
||||
// We'll make all of our messages formatted as public; just don't log sensitive information.
|
||||
// Note we don't take advantage of info like the source line number because we wrap this macro inside our own function
|
||||
// And we don't really leverage of os_log's deferred formatting processing because we format the string before passing it in
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
switch (level) {
|
||||
case SULogLevelDefault:
|
||||
// See docs for OS_LOG_TYPE_DEFAULT
|
||||
// By default, OS_LOG_TYPE_DEFAULT seems to be more noticable than OS_LOG_TYPE_INFO
|
||||
os_log(logger, "%{public}@", logMessage);
|
||||
break;
|
||||
case SULogLevelError:
|
||||
// See docs for OS_LOG_TYPE_ERROR
|
||||
os_log_error(logger, "%{public}@", logMessage);
|
||||
break;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
return;
|
||||
|
||||
// We'll make all of our messages formatted as public; just don't log sensitive information.
|
||||
// Note we don't take advantage of info like the source line number because we wrap this macro inside our own function
|
||||
// And we don't really leverage of os_log's deferred formatting processing because we format the string before passing it in
|
||||
switch (level) {
|
||||
case SULogLevelDefault:
|
||||
// See docs for OS_LOG_TYPE_DEFAULT
|
||||
// By default, OS_LOG_TYPE_DEFAULT seems to be more noticable than OS_LOG_TYPE_INFO
|
||||
os_log(logger, "%{public}@", logMessage);
|
||||
break;
|
||||
case SULogLevelError:
|
||||
// See docs for OS_LOG_TYPE_ERROR
|
||||
os_log_error(logger, "%{public}@", logMessage);
|
||||
break;
|
||||
}
|
||||
|
||||
// Otherwise use ASL
|
||||
// Make sure we do not async, because if we async, the log may not be delivered deterministically
|
||||
// TODO: When we remove support for macOS 10.11, remove all this asl code
|
||||
dispatch_sync(queue, ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
aslmsg message = asl_new(ASL_TYPE_MSG);
|
||||
#pragma clang diagnostic pop
|
||||
if (message == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) {
|
||||
#pragma clang diagnostic pop
|
||||
return;
|
||||
}
|
||||
|
||||
int levelSetResult;
|
||||
switch (level) {
|
||||
case SULogLevelDefault:
|
||||
// Just use one level below the error level
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_WARNING));
|
||||
#pragma clang diagnostic pop
|
||||
break;
|
||||
case SULogLevelError:
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_ERR));
|
||||
#pragma clang diagnostic pop
|
||||
break;
|
||||
}
|
||||
if (levelSetResult != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
asl_send(client, message);
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
Vendored
+1
-13
@@ -30,17 +30,8 @@ NSString *const SUSystemProfilerPreferredLanguageKey = @"lang";
|
||||
|
||||
@implementation SUSystemProfiler
|
||||
|
||||
+ (NSDictionary<NSString *, NSString *> *)modelTranslationTable
|
||||
{
|
||||
// Use explicit class to use the correct bundle even when subclassed
|
||||
NSString *path = [[NSBundle bundleForClass:[SUSystemProfiler class]] pathForResource:@"SUModelTranslation" ofType:@"plist"];
|
||||
return [[NSDictionary alloc] initWithContentsOfFile:path];
|
||||
}
|
||||
|
||||
+ (NSArray<NSDictionary<NSString *, NSString *> *> *)systemProfileArrayForHost:(SUHost *)host
|
||||
{
|
||||
NSDictionary<NSString *, NSString *> *modelTranslation = [self modelTranslationTable];
|
||||
|
||||
// Gather profile information and append it to the URL.
|
||||
NSMutableArray<NSDictionary<NSString *, NSString *> *> *profileArray = [NSMutableArray array];
|
||||
NSArray *profileDictKeys = @[@"key", @"displayKey", @"value", @"displayValue"];
|
||||
@@ -115,10 +106,7 @@ NSString *const SUSystemProfilerPreferredLanguageKey = @"lang";
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = @(cpuModel);
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil) {
|
||||
visibleModelName = rawModelName;
|
||||
}
|
||||
NSString *visibleModelName = rawModelName;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerHardwareModelKey, @"Mac Model", rawModelName, visibleModelName] forKeys:profileDictKeys]];
|
||||
}
|
||||
free(cpuModel);
|
||||
|
||||
Vendored
+19
-11
@@ -292,6 +292,8 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
||||
BOOL showReleaseNotes = [self showsReleaseNotes];
|
||||
|
||||
if (showReleaseNotes) {
|
||||
self.window.frameAutosaveName = @"SUUpdateAlert";
|
||||
|
||||
NSURL *colorStyleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"ReleaseNotesColorStyle" withExtension:@"css"];
|
||||
|
||||
// "-apple-system-font" is a reference to the system UI font. "-apple-system" is the new recommended token, but for backward compatibility we can't use it.
|
||||
@@ -318,21 +320,28 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
||||
|
||||
self.webView.view.frame = boxContentView.bounds;
|
||||
self.webView.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
||||
} else {
|
||||
// Update alert should not be resizable when no release notes are available
|
||||
self.window.styleMask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
|
||||
[self.window setFrameAutosaveName: showReleaseNotes ? @"SUUpdateAlert" : @"SUUpdateAlertSmall" ];
|
||||
|
||||
if (self.updateItem.informationOnlyUpdate) {
|
||||
[self.installButton setTitle:SULocalizedString(@"Learn More…", @"Alternate title for 'Install Update' button when there's no download in RSS feed.")];
|
||||
[self.installButton setAction:@selector(openInfoURL:)];
|
||||
}
|
||||
|
||||
BOOL allowsAutomaticUpdates = self.allowsAutomaticUpdates;
|
||||
|
||||
if (showReleaseNotes) {
|
||||
[self displayReleaseNotes];
|
||||
} else {
|
||||
NSLayoutConstraint *automaticallyInstallUpdatesButtonToDescriptionFieldConstraint = [NSLayoutConstraint constraintWithItem:self.automaticallyInstallUpdatesButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.descriptionField attribute:NSLayoutAttributeBottom multiplier:1.0 constant:8.0];
|
||||
|
||||
[self.window.contentView addConstraint:automaticallyInstallUpdatesButtonToDescriptionFieldConstraint];
|
||||
// When automatic updates aren't allowed we won't show the automatic install updates button
|
||||
// This button is removed later below
|
||||
if (allowsAutomaticUpdates) {
|
||||
NSLayoutConstraint *automaticallyInstallUpdatesButtonToDescriptionFieldConstraint = [NSLayoutConstraint constraintWithItem:self.automaticallyInstallUpdatesButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.descriptionField attribute:NSLayoutAttributeBottom multiplier:1.0 constant:8.0];
|
||||
|
||||
[self.window.contentView addConstraint:automaticallyInstallUpdatesButtonToDescriptionFieldConstraint];
|
||||
}
|
||||
|
||||
[self.releaseNotesContainerView removeFromSuperview];
|
||||
}
|
||||
@@ -341,19 +350,18 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
||||
|
||||
// When we show release notes, it looks ugly if the install buttons are not closer to the release notes view
|
||||
// However when we don't show release notes, it looks ugly if the install buttons are too close to the description field. Shrugs.
|
||||
if (!self.allowsAutomaticUpdates) {
|
||||
if (!allowsAutomaticUpdates) {
|
||||
if (showReleaseNotes) {
|
||||
// Fix constraints so that buttons aren't far away from web view when we hide the automatic updates check box
|
||||
NSLayoutConstraint *skipButtonToReleaseNotesContainerConstraint = [NSLayoutConstraint constraintWithItem:self.skipButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.releaseNotesContainerView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12.0];
|
||||
|
||||
[self.window.contentView addConstraint:skipButtonToReleaseNotesContainerConstraint];
|
||||
|
||||
[self.automaticallyInstallUpdatesButton removeFromSuperview];
|
||||
} else {
|
||||
// Disable automatic install updates option if the developer wishes for it in Info.plist
|
||||
// If we are showing release notes, this button will be hidden instead
|
||||
self.automaticallyInstallUpdatesButton.enabled = NO;
|
||||
NSLayoutConstraint *skipButtonToDescriptionConstraint = [NSLayoutConstraint constraintWithItem:self.skipButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.descriptionField attribute:NSLayoutAttributeBottom multiplier:1.0 constant:20.0];
|
||||
|
||||
[self.window.contentView addConstraint:skipButtonToDescriptionConstraint];
|
||||
}
|
||||
[self.automaticallyInstallUpdatesButton removeFromSuperview];
|
||||
}
|
||||
|
||||
if (self.state.stage == SPUUserUpdateStageInstalling) {
|
||||
|
||||
Vendored
+1
-1
@@ -163,7 +163,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE
|
||||
return touchBar;
|
||||
}
|
||||
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macos(10.12.2))
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
if ([identifier isEqualToString:SUUpdatePermissionPromptTouchBarIndentifier]) {
|
||||
NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier];
|
||||
|
||||
Vendored
+1
-1
@@ -77,7 +77,7 @@
|
||||
BOOL isPackage = NO;
|
||||
|
||||
// install source could point to a new bundle or a package
|
||||
NSString *installSource = [SUInstaller installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:NULL];
|
||||
NSString *installSource = [SUInstaller installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage];
|
||||
if (installSource == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"No suitable install is found in the update. The update will be rejected." }];
|
||||
|
||||
Vendored
+3
-8
@@ -128,14 +128,9 @@ static WKUserScript *_userScriptWithInjectedStyleSource(NSString *styleSource)
|
||||
// Unfortunately we have to rely on a private API
|
||||
// FB7539179: https://github.com/feedback-assistant/reports/issues/81 | https://bugs.webkit.org/show_bug.cgi?id=155550
|
||||
// But it seems like others are already relying on it, passed App Review, and apps couldn't be broken due to compatibility
|
||||
if (@available(macOS 10.12, *)) {
|
||||
if ([self.webView respondsToSelector:@selector(_setDrawsBackground:)]) {
|
||||
[self.webView _setDrawsBackground:drawsBackground];
|
||||
}
|
||||
} else {
|
||||
if ([self.webView respondsToSelector:@selector(_setDrawsTransparentBackground:)]) {
|
||||
[self.webView _setDrawsTransparentBackground:!drawsBackground];
|
||||
}
|
||||
// Note: before we were using _setDrawsTransparentBackground < macOS 10.12
|
||||
if ([self.webView respondsToSelector:@selector(_setDrawsBackground:)]) {
|
||||
[self.webView _setDrawsBackground:drawsBackground];
|
||||
}
|
||||
|
||||
self.drawsWebViewBackground = drawsBackground;
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
"%@ %@ is currently the newest version available." = "O %1$@ %2$@ é neste momento a versão mais recente disponível.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "O %1$@ %2$@ é neste momento a versão mais recente disponível.\n(Neste momento está na versão %3$@.)";
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "O %1$@ %2$@ é neste momento a versão mais recente disponível.\n(You are currently running version %3$@.)";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
"%@ %@ is now available—you have %@. Would you like to download it now?" = "O %1$@ %2$@ está agora disponível e tem a versão %3$@. Gostaria de o transferir agora?";
|
||||
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ 已是目前最新的版本。";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ 已是目前最新的版本。\n(您正在執行的版本是 %3$@。)";
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ 已是目前最新的版本。\n(You are currently running version %3$@.)";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
"%@ %@ is now available—you have %@. Would you like to download it now?" = "%1$@ %2$@ 現在已可取得,您的版本則是 %3$@。您要現在下載嗎?";
|
||||
@@ -74,7 +74,7 @@
|
||||
"Updating %@" = "正在更新 %@";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "請將 %1$@ 移至您的「應用程式」檔案夾,從該處重新啟動,然後再試一次。";
|
||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "請將 %1$@ 移至您的“應用程式”檔案夾,從該處重新啟動,然後再試一次。";
|
||||
|
||||
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
|
||||
"You’re up-to-date!" = "您已有最新版本!";
|
||||
"You’re up-to-date!" = "你已有最新版本!";
|
||||
+333
-13
@@ -649,6 +649,133 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInSource
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
if (chmod([sourceFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInDestination
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
if (chmod([destinationFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInSourceAndOtherFileAtDestinationPresent
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
NSString *destinationFile2 = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:destinationFile2 atomically:YES]);
|
||||
|
||||
if (chmod([sourceFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInDestinationAndOtherFileAtDestinationPresent
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
NSString *destinationFile2 = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:destinationFile2 atomically:YES]);
|
||||
|
||||
if (chmod([destinationFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInSourceAndOtherFileAtSourcePresent
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
NSString *sourceFile2 = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile2 atomically:YES]);
|
||||
|
||||
if (chmod([sourceFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
if (chmod([sourceFile2 fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRegularLargerFileMoveWithNoWritablePermissionInDestinationAndOtherFileAtSourcePresent
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
NSString *sourceFile2 = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||
|
||||
NSData *data = [self bigData2];
|
||||
XCTAssertTrue([data writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([data writeToFile:destinationFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile2 atomically:YES]);
|
||||
|
||||
if (chmod([destinationFile fileSystemRepresentation], 0444) != 0) {
|
||||
NSLog(@"Change Permission Error..");
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSymbolicLinkMove
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
@@ -985,6 +1112,56 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileChangeInDirectoriesWithContentChangeAndNoWritablePermissionInSource
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceA = [sourceDirectory stringByAppendingPathComponent:@"Contents/Hello/"];
|
||||
NSString *destinationA = [destinationDirectory stringByAppendingPathComponent:@"Contents/Meek/"];
|
||||
|
||||
XCTAssertTrue([fileManager createDirectoryAtPath:sourceA withIntermediateDirectories:YES attributes:NULL error:NULL]);
|
||||
XCTAssertTrue([fileManager createDirectoryAtPath:destinationA withIntermediateDirectories:YES attributes:NULL error:NULL]);
|
||||
|
||||
NSString *sourceFile = [sourceA stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationA stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData2] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:sourceFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileChangeInDirectoriesWithContentChangeAndNoWritablePermissionInDestination
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceA = [sourceDirectory stringByAppendingPathComponent:@"Contents/Hello/"];
|
||||
NSString *destinationA = [destinationDirectory stringByAppendingPathComponent:@"Contents/Meek/"];
|
||||
|
||||
XCTAssertTrue([fileManager createDirectoryAtPath:sourceA withIntermediateDirectories:YES attributes:NULL error:NULL]);
|
||||
XCTAssertTrue([fileManager createDirectoryAtPath:destinationA withIntermediateDirectories:YES attributes:NULL error:NULL]);
|
||||
|
||||
NSString *sourceFile = [sourceA stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationA stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData2] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:destinationFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testMultipleBigFileChangeInDirectoriesWithContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
@@ -1012,6 +1189,158 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSmallFileNoWritablePermissionInSourceWithNoContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:sourceFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSmallFileNoWritablePermissionInDestinationWithNoContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:destinationFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileNoWritablePermissionInSourceWithNoContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:sourceFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileNoWritablePermissionInDestinationWithNoContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData1] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:destinationFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSmallFileNoWritablePermissionInSourceWithContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData data] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:sourceFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testSmallFileNoWritablePermissionInDestinationWithContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData data] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:@"lawl" length:4] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:destinationFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileNoWritablePermissionInSourceWithContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData2] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:sourceFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testBigFileNoWritablePermissionInDestinationWithContentChange
|
||||
{
|
||||
[self createAndApplyPatchWithHandler:^(NSFileManager *fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[self bigData1] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[self bigData2] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
NSError *error = nil;
|
||||
if (![fileManager setAttributes:@{NSFilePosixPermissions : @0444} ofItemAtPath:destinationFile error:&error]) {
|
||||
NSLog(@"Change Permission Error: %@", error);
|
||||
XCTFail(@"Failed setting file permissions");
|
||||
}
|
||||
|
||||
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testFileSystemCompression
|
||||
{
|
||||
[self createAndApplyPatchWithBeforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
@@ -1029,23 +1358,14 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
||||
}
|
||||
|
||||
NSTask *dittoTask = [[NSTask alloc] init];
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
|
||||
} else {
|
||||
dittoTask.launchPath = @"/usr/bin/ditto";
|
||||
}
|
||||
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
|
||||
|
||||
dittoTask.arguments = @[@"--hfsCompression", destinationFile, destinationFile2];
|
||||
|
||||
NSError *launchError = nil;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
BOOL launched = [dittoTask launchAndReturnError:&launchError];
|
||||
if (!launched) {
|
||||
XCTFail(@"Failed to launch ditto: %@", launchError);
|
||||
}
|
||||
} else {
|
||||
[dittoTask launch];
|
||||
BOOL launched = [dittoTask launchAndReturnError:&launchError];
|
||||
if (!launched) {
|
||||
XCTFail(@"Failed to launch ditto: %@", launchError);
|
||||
}
|
||||
[dittoTask waitUntilExit];
|
||||
|
||||
|
||||
@@ -24,9 +24,10 @@ class SUUnarchiverTest: XCTestCase
|
||||
let unarchivedSuccessExpectation = super.expectation(description: "Unarchived Success (format: \(archiveExtension))")
|
||||
let unarchivedFailureExpectation = super.expectation(description: "Unarchived Failure (format: \(archiveExtension))")
|
||||
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent(archiveResourceURL.lastPathComponent)
|
||||
let extractedAppURL = tempDirectoryURL.appendingPathComponent(extractedAppName).appendingPathExtension("app")
|
||||
|
||||
self.unarchiveTestAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, archiveResourceURL: archiveResourceURL, password: password, expectingInstallationType: installationType, expectingSuccess: expectingSuccess, testExpectation: unarchivedSuccessExpectation)
|
||||
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)
|
||||
@@ -39,7 +40,7 @@ class SUUnarchiverTest: XCTestCase
|
||||
|
||||
func unarchiveNonExistentFileTestFailureAppWithExtension(_ archiveExtension: String, tempDirectoryURL: URL, password: String?, expectingInstallationType installationType: String, testExpectation: XCTestExpectation) {
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent("error-invalid").appendingPathExtension(archiveExtension)
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, extractionDirectory: tempDirectoryURL.path, updatingHostBundlePath: nil, decryptionPassword: password, expectingInstallationType: installationType)!
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password, expectingInstallationType: installationType)!
|
||||
|
||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||
XCTAssertNotNil(error)
|
||||
@@ -48,9 +49,13 @@ class SUUnarchiverTest: XCTestCase
|
||||
}
|
||||
|
||||
// swiftlint:disable function_parameter_count
|
||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, appName: String, tempDirectoryURL: URL, archiveResourceURL: URL, password: String?, expectingInstallationType installationType: String, expectingSuccess: Bool, testExpectation: XCTestExpectation) {
|
||||
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: archiveResourceURL.path, extractionDirectory: tempDirectoryURL.path, updatingHostBundlePath: nil, decryptionPassword: password, expectingInstallationType: installationType)!
|
||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, appName: String, tempDirectoryURL: URL, tempArchiveURL: URL, archiveResourceURL: URL, password: String?, expectingInstallationType installationType: String, expectingSuccess: Bool, testExpectation: XCTestExpectation) {
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
try! fileManager.copyItem(at: archiveResourceURL, to: tempArchiveURL)
|
||||
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password, expectingInstallationType: installationType)!
|
||||
|
||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||
if expectingSuccess {
|
||||
@@ -125,12 +130,10 @@ class SUUnarchiverTest: XCTestCase
|
||||
self.unarchiveTestAppWithExtension("dmg", resourceName: "SparkleTestCodeSign_apfs")
|
||||
}
|
||||
|
||||
func testUnarchivingBarePackage()
|
||||
func testUnarchivingFlatPackage()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("pkg", resourceName: "test", expectingInstallationType: SPUInstallationTypeGuidedPackage)
|
||||
|
||||
self.unarchiveTestAppWithExtension("pkg", resourceName: "test", expectingInstallationType: SPUInstallationTypeInteractivePackage, expectingSuccess: false)
|
||||
|
||||
self.unarchiveTestAppWithExtension("pkg", resourceName: "test", expectingInstallationType: SPUInstallationTypeApplication, expectingSuccess: false)
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class ArchiveItem: CustomStringConvertible {
|
||||
self.version = version
|
||||
self._shortVersion = shortVersion
|
||||
self.feedURL = feedURL
|
||||
self.minimumSystemVersion = minimumSystemVersion ?? "10.11"
|
||||
self.minimumSystemVersion = minimumSystemVersion ?? "10.13"
|
||||
self.frameworkVersion = frameworkVersion
|
||||
self.archivePath = archivePath
|
||||
self.appPath = appPath
|
||||
|
||||
@@ -8,26 +8,38 @@ import Foundation
|
||||
func unarchive(itemPath: URL, archiveDestDir: URL, callback: @escaping (Error?) -> Void) {
|
||||
let fileManager = FileManager.default
|
||||
let tempDir = archiveDestDir.appendingPathExtension("tmp")
|
||||
let itemCopy = tempDir.appendingPathComponent(itemPath.lastPathComponent)
|
||||
|
||||
_ = try? fileManager.removeItem(at: tempDir)
|
||||
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:])
|
||||
|
||||
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemPath.path, extractionDirectory: tempDir.path, updatingHostBundlePath: nil, decryptionPassword: nil, expectingInstallationType: SPUInstallationTypeApplication) {
|
||||
unarchiver.unarchive(completionBlock: { (error: Error?) in
|
||||
if error != nil {
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
do {
|
||||
do {
|
||||
try fileManager.linkItem(at: itemPath, to: itemCopy)
|
||||
} catch {
|
||||
try fileManager.copyItem(at: itemPath, to: itemCopy)
|
||||
}
|
||||
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemCopy.path, updatingHostBundlePath: nil, decryptionPassword: nil, expectingInstallationType: SPUInstallationTypeApplication) {
|
||||
unarchiver.unarchive(completionBlock: { (error: Error?) in
|
||||
if error != nil {
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
try fileManager.moveItem(at: tempDir, to: archiveDestDir)
|
||||
callback(nil)
|
||||
} catch {
|
||||
callback(error)
|
||||
}
|
||||
}, progressBlock: nil)
|
||||
} else {
|
||||
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemPath.path)"))
|
||||
_ = try? fileManager.removeItem(at: itemCopy)
|
||||
do {
|
||||
try fileManager.moveItem(at: tempDir, to: archiveDestDir)
|
||||
callback(nil)
|
||||
} catch {
|
||||
callback(error)
|
||||
}
|
||||
}, progressBlock: nil)
|
||||
} else {
|
||||
_ = try? fileManager.removeItem(at: itemCopy)
|
||||
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"))
|
||||
}
|
||||
} catch {
|
||||
_ = try? fileManager.removeItem(at: tempDir)
|
||||
callback(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ struct GenerateAppcast: ParsableCommand {
|
||||
If the contents of these files are short (< \(DEFAULT_MAX_CDATA_THRESHOLD) characters) and do not include a DOCTYPE or body tags, they will be treated as embedded CDATA release notes.
|
||||
|
||||
For new update entries, Sparkle infers the minimum system OS requirement based on your update's LSMinimumSystemVersion provided
|
||||
by your application's Info.plist. If none is found, \(programName) defaults to Sparkle's own minimum system requirement (macOS 10.11).
|
||||
by your application's Info.plist. If none is found, \(programName) defaults to Sparkle's own minimum system requirement (macOS 10.13).
|
||||
|
||||
An example of an archives directory may look like:
|
||||
./my-app-release-zipfiles/
|
||||
|
||||
@@ -244,9 +244,6 @@ typedef NS_ENUM(int, CLIErrorExitStatus) {
|
||||
fprintf(stderr, "Update was cancelled.\n");
|
||||
}
|
||||
exit(CLIErrorExitStatusUpdateCancelledAuthorization);
|
||||
} else if (error.code == SUInstallationRootInteractiveError) {
|
||||
fprintf(stderr, "%s\n", error.localizedDescription.UTF8String);
|
||||
exit(CLIErrorCodeCannotInstallInteractivePackageAsRoot);
|
||||
} else if (error.code == SUInstallationWriteNoPermissionError) {
|
||||
fprintf(stderr, "Error: %s", error.localizedDescription.UTF8String);
|
||||
if (error.localizedRecoverySuggestion != nil) {
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ static void printUsage(char **argv)
|
||||
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. Alternatively, this tool can be run as root under an active user login\n session, which will not require (and disallow) interaction.\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\n", DEFER_FLAG);
|
||||
fprintf(stderr, " If update installation fails due to not having permission (e.g. from Gatekeeper) to replace the old bundle, an exit status of 8 is returned.\n");
|
||||
fprintf(stderr, " If update installation fails due to not having permission (e.g. from Gatekeeper) to\n replace the old bundle, an exit status of 8 is returned.\n");
|
||||
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);
|
||||
@@ -45,7 +45,7 @@ static void printUsage(char **argv)
|
||||
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 Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges.\n Without passing this, an exit status of 3 is returned if an update\n 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);
|
||||
fprintf(stderr, " --%s\n Defer installation until after the application terminates on its own. The\n application will not be relaunched unless the installation is resumed later.\n", DEFER_FLAG);
|
||||
|
||||
Reference in new issue
Block a user