From 66e3083e0c8ef1df1f9bbbcabde35c0cab25c169 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 18 Jul 2016 17:40:35 -0400 Subject: [PATCH 01/29] Initial work on removing AuthorizationExecuteWithPrivileges I need to at least look at: * Automatic downloaded / silent updates * Running updates as root user from beginning * Status info query service * Add guided flag in the appcast --- Configurations/ConfigCommon.xcconfig | 3 +- Configurations/ConfigFileop.xcconfig | 5 - InstallerConnection/SUInstallerConnection.m | 6 +- .../SUInstallerConnectionProtocol.h | 2 +- .../SUXPCInstallerConnection.m | 4 +- InstallerLauncher/InstallerProgressLauncher.h | 30 ++ InstallerLauncher/InstallerProgressLauncher.m | 140 ++++++ InstallerLauncher/SUAuthorizationReply.h | 16 + InstallerLauncher/SUInstallerLauncher.m | 216 ++++++--- .../SUInstallerLauncherProtocol.h | 3 +- .../SUInstallerProgressLauncherProtocol.h | 24 + InstallerLauncher/SUSubmitInstaller.h | 20 + InstallerLauncher/SUSubmitInstaller.m | 120 +++++ InstallerStatus/SUInstallerStatus.m | 5 +- Sparkle.xcodeproj/project.pbxproj | 247 ++-------- Sparkle/Autoupdate/AgentConnection.h | 34 ++ Sparkle/Autoupdate/AgentConnection.m | 109 +++++ Sparkle/Autoupdate/AppInstaller.h | 2 +- Sparkle/Autoupdate/AppInstaller.m | 180 ++++--- Sparkle/Autoupdate/SUInstallationInputData.h | 4 +- Sparkle/Autoupdate/SUInstallationInputData.m | 16 +- Sparkle/Autoupdate/SUInstallerProtocol.h | 6 +- Sparkle/Autoupdate/SUMessageTypes.h | 4 + Sparkle/Autoupdate/SUMessageTypes.m | 12 + Sparkle/Autoupdate/StatusInfo.m | 5 +- Sparkle/Autoupdate/TerminationListener.m | 2 +- .../InstallerProgress-Info.plist | 4 + .../InstallerProgressAppController.h | 6 +- .../InstallerProgressAppController.m | 211 +++++++-- .../InstallerProgressAppControllerDelegate.h | 20 - .../InstallerProgressDelegate.h | 20 + .../SUInstallerAgentInitiationProtocol.h | 15 + .../SUInstallerAgentProtocol.h | 25 + .../InstallerProgress/ShowInstallerProgress.h | 4 +- .../InstallerProgress/ShowInstallerProgress.m | 4 +- Sparkle/InstallerProgress/main.m | 11 +- Sparkle/SUCoreBasedUpdateDriver.m | 3 +- Sparkle/SUFileManager.h | 33 -- Sparkle/SUFileManager.m | 442 ++---------------- Sparkle/SUGuidedPackageInstaller.m | 11 +- Sparkle/SUInstallerDriver.m | 39 +- Sparkle/SUPackageInstaller.m | 7 +- Sparkle/SUPlainInstaller.m | 30 +- Sparkle/SUSystemAuthorization.h | 5 +- Sparkle/SUSystemAuthorization.m | 67 +-- Sparkle/SUURLDownload.m | 1 + Tests/SUFileManagerTest.swift | 6 - Tests/SUInstallerTest.m | 5 +- fileop/SUFileOperationConstants.h | 16 - fileop/SUFileOperationConstants.m | 18 - fileop/fileop.m | 151 ------ 51 files changed, 1192 insertions(+), 1177 deletions(-) delete mode 100644 Configurations/ConfigFileop.xcconfig create mode 100644 InstallerLauncher/InstallerProgressLauncher.h create mode 100644 InstallerLauncher/InstallerProgressLauncher.m create mode 100644 InstallerLauncher/SUAuthorizationReply.h create mode 100644 InstallerLauncher/SUInstallerProgressLauncherProtocol.h create mode 100644 InstallerLauncher/SUSubmitInstaller.h create mode 100644 InstallerLauncher/SUSubmitInstaller.m create mode 100644 Sparkle/Autoupdate/AgentConnection.h create mode 100644 Sparkle/Autoupdate/AgentConnection.m delete mode 100644 Sparkle/InstallerProgress/InstallerProgressAppControllerDelegate.h create mode 100644 Sparkle/InstallerProgress/InstallerProgressDelegate.h create mode 100644 Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h create mode 100644 Sparkle/InstallerProgress/SUInstallerAgentProtocol.h delete mode 100644 fileop/SUFileOperationConstants.h delete mode 100644 fileop/SUFileOperationConstants.m delete mode 100644 fileop/fileop.m diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index fc78b29e..b4448915 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -3,7 +3,6 @@ SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater -SPARKLE_FILEOP_TOOL_NAME = fileop SPARKLE_APPEND_VERSION_NUMBER = 1 @@ -46,7 +45,7 @@ INSTALLER_LAUNCHER_BUNDLE_ID = org.sparkle-project.${INSTALLER_LAUNCHER_PRODUCT_ TEMPORARY_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${TEMPORARY_DOWNLOADER_PRODUCT_NAME} PERSISTENT_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${PERSISTENT_DOWNLOADER_PRODUCT_NAME} -GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" TEMPORARY_DOWNLOADER_BUNDLE_ID=\"${TEMPORARY_DOWNLOADER_BUNDLE_ID}\" PERSISTENT_DOWNLOADER_BUNDLE_ID=\"${PERSISTENT_DOWNLOADER_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" INSTALLER_CONNECTION_PRODUCT_NAME=\"${INSTALLER_CONNECTION_PRODUCT_NAME}\" INSTALLER_STATUS_PRODUCT_NAME=\"${INSTALLER_STATUS_PRODUCT_NAME}\" TEMPORARY_DOWNLOADER_PRODUCT_NAME=\"${TEMPORARY_DOWNLOADER_PRODUCT_NAME}\" PERSISTENT_DOWNLOADER_PRODUCT_NAME=\"${PERSISTENT_DOWNLOADER_PRODUCT_NAME}\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\" +GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" TEMPORARY_DOWNLOADER_BUNDLE_ID=\"${TEMPORARY_DOWNLOADER_BUNDLE_ID}\" PERSISTENT_DOWNLOADER_BUNDLE_ID=\"${PERSISTENT_DOWNLOADER_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" INSTALLER_CONNECTION_PRODUCT_NAME=\"${INSTALLER_CONNECTION_PRODUCT_NAME}\" INSTALLER_STATUS_PRODUCT_NAME=\"${INSTALLER_STATUS_PRODUCT_NAME}\" TEMPORARY_DOWNLOADER_PRODUCT_NAME=\"${TEMPORARY_DOWNLOADER_PRODUCT_NAME}\" PERSISTENT_DOWNLOADER_PRODUCT_NAME=\"${PERSISTENT_DOWNLOADER_PRODUCT_NAME}\" CLANG_ENABLE_OBJC_ARC = YES GCC_ENABLE_PASCAL_STRINGS = NO diff --git a/Configurations/ConfigFileop.xcconfig b/Configurations/ConfigFileop.xcconfig deleted file mode 100644 index 33efd218..00000000 --- a/Configurations/ConfigFileop.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -// Fileop tool only - -PRODUCT_NAME = $(SPARKLE_FILEOP_TOOL_NAME) -SKIP_INSTALL = YES -CLANG_ENABLE_MODULES = NO diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m index 9db088a5..71246774 100644 --- a/InstallerConnection/SUInstallerConnection.m +++ b/InstallerConnection/SUInstallerConnection.m @@ -58,9 +58,9 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K [self enableAutomaticTermination]; } -- (void)setServiceName:(NSString *)serviceName +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided { - NSXPCConnectionOptions options = SUGrantsSystemAuthorizationAccess() ? NSXPCConnectionPrivileged : 0; + NSXPCConnectionOptions options = SUNeedsSystemAuthorizationAccess(hostPath, guided, NULL) ? NSXPCConnectionPrivileged : 0; NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; @@ -72,7 +72,7 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K __weak SUInstallerConnection *weakSelf = self; self.connection.interruptionHandler = ^{ - [weakSelf invalidate]; + [weakSelf.connection invalidate]; }; self.connection.invalidationHandler = ^{ diff --git a/InstallerConnection/SUInstallerConnectionProtocol.h b/InstallerConnection/SUInstallerConnectionProtocol.h index 4669f37b..8eeaeb0c 100644 --- a/InstallerConnection/SUInstallerConnectionProtocol.h +++ b/InstallerConnection/SUInstallerConnectionProtocol.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setInvalidationHandler:(void (^)(void))invalidationHandler; -- (void)setServiceName:(NSString *)serviceName; +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided; - (void)invalidate; diff --git a/InstallerConnection/SUXPCInstallerConnection.m b/InstallerConnection/SUXPCInstallerConnection.m index af28c0d3..76cbe27e 100644 --- a/InstallerConnection/SUXPCInstallerConnection.m +++ b/InstallerConnection/SUXPCInstallerConnection.m @@ -59,9 +59,9 @@ }]; } -- (void)setServiceName:(NSString *)serviceName +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided { - [self.connection.remoteObjectProxy setServiceName:serviceName]; + [self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath guided:guided]; } - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data diff --git a/InstallerLauncher/InstallerProgressLauncher.h b/InstallerLauncher/InstallerProgressLauncher.h new file mode 100644 index 00000000..0e1e6d6e --- /dev/null +++ b/InstallerLauncher/InstallerProgressLauncher.h @@ -0,0 +1,30 @@ +// +// InstallerProgressLauncher.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol InstallerProgressLauncherDelegate + +- (void)installerProgressLauncherDidInvalidate; +- (void)installerProgressLauncherDidSubmitJob; + +@end + +@interface InstallerProgressLauncher : NSObject + +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle installerPath:(NSString *)installerPath allowingInteraction:(BOOL)allowingInteraction delegate:(id)delegate; + +- (void)startListener; + +- (void)invalidate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerLauncher/InstallerProgressLauncher.m b/InstallerLauncher/InstallerProgressLauncher.m new file mode 100644 index 00000000..79903605 --- /dev/null +++ b/InstallerLauncher/InstallerProgressLauncher.m @@ -0,0 +1,140 @@ +// +// InstallerProgressLauncher.m +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "InstallerProgressLauncher.h" +#import "SUMessageTypes.h" +#import "SUInstallerProgressLauncherProtocol.h" +#import "SUSubmitInstaller.h" +#import "SULog.h" + +#define REQUEST_AUTHORIZATION_TIMEOUT 7ull + +@interface InstallerProgressLauncher () + +@property (nonatomic) NSXPCListener *xpcListener; +@property (nonatomic) NSXPCConnection *activeConnection; +@property (nonatomic, readonly) NSBundle *hostBundle; +@property (nonatomic, copy, readonly) NSString *installerPath; +@property (nonatomic, readonly) BOOL allowsInteraction; +@property (nonatomic, weak) id delegate; +@property (nonatomic) BOOL connected; + +@end + +@implementation InstallerProgressLauncher + +@synthesize xpcListener = _xpcListener; +@synthesize activeConnection = _activeConnection; +@synthesize hostBundle = _hostBundle; +@synthesize installerPath = _installerPath; +@synthesize allowsInteraction = _allowsInteraction; +@synthesize delegate = _delegate; +@synthesize connected = _connected; + +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle installerPath:(NSString *)installerPath allowingInteraction:(BOOL)allowingInteraction delegate:(id)delegate +{ + self = [super init]; + if (self != nil) { + NSString *bundleIdentifier = hostBundle.bundleIdentifier; + assert(bundleIdentifier != nil); + + _hostBundle = hostBundle; + _installerPath = [installerPath copy]; + _allowsInteraction = allowingInteraction; + _delegate = delegate; + + _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUProgressAgentLauncherServiceNameForBundleIdentifier(bundleIdentifier)]; + _xpcListener.delegate = self; + } + return self; +} + +- (void)startListener +{ + [self.xpcListener resume]; +} + +- (void)invalidate +{ + // Declare local variable for the delegate, so that if the delegate invokes -invalidate, we won't be in an infinite recursion + id delegate = self.delegate; + self.delegate = nil; + [delegate installerProgressLauncherDidInvalidate]; + + [self.activeConnection invalidate]; + [self.xpcListener invalidate]; + + self.activeConnection = nil; + self.xpcListener = nil; +} + +- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)connection +{ + if (self.activeConnection != nil) { + SULog(@"Error: active connection for progress launcher already exists"); + [connection invalidate]; + return NO; + } + + connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerProgressLauncherProtocol)]; + connection.exportedObject = self; + + self.activeConnection = connection; + + __weak InstallerProgressLauncher *weakSelf = self; + connection.interruptionHandler = ^{ + [weakSelf.activeConnection invalidate]; + }; + + connection.invalidationHandler = ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + InstallerProgressLauncher *strongSelf = weakSelf; + if (strongSelf != nil) { + strongSelf.activeConnection = nil; + [strongSelf invalidate]; + } + }); + }; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(REQUEST_AUTHORIZATION_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + SULog(@"Dispatch timeout invoked"); + if (!self.connected) { + [self invalidate]; + } + }); + + [connection resume]; + + return YES; +} + +- (void)requestUserAuthorizationWithReply:(void (^)(SUAuthorizationReply))reply +{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.connected = YES; + + SUAuthorizationReply submissionReply = [SUSubmitInstaller submitInstallerAtPath:self.installerPath withHostBundle:self.hostBundle allowingInteraction:self.allowsInteraction inSystemDomain:YES]; + + if (submissionReply == SUAuthorizationReplyFailure) { + SULog(@"Error: failed to submit installer in system domain"); + } + + reply(submissionReply); + + if (submissionReply == SUAuthorizationReplySuccess) { + [self.delegate installerProgressLauncherDidSubmitJob]; + } + }); +} + +- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement +{ + acknowledgement(); +} + +@end diff --git a/InstallerLauncher/SUAuthorizationReply.h b/InstallerLauncher/SUAuthorizationReply.h new file mode 100644 index 00000000..1b8d0c97 --- /dev/null +++ b/InstallerLauncher/SUAuthorizationReply.h @@ -0,0 +1,16 @@ +// +// SUAuthorizationReply.h +// Sparkle +// +// Created by Mayur Pawashe on 7/18/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, SUAuthorizationReply) +{ + SUAuthorizationReplySuccess = 0, + SUAuthorizationReplyCancelled = 1, + SUAuthorizationReplyFailure = 2 +}; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 5d6e0aba..19857f5d 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -10,76 +10,176 @@ #import "SUFileManager.h" #import "SULog.h" #import "SUMessageTypes.h" -#import #import "SUSystemAuthorization.h" +#import "SUSubmitInstaller.h" +#import "SUInstallerProgressLauncherProtocol.h" + +#define AUTHORIZATION_REPLY_TIMEOUT 7ull + +@interface SUInstallerLauncher () + +@property (nonatomic, nullable) NSXPCConnection *activeConnection; + +@end @implementation SUInstallerLauncher -- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(BOOL success))completionHandler +@synthesize activeConnection = _activeConnection; + +- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction installerPath:(NSString *)installerPath shouldSubmitInstaller:(BOOL)shouldSubmitInstaller +{ + SUFileManager *fileManager = [SUFileManager defaultManager]; + + NSURL *progressToolURL = [NSURL fileURLWithPath:progressToolPath]; + + NSError *quarantineError = nil; + if (![fileManager releaseItemFromQuarantineAtRootURL:progressToolURL error:&quarantineError]) { + // This may or may not be a fatal error depending on if the process is sandboxed or not + SULog(@"Failed to release quarantine on installer at %@ with error %@", progressToolPath, quarantineError); + } + + NSString *executablePath = [[NSBundle bundleWithURL:progressToolURL] executablePath]; + assert(executablePath != nil); + + NSString *hostBundlePath = hostBundle.bundlePath; + assert(hostBundlePath != nil); + + NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; + assert(hostBundleIdentifier != nil); + + NSArray *arguments = @[executablePath, hostBundlePath, @(allowingInteraction).stringValue, installerPath, @(shouldSubmitInstaller).stringValue]; + +#warning support running under system domain if updater is running as root - this means we would have to try running job under a different user + CFStringRef domain = kSMDomainUserLaunchd; + NSString *label = [NSString stringWithFormat:@"%@-sparkle-progress", hostBundleIdentifier]; + + AuthorizationRef auth = NULL; + Boolean submittedJob = false; + OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); + if (createStatus == errAuthorizationSuccess) { + // Try to remove the job from launchd if it is already running + // We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid + // using it because the headers indicate it may be removed one day without any replacement + CFErrorRef removeError = NULL; + if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { + if (removeError != NULL) { + // It's normal for a job to not be found, so this is not an interesting error + if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { + SULog(@"Remove error: %@", removeError); + } + CFRelease(removeError); + } + } + + NSMutableDictionary *jobDictionary = [[NSMutableDictionary alloc] init]; + jobDictionary[@"Label"] = label; + jobDictionary[@"ProgramArguments"] = arguments; + jobDictionary[@"EnableTransactions"] = @NO; + jobDictionary[@"KeepAlive"] = @{@"SuccessfulExit" : @NO}; + jobDictionary[@"RunAtLoad"] = @NO; + jobDictionary[@"NICE"] = @0; + jobDictionary[@"LaunchOnlyOnce"] = @YES; + + if (shouldSubmitInstaller) { + jobDictionary[@"MachServices"] = @{SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}; + } + + CFErrorRef submitError = NULL; + submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); + if (!submittedJob) { + if (submitError != NULL) { + SULog(@"Submit progress error: %@", submitError); + CFRelease(submitError); + } + } + + AuthorizationFree(auth, kAuthorizationFlagDefaults); + } + + return (submittedJob == true); +} + +- (void)waitForProgressAgentWithHostBundle:(NSBundle *)hostBundle completion:(void (^)(SUAuthorizationReply))completionHandler +{ + NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; + assert(hostBundleIdentifier != nil); + + NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier) options:(NSXPCConnectionOptions)0]; + + connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerProgressLauncherProtocol)]; + + self.activeConnection = connection; + + __weak SUInstallerLauncher *weakSelf = self; + connection.interruptionHandler = ^{ + [weakSelf.activeConnection invalidate]; + }; + + __block BOOL invokedCompletion = NO; + + connection.invalidationHandler = ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (!invokedCompletion) { + invokedCompletion = YES; + completionHandler(SUAuthorizationReplyFailure); + } + }); + }; + + [connection resume]; + + id launcher = connection.remoteObjectProxy; + + __block BOOL intiatedConnection = NO; + [launcher connectionDidInitiateWithReply:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + intiatedConnection = YES; + + [launcher requestUserAuthorizationWithReply:^(SUAuthorizationReply reply) { + dispatch_async(dispatch_get_main_queue(), ^{ + if (!invokedCompletion) { + invokedCompletion = YES; + [weakSelf.activeConnection invalidate]; + completionHandler(reply); + } + }); + }]; + }); + }]; + + // If we initiated a connection, we can't time out because the user could just be taking a really long time to reply + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AUTHORIZATION_REPLY_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (!intiatedConnection && !invokedCompletion) { + [weakSelf.activeConnection invalidate]; + } + }); +} + +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ - SUFileManager *fileManager = [SUFileManager defaultManager]; + NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; - NSURL *installerURL = [NSURL fileURLWithPath:installerPath]; + BOOL submittedInstaller = NO; + BOOL preflighted = NO; - NSError *quarantineError = nil; - if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { - // This may or may not be a fatal error depending on if the process is sandboxed or not - SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); + // Only submit a job here if we are preflighted (already running root in which case we use system domain), + // or if we do not have to ask the user for authorization + BOOL needsSystemAuthorization = SUNeedsSystemAuthorizationAccess(hostBundlePath, guidedInstallation, &preflighted); + BOOL shouldSubmitInstallerImmediately = (!needsSystemAuthorization || preflighted); + if (shouldSubmitInstallerImmediately) { + submittedInstaller = ([SUSubmitInstaller submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); } - NSString *executablePath = [[[installerPath stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"MacOS"] stringByAppendingPathComponent:@SPARKLE_RELAUNCH_TOOL_NAME]; + BOOL submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle allowingInteraction:allowingInteraction installerPath:installerPath shouldSubmitInstaller:!shouldSubmitInstallerImmediately]; - NSError *ownershipError = nil; - if (![fileManager changeOwnerAndGroupOfItemAtRootURL:[NSURL fileURLWithPath:executablePath] toMatchURL:installerURL error:&ownershipError]) { - // This may or may not be a fatal error - SULog(@"Failed to change ownership on installer executable at %@ with error %@", executablePath, ownershipError); + if (!submittedProgressTool) { + completionHandler(SUAuthorizationReplyFailure); + } else if (shouldSubmitInstallerImmediately) { + completionHandler(submittedInstaller ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); + } else { + [self waitForProgressAgentWithHostBundle:hostBundle completion:completionHandler]; } - - NSArray *arguments = @[executablePath, hostBundleIdentifier, @(allowingInteraction).stringValue]; - - // If the updater is running as the logged in user, we submit a job under the user domain - // However if the updater is running as root (which is experimental), we submit the job under the system domain - // We don't yet handle the updater running as the logged in user, and submitting a job under the system domain, which - // would remove the need for using AuthorizationExecuteWithPrivileges() in the installer. That would require knowing before hand - // if we will need to request authorization privileges, and that would prevent this code from being invoked silently/automatically. - // Additionally, we would want to remove AppKit references in the installer - BOOL grantsSystemPrivilege = NO; - AuthorizationRef auth = SUCreateAuthorization(&grantsSystemPrivilege); - Boolean submittedJob = false; - if (auth != NULL) { - CFStringRef domain = (grantsSystemPrivilege ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); - NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; - - // Try to remove the job from launchd if it is already running - // We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid - // using it because the headers indicate it may be removed one day without any replacement - CFErrorRef removeError = NULL; - if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { - if (removeError != NULL) { - // It's normal for a job to not be found, so this is not an interesting error - if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { - SULog(@"Remove error: %@", removeError); - } - CFRelease(removeError); - } - } - - NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; - - CFErrorRef submitError = NULL; - submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); - if (!submittedJob) { - if (submitError != NULL) { - SULog(@"Submit error: %@", submitError); - CFRelease(submitError); - } - } - - AuthorizationFree(auth, kAuthorizationFlagDefaults); - } - - completionHandler(submittedJob == true); }); } diff --git a/InstallerLauncher/SUInstallerLauncherProtocol.h b/InstallerLauncher/SUInstallerLauncherProtocol.h index 76054683..aa76076f 100644 --- a/InstallerLauncher/SUInstallerLauncherProtocol.h +++ b/InstallerLauncher/SUInstallerLauncherProtocol.h @@ -7,9 +7,10 @@ // #import +#import "SUAuthorizationReply.h" @protocol SUInstallerLauncherProtocol -- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(BOOL success))completionHandler; +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler; @end diff --git a/InstallerLauncher/SUInstallerProgressLauncherProtocol.h b/InstallerLauncher/SUInstallerProgressLauncherProtocol.h new file mode 100644 index 00000000..dc30099b --- /dev/null +++ b/InstallerLauncher/SUInstallerProgressLauncherProtocol.h @@ -0,0 +1,24 @@ +// +// SUInstallerProgressLauncherProtocol.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerAgentInitiationProtocol.h" +#import "SUAuthorizationReply.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol SUInstallerProgressLauncherProtocol + +- (void)requestUserAuthorizationWithReply:(void (^)(SUAuthorizationReply))reply; + +// Redeclare this method from SUInstallerAgentInitiationProtocol because XPC decoders on older OS systems (eg: 10.8) do not traverse parent protocols +- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerLauncher/SUSubmitInstaller.h b/InstallerLauncher/SUSubmitInstaller.h new file mode 100644 index 00000000..4f0eb014 --- /dev/null +++ b/InstallerLauncher/SUSubmitInstaller.h @@ -0,0 +1,20 @@ +// +// SUSubmitInstaller.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUAuthorizationReply.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SUSubmitInstaller : NSObject + ++ (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerLauncher/SUSubmitInstaller.m b/InstallerLauncher/SUSubmitInstaller.m new file mode 100644 index 00000000..50dff100 --- /dev/null +++ b/InstallerLauncher/SUSubmitInstaller.m @@ -0,0 +1,120 @@ +// +// SUSubmitInstaller.m +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUSubmitInstaller.h" +#import "SUFileManager.h" +#import "SULog.h" +#import "SUMessageTypes.h" +#import + +@implementation SUSubmitInstaller + ++ (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain +{ + SUFileManager *fileManager = [SUFileManager defaultManager]; + + NSURL *installerURL = [NSURL fileURLWithPath:installerPath]; + + NSError *quarantineError = nil; + if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { + // This may or may not be a fatal error depending on if the process is sandboxed or not + SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); + } + + NSString *executablePath = [[NSBundle bundleWithURL:installerURL] executablePath]; + assert(executablePath != nil); + + NSError *ownershipError = nil; + if (![fileManager changeOwnerAndGroupOfItemAtRootURL:[NSURL fileURLWithPath:executablePath] toMatchURL:installerURL error:&ownershipError]) { + // This may or may not be a fatal error + SULog(@"Failed to change ownership on installer executable at %@ with error %@", executablePath, ownershipError); + } + + NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; + assert(hostBundleIdentifier != nil); + + NSArray *arguments = @[executablePath, hostBundleIdentifier, @(allowingInteraction).stringValue]; + + AuthorizationRef auth = NULL; + OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); + if (createStatus != errAuthorizationSuccess) { + auth = NULL; + SULog(@"Failed to create authorization reference"); + } + + BOOL canceledAuthorization = NO; + BOOL failedToUseSystemDomain = NO; + if (auth != NULL && systemDomain) { + AuthorizationItem rightItems[] = { + { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} + }; + + AuthorizationRights rights = { + .count = sizeof(rightItems) / sizeof(*rightItems), + .items = rightItems, + }; + + AuthorizationFlags flags = + (AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed); + + OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); + if (copyStatus != errAuthorizationSuccess) { + SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons"); + failedToUseSystemDomain = YES; + + if (copyStatus == errAuthorizationCanceled) { + canceledAuthorization = YES; + } + } + } + + Boolean submittedJob = false; + if (!failedToUseSystemDomain && auth != NULL) { + CFStringRef domain = (systemDomain ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); + NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; + + // Try to remove the job from launchd if it is already running + // We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid + // using it because the headers indicate it may be removed one day without any replacement + CFErrorRef removeError = NULL; + if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { + if (removeError != NULL) { + // It's normal for a job to not be found, so this is not an interesting error + if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { + SULog(@"Remove error: %@", removeError); + } + CFRelease(removeError); + } + } + + NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; + + CFErrorRef submitError = NULL; + submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); + if (!submittedJob) { + if (submitError != NULL) { + SULog(@"Submit error: %@", submitError); + CFRelease(submitError); + } + } + + AuthorizationFree(auth, kAuthorizationFlagDefaults); + } + + SUAuthorizationReply reply; + if (submittedJob == true) { + reply = SUAuthorizationReplySuccess; + } else if (canceledAuthorization) { + reply = SUAuthorizationReplyCancelled; + } else { + reply = SUAuthorizationReplyFailure; + } + return reply; +} + +@end diff --git a/InstallerStatus/SUInstallerStatus.m b/InstallerStatus/SUInstallerStatus.m index 834834fb..49041d72 100644 --- a/InstallerStatus/SUInstallerStatus.m +++ b/InstallerStatus/SUInstallerStatus.m @@ -28,8 +28,7 @@ - (void)setServiceName:(NSString *)serviceName { - NSXPCConnectionOptions options = SUGrantsSystemAuthorizationAccess() ? NSXPCConnectionPrivileged : 0; - NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; + NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:(NSXPCConnectionOptions)0]; connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)]; @@ -37,7 +36,7 @@ __weak SUInstallerStatus *weakSelf = self; self.connection.interruptionHandler = ^{ - [weakSelf invalidate]; + [weakSelf.connection invalidate]; }; self.connection.invalidationHandler = ^{ diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 03015769..7f08d890 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -26,7 +26,6 @@ /* Begin PBXBuildFile section */ 1420DF50196247F900203BB0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1420DF4F196247F900203BB0 /* Images.xcassets */; }; - 1420DF51196247F900203BB0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1420DF4F196247F900203BB0 /* Images.xcassets */; }; 142E0E0019A6954400E4312B /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 142E0E0219A6A14700E4312B /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 142E0E0419A6A26F00E4312B /* Autoupdate.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 55C14BB7136EEF1500649790 /* Autoupdate.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -44,7 +43,6 @@ 1495006E195FCE1100BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; 1495006F195FCE1800BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; 14950070195FCE3A00BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; - 14950071195FCE3D00BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; 14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; 14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; 14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */ = {isa = PBXBuildFile; fileRef = 14958C6B19AEBC530061B14F /* signed-test-file.txt */; }; @@ -120,15 +118,14 @@ 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; }; 61FA52880E2D9EA400EF58AD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 720B16451C66433D006985FB /* SUTestApplicationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720B16431C66433D006985FB /* SUTestApplicationTest.swift */; }; - 720E21781D0CED2B003A311C /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; 720E217B1D0D00BF003A311C /* SUUpdaterCycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21791D0D00BF003A311C /* SUUpdaterCycle.h */; }; 720E217C1D0D00BF003A311C /* SUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SUUpdaterCycle.m */; }; 7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; }; 72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */; }; 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B071C82C9600013C1C5 /* SULocalizations.h */; }; - 721BC2031D17A4FC002BC71E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; - 721BC2041D17A51B002BC71E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; - 721BC20B1D17A5AD002BC71E /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 721BC20A1D17A5AD002BC71E /* CoreServices.framework */; }; + 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; + 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 721652651D3C744700FD13D8 /* InstallerProgressLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */; }; 721BC20E1D1CDE55002BC71E /* SULocalCacheDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 721BC20C1D1CDE55002BC71E /* SULocalCacheDirectory.h */; }; 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; 721BC2101D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; @@ -144,6 +141,11 @@ 721CF1A91AD7644C00D9AC09 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; settings = {COMPILER_FLAGS = "-w"; }; }; 721CF1AA1AD7647000D9AC09 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; }; 721CF1AB1AD764EB00D9AC09 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; }; + 722194551D3C0135004C34FF /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194541D3C0135004C34FF /* AgentConnection.m */; }; + 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; + 7221947A1D3C42EA004C34FF /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */; }; + 7221947B1D3C42F7004C34FF /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; + 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7229E1B61C97C91100CB50D0 /* SUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SUUpdateDriver.h */; }; 7229E1B91C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h */; }; @@ -177,8 +179,6 @@ 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; 724BB3B11D3484B2005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; 724BB3B21D34862A005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; - 724BB3B31D35A6E6005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; - 724BB3B41D35AA44005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; 724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; }; 725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; @@ -279,7 +279,7 @@ 72B144501CF8826900B971EE /* SUAuthorizationEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B1444E1CF8826900B971EE /* SUAuthorizationEnvironment.h */; }; 72B144511CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */; }; 72B144521CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */; }; - 72B144531CF8992200B971EE /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; + 72B52A1E1D3CA4560085AC99 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 721BC20A1D17A5AD002BC71E /* CoreServices.framework */; }; 72B767CA1C9B707000A07552 /* SUAppcastDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767C81C9B707000A07552 /* SUAppcastDriver.h */; }; 72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767C91C9B707000A07552 /* SUAppcastDriver.m */; }; 72B767CE1C9B924900A07552 /* SUInstallerDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767CC1C9B924900A07552 /* SUInstallerDriver.h */; }; @@ -315,15 +315,6 @@ 72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; }; 72E45CFE1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */; }; 72E45DDD1B65C3BD005C701A /* sign_update in Resources */ = {isa = PBXBuildFile; fileRef = 72E45DDC1B65C3BD005C701A /* sign_update */; }; - 72E641A71D090F51000404CA /* fileop.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A41D090F51000404CA /* fileop.m */; }; - 72E641A81D090F51000404CA /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; - 72E641AB1D090F6E000404CA /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; - 72E641AC1D090F7F000404CA /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; - 72E641AF1D090F9E000404CA /* fileop in Resources */ = {isa = PBXBuildFile; fileRef = 72E6419B1D090F1C000404CA /* fileop */; }; - 72E641B11D091781000404CA /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; - 72E641B21D091789000404CA /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 72E641B31D0918E4000404CA /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; - 72E641B51D091A15000404CA /* fileop in Copy Executables */ = {isa = PBXBuildFile; fileRef = 72E6419B1D090F1C000404CA /* fileop */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; }; 72EB87EB1CB8859100C37F42 /* Updater.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; }; @@ -468,20 +459,6 @@ remoteGlobalIDString = 721C24441CB753E6005440CB; remoteInfo = "Installer Progress"; }; - 72E641A91D090F63000404CA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 72E6419A1D090F1C000404CA; - remoteInfo = fileop; - }; - 72E641AD1D090F98000404CA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 72E6419A1D090F1C000404CA; - remoteInfo = fileop; - }; 72F94F611CC48669002DEE68 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -587,26 +564,6 @@ name = "Copy Sparkle"; runOnlyForDeploymentPostprocessing = 0; }; - 72E641991D090F1C000404CA /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; - 72E641B41D091A0A000404CA /* Copy Executables */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 6; - files = ( - 72E641B51D091A15000404CA /* fileop in Copy Executables */, - ); - name = "Copy Executables"; - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -841,6 +798,10 @@ 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUParameterAssert.h; sourceTree = ""; }; 72162B071C82C9600013C1C5 /* SULocalizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULocalizations.h; sourceTree = ""; }; + 721652631D3C744700FD13D8 /* InstallerProgressLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressLauncher.h; path = InstallerLauncher/InstallerProgressLauncher.h; sourceTree = SOURCE_ROOT; }; + 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressLauncher.m; path = InstallerLauncher/InstallerProgressLauncher.m; sourceTree = SOURCE_ROOT; }; + 721652661D3C76E500FD13D8 /* SUInstallerProgressLauncherProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstallerProgressLauncherProtocol.h; path = InstallerLauncher/SUInstallerProgressLauncherProtocol.h; sourceTree = SOURCE_ROOT; }; + 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUAuthorizationReply.h; path = InstallerLauncher/SUAuthorizationReply.h; sourceTree = SOURCE_ROOT; }; 721BC2061D17A532002BC71E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 721BC2081D17A553002BC71E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; 721BC20A1D17A5AD002BC71E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; @@ -849,6 +810,12 @@ 721C24451CB753E6005440CB /* Updater.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Updater.app; sourceTree = BUILT_PRODUCTS_DIR; }; 721C24571CB754E8005440CB /* ConfigInstallerProgress.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerProgress.xcconfig; sourceTree = ""; }; 721C24581CB7567D005440CB /* InstallerProgress-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "InstallerProgress-Info.plist"; path = "Sparkle/InstallerProgress/InstallerProgress-Info.plist"; sourceTree = SOURCE_ROOT; }; + 722194511D3BF987004C34FF /* SUInstallerAgentProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentProtocol.h; sourceTree = SOURCE_ROOT; }; + 722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentInitiationProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h; sourceTree = SOURCE_ROOT; }; + 722194531D3C0135004C34FF /* AgentConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AgentConnection.h; sourceTree = ""; }; + 722194541D3C0135004C34FF /* AgentConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AgentConnection.m; sourceTree = ""; }; + 722194761D3C4251004C34FF /* SUSubmitInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSubmitInstaller.h; sourceTree = ""; }; + 722194771D3C4251004C34FF /* SUSubmitInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSubmitInstaller.m; sourceTree = ""; }; 7223E7611AD1AEFF008E3161 /* sais.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sais.c; sourceTree = ""; }; 7223E7621AD1AEFF008E3161 /* sais.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sais.h; sourceTree = ""; }; 7229E1B51C97C91100CB50D0 /* SUUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateDriver.h; sourceTree = ""; }; @@ -1006,7 +973,7 @@ 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressAppController.m; path = Sparkle/InstallerProgress/InstallerProgressAppController.m; sourceTree = SOURCE_ROOT; }; 72D954821CBAD34F006F28BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sparkle/InstallerProgress/main.m; sourceTree = SOURCE_ROOT; }; 72D954841CBAD418006F28BD /* ShowInstallerProgress.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ShowInstallerProgress.h; path = Sparkle/InstallerProgress/ShowInstallerProgress.h; sourceTree = SOURCE_ROOT; }; - 72D954851CBAD4AE006F28BD /* InstallerProgressAppControllerDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InstallerProgressAppControllerDelegate.h; path = Sparkle/InstallerProgress/InstallerProgressAppControllerDelegate.h; sourceTree = SOURCE_ROOT; }; + 72D954851CBAD4AE006F28BD /* InstallerProgressDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InstallerProgressDelegate.h; path = Sparkle/InstallerProgress/InstallerProgressDelegate.h; sourceTree = SOURCE_ROOT; }; 72D9549E1CBB415B006F28BD /* sparkle.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sparkle.app; sourceTree = BUILT_PRODUCTS_DIR; }; 72D954A01CBB415C006F28BD /* SUCommandLineDriver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUCommandLineDriver.h; sourceTree = ""; }; 72D954A11CBB415C006F28BD /* SUCommandLineDriver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUCommandLineDriver.m; sourceTree = ""; }; @@ -1023,11 +990,6 @@ 72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = ""; }; 72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_app_only_dsa_priv_dont_ever_do_this_for_real.pem; sourceTree = ""; }; 72E45DDC1B65C3BD005C701A /* sign_update */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = sign_update; path = bin/sign_update; sourceTree = SOURCE_ROOT; }; - 72E6419B1D090F1C000404CA /* fileop */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fileop; sourceTree = BUILT_PRODUCTS_DIR; }; - 72E641A41D090F51000404CA /* fileop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = fileop.m; sourceTree = ""; }; - 72E641A51D090F51000404CA /* SUFileOperationConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileOperationConstants.h; sourceTree = ""; }; - 72E641A61D090F51000404CA /* SUFileOperationConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUFileOperationConstants.m; sourceTree = ""; }; - 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigFileop.xcconfig; sourceTree = ""; }; 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; }; 72F94EB01CC2A865002DEE68 /* ConfigCommonReleaseHTTP.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonReleaseHTTP.xcconfig; sourceTree = ""; }; 72F94ED31CC33F1E002DEE68 /* set-ats-exceptions.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-ats-exceptions.sh"; sourceTree = ""; }; @@ -1066,8 +1028,8 @@ files = ( 726E076B1CA616B3001A286B /* libbz2.tbd in Frameworks */, 726E07691CA616A4001A286B /* libxar.tbd in Frameworks */, - 14950071195FCE3D00BC5B5B /* AppKit.framework in Frameworks */, 14950070195FCE3A00BC5B5B /* Foundation.framework in Frameworks */, + 72B52A1E1D3CA4560085AC99 /* CoreServices.framework in Frameworks */, 55C14F9A136F045400649790 /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1112,6 +1074,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7221947A1D3C42EA004C34FF /* ServiceManagement.framework in Frameworks */, 724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */, 721C245A1CB75756005440CB /* Cocoa.framework in Frameworks */, ); @@ -1175,16 +1138,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72E641981D090F1C000404CA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 721BC20B1D17A5AD002BC71E /* CoreServices.framework in Frameworks */, - 721BC2041D17A51B002BC71E /* Foundation.framework in Frameworks */, - 721BC2031D17A4FC002BC71E /* Security.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1215,7 +1168,6 @@ 728638F31CAF5A5F00783084 /* SparkleTemporaryDownloader.xpc */, 721C24451CB753E6005440CB /* Updater.app */, 72D9549E1CBB415B006F28BD /* sparkle.app */, - 72E6419B1D090F1C000404CA /* fileop */, 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */, 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */, ); @@ -1373,7 +1325,6 @@ 55C14BD5136EEFD000649790 /* Autoupdate */ = { isa = PBXGroup; children = ( - 72E6419C1D090F1C000404CA /* fileop */, 61CFB2C10E384958007A1735 /* Verifiers */, 6101354A0DD25B7F0049ACDF /* Unarchiving */, 618FA6DB0DB485440026945C /* Installation */, @@ -1383,6 +1334,8 @@ 729746221C8E8F1100FC134E /* AppInstaller.m */, 724BB38B1D33283C005D534A /* StatusInfo.h */, 724BB38C1D33283C005D534A /* StatusInfo.m */, + 722194531D3C0135004C34FF /* AgentConnection.h */, + 722194541D3C0135004C34FF /* AgentConnection.m */, 7297461E1C8E8D9A00FC134E /* TerminationListener.h */, 7297461F1C8E8D9A00FC134E /* TerminationListener.m */, 726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */, @@ -1612,9 +1565,15 @@ 721C24461CB753E6005440CB /* Installer Progress */ = { isa = PBXGroup; children = ( - 72D954851CBAD4AE006F28BD /* InstallerProgressAppControllerDelegate.h */, + 72D954851CBAD4AE006F28BD /* InstallerProgressDelegate.h */, + 722194511D3BF987004C34FF /* SUInstallerAgentProtocol.h */, + 722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */, 72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */, 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */, + 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */, + 721652661D3C76E500FD13D8 /* SUInstallerProgressLauncherProtocol.h */, + 721652631D3C744700FD13D8 /* InstallerProgressLauncher.h */, + 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */, 72D954841CBAD418006F28BD /* ShowInstallerProgress.h */, 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */, 72D954821CBAD34F006F28BD /* main.m */, @@ -1690,6 +1649,8 @@ 726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */, 726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */, 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */, + 722194761D3C4251004C34FF /* SUSubmitInstaller.h */, + 722194771D3C4251004C34FF /* SUSubmitInstaller.m */, 726E07B31CAF08D6001A286B /* main.m */, 726E07B51CAF08D6001A286B /* Info.plist */, ); @@ -1784,17 +1745,6 @@ path = "sparkle-cli"; sourceTree = ""; }; - 72E6419C1D090F1C000404CA /* fileop */ = { - isa = PBXGroup; - children = ( - 72E641A41D090F51000404CA /* fileop.m */, - 72E641A51D090F51000404CA /* SUFileOperationConstants.h */, - 72E641A61D090F51000404CA /* SUFileOperationConstants.m */, - ); - name = fileop; - path = ../../fileop; - sourceTree = ""; - }; 72F94F551CC43D99002DEE68 /* XPC Services */ = { isa = PBXGroup; children = ( @@ -1822,7 +1772,6 @@ FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */, FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */, FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */, - 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */, 721C24571CB754E8005440CB /* ConfigInstallerProgress.xcconfig */, FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */, 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */, @@ -1972,16 +1921,12 @@ isa = PBXNativeTarget; buildConfigurationList = 55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "Autoupdate" */; buildPhases = ( - 55C14BB3136EEF1500649790 /* Resources */, 55C14BB4136EEF1500649790 /* Sources */, 55C14BB5136EEF1500649790 /* Frameworks */, - 14652F7B19A945D600959E44 /* Run Script: Set Git Version Info */, - 72E641B41D091A0A000404CA /* Copy Executables */, ); buildRules = ( ); dependencies = ( - 72E641AA1D090F63000404CA /* PBXTargetDependency */, ); name = Autoupdate; productName = Autoupdate; @@ -2016,7 +1961,6 @@ buildRules = ( ); dependencies = ( - 72E641AE1D090F98000404CA /* PBXTargetDependency */, 61FA528D0E2D9EB200EF58AD /* PBXTargetDependency */, ); name = "Sparkle Unit Tests"; @@ -2208,23 +2152,6 @@ productReference = 72D9549E1CBB415B006F28BD /* sparkle.app */; productType = "com.apple.product-type.application"; }; - 72E6419A1D090F1C000404CA /* fileop */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72E6419F1D090F1C000404CA /* Build configuration list for PBXNativeTarget "fileop" */; - buildPhases = ( - 72E641971D090F1C000404CA /* Sources */, - 72E641981D090F1C000404CA /* Frameworks */, - 72E641991D090F1C000404CA /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = fileop; - productName = fileop; - productReference = 72E6419B1D090F1C000404CA /* fileop */; - productType = "com.apple.product-type.tool"; - }; 8DC2EF4F0486A6940098B216 /* Sparkle */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Sparkle" */; @@ -2314,9 +2241,6 @@ 72D9549D1CBB415B006F28BD = { CreatedOnToolsVersion = 7.3; }; - 72E6419A1D090F1C000404CA = { - CreatedOnToolsVersion = 7.3.1; - }; }; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */; @@ -2394,7 +2318,6 @@ 1420DF491962329200203BB0 /* Documentation */, 1495005F195FB89400BC5B5B /* All */, 726B2B5C1C645FC900388755 /* UI Tests */, - 72E6419A1D090F1C000404CA /* fileop */, ); }; /* End PBXProject section */ @@ -2404,7 +2327,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 72E641AF1D090F9E000404CA /* fileop in Resources */, 14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */, 5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */, 72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */, @@ -2420,14 +2342,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 55C14BB3136EEF1500649790 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1420DF51196247F900203BB0 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 61B5F8FE09C4CEE200B25A18 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2525,21 +2439,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 14652F7B19A945D600959E44 /* Run Script: Set Git Version Info */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script: Set Git Version Info"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\""; - showEnvVarsInLog = 0; - }; 6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 12; @@ -2622,8 +2521,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 72E641AB1D090F6E000404CA /* SUFileOperationConstants.m in Sources */, - 72B144531CF8992200B971EE /* SUApplicationInfo.m in Sources */, + 722194551D3C0135004C34FF /* AgentConnection.m in Sources */, 72B09CEE1CEA21CD0052EF9E /* bscommon.c in Sources */, 72D9547E1CBA221E006F28BD /* SUAppcastItem.m in Sources */, 72B144521CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */, @@ -2672,7 +2570,6 @@ 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */, 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */, 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */, - 720E21781D0CED2B003A311C /* SUFileOperationConstants.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2729,14 +2626,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 724BB3B41D35AA44005D534A /* SUSystemAuthorization.m in Sources */, - 724BB3B31D35A6E6005D534A /* SUInstallerStatus.m in Sources */, + 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */, + 7221947B1D3C42F7004C34FF /* SUFileManager.m in Sources */, 72D954831CBAD34F006F28BD /* main.m in Sources */, 721C24621CB75C68005440CB /* SULog.m in Sources */, 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */, 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */, 721C24611CB75C5D005440CB /* SUHost.m in Sources */, + 721652651D3C744700FD13D8 /* InstallerProgressLauncher.m in Sources */, 721C245F1CB75A6B005440CB /* SUMessageTypes.m in Sources */, + 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */, 721C245E1CB757DE005440CB /* SUConstants.m in Sources */, 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */, 721C245C1CB7576E005440CB /* SUStatusController.m in Sources */, @@ -2775,9 +2674,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */, 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */, 724BB3671D30B2C5005D534A /* SUMessageTypes.m in Sources */, - 72E641B31D0918E4000404CA /* SUFileOperationConstants.m in Sources */, 726E07C01CAF15B7001A286B /* SULog.m in Sources */, 726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */, 726E07BE1CAF0C5C001A286B /* SUFileManager.m in Sources */, @@ -2828,25 +2727,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72E641971D090F1C000404CA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72E641B21D091789000404CA /* SUConstants.m in Sources */, - 72E641B11D091781000404CA /* SUFileManager.m in Sources */, - 72E641A71D090F51000404CA /* fileop.m in Sources */, - 72E641A81D090F51000404CA /* SUFileOperationConstants.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */, 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */, 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */, 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */, - 72E641AC1D090F7F000404CA /* SUFileOperationConstants.m in Sources */, 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */, 724A0A3E1CF7AF0E00D8C3D5 /* SUTemporaryDownloader.m in Sources */, 723B5DAA1CF7AB6A00365F95 /* SUPersistentDownloader.m in Sources */, @@ -2989,16 +2877,6 @@ target = 721C24441CB753E6005440CB /* Installer Progress */; targetProxy = 72D954B91CBB6E27006F28BD /* PBXContainerItemProxy */; }; - 72E641AA1D090F63000404CA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72E6419A1D090F1C000404CA /* fileop */; - targetProxy = 72E641A91D090F63000404CA /* PBXContainerItemProxy */; - }; - 72E641AE1D090F98000404CA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72E6419A1D090F1C000404CA /* fileop */; - targetProxy = 72E641AD1D090F98000404CA /* PBXContainerItemProxy */; - }; 72F94F621CC48669002DEE68 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */; @@ -3587,38 +3465,6 @@ }; name = Release; }; - 72E641A01D090F1C000404CA /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */; - buildSettings = { - GCC_NO_COMMON_BLOCKS = YES; - }; - name = Debug; - }; - 72E641A11D090F1C000404CA /* Coverage */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */; - buildSettings = { - GCC_NO_COMMON_BLOCKS = YES; - }; - name = Coverage; - }; - 72E641A21D090F1C000404CA /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */; - buildSettings = { - GCC_NO_COMMON_BLOCKS = YES; - }; - name = Release; - }; - 72E641A31D090F1C000404CA /* Release-HTTP */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */; - buildSettings = { - GCC_NO_COMMON_BLOCKS = YES; - }; - name = "Release-HTTP"; - }; 72F94E9F1CC2A23A002DEE68 /* Release-HTTP */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72F94EB01CC2A865002DEE68 /* ConfigCommonReleaseHTTP.xcconfig */; @@ -3854,6 +3700,7 @@ 724BB37C1D31D0B7005D534A /* Release-HTTP */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 724BB39F1D333832005D534A /* Build configuration list for PBXNativeTarget "SparkleInstallerStatus" */ = { isa = XCConfigurationList; @@ -3864,6 +3711,7 @@ 724BB3A31D333832005D534A /* Release-HTTP */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 726B2B671C645FC900388755 /* Build configuration list for PBXNativeTarget "UI Tests" */ = { isa = XCConfigurationList; @@ -3931,17 +3779,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 72E6419F1D090F1C000404CA /* Build configuration list for PBXNativeTarget "fileop" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72E641A01D090F1C000404CA /* Debug */, - 72E641A11D090F1C000404CA /* Coverage */, - 72E641A21D090F1C000404CA /* Release */, - 72E641A31D090F1C000404CA /* Release-HTTP */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; diff --git a/Sparkle/Autoupdate/AgentConnection.h b/Sparkle/Autoupdate/AgentConnection.h new file mode 100644 index 00000000..98082ed6 --- /dev/null +++ b/Sparkle/Autoupdate/AgentConnection.h @@ -0,0 +1,34 @@ +// +// AgentConnection.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol AgentConnectionDelegate + +- (void)agentConnectionDidInitiate; +- (void)agentConnectionDidInvalidate; + +@end + +@protocol SUInstallerAgentProtocol; + +@interface AgentConnection : NSObject + +- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id)delegate; + +- (void)startListener; +- (void)invalidate; + +@property (nonatomic, readonly, nullable) id agent; +@property (nonatomic, readonly) BOOL connected; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/Autoupdate/AgentConnection.m b/Sparkle/Autoupdate/AgentConnection.m new file mode 100644 index 00000000..69b865af --- /dev/null +++ b/Sparkle/Autoupdate/AgentConnection.m @@ -0,0 +1,109 @@ +// +// AgentConnection.m +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "AgentConnection.h" +#import "SUMessageTypes.h" +#import "SUInstallerAgentProtocol.h" +#import "SUInstallerAgentInitiationProtocol.h" + +#ifdef _APPKITDEFINES_H +#error This is a "daemon-safe" class and should NOT import AppKit +#endif + +@interface AgentConnection () + +@property (nonatomic) NSXPCListener *xpcListener; +@property (nonatomic, nullable) NSXPCConnection *activeConnection; +@property (nonatomic, nullable) id agent; +@property (nonatomic, weak) id delegate; +@property (nonatomic) BOOL connected; + +@end + +@implementation AgentConnection + +@synthesize xpcListener = _xpcListener; +@synthesize activeConnection = _activeConnection; +@synthesize agent = _agent; +@synthesize delegate = _delegate; +@synthesize connected = _connected; + +- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id)delegate +{ + self = [super init]; + if (self != nil) { + // Agents should always be the one that connect to daemons due to how mach bootstraps work + // For this reason, we are the ones that are creating a listener, not the agent + _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUProgressAgentServiceNameForBundleIdentifier(bundleIdentifier)]; + _xpcListener.delegate = self; + _delegate = delegate; + } + return self; +} + +- (void)startListener +{ + [self.xpcListener resume]; +} + +- (void)invalidate +{ + self.delegate = nil; + + [self.activeConnection invalidate]; + self.activeConnection = nil; + + [self.xpcListener invalidate]; + self.xpcListener = nil; +} + +- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection +{ + if (self.activeConnection != nil) { + [newConnection invalidate]; + return NO; + } + + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)]; + newConnection.exportedObject = self; + + newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentProtocol)]; + + self.activeConnection = newConnection; + + __weak AgentConnection *weakSelf = self; + newConnection.interruptionHandler = ^{ + [weakSelf.activeConnection invalidate]; + }; + + newConnection.invalidationHandler = ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.delegate agentConnectionDidInvalidate]; + }); + }; + + [newConnection resume]; + + self.agent = newConnection.remoteObjectProxy; + + return YES; +} + +- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement +{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.connected = YES; + + [self.delegate agentConnectionDidInitiate]; + self.delegate = nil; + }); + + acknowledgement(); +} + +@end diff --git a/Sparkle/Autoupdate/AppInstaller.h b/Sparkle/Autoupdate/AppInstaller.h index 84174fe6..ea1ea48e 100644 --- a/Sparkle/Autoupdate/AppInstaller.h +++ b/Sparkle/Autoupdate/AppInstaller.h @@ -6,7 +6,7 @@ // Copyright © 2016 Sparkle Project. All rights reserved. // -#import +#import #import "SUUnarchiverProtocol.h" @interface AppInstaller : NSObject diff --git a/Sparkle/Autoupdate/AppInstaller.m b/Sparkle/Autoupdate/AppInstaller.m index a198f858..caef3a7f 100644 --- a/Sparkle/Autoupdate/AppInstaller.m +++ b/Sparkle/Autoupdate/AppInstaller.m @@ -23,12 +23,17 @@ #import "SUFileManager.h" #import "SUInstallationInfo.h" #import "SUAppcastItem.h" -#import "SUAuthorizationEnvironment.h" -#import "SUApplicationInfo.h" #import "SUErrors.h" #import "SUInstallerCommunicationProtocol.h" +#import "AgentConnection.h" +#import "SUInstallerAgentProtocol.h" + +#ifdef _APPKITDEFINES_H +#error This is a "daemon-safe" class and should NOT import AppKit +#endif #define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull +#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull /*! * Terminate the application after a delay from launching the new update to avoid OS activation issues @@ -44,12 +49,13 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5; */ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; -@interface AppInstaller () +@interface AppInstaller () @property (nonatomic) NSXPCListener* xpcListener; @property (nonatomic) NSXPCConnection *activeConnection; @property (nonatomic) id communicator; @property (nonatomic) StatusInfo *statusInfo; +@property (nonatomic) AgentConnection *agentConnection; @property (nonatomic) BOOL receivedUpdaterPong; @property (nonatomic, strong) TerminationListener *terminationListener; @@ -70,6 +76,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @property (nonatomic) BOOL performedStage2Installation; @property (nonatomic) BOOL performedStage3Installation; +@property (nonatomic) NSUInteger agentConnectionCounter; + @end @implementation AppInstaller @@ -78,6 +86,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @synthesize activeConnection = _activeConnection; @synthesize communicator = _communicator; @synthesize statusInfo = _statusInfo; +@synthesize agentConnection = _agentConnection; @synthesize receivedUpdaterPong = _receivedUpdaterPong; @synthesize hostBundleIdentifier = _hostBundleIdentifier; @synthesize allowsInteraction = _allowsInteraction; @@ -93,6 +102,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @synthesize performedStage1Installation = _performedStage1Installation; @synthesize performedStage2Installation = _performedStage2Installation; @synthesize performedStage3Installation = _performedStage3Installation; +@synthesize agentConnectionCounter = _agentConnectionCounter; - (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowsInteraction { @@ -108,6 +118,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; _xpcListener.delegate = self; _statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier]; + _agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self]; return self; } @@ -159,12 +170,18 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; { [self.xpcListener resume]; [self.statusInfo startListener]; + [self.agentConnection startListener]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ if (!self.receivedInstallationData) { SULog(@"Timeout: installation data was never received"); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } + + if (!self.agentConnection.connected) { + SULog(@"Timeout: agent connection was never initiated"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } }); } @@ -302,10 +319,50 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; } else { [self.communicator handleMessageWithIdentifier:SUInstallationStartedStage1 data:[NSData data]]; - [self startInstallation]; + self.agentConnectionCounter++; + if (self.agentConnectionCounter == 2) { + [self retrieveProcessIdentifierAndStartInstallation]; + } } } +- (void)agentConnectionDidInitiate +{ + self.agentConnectionCounter++; + if (self.agentConnectionCounter == 2) { + [self retrieveProcessIdentifierAndStartInstallation]; + } +} + +- (void)agentConnectionDidInvalidate +{ + if (self.agentConnectionCounter < 2) { + SULog(@"Error: Agent connection invalidated before installation began"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } +} + +- (void)retrieveProcessIdentifierAndStartInstallation +{ + // We use the relaunch path for the bundle to listen for termination instead of the host path + // For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates + // Otherwise for an app, the relaunch path and host path should be identical + + [self.agentConnection.agent registerRelaunchBundlePath:self.installationData.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier]; + [self startInstallation]; + }); + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (self.terminationListener == nil) { + SULog(@"Timeour error: failed to retreive process identifier from agent"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + }); +} + - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data { if (identifier == SUInstallationData && self.installationData == nil) { @@ -328,23 +385,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; SULog(@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } else { - NSBundle *relaunchBundle = [NSBundle bundleWithPath:nonNullInstallationData.relaunchPath]; - if (relaunchBundle == nil) { - SULog(@"Error: Failed to locate relaunch bundle path %@", nonNullInstallationData.relaunchPath); + // This will be important later + if (nonNullInstallationData.relaunchPath == nil) { + SULog(@"Error: Failed to obtain relaunch path from installation data"); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } else { self.host = host; self.installationData = installationData; - // We use the relaunch path for the bundle to listen for termination instead of the host path - // For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates - // Otherwise for an app, the relaunch path and host path should be identical - - NSRunningApplication *runningApplication = [SUApplicationInfo runningApplicationWithBundle:host.bundle]; - NSNumber *processIdentifier = (runningApplication == nil || runningApplication.terminated) ? nil : @(runningApplication.processIdentifier); - - self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier]; - [self extractAndInstallUpdate]; } } @@ -442,53 +490,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; return; } - SUAuthorizationEnvironment *environment = nil; - NSURL *tempIconDirectoryURL = nil; - if (self.shouldShowUI && self.allowsInteraction && [self.installer mayNeedToRequestAuthorization]) { - NSString *prompt = [NSString stringWithFormat:NSLocalizedString(@"%1$@ wants to update.", nil), self.host.name]; - - NSString *iconPath = nil; - - // Authorization API requires a 32x32 icon image and accepts png (but not icns or tiff) - NSImage *icon = [SUApplicationInfo bestIconForBundle:self.host.bundle]; - [icon setSize:NSMakeSize(32, 32)]; - - CGImageRef iconRef = [icon CGImageForProposedRect:NULL context:nil hints:nil]; - NSBitmapImageRep *representation = [[NSBitmapImageRep alloc] initWithCGImage:iconRef]; - NSData *pngData = [representation representationUsingType:NSPNGFileType properties:@{}]; - - // Write the icon to a temporary directory. This icon file should be in a directory that's readable to everyone. - NSError *tempError = nil; - tempIconDirectoryURL = [[SUFileManager defaultManager] makeTemporaryDirectoryWithPreferredName:@"sparkle-auth-icon" appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:&tempError]; - if (tempIconDirectoryURL == nil) { - SULog(@"Failed to create temporary directory for authorization icon: %@", tempError); - } else { - NSURL *iconURL = [tempIconDirectoryURL URLByAppendingPathComponent:@"icon.png"]; - if ([pngData writeToURL:iconURL atomically:YES]) { - iconPath = iconURL.path; - } - } - - environment = [[SUAuthorizationEnvironment alloc] initWithPrompt:prompt iconPath:(iconPath != nil ? iconPath : @"")]; - - dispatch_async(dispatch_get_main_queue(), ^{ - // We should activate our app so that the auth prompt will be active - [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; - }); - } - - NSString *fileOperationToolPath = [[[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@""SPARKLE_FILEOP_TOOL_NAME]; - - if (![[NSFileManager defaultManager] fileExistsAtPath:fileOperationToolPath]) { - SULog(@"Potential Installation Error: File operation tool path %@ is not found", fileOperationToolPath); - } - NSError *secondStageError = nil; - BOOL performedSecondStage = [self.installer performSecondStageAllowingAuthorization:self.allowsInteraction fileOperationToolPath:fileOperationToolPath environment:environment allowingUI:self.shouldShowUI error:&secondStageError]; - - if (tempIconDirectoryURL != nil) { - [[SUFileManager defaultManager] removeItemAtURL:tempIconDirectoryURL error:NULL]; - } + BOOL performedSecondStage = [self.installer performSecondStageAllowingUI:self.shouldShowUI error:&secondStageError]; if (performedSecondStage) { self.performedStage2Installation = YES; @@ -543,37 +546,17 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; [self.communicator handleMessageWithIdentifier:SUUpdaterAlivePing data:[NSData data]]; // Launch our installer progress UI tool if only after a certain amount of time passes - __block NSRunningApplication *installerProgressRunningApplication = nil; __block BOOL shouldLaunchInstallerProgress = YES; - - NSString *progressToolPath = self.installationData.progressToolPath; - if (progressToolPath != nil && self.shouldShowUI && ![self.installer displaysUserProgress]) { - NSURL *progressToolURL = [NSURL fileURLWithPath:progressToolPath]; - if (progressToolURL != nil) { - NSError *quarantineError = nil; - if (![[SUFileManager defaultManager] releaseItemFromQuarantineAtRootURL:progressToolURL error:&quarantineError]) { - SULog(@"Error: Failed releasing quarantine from installer progress tool: %@", quarantineError); + if (self.shouldShowUI && ![self.installer displaysUserProgress]) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // Make sure we're still eligible for showing the installer progress + // Also if the updater process is still alive, showing the progress should not be our duty + // if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil, + // this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater + if (shouldLaunchInstallerProgress && (!self.receivedUpdaterPong || self.communicator == nil)) { + [self.agentConnection.agent showProgress]; } - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - // Make sure we're still eligible for showing the installer progress - // Also if the updater process is still alive, showing the progress should not be our duty - // if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil, - // this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater - if (shouldLaunchInstallerProgress && (!self.receivedUpdaterPong || self.communicator == nil)) { - NSError *launchError = nil; - - NSArray *arguments = @[self.host.bundlePath]; - NSRunningApplication *runningApplication = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:progressToolURL options:(NSWorkspaceLaunchOptions)(NSWorkspaceLaunchDefault | NSWorkspaceLaunchNewInstance) configuration:@{NSWorkspaceLaunchConfigurationArguments : arguments} error:&launchError]; - - if (runningApplication == nil) { - SULog(@"Failed to launch installer progress tool with error: %@", launchError); - } else { - installerProgressRunningApplication = runningApplication; - } - } - }); - } + }); } dispatch_async(self.installerQueue, ^{ @@ -601,7 +584,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; dispatch_async(dispatch_get_main_queue(), ^{ // Make sure to terminate our displayed progress before we move onto cleanup - [installerProgressRunningApplication terminate]; + [self.agentConnection.agent stopProgress]; shouldLaunchInstallerProgress = NO; [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage3 data:[NSData data]]; @@ -624,7 +607,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; pathToRelaunch = self.installationData.relaunchPath; } - [self relaunchAtPath:pathToRelaunch]; + [self.agentConnection.agent relaunchPath:pathToRelaunch]; } dispatch_async(self.installerQueue, ^{ @@ -652,6 +635,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; [self.statusInfo invalidate]; self.statusInfo = nil; + [self.agentConnection invalidate]; + self.agentConnection = nil; + NSError *theError = nil; if (![[NSFileManager defaultManager] removeItemAtPath:self.installationData.updateDirectoryPath error:&theError]) { SULog(@"Couldn't remove update folder: %@.", theError); @@ -662,12 +648,4 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; exit(status); } -- (void)relaunchAtPath:(NSString *)relaunchPath -{ - // Don't use -launchApplication: because we may not be launching an application. Eg: it could be a system prefpane - if (![[NSWorkspace sharedWorkspace] openFile:relaunchPath]) { - SULog(@"Failed to launch %@", relaunchPath); - } -} - @end diff --git a/Sparkle/Autoupdate/SUInstallationInputData.h b/Sparkle/Autoupdate/SUInstallationInputData.h index 48a9ad8f..573916c3 100644 --- a/Sparkle/Autoupdate/SUInstallationInputData.h +++ b/Sparkle/Autoupdate/SUInstallationInputData.h @@ -14,17 +14,15 @@ NS_ASSUME_NONNULL_BEGIN /* * relaunchPath - path to application bundle to relaunch and listen for termination - * progressToolPath - path to optional GUI tool that shows update progress if installation is not quick * hostBundlePath - path to host bundle to update & replace * updateDirectoryPath - path to update directory (i.e, temporary directory containing the new update archive) * downloadName - name of update archive in update directory * dsaSignature - DSA signature for the update that came from the appcast item * decryptionPassword - optional decryption password for dmg archives */ -- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath progressToolPath:(nullable NSString *)progressToolPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword; +- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword; @property (nonatomic, copy, readonly) NSString *relaunchPath; -@property (nonatomic, copy, readonly, nullable) NSString *progressToolPath; @property (nonatomic, copy, readonly) NSString *hostBundlePath; @property (nonatomic, copy, readonly) NSString *updateDirectoryPath; @property (nonatomic, copy, readonly) NSString *downloadName; diff --git a/Sparkle/Autoupdate/SUInstallationInputData.m b/Sparkle/Autoupdate/SUInstallationInputData.m index 467049c5..93250523 100644 --- a/Sparkle/Autoupdate/SUInstallationInputData.m +++ b/Sparkle/Autoupdate/SUInstallationInputData.m @@ -8,8 +8,11 @@ #import "SUInstallationInputData.h" +#ifdef _APPKITDEFINES_H +#error This is a "daemon-safe" class and should NOT import AppKit +#endif + static NSString *SURelaunchPathKey = @"SURelaunchPath"; -static NSString *SUProgressToolPathKey = @"SUProgressToolPath"; static NSString *SUHostBundlePathKey = @"SUHostBundlePath"; static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath"; static NSString *SUDownloadNameKey = @"SUDownloadName"; @@ -19,19 +22,17 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; @implementation SUInstallationInputData @synthesize relaunchPath = _relaunchPath; -@synthesize progressToolPath = _progressToolPath; @synthesize hostBundlePath = _hostBundlePath; @synthesize updateDirectoryPath = _updateDirectoryPath; @synthesize downloadName = _downloadName; @synthesize dsaSignature = _dsaSignature; @synthesize decryptionPassword = _decryptionPassword; -- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath progressToolPath:(nullable NSString *)progressToolPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword +- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword { self = [super init]; if (self != nil) { _relaunchPath = [relaunchPath copy]; - _progressToolPath = [progressToolPath copy]; _hostBundlePath = [hostBundlePath copy]; _updateDirectoryPath = [updateDirectoryPath copy]; _downloadName = [downloadName copy]; @@ -48,8 +49,6 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; return nil; } - NSString *progressToolPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUProgressToolPathKey]; - NSString *hostBundlePath = [decoder decodeObjectOfClass:[NSString class] forKey:SUHostBundlePathKey]; if (hostBundlePath == nil) { return nil; @@ -72,15 +71,12 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey]; - return [self initWithRelaunchPath:relaunchPath progressToolPath:progressToolPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; + return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey]; - if (self.progressToolPath != nil) { - [coder encodeObject:self.progressToolPath forKey:SUProgressToolPathKey]; - } [coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey]; [coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey]; [coder encodeObject:self.downloadName forKey:SUDownloadNameKey]; diff --git a/Sparkle/Autoupdate/SUInstallerProtocol.h b/Sparkle/Autoupdate/SUInstallerProtocol.h index bd418afc..1c91c553 100644 --- a/Sparkle/Autoupdate/SUInstallerProtocol.h +++ b/Sparkle/Autoupdate/SUInstallerProtocol.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN // The allowsUI flag indicates whether this and the 3rd stage can show UI or not, possibly affecting whether or not this stage succeeds. // Eg: This may be appropriate for first showing an authorization prompt before the user application is terminated (if the operation succeeds) // Should be able to be called from non-main thread -- (BOOL)performSecondStageAllowingAuthorization:(BOOL)allowsAuthorization fileOperationToolPath:(NSString *)fileOperationToolPath environment:(SUAuthorizationEnvironment * _Nullable)authorizationEnvironment allowingUI:(BOOL)allowsUI error:(NSError **)error; +- (BOOL)performSecondStageAllowingUI:(BOOL)allowsUI error:(NSError **)error; // Stage 3 occurs after the user application has has been terminated. This is where the final installation work can be done. // After this stage is done, the user application will be relaunched. @@ -42,10 +42,6 @@ NS_ASSUME_NONNULL_BEGIN // Should be thread safe - (BOOL)canInstallSilently; -// Indicates whether or not this installer may need authorization when performing the second stage of the installation -// Should be thread safe -- (BOOL)mayNeedToRequestAuthorization; - // Cleans up work done from any of the previous stages. This should be invoked after stage 3 succeeds, // or after any one of the stages fails. // Should be able to be called from non-main thread diff --git a/Sparkle/Autoupdate/SUMessageTypes.h b/Sparkle/Autoupdate/SUMessageTypes.h index 8a5e2392..f82217d0 100644 --- a/Sparkle/Autoupdate/SUMessageTypes.h +++ b/Sparkle/Autoupdate/SUMessageTypes.h @@ -43,4 +43,8 @@ NSString *SUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier); NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier); +NSString *SUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier); + +NSString *SUProgressAgentLauncherServiceNameForBundleIdentifier(NSString *bundleIdentifier); + NS_ASSUME_NONNULL_END diff --git a/Sparkle/Autoupdate/SUMessageTypes.m b/Sparkle/Autoupdate/SUMessageTypes.m index 7abbf1d5..9fa5f91e 100644 --- a/Sparkle/Autoupdate/SUMessageTypes.m +++ b/Sparkle/Autoupdate/SUMessageTypes.m @@ -15,6 +15,8 @@ NSString *SUAppcastItemArchiveKey = @"SUAppcastItemArchive"; // These should be very short because length restrictions exist on earlier versions of macOS #define SPARKLE_INSTALLER_TAG @"-spki" #define SPARKLE_STATUS_TAG @"-spks" +#define SPARKLE_PROGRESS_TAG @"-spkp" +#define SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG @"-spkl" // macOS 10.8 at least can't handle service names that are 64 characters or longer // This was fixed some point after 10.8, but I'm not sure if it was fixed in 10.9 or 10.10 or 10.11 @@ -77,3 +79,13 @@ NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier) { return SUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier); } + +NSString *SUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier) +{ + return SUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier); +} + +NSString *SUProgressAgentLauncherServiceNameForBundleIdentifier(NSString *bundleIdentifier) +{ + return SUServiceNameWithTag(SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG, bundleIdentifier); +} diff --git a/Sparkle/Autoupdate/StatusInfo.m b/Sparkle/Autoupdate/StatusInfo.m index 1f8d99b8..0062de9d 100644 --- a/Sparkle/Autoupdate/StatusInfo.m +++ b/Sparkle/Autoupdate/StatusInfo.m @@ -8,7 +8,10 @@ #import "StatusInfo.h" #import "SUMessageTypes.h" -#import "SULog.h" + +#ifdef _APPKITDEFINES_H +#error This is a "daemon-safe" class and should NOT import AppKit +#endif @interface StatusInfo () diff --git a/Sparkle/Autoupdate/TerminationListener.m b/Sparkle/Autoupdate/TerminationListener.m index ff24b274..07a5f57a 100644 --- a/Sparkle/Autoupdate/TerminationListener.m +++ b/Sparkle/Autoupdate/TerminationListener.m @@ -14,7 +14,7 @@ #include #ifdef _APPKITDEFINES_H -#error This is class should NOT import AppKit +#error This is a "daemon-safe" class and should NOT import AppKit #endif @interface TerminationListener () diff --git a/Sparkle/InstallerProgress/InstallerProgress-Info.plist b/Sparkle/InstallerProgress/InstallerProgress-Info.plist index 6f42e62b..a4b82eaa 100644 --- a/Sparkle/InstallerProgress/InstallerProgress-Info.plist +++ b/Sparkle/InstallerProgress/InstallerProgress-Info.plist @@ -26,5 +26,9 @@ $(MACOSX_DEPLOYMENT_TARGET) NSPrincipalClass NSApplication + LSBackgroundOnly + 1 + LSUIElement + 1 diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.h b/Sparkle/InstallerProgress/InstallerProgressAppController.h index f91aa592..b60cef6d 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.h +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.h @@ -10,14 +10,16 @@ NS_ASSUME_NONNULL_BEGIN -@protocol InstallerProgressAppControllerDelegate; +@protocol InstallerProgressDelegate; @interface InstallerProgressAppController : NSObject -- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate; +- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate; - (void)run; +- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn)); + @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index 5ee37200..9260bce5 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -7,11 +7,14 @@ // #import "InstallerProgressAppController.h" -#import "InstallerProgressAppControllerDelegate.h" -#import "SUInstallerStatus.h" +#import "InstallerProgressDelegate.h" #import "SUMessageTypes.h" #import "SULog.h" #import "SUApplicationInfo.h" +#import "SUInstallerAgentProtocol.h" +#import "SUInstallerAgentInitiationProtocol.h" +#import "InstallerProgressLauncher.h" +#import /*! * Terminate the application after a delay from launching the new update to avoid OS activation issues @@ -20,59 +23,102 @@ */ static const NSTimeInterval SUTerminationTimeDelay = 0.3; -@interface InstallerProgressAppController () +@interface InstallerProgressAppController () @property (nonatomic, readonly) NSApplication *application; -@property (nonatomic, readonly) NSBundle *bundle; -@property (nonatomic, readonly, weak) id delegate; -@property (nonatomic, readonly) id statusInfo; +@property (nonatomic, weak) id delegate; +@property (nonatomic, readonly) NSXPCConnection *connection; +@property (nonatomic) BOOL connected; +@property (nonatomic) BOOL repliedToRegistration; +@property (nonatomic, readonly) NSBundle *hostBundle; +@property (nonatomic, readonly, nullable) InstallerProgressLauncher *progressLauncher; +@property (nonatomic) BOOL submittedLauncherJob; @end +#define CONNECTION_ACKNOWLEDGEMENT_TIMEOUT 7ull + @implementation InstallerProgressAppController @synthesize application = _application; -@synthesize bundle = _bundle; @synthesize delegate = _delegate; -@synthesize statusInfo = _statusInfo; +@synthesize connection = _connection; +@synthesize connected = _connected; +@synthesize repliedToRegistration = _repliedToRegistration; +@synthesize hostBundle = _hostBundle; +@synthesize progressLauncher = _progressLauncher; +@synthesize submittedLauncherJob = _submittedLauncherJob; -- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate +- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate { self = [super init]; if (self != nil) { - if (arguments.count != 2) { - exit(EXIT_FAILURE); + if (arguments.count != 5) { + SULog(@"Error: Invalid arguments"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; } NSString *hostBundlePath = arguments[1]; - NSBundle *bundle = [NSBundle bundleWithPath:hostBundlePath]; - if (bundle == nil) { - SULog(@"Error: bundle at %@ is nil", hostBundlePath); - exit(EXIT_FAILURE); + if (hostBundlePath.length == 0) { + SULog(@"Error: Host bundle path length is 0"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; } - NSString *bundleIdentifier = bundle.bundleIdentifier; - if (bundleIdentifier == nil) { - SULog(@"Error: Bundle Identifier for target is nil"); - exit(EXIT_FAILURE); + _hostBundle = [NSBundle bundleWithPath:hostBundlePath]; + if (_hostBundle == nil) { + SULog(@"Error: Host bundle for target is nil"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + + NSString *hostBundleIdentifier = _hostBundle.bundleIdentifier; + if (hostBundleIdentifier == nil) { + SULog(@"Error: Host bundle identifier for target is nil"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + + BOOL allowingInteraction = arguments[2].boolValue; + + NSString *installerPath = arguments[3]; + if (installerPath.length == 0) { + SULog(@"Error: Installer path length is 0"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + + BOOL shouldSubmitInstaller = arguments[4].boolValue; + if (shouldSubmitInstaller) { + _progressLauncher = [[InstallerProgressLauncher alloc] initWithHostBundle:_hostBundle installerPath:installerPath allowingInteraction:allowingInteraction delegate:self]; } - application.applicationIconImage = [SUApplicationInfo bestIconForBundle:bundle]; - application.delegate = self; _application = application; _delegate = delegate; - _bundle = bundle; - _statusInfo = [[SUInstallerStatus alloc] init]; - [_statusInfo setInvalidationHandler:^{ + NSXPCConnectionOptions connectionOptions = shouldSubmitInstaller ? NSXPCConnectionPrivileged : 0; + _connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions]; + + _connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentProtocol)]; + _connection.exportedObject = self; + + _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)]; + + __weak InstallerProgressAppController *weakSelf = self; + _connection.interruptionHandler = ^{ + [weakSelf.connection invalidate]; + }; + + _connection.invalidationHandler = ^{ dispatch_async(dispatch_get_main_queue(), ^{ - [application terminate:nil]; + InstallerProgressAppController *strongSelf = weakSelf; + if (strongSelf != nil) { + int exitStatus = (strongSelf.repliedToRegistration ? EXIT_SUCCESS : EXIT_FAILURE); + if (!strongSelf.repliedToRegistration) { + SULog(@"Error: Agent Invalidating without having the chance to reply to installer"); + } + [strongSelf cleanupAndExitWithStatus:exitStatus]; + } }); - }]; - - [_statusInfo setServiceName:SUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)]; + }; } return self; } @@ -82,16 +128,112 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; [self.application run]; } -- (void)applicationDidFinishLaunching:(NSNotification *)__unused notification +- (void)startConnection { - [self.statusInfo probeStatusConnectivityWithReply:^{ + [self.connection resume]; + [self.connection.remoteObjectProxy connectionDidInitiateWithReply:^{ dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate applicationDidFinishLaunchingWithTargetBundle:self.bundle]; + self.connected = YES; }); }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(CONNECTION_ACKNOWLEDGEMENT_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (!self.connected) { + SULog(@"Timeout error: failed to receive acknowledgement from installer"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + }); } -// Close status window immediately, but delay termination for a little bit to better increase the chance +- (void)applicationDidFinishLaunching:(NSNotification *)__unused notification +{ + if (self.progressLauncher == nil) { + [self startConnection]; + } else { + [self.progressLauncher startListener]; + } +} + +- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn)) +{ + [self.connection invalidate]; + [self.progressLauncher invalidate]; + + exit(status); +} + +- (void)installerProgressLauncherDidSubmitJob +{ + self.submittedLauncherJob = YES; + [self startConnection]; +} + +- (void)installerProgressLauncherDidInvalidate +{ + if (!self.submittedLauncherJob) { + SULog(@"Installer progress launcher invalidated"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } +} + +- (void)registerRelaunchBundlePath:(NSString *)relaunchBundlePath reply:(void (^)(NSNumber *))reply +{ + dispatch_async(dispatch_get_main_queue(), ^{ + assert(relaunchBundlePath != nil); + NSBundle *relaunchBundle = [NSBundle bundleWithPath:relaunchBundlePath]; + if (relaunchBundle == nil) { + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } + + NSRunningApplication *runningApplication = [SUApplicationInfo runningApplicationWithBundle:relaunchBundle]; + NSNumber *processIdentifier = (runningApplication == nil || runningApplication.terminated) ? nil : @(runningApplication.processIdentifier); + + reply(processIdentifier); + + self.repliedToRegistration = YES; + }); +} + +- (void)relaunchPath:(NSString *)pathToRelaunch +{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (![[NSWorkspace sharedWorkspace] openFile:pathToRelaunch]) { + SULog(@"Error: Failed to relaunch bundle at %@", pathToRelaunch); + } + }); +} + +- (void)showProgress +{ + dispatch_async(dispatch_get_main_queue(), ^{ + // Show app icon in the dock + ProcessSerialNumber psn = { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + + // Note: the application icon needs to be set after showing the icon in the dock + self.application.applicationIconImage = [SUApplicationInfo bestIconForBundle:self.hostBundle]; + + // Activate ourselves otherwise we will probably be in the background + [self.application activateIgnoringOtherApps:YES]; + + [self.delegate installerProgressShouldDisplayWithBundle:self.hostBundle]; + }); +} + +- (void)stopProgress +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self _stopProgress]; + }); +} + +- (void)_stopProgress +{ + [self.delegate installerProgressShouldStop]; + self.delegate = nil; +} + +// Dismiss any UI immediately, but delay termination for a little bit to better increase the chance // the updated application when relaunched will be the frontmost application // This is related to macOS activation issues when terminating a frontmost application happens right before // launching another app @@ -99,8 +241,11 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUTerminationTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // Exit right away, don't go through the apple event process again - exit(EXIT_SUCCESS); + [self cleanupAndExitWithStatus:EXIT_SUCCESS]; }); + + [self _stopProgress]; + // Reply with a 'cancel' rather than 'later' because 'later' may make the runloop stop completely, not having the dispatch_after above invoked return NSTerminateCancel; } diff --git a/Sparkle/InstallerProgress/InstallerProgressAppControllerDelegate.h b/Sparkle/InstallerProgress/InstallerProgressAppControllerDelegate.h deleted file mode 100644 index 6782ec76..00000000 --- a/Sparkle/InstallerProgress/InstallerProgressAppControllerDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// InstallerProgressAppControllerDelegate.h -// Sparkle -// -// Created by Mayur Pawashe on 4/10/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol InstallerProgressAppControllerDelegate - -- (void)applicationDidFinishLaunchingWithTargetBundle:(NSBundle *)bundle; -- (void)applicationWillTerminateAfterDelay; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/InstallerProgress/InstallerProgressDelegate.h b/Sparkle/InstallerProgress/InstallerProgressDelegate.h new file mode 100644 index 00000000..9bf1d314 --- /dev/null +++ b/Sparkle/InstallerProgress/InstallerProgressDelegate.h @@ -0,0 +1,20 @@ +// +// InstallerProgressDelegate.h +// Sparkle +// +// Created by Mayur Pawashe on 4/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol InstallerProgressDelegate + +- (void)installerProgressShouldDisplayWithBundle:(NSBundle *)bundle; +- (void)installerProgressShouldStop; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h b/Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h new file mode 100644 index 00000000..948e6c89 --- /dev/null +++ b/Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h @@ -0,0 +1,15 @@ +// +// SUInstallerAgentInitiationProtocol.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +@protocol SUInstallerAgentInitiationProtocol + +- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement; + +@end diff --git a/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h b/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h new file mode 100644 index 00000000..d4b33db4 --- /dev/null +++ b/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h @@ -0,0 +1,25 @@ +// +// SUInstallerAgentProtocol.h +// Sparkle +// +// Created by Mayur Pawashe on 7/17/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol SUInstallerAgentProtocol + +- (void)registerRelaunchBundlePath:(NSString *)relaunchBundlePath reply:(void (^)(NSNumber * _Nullable processIdentifier))reply; + +- (void)showProgress; + +- (void)stopProgress; + +- (void)relaunchPath:(NSString *)pathToRelaunch; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/InstallerProgress/ShowInstallerProgress.h b/Sparkle/InstallerProgress/ShowInstallerProgress.h index f7879216..62ff0419 100644 --- a/Sparkle/InstallerProgress/ShowInstallerProgress.h +++ b/Sparkle/InstallerProgress/ShowInstallerProgress.h @@ -7,11 +7,11 @@ // #import -#import "InstallerProgressAppControllerDelegate.h" +#import "InstallerProgressDelegate.h" NS_ASSUME_NONNULL_BEGIN -@interface ShowInstallerProgress : NSObject +@interface ShowInstallerProgress : NSObject @end diff --git a/Sparkle/InstallerProgress/ShowInstallerProgress.m b/Sparkle/InstallerProgress/ShowInstallerProgress.m index 30ce4908..8e4602b8 100644 --- a/Sparkle/InstallerProgress/ShowInstallerProgress.m +++ b/Sparkle/InstallerProgress/ShowInstallerProgress.m @@ -22,7 +22,7 @@ @synthesize statusController = _statusController; -- (void)applicationDidFinishLaunchingWithTargetBundle:(NSBundle *)bundle +- (void)installerProgressShouldDisplayWithBundle:(NSBundle *)bundle { SUHost *host = [[SUHost alloc] initWithBundle:bundle]; self.statusController = [[SUStatusController alloc] initWithHost:host]; @@ -32,7 +32,7 @@ [self.statusController showWindow:self]; } -- (void)applicationWillTerminateAfterDelay +- (void)installerProgressShouldStop { [self.statusController close]; self.statusController = nil; diff --git a/Sparkle/InstallerProgress/main.m b/Sparkle/InstallerProgress/main.m index 6cd99eb2..cfc7ffbc 100644 --- a/Sparkle/InstallerProgress/main.m +++ b/Sparkle/InstallerProgress/main.m @@ -14,7 +14,7 @@ int main(int __unused argc, const char __unused *argv[]) { @autoreleasepool { - ShowInstallerProgress *showInstallerProgress = [[ShowInstallerProgress alloc] init]; + id showInstallerProgress = [[ShowInstallerProgress alloc] init]; InstallerProgressAppController *appController = [[InstallerProgressAppController alloc] @@ -22,6 +22,15 @@ int main(int __unused argc, const char __unused *argv[]) arguments:[[NSProcessInfo processInfo] arguments] delegate:showInstallerProgress]; + // Ignore SIGTERM because we are going to catch it ourselves + signal(SIGTERM, SIG_IGN); + + dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue()); + dispatch_source_set_event_handler(sigtermSource, ^{ + [appController cleanupAndExitWithStatus:SIGTERM]; + }); + dispatch_resume(sigtermSource); + [appController run]; } diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 4fe5d179..7b8db88d 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -14,6 +14,7 @@ #import "SUDownloadDriver.h" #import "SULocalCacheDirectory.h" #import "SULog.h" +#import "SUErrors.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -148,7 +149,7 @@ [self.installerDriver extractDownloadName:downloadName withUpdateItem:self.updateItem temporaryDirectory:temporaryDirectory completion:^(NSError * _Nullable error) { if (error != nil) { - [self.delegate coreDriverIsRequestingAbortUpdateWithError:error]; + [self.delegate coreDriverIsRequestingAbortUpdateWithError:(error.code == SUInstallationCancelledError) ? nil : error]; } }]; } diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 552e8e5d..032ef60c 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -9,8 +9,6 @@ #import #import "SUExport.h" -@class SUAuthorizationEnvironment; - NS_ASSUME_NONNULL_BEGIN /** @@ -27,37 +25,6 @@ NS_ASSUME_NONNULL_BEGIN */ + (instancetype)defaultManager; -/** - * Creates a file manager that allows authorizing for file operations - * @param authorizationToolPath Specifies the path to the tool that can perform file operations and be run as root. - * This tool will be invoked when read or write access is denied when attempting ordinary file operations. See the `fileop` tool included in Sparkle. - * @param environment Specifies the authorization environment used when making an authorization request. Pass nil to use a default environment. - * @return A new file manager instance - * - * This method just creates the file manager. It doesn't acquire authorization immediately or if it doesn't need to. - */ -+ (instancetype)fileManagerWithAuthorizationToolPath:(NSString *)authorizationToolPath environment:(SUAuthorizationEnvironment * _Nullable)environment; - -/** - * Returns a file manager that allows or disallows authorizing for file operations based on the current file manager - * @return A file manager instance that can perform authorized operations if the current file manager has already performed them. - * If the current file manager instance hasn't yet performed authorized operations, then neither can the instance returned by this method - * - * This may return a newly created file manager or re-use the existing file manager depending on the current authorization rights. - */ -- (instancetype)fileManagerByPreservingAuthorizationRights; - -/** - * Requests and grants authorization for performing authorized operations. - * - * @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL. An error code of SUInstallationCancelledError is returned if an authorization prompt occurs and the user decides to cancel the request. - * @return YES on success otherwise returns NO - * - * This will prompt the user for an authorization dialog if the user's permission is needed to perform authorized operations. - * If the process is running as root already, no authorization prompt is made. - */ -- (BOOL)grantAuthorizationPrivilegesWithError:(NSError * __autoreleasing *)error; - /** * Creates a temporary directory on the same volume as a provided URL * @param preferredName A name that may be used when creating the temporary directory. Note that in the uncothirdStageErrormmon case this name is used, the temporary directory will be created inside the directory pointed by appropriateURL diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 63c1e294..7365c380 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -7,10 +7,7 @@ // #import "SUFileManager.h" -#import "SUAuthorizationEnvironment.h" -#import #import "SUErrors.h" -#import "SUFileOperationConstants.h" #include #include @@ -46,11 +43,6 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return YES; } -// Used to indicate if the type of NSError requires us to attempt to peform the same operation again except with authentication -// To be safe, both read and write permission denied's are included because Cocoa's error methods are not very well documented -// and at least one case is caused from lack of read permissions (-[NSURL setResourceValue:forKey:error:]) -#define NS_HAS_PERMISSION_ERROR(error) (error.code == NSFileReadNoPermissionError || error.code == NSFileWriteNoPermissionError) - #pragma clang diagnostic push // Use direct access because it's easier, clearer, and faster #pragma clang diagnostic ignored "-Wdirect-ivar-access" @@ -59,166 +51,20 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { { AuthorizationRef _auth; NSFileManager *_fileManager; - NSString *_authorizationToolPath; - SUAuthorizationEnvironment *_environment; } -- (instancetype)initWithAuthorizationToolPath:(NSString *)authorizationToolPath environment:(SUAuthorizationEnvironment *)environment +- (instancetype)init { self = [super init]; if (self != nil) { _fileManager = [[NSFileManager alloc] init]; - _authorizationToolPath = [authorizationToolPath copy]; - _environment = environment; } return self; } + (instancetype)defaultManager { - return [[self alloc] initWithAuthorizationToolPath:nil environment:nil]; -} - -+ (instancetype)fileManagerWithAuthorizationToolPath:(NSString *)authorizationToolPath environment:(SUAuthorizationEnvironment * _Nullable)environment -{ - return [[self alloc] initWithAuthorizationToolPath:authorizationToolPath environment:environment]; -} - -- (instancetype)fileManagerByPreservingAuthorizationRights -{ - // Check if we don't allow authorization, or that we haven't needed to authorize yet, to create or re-use a - // file manager instance with these restrictions - return (_authorizationToolPath != nil && _auth != NULL) ? self : [SUFileManager defaultManager]; -} - -// Acquires an authorization reference with root privileges which is intended to be used for authorized file operations -- (BOOL)_acquireAuthorizationWithError:(NSError *__autoreleasing *)error -{ - // No need to continue if we already acquired an authorization reference - if (_auth != NULL) { - return YES; - } - - if (_authorizationToolPath == nil) { - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: @"Unable to grant authorization to perform action because it is explicitly turned off" }]; - } - return NO; - } - - // This should almost always succeed, fail in unusual/rare cases - OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &_auth); - if (createStatus != errAuthorizationSuccess) { - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed creating authorization reference with status code %d.", createStatus] }]; - } - _auth = NULL; - return NO; - } - - AuthorizationItem rightItems[] = { - // The right that allows us to run tools as root user - {.name = kAuthorizationRightExecute, .valueLength = 0, .value = NULL, .flags = 0} - }; - - AuthorizationRights rights = { - .count = sizeof(rightItems) / sizeof(*rightItems), - .items = rightItems - }; - - AuthorizationFlags flags = - (AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize); - - // This will test if we can gain authorization for running utlities as root - OSStatus copyStatus = AuthorizationCopyRights(_auth, &rights, (_environment != nil ? _environment.environment : kAuthorizationEmptyEnvironment), flags, NULL); - if (copyStatus != errAuthorizationSuccess) { - if (error != NULL) { - if (copyStatus == errAuthorizationCanceled) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:@{ NSLocalizedDescriptionKey: @"Authorization access was cancelled by the user." }]; - } else { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed granting authorization rights with status code %d.", copyStatus] }]; - } - } - - AuthorizationFree(_auth, kAuthorizationFlagDefaults); - _auth = NULL; - - return NO; - } - - return YES; -} - -- (BOOL)_authorizeAndExecuteCommand:(char *)command sourcePath:(char *)sourcePath destinationPath:(char *)destinationPath error:(NSError * __autoreleasing *)error -{ - NSError *acquireError = nil; - if (![self _acquireAuthorizationWithError:&acquireError]) { - if (error != NULL) { - *error = acquireError; - } - return NO; - } - - char *arguments[] = { command, sourcePath, destinationPath, NULL }; - - char toolPath[PATH_MAX] = {0}; - if (![_authorizationToolPath getFileSystemRepresentation:toolPath maxLength:sizeof(toolPath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Authorization tool (%@) cannot be represented as a valid file name.", _authorizationToolPath.lastPathComponent] }]; - } - return NO; - } - - FILE *pipe = NULL; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (AuthorizationExecuteWithPrivileges(_auth, toolPath, kAuthorizationFlagDefaults, arguments, &pipe) != errAuthorizationSuccess) { -#pragma clang diagnostic pop - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:@"Failed to run authorization tool." }]; - } - return NO; - } - - uint32_t pidData = 0; - if (fread(&pidData, sizeof(pidData), 1, pipe) < 1) { - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:@"Failed to retrieve authorized executable process identifier." }]; - } - fclose(pipe); - return NO; - } - - pid_t childPid = (int32_t)CFSwapInt32LittleToHost(pidData); - int status = 0; - - pid_t waitResult; - do { - waitResult = waitpid(childPid, &status, 0); - } while (waitResult == -1 && errno == EINTR); - - fclose(pipe); - - if (waitResult == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Failed to execute authorized executable with result %d and status (%d, %d, %d).", waitResult, status, WIFEXITED(status), WEXITSTATUS(status)] }]; - } - return NO; - } - - return YES; -} - -- (void)dealloc -{ - if (_auth != NULL) { - AuthorizationFree(_auth, kAuthorizationFlagDefaults); - } -} - -- (BOOL)grantAuthorizationPrivilegesWithError:(NSError * __autoreleasing *)error -{ - return [self _acquireAuthorizationWithError:error]; + return [[self alloc] init]; } // -[NSFileManager attributesOfItemAtPath:error:] won't follow symbolic links @@ -275,36 +121,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return removexattr(path, attr, options); } -#define XATTR_UTILITY_PATH "/usr/bin/xattr" -// Recursively remove an xattr at a specified root URL with authentication -- (BOOL)_removeQuarantineWithAuthenticationAtRootURL:(NSURL *)rootURL error:(NSError *__autoreleasing *)error -{ - // Because this is a system utility, it's fine to follow the symbolic link if one exists - if (![_fileManager fileExistsAtPath:@(XATTR_UTILITY_PATH)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: @"xattr utility does not exist on this system." }]; - } - return NO; - } - - char path[PATH_MAX] = {0}; - if (![rootURL.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"File to remove (%@) cannot be represented as a valid file name.", rootURL.path.lastPathComponent] }]; - } - return NO; - } - - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpRemoveQuarantineCommand sourcePath:path destinationPath:NULL error:&executeError]; - if (!success && error != NULL) { - *error = executeError; - } - - return success; -} - -- (BOOL)_releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL withQuarantineRetrieval:(BOOL (^)(NSURL *))quarantineRetrieval quarantineRemoval:(BOOL (^)(NSURL *, NSError * __autoreleasing *))quarantineRemoval isAccessError:(BOOL (^)(NSError *))isAccessError error:(NSError * __autoreleasing *)error +- (BOOL)_releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL withQuarantineRetrieval:(BOOL (^)(NSURL *))quarantineRetrieval quarantineRemoval:(BOOL (^)(NSURL *, NSError * __autoreleasing *))quarantineRemoval error:(NSError * __autoreleasing *)error { if (![self _itemExistsAtURL:rootURL]) { if (error != NULL) { @@ -322,18 +139,13 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { if (quarantineRemoval(fileURL, &removalError)) { removedQuarantine = YES; } else { - if (isAccessError(removalError)) { - removedQuarantine = [self _removeQuarantineWithAuthenticationAtRootURL:rootURL error:error]; - attemptedAuthentication = YES; - } else { - if (success != NULL) { - // Make sure we haven't already run into an error - if (*success && error != NULL) { - *error = removalError; - } - // Fail, but still try to release other items from quarantine - *success = NO; + if (success != NULL) { + // Make sure we haven't already run into an error + if (*success && error != NULL) { + *error = removalError; } + // Fail, but still try to release other items from quarantine + *success = NO; } } } @@ -400,6 +212,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { { static const int removeXAttrOptions = XATTR_NOFOLLOW; +#warning this code is over complicated now, needs to be rewritten return [self _releaseItemFromQuarantineAtRootURL:rootURL @@ -413,9 +226,6 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } return removedQuarantine; } - isAccessError:^BOOL(NSError *removalError) { - return (removalError.code == EACCES); - } error:error]; } @@ -464,43 +274,13 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { #pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus copyResult = FSCopyObjectSync(&sourceRef, &destinationParentRef, (__bridge CFStringRef)(destinationURL.lastPathComponent), NULL, kFSFileOperationDefaultOptions); #pragma clang diagnostic pop - if (copyResult == noErr) { - return YES; - } - - // Note: I have received afpAccessDenied error in testing even when not copying from/to an AFP mount, - // when the error should have been a normal permission denied one - if (copyResult != permErr && copyResult != afpAccessDenied) { + + if (copyResult != noErr) { if (error != NULL) { *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:copyResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to copy file (%@)", sourceURL.lastPathComponent] }]; } - return NO; - } - - char sourcePath[PATH_MAX] = {0}; - if (![sourceURL.path getFileSystemRepresentation:sourcePath maxLength:sizeof(sourcePath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination to copy file to (%@) cannot be represented as a valid file name.", sourceURL.lastPathComponent] }]; - } - return NO; - } - - char destinationPath[PATH_MAX] = {0}; - if (![destinationURL.path getFileSystemRepresentation:destinationPath maxLength:sizeof(destinationPath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination to copy file to (%@) cannot be represented as a valid file name.", destinationURL.lastPathComponent] }]; - } - return NO; } - NSError *executeError = nil; - if (![self _authorizeAndExecuteCommand:SUFileOpCopyCommand sourcePath:sourcePath destinationPath:destinationPath error:&executeError]) { - if (error != NULL) { - *error = executeError; - } - return NO; - } - return YES; } @@ -572,48 +352,11 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { if (foundSourceVolume && foundDestinationVolume && sourceVolume != destinationVolume) { return ([self copyItemAtURL:sourceURL toURL:destinationURL error:error] && [self removeItemAtURL:sourceURL error:error]); } - - NSError *moveError = nil; - if ([_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:&moveError]) { - return YES; - } - - if (!NS_HAS_PERMISSION_ERROR(moveError)) { - if (error != NULL) { - *error = moveError; - } - return NO; - } - - char sourcePath[PATH_MAX] = {0}; - if (![sourceURL.path getFileSystemRepresentation:sourcePath maxLength:sizeof(sourcePath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"File to move (%@) cannot be represented as a valid file name.", sourceURL.path.lastPathComponent] }]; - } - return NO; - } - - char destinationPath[PATH_MAX] = {0}; - if (![destinationURL.path getFileSystemRepresentation:destinationPath maxLength:sizeof(destinationPath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination (%@) cannot be represented as a valid file name.", destinationURL.path.lastPathComponent] }]; - } - return NO; - } - NSError *executeError = nil; - if (![self _authorizeAndExecuteCommand:SUFileOpMoveCommand sourcePath:sourcePath destinationPath:destinationPath error:&executeError]) { - if (error != NULL) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to perform authorized file move for %@.", sourceURL.lastPathComponent]; - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:errorMessage, NSUnderlyingErrorKey: executeError }]; - } - return NO; - } - - return YES; + return [_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:error]; } -- (BOOL)_changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(NSNumber *)ownerID groupID:(NSNumber *)groupID needsAuth:(BOOL *)needsAuth error:(NSError * __autoreleasing *)error +- (BOOL)_changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(NSNumber *)ownerID groupID:(NSNumber *)groupID error:(NSError * __autoreleasing *)error { char path[PATH_MAX] = {0}; if (![targetURL.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { @@ -632,23 +375,16 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } // We use fchown instead of chown because the latter can follow symbolic links - BOOL success = fchown(fileDescriptor, ownerID.unsignedIntValue, groupID.unsignedIntValue) == 0; + BOOL success = (fchown(fileDescriptor, ownerID.unsignedIntValue, groupID.unsignedIntValue) == 0); close(fileDescriptor); if (!success) { - if (errno == EPERM) { - if (needsAuth != NULL) { - *needsAuth = YES; - } - } else { - if (error != NULL) { - *error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to change owner & group for %@ with owner ID %u and group ID %u.", targetURL.path.lastPathComponent, ownerID.unsignedIntValue, groupID.unsignedIntValue] }]; - } - return NO; + if (error != NULL) { + *error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to change owner & group for %@ with owner ID %u and group ID %u.", targetURL.path.lastPathComponent, ownerID.unsignedIntValue, groupID.unsignedIntValue] }]; } } - return YES; + return success; } - (BOOL)changeOwnerAndGroupOfItemAtRootURL:(NSURL *)targetURL toMatchURL:(NSURL *)matchURL error:(NSError * __autoreleasing *)error @@ -715,53 +451,20 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return YES; } - BOOL needsAuth = NO; - - if (![self _changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID groupID:groupID needsAuth:&needsAuth error:error]) { + if (![self _changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID groupID:groupID error:error]) { return NO; } if (isTargetADirectory) { NSDirectoryEnumerator *directoryEnumerator = [_fileManager enumeratorAtURL:targetURL includingPropertiesForKeys:nil options:(NSDirectoryEnumerationOptions)0 errorHandler:nil]; for (NSURL *url in directoryEnumerator) { - if (![self _changeOwnerAndGroupOfItemAtURL:url ownerID:ownerID groupID:groupID needsAuth:&needsAuth error:error]) { + if (![self _changeOwnerAndGroupOfItemAtURL:url ownerID:ownerID groupID:groupID error:error]) { return NO; } - - if (needsAuth) { - break; - } } } - - if (!needsAuth) { - return YES; - } - - char targetPath[PATH_MAX] = {0}; - if (![targetURL.path getFileSystemRepresentation:targetPath maxLength:sizeof(targetPath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Target file (%@) cannot be represented as a valid file name.", targetURL.path.lastPathComponent] }]; - } - return NO; - } - char matchPath[PATH_MAX] = {0}; - if (![matchURLPath getFileSystemRepresentation:matchPath maxLength:sizeof(matchPath)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Match file (%@) cannot be represented as a valid file name.", matchURL.path.lastPathComponent] }]; - } - return NO; - } - - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpChangeOwnerAndGroupCommand sourcePath:targetPath destinationPath:matchPath error:&executeError]; - if (!success && error != NULL) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to change owner & group on %@ to match %@ with authorization.", targetURL.path.lastPathComponent, matchURLPath.lastPathComponent]; - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError }]; - } - - return success; + return YES; } - (BOOL)_updateItemAtURL:(NSURL *)targetURL withAccessTime:(struct timeval)accessTime error:(NSError * __autoreleasing *)error @@ -859,7 +562,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { // The document says LSRegisterURL() can be used as well but this hasn't worked out well for me in practice // Anyway, updating the modification time of the application is important because the system will be aware a new version of your app is available, // Finder will report the correct file size and other metadata for it, URL schemes your app may register will be updated, etc. -// Behind the scenes, touch calls to utimes() which is what we use here - unless we need to authenticate +// Behind the scenes, touch calls to utimes() which is what we use here - (BOOL)updateModificationAndAccessTimeOfItemAtURL:(NSURL *)targetURL error:(NSError * __autoreleasing *)error { if (![self _itemExistsAtURL:targetURL]) { @@ -887,28 +590,15 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { // Using futimes() because utimes() follows symbolic links BOOL updatedTime = (futimes(fileDescriptor, NULL) == 0); - close(fileDescriptor); - if (updatedTime) { - return YES; - } - - if (errno != EACCES) { + if (!updatedTime) { if (error != NULL) { *error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to update modification & access time for %@", targetURL.path.lastPathComponent] }]; } - return NO; } - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpUpdateModificationAndAccessTimeCommand sourcePath:path destinationPath:NULL error:&executeError]; - if (!success && error != NULL) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to update modification & access time on %@ with authorization.", targetURL.path.lastPathComponent]; - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError }]; - } - - return success; + return updatedTime; } // Creates a directory at the item pointed by url @@ -932,35 +622,14 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } NSError *createDirectoryError = nil; - if ([_fileManager createDirectoryAtURL:url withIntermediateDirectories:NO attributes:nil error:&createDirectoryError]) { - return YES; - } - - if (!NS_HAS_PERMISSION_ERROR(createDirectoryError)) { + if (![_fileManager createDirectoryAtURL:url withIntermediateDirectories:NO attributes:nil error:&createDirectoryError]) { if (error != NULL) { *error = createDirectoryError; } return NO; } - - char path[PATH_MAX] = {0}; - if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Directory to create (%@) cannot be represented as a valid file name.", url.path.lastPathComponent] }]; - } - return NO; - } - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpMakeDirectoryCommand sourcePath:path destinationPath:NULL error:&executeError]; - if (!success) { - if (error != NULL) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to make directory %@ with authorization.", url.path.lastPathComponent]; - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError }]; - } - } - - return success; + return YES; } - (NSURL *)makeTemporaryDirectoryWithPreferredName:(NSString *)preferredName appropriateForDirectoryURL:(NSURL *)directoryURL error:(NSError * __autoreleasing *)error @@ -994,33 +663,14 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } NSError *removeError = nil; - if ([_fileManager removeItemAtURL:url error:&removeError]) { - return YES; - } - - if (!NS_HAS_PERMISSION_ERROR(removeError)) { + if (![_fileManager removeItemAtURL:url error:&removeError]) { if (error != NULL) { *error = removeError; } return NO; } - - char path[PATH_MAX] = {0}; - if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"File to remove (%@) cannot be represented as a valid file name.", url.path.lastPathComponent] }]; - } - return NO; - } - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpRemoveCommand sourcePath:path destinationPath:NULL error:&executeError]; - - if (!success && error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to remove %@ with authentication.", url.path.lastPathComponent], NSUnderlyingErrorKey: executeError }]; - } - - return success; + return YES; } - (BOOL)moveItemAtURLToTrash:(NSURL *)url error:(NSError *__autoreleasing *)error @@ -1087,20 +737,30 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return NO; } - char path[PATH_MAX] = {0}; - if (![packageURL.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Package to execute (%@) cannot be represented as a valid file name.", packageURL.path.lastPathComponent] }]; + // This command *must* be run as root + NSString *installerPath = @"/usr/sbin/installer"; + + NSTask *task = [[NSTask alloc] init]; + task.launchPath = installerPath; + task.arguments = @[@"-pkg", packageURL.path, @"-target", @"/"]; + task.standardError = [NSPipe pipe]; + task.standardOutput = [NSPipe pipe]; + + BOOL success = YES; + @try { + [task launch]; + [task waitUntilExit]; + if (task.terminationStatus != EXIT_SUCCESS) { + success = NO; + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }]; + } + } + } @catch (NSException *) { + success = NO; + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }]; } - return NO; - } - - NSError *executeError = nil; - BOOL success = [self _authorizeAndExecuteCommand:SUFileOpInstallCommand sourcePath:path destinationPath:NULL error:&executeError]; - - if (!success && error != NULL) { - NSString* errorMessage = @"Failed to execute package installer."; - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError}]; } return success; } diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index f6644b17..4ef0bf17 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -43,7 +43,7 @@ return YES; } -- (BOOL)performSecondStageAllowingAuthorization:(BOOL)allowsAuthorization fileOperationToolPath:(NSString *)fileOperationToolPath environment:(SUAuthorizationEnvironment * _Nullable)authorizationEnvironment allowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error +- (BOOL)performSecondStageAllowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error { if (!allowsUI && ![self canInstallSilently]) { if (error != NULL) { @@ -53,9 +53,9 @@ } // If we're root, we can allow using the authorization APIs - self.fileManager = (allowsAuthorization || [self isRootUser]) ? [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath environment:authorizationEnvironment] : [SUFileManager defaultManager]; + self.fileManager = [SUFileManager defaultManager]; - return [self.fileManager grantAuthorizationPrivilegesWithError:error]; + return YES; } - (BOOL)performThirdStage:(NSError * __autoreleasing *)error @@ -78,11 +78,6 @@ return [self isRootUser]; } -- (BOOL)mayNeedToRequestAuthorization -{ - return YES; -} - - (void)cleanup { } diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 323179b8..c3c92027 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -122,7 +122,8 @@ NSString *serviceName = SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier); - [self.installerConnection setServiceName:serviceName]; +#warning use self.updateItem later for passing guided option + [self.installerConnection setServiceName:serviceName hostPath:self.host.bundlePath guided:NO]; [self sendInstallationData]; } @@ -164,18 +165,7 @@ decryptionPassword = [self.updaterDelegate decryptionPasswordForUpdater:self.updater]; } - NSString *localProgressToolPath = [self.sparkleBundle pathForResource:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME ofType:@"app"]; - if (localProgressToolPath == nil) { - SULog(@"Error: Failed to find installer progress tool: %@", localProgressToolPath); - } - - NSError *progressToolError = nil; - NSString *progressToolPath = [self copyPathToCacheDirectory:localProgressToolPath error:&progressToolError]; - if (progressToolPath == nil) { - SULog(@"Error: Failed to copy or find installer progress tool: %@", progressToolError); - } - - SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch progressToolPath:progressToolPath hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; + SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; NSData *archivedData = SUArchiveRootObjectSecurely(installationData); if (archivedData == nil) { @@ -392,12 +382,11 @@ return; } - NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier; - if (hostBundleIdentifier == nil) { - NSError *error = - [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while finding the application's bundle identifier. Please try again later.", nil) }]; - - completionHandler(error); + // Copy the progress tool as well + NSError *progressToolError = nil; + NSString *progressToolPath = [self copyPathToCacheDirectory:[self.sparkleBundle pathForResource:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME ofType:@"app"] error:&progressToolError]; + if (progressToolPath == nil) { + completionHandler(progressToolError); return; } @@ -412,6 +401,7 @@ launcherConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerLauncherProtocol)]; [launcherConnection resume]; +#warning revisit weak connection __weak NSXPCConnection *weakConnection = launcherConnection; launcherConnection.interruptionHandler = ^{ dispatch_async(dispatch_get_main_queue(), ^{ @@ -440,15 +430,22 @@ shouldAllowInstallerInteraction = [self.updaterDelegate updaterShouldAllowInstallerInteraction:self.updater]; } - [installerLauncher launchInstallerAtPath:relaunchToolPath withHostBundleIdentifier:hostBundleIdentifier allowingInteraction:shouldAllowInstallerInteraction completion:^(BOOL success) { + NSString *hostBundlePath = self.host.bundle.bundlePath; + assert(hostBundlePath != nil); + +#warning pass actual guided flag eventually + [installerLauncher launchInstallerAtPath:relaunchToolPath progressToolPath:progressToolPath withHostBundlePath:hostBundlePath guidedInstallation:NO allowingInteraction:shouldAllowInstallerInteraction completion:^(SUAuthorizationReply result) { dispatch_async(dispatch_get_main_queue(), ^{ retrievedLaunchStatus = YES; [launcherConnection invalidate]; - if (!success) { + if (result == SUAuthorizationReplyFailure) { NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while launching the installer. Please try again later.", nil) }]; + completionHandler(error); + } else if (result == SUAuthorizationReplyCancelled) { + NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:nil]; completionHandler(error); } else { [self setUpConnection]; diff --git a/Sparkle/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index 4177113d..147c7ff9 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/SUPackageInstaller.m @@ -47,7 +47,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; return YES; } -- (BOOL)performSecondStageAllowingAuthorization:(BOOL)__unused allowsAuthorization fileOperationToolPath:(NSString *)__unused fileOperationToolPath environment:(SUAuthorizationEnvironment * _Nullable)__unused authorizationEnvironment allowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error +- (BOOL)performSecondStageAllowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error { if (!allowsUI) { if (error != NULL) { @@ -91,11 +91,6 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; return NO; } -- (BOOL)mayNeedToRequestAuthorization -{ - return NO; -} - - (void)cleanup { } diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index cdca4669..0b53fd35 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -227,22 +227,11 @@ return YES; } -- (BOOL)performSecondStageAllowingAuthorization:(BOOL)allowsAuthorization fileOperationToolPath:(NSString *)fileOperationToolPath environment:(SUAuthorizationEnvironment * _Nullable)authorizationEnvironment allowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error +- (BOOL)performSecondStageAllowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error { - self.fileManager = (allowsAuthorization && allowsUI) ? [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath environment:authorizationEnvironment] : [SUFileManager defaultManager]; + self.fileManager = [SUFileManager defaultManager]; - // Bring up authorization prompt right away if we need it - BOOL canInstallSilently = [self canInstallSilently]; - if (allowsAuthorization && !canInstallSilently) { - return [self.fileManager grantAuthorizationPrivilegesWithError:error]; - } else { - if (!canInstallSilently) { - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot install the update silently" }]; - } - } - return canInstallSilently; - } + return YES; } - (BOOL)performThirdStage:(NSError * __autoreleasing *)error @@ -259,21 +248,12 @@ - (BOOL)canInstallSilently { - return ![self mayNeedToRequestAuthorization]; -} - -- (BOOL)mayNeedToRequestAuthorization -{ - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSString *bundlePath = self.host.bundle.bundlePath; - // It's very well possible to have the bundle be writable but not be able to write into the parent directory - // And if the bundle isn't writable, but we can write into the parent directory, we will still need to authorize to replace it - return ![fileManager isWritableFileAtPath:bundlePath] || ![fileManager isWritableFileAtPath:[bundlePath stringByDeletingLastPathComponent]]; + return YES; } - (void)cleanup { - SUFileManager *fileManager = [self.fileManager fileManagerByPreservingAuthorizationRights];; + SUFileManager *fileManager = self.fileManager; NSURL *oldTempURL = self.oldTempURL; NSURL *tempOldDirectoryURL = self.tempOldDirectoryURL; NSURL *tempNewDirectoryURL = self.tempNewDirectoryURL; diff --git a/Sparkle/SUSystemAuthorization.h b/Sparkle/SUSystemAuthorization.h index a9f1a57e..13fc0547 100644 --- a/Sparkle/SUSystemAuthorization.h +++ b/Sparkle/SUSystemAuthorization.h @@ -11,9 +11,6 @@ NS_ASSUME_NONNULL_BEGIN -// Must free authorization ref later -AuthorizationRef SUCreateAuthorization(BOOL * _Nullable grantedSystemPrivilege); - -BOOL SUGrantsSystemAuthorizationAccess(void); +BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nullable preflighted); NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUSystemAuthorization.m b/Sparkle/SUSystemAuthorization.m index 2f53ca24..924bb379 100644 --- a/Sparkle/SUSystemAuthorization.m +++ b/Sparkle/SUSystemAuthorization.m @@ -9,44 +9,49 @@ #import "SUSystemAuthorization.h" #import -AuthorizationRef SUCreateAuthorization(BOOL * _Nullable grantedSystemPrivilege) +static BOOL SUPreflightSystemAuthorization(void) { // This should almost always succeed, fail in unusual/rare cases AuthorizationRef auth = NULL; OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); if (createStatus != errAuthorizationSuccess) { - auth = NULL; - if (grantedSystemPrivilege != NULL) { - *grantedSystemPrivilege = NO; - } - } else { - AuthorizationItem rightItems[] = { - { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} - }; - - AuthorizationRights rights = { - .count = sizeof(rightItems) / sizeof(*rightItems), - .items = rightItems, - }; - - AuthorizationFlags flags = - (AuthorizationFlags)(kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize); - - // This will test if we can gain authorization for running utlities as root - OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); - if (grantedSystemPrivilege != NULL) { - *grantedSystemPrivilege = (copyStatus == errAuthorizationSuccess); - } + return NO; } - return auth; -} - -BOOL SUGrantsSystemAuthorizationAccess(void) -{ - BOOL grantedSystemPrivilege = NO; - AuthorizationRef auth = SUCreateAuthorization(&grantedSystemPrivilege); + AuthorizationItem rightItems[] = { + { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} + }; + + AuthorizationRights rights = { + .count = sizeof(rightItems) / sizeof(*rightItems), + .items = rightItems, + }; + + AuthorizationFlags flags = + (AuthorizationFlags)(kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize); + + // This will test if we can gain authorization for running utlities as root + OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); + AuthorizationFree(auth, kAuthorizationFlagDefaults); - return grantedSystemPrivilege; + return (copyStatus == errAuthorizationSuccess); +} + +BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nullable preflighted) +{ + BOOL result; + if (SUPreflightSystemAuthorization()) { + if (preflighted != NULL) { + *preflighted = YES; + } + result = YES; + } else if (guided) { + result = YES; + } else { +#pragma what about symbolic links? + NSFileManager *fileManager = [NSFileManager defaultManager]; + result = ![fileManager isWritableFileAtPath:path] || ![fileManager isWritableFileAtPath:[path stringByDeletingLastPathComponent]]; + } + return result; } diff --git a/Sparkle/SUURLDownload.m b/Sparkle/SUURLDownload.m index 43596a51..5be3578f 100644 --- a/Sparkle/SUURLDownload.m +++ b/Sparkle/SUURLDownload.m @@ -25,6 +25,7 @@ void SUDownloadURLWithRequest(NSURLRequest * request, void (^completionBlock)(NS connection = [[NSXPCConnection alloc] initWithServiceName:@TEMPORARY_DOWNLOADER_BUNDLE_ID]; connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUTemporaryDownloaderProtocol)]; +#warning revisit connection weak reference __weak NSXPCConnection *weakConnection = connection; connection.interruptionHandler = ^{ dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Tests/SUFileManagerTest.swift b/Tests/SUFileManagerTest.swift index 3d9dbe7a..26fcf4d7 100644 --- a/Tests/SUFileManagerTest.swift +++ b/Tests/SUFileManagerTest.swift @@ -355,10 +355,4 @@ class SUFileManagerTest: XCTestCase XCTAssertNil(try? fileManager.makeDirectoryAtURL(validSymlinkURL)) } } - - func testAcquireBadAuthorization() - { - let fileManager = SUFileManager.defaultManager() - XCTAssertNil(try? fileManager._acquireAuthorization()) - } } diff --git a/Tests/SUInstallerTest.m b/Tests/SUInstallerTest.m index 8eee10c2..1c32e810 100644 --- a/Tests/SUInstallerTest.m +++ b/Tests/SUInstallerTest.m @@ -67,11 +67,8 @@ return; } - NSString *fileOperationToolPath = [bundle pathForResource:@""SPARKLE_FILEOP_TOOL_NAME ofType:@""]; - XCTAssertNotNil(fileOperationToolPath); - NSError *secondStageError = nil; - if (![installer performSecondStageAllowingAuthorization:YES fileOperationToolPath:fileOperationToolPath environment:nil allowingUI:YES error:&secondStageError]) { + if (![installer performSecondStageAllowingUI:YES error:&secondStageError]) { NSLog(@"Underlying error: %@", [secondStageError.userInfo objectForKey:NSUnderlyingErrorKey]); XCTFail(@"Second Stage failed with error: %@", secondStageError); return; diff --git a/fileop/SUFileOperationConstants.h b/fileop/SUFileOperationConstants.h deleted file mode 100644 index 9f4ba685..00000000 --- a/fileop/SUFileOperationConstants.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SUFileOperationConstants.h -// Sparkle -// -// Created by Mayur Pawashe on 6/5/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -extern char * const SUFileOpRemoveQuarantineCommand; -extern char * const SUFileOpCopyCommand; -extern char * const SUFileOpMoveCommand; -extern char * const SUFileOpChangeOwnerAndGroupCommand; -extern char * const SUFileOpUpdateModificationAndAccessTimeCommand; -extern char * const SUFileOpMakeDirectoryCommand; -extern char * const SUFileOpRemoveCommand; -extern char * const SUFileOpInstallCommand; diff --git a/fileop/SUFileOperationConstants.m b/fileop/SUFileOperationConstants.m deleted file mode 100644 index 5ece5917..00000000 --- a/fileop/SUFileOperationConstants.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// SUFileOperationConstants.m -// Sparkle -// -// Created by Mayur Pawashe on 6/5/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SUFileOperationConstants.h" - -char * const SUFileOpRemoveQuarantineCommand = "xattr-d-apple-quarantine"; -char * const SUFileOpCopyCommand = "cp"; -char * const SUFileOpMoveCommand = "mv"; -char * const SUFileOpChangeOwnerAndGroupCommand = "chown"; -char * const SUFileOpUpdateModificationAndAccessTimeCommand = "touch"; -char * const SUFileOpMakeDirectoryCommand = "mkdir"; -char * const SUFileOpRemoveCommand = "rm"; -char * const SUFileOpInstallCommand = "installer"; diff --git a/fileop/fileop.m b/fileop/fileop.m deleted file mode 100644 index 044f2abc..00000000 --- a/fileop/fileop.m +++ /dev/null @@ -1,151 +0,0 @@ -// -// fileop.m -// fileop -// -// Created by Mayur Pawashe on 6/5/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SUFileManager.h" -#import "SUFileOperationConstants.h" - -// If we fail, we exit with a unique status code -// We don't try to NSLog because the logs can't be seen anywhere, -// and we don't want to log to a file irresponsibly (especially as root), -// nor want to communicate to the parent forcing the parent to read from the stdout pipe -// (allowing us to avoid any sort of potential blocking issues?) -typedef NS_ENUM(uint8_t, SUFileOpError) -{ - SUWritePIDFailure = 0x02, - SUFlushFailure = 0x03, - SUInsufficientNumberOfArguments = 0x04, - SUCommandNameUTF8ParseFailure = 0x05, - SUPathUTF8ParseFailure = 0x06, - SUQuarantineRemovalFailure = 0x07, - SUCopyFailure = 0x08, - SUMoveFailure = 0x09, - SUChangeOwnerAndGroupFailure = 0x0A, - SUTouchFailure = 0x0B, - SUMakeDirectoryFailure = 0x0C, - SURemoveFailure = 0x0D, - SUPackageFailureStatusCode = 0x0E, - SUPackageRaisedExceptionFailure = 0x0F, - SUInvalidCommandFailure = 0x10, - // This code can be OR'd with another one to produce a unique combination - SUInvalidOrNoDestination = 0x80 -}; - -int main(int argc, const char *argv[]) -{ - @autoreleasepool { - // Before we do anything, we should let the parent know our pid so they can wait() on us - // We do this because AuthorizationExecuteWithPrivileges() has no way of reporting back the child pid, - // but it does give us a communication pipe - uint32_t pid = CFSwapInt32HostToLittle((uint32_t)getpid()); - if (fwrite(&pid, sizeof(pid), 1, stdout) < 1) { - exit(SUWritePIDFailure); - } - - if (fflush(stdout) != 0) { - exit(SUFlushFailure); - } - - // At least we need the command name and file path arguments - if (argc < 3) { - exit(SUInsufficientNumberOfArguments); - } - - NSString *command = [[NSString alloc] initWithUTF8String:argv[1]]; - if (command == nil) { - exit(SUCommandNameUTF8ParseFailure); - } - - NSString *filepath = [[NSString alloc] initWithUTF8String:argv[2]]; - if (filepath == nil) { - exit(SUPathUTF8ParseFailure); - } - - NSURL *fileURL = [NSURL fileURLWithPath:filepath]; - if (fileURL == nil) { - exit(SUPathUTF8ParseFailure); - } - - NSURL *destinationURL = nil; - if (argc >= 4) { - NSString *destinationPath = [[NSString alloc] initWithUTF8String:argv[3]]; - if (destinationPath != nil) { - destinationURL = [NSURL fileURLWithPath:destinationPath]; - } - } - - // This tool should be executed as root, so we should not try to authorize - SUFileManager *fileManager = [SUFileManager defaultManager]; - - if ([command isEqualToString:@(SUFileOpRemoveQuarantineCommand)]) { - if (![fileManager releaseItemFromQuarantineAtRootURL:fileURL error:NULL]) { - exit(SUQuarantineRemovalFailure); - } - } else if ([command isEqualToString:@(SUFileOpCopyCommand)]) { - if (destinationURL != nil) { - if (![fileManager copyItemAtURL:fileURL toURL:destinationURL error:NULL]) { - exit(SUCopyFailure); - } - } else { - exit(SUInvalidOrNoDestination | SUCopyFailure); - } - } else if ([command isEqualToString:@(SUFileOpMoveCommand)]) { - if (destinationURL != nil) { - if (![fileManager moveItemAtURL:fileURL toURL:destinationURL error:NULL]) { - exit(SUMoveFailure); - } - } else { - exit(SUInvalidOrNoDestination | SUMoveFailure); - } - } else if ([command isEqualToString:@(SUFileOpChangeOwnerAndGroupCommand)]) { - if (destinationURL != nil) { - if (![fileManager changeOwnerAndGroupOfItemAtRootURL:fileURL toMatchURL:destinationURL error:NULL]) { - exit(SUChangeOwnerAndGroupFailure); - } - } else { - exit(SUInvalidOrNoDestination | SUChangeOwnerAndGroupFailure); - } - } else if ([command isEqualToString:@(SUFileOpUpdateModificationAndAccessTimeCommand)]) { - if (![fileManager updateModificationAndAccessTimeOfItemAtURL:fileURL error:NULL]) { - exit(SUTouchFailure); - } - } else if ([command isEqualToString:@(SUFileOpMakeDirectoryCommand)]) { - if (![fileManager makeDirectoryAtURL:fileURL error:NULL]) { - exit(SUMakeDirectoryFailure); - } - } else if ([command isEqualToString:@(SUFileOpRemoveCommand)]) { - if (![fileManager removeItemAtURL:fileURL error:NULL]) { - exit(SURemoveFailure); - } - } else if ([command isEqualToString:@(SUFileOpInstallCommand)]) { - // The one command that can *only* be run as the root user - NSString *installerPath = @"/usr/sbin/installer"; - - NSTask *task = [[NSTask alloc] init]; - task.launchPath = installerPath; - task.arguments = @[@"-pkg", filepath, @"-target", @"/"]; - // Output won't show up anyway, so we may as well ignore it - task.standardError = [NSPipe pipe]; - task.standardOutput = [NSPipe pipe]; - - @try { - [task launch]; - [task waitUntilExit]; - if (task.terminationStatus != EXIT_SUCCESS) { - exit(SUPackageFailureStatusCode); - } - } @catch (NSException *) { - exit(SUPackageRaisedExceptionFailure); - } - } else { - exit(SUInvalidCommandFailure); - } - - return EXIT_SUCCESS; - } -} From dd02cb2509a4893f0de46740b3c8d865aef805ce Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 18 Jul 2016 18:46:12 -0400 Subject: [PATCH 02/29] Change Autoupdate target from app to command line tool --- .../AgentConnection.h | 0 .../AgentConnection.m | 0 .../Autoupdate => Autoupdate}/AppInstaller.h | 0 .../Autoupdate => Autoupdate}/AppInstaller.m | 0 {Sparkle => Autoupdate}/SUBinaryDeltaApply.h | 0 {Sparkle => Autoupdate}/SUBinaryDeltaApply.m | 0 {Sparkle => Autoupdate}/SUBinaryDeltaCommon.h | 0 {Sparkle => Autoupdate}/SUBinaryDeltaCommon.m | 0 {Sparkle => Autoupdate}/SUBinaryDeltaCreate.h | 0 {Sparkle => Autoupdate}/SUBinaryDeltaCreate.m | 0 {Sparkle => Autoupdate}/SUBinaryDeltaTool.m | 0 .../SUBinaryDeltaUnarchiver.h | 0 .../SUBinaryDeltaUnarchiver.m | 0 .../SUCodeSigningVerifier.h | 0 .../SUCodeSigningVerifier.m | 0 {Sparkle => Autoupdate}/SUDSAVerifier.h | 0 {Sparkle => Autoupdate}/SUDSAVerifier.m | 0 .../SUDiskImageUnarchiver.h | 0 .../SUDiskImageUnarchiver.m | 0 .../SUGuidedPackageInstaller.h | 0 .../SUGuidedPackageInstaller.m | 1 + .../SUInstallationInfo.h | 0 .../SUInstallationInfo.m | 0 .../SUInstallationInputData.h | 0 .../SUInstallationInputData.m | 0 {Sparkle => Autoupdate}/SUInstaller.h | 0 {Sparkle => Autoupdate}/SUInstaller.m | 0 .../SUInstallerProtocol.h | 0 .../SUMessageTypes.h | 0 .../SUMessageTypes.m | 0 {Sparkle => Autoupdate}/SUPackageInstaller.h | 0 {Sparkle => Autoupdate}/SUPackageInstaller.m | 0 {Sparkle => Autoupdate}/SUPipedUnarchiver.h | 0 {Sparkle => Autoupdate}/SUPipedUnarchiver.m | 0 {Sparkle => Autoupdate}/SUPlainInstaller.h | 0 {Sparkle => Autoupdate}/SUPlainInstaller.m | 0 .../SUStatusInfoProtocol.h | 0 {Sparkle => Autoupdate}/SUUnarchiver.h | 0 {Sparkle => Autoupdate}/SUUnarchiver.m | 0 .../SUUnarchiverProtocol.h | 0 .../Autoupdate => Autoupdate}/StatusInfo.h | 0 .../Autoupdate => Autoupdate}/StatusInfo.m | 0 .../TerminationListener.h | 0 .../TerminationListener.m | 0 .../Autoupdate.m => Autoupdate/main.m | 0 Configurations/ConfigRelaunch.xcconfig | 1 - InstallerLauncher/SUSubmitInstaller.m | 13 +- Sparkle.xcodeproj/project.pbxproj | 679 +++++++++--------- Sparkle/Autoupdate/Autoupdate-Info.plist | 32 - Sparkle/SUInstallerDriver.m | 2 +- Sparkle/SUSystemAuthorization.m | 2 +- 51 files changed, 330 insertions(+), 400 deletions(-) rename {Sparkle/Autoupdate => Autoupdate}/AgentConnection.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/AgentConnection.m (100%) rename {Sparkle/Autoupdate => Autoupdate}/AppInstaller.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/AppInstaller.m (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaApply.h (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaApply.m (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaCommon.h (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaCommon.m (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaCreate.h (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaCreate.m (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaTool.m (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaUnarchiver.h (100%) rename {Sparkle => Autoupdate}/SUBinaryDeltaUnarchiver.m (100%) rename {Sparkle => Autoupdate}/SUCodeSigningVerifier.h (100%) rename {Sparkle => Autoupdate}/SUCodeSigningVerifier.m (100%) rename {Sparkle => Autoupdate}/SUDSAVerifier.h (100%) rename {Sparkle => Autoupdate}/SUDSAVerifier.m (100%) rename {Sparkle => Autoupdate}/SUDiskImageUnarchiver.h (100%) rename {Sparkle => Autoupdate}/SUDiskImageUnarchiver.m (100%) rename {Sparkle => Autoupdate}/SUGuidedPackageInstaller.h (100%) rename {Sparkle => Autoupdate}/SUGuidedPackageInstaller.m (96%) rename {Sparkle/Autoupdate => Autoupdate}/SUInstallationInfo.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUInstallationInfo.m (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUInstallationInputData.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUInstallationInputData.m (100%) rename {Sparkle => Autoupdate}/SUInstaller.h (100%) rename {Sparkle => Autoupdate}/SUInstaller.m (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUInstallerProtocol.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUMessageTypes.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUMessageTypes.m (100%) rename {Sparkle => Autoupdate}/SUPackageInstaller.h (100%) rename {Sparkle => Autoupdate}/SUPackageInstaller.m (100%) rename {Sparkle => Autoupdate}/SUPipedUnarchiver.h (100%) rename {Sparkle => Autoupdate}/SUPipedUnarchiver.m (100%) rename {Sparkle => Autoupdate}/SUPlainInstaller.h (100%) rename {Sparkle => Autoupdate}/SUPlainInstaller.m (100%) rename {Sparkle/Autoupdate => Autoupdate}/SUStatusInfoProtocol.h (100%) rename {Sparkle => Autoupdate}/SUUnarchiver.h (100%) rename {Sparkle => Autoupdate}/SUUnarchiver.m (100%) rename {Sparkle => Autoupdate}/SUUnarchiverProtocol.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/StatusInfo.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/StatusInfo.m (100%) rename {Sparkle/Autoupdate => Autoupdate}/TerminationListener.h (100%) rename {Sparkle/Autoupdate => Autoupdate}/TerminationListener.m (100%) rename Sparkle/Autoupdate/Autoupdate.m => Autoupdate/main.m (100%) delete mode 100644 Sparkle/Autoupdate/Autoupdate-Info.plist diff --git a/Sparkle/Autoupdate/AgentConnection.h b/Autoupdate/AgentConnection.h similarity index 100% rename from Sparkle/Autoupdate/AgentConnection.h rename to Autoupdate/AgentConnection.h diff --git a/Sparkle/Autoupdate/AgentConnection.m b/Autoupdate/AgentConnection.m similarity index 100% rename from Sparkle/Autoupdate/AgentConnection.m rename to Autoupdate/AgentConnection.m diff --git a/Sparkle/Autoupdate/AppInstaller.h b/Autoupdate/AppInstaller.h similarity index 100% rename from Sparkle/Autoupdate/AppInstaller.h rename to Autoupdate/AppInstaller.h diff --git a/Sparkle/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m similarity index 100% rename from Sparkle/Autoupdate/AppInstaller.m rename to Autoupdate/AppInstaller.m diff --git a/Sparkle/SUBinaryDeltaApply.h b/Autoupdate/SUBinaryDeltaApply.h similarity index 100% rename from Sparkle/SUBinaryDeltaApply.h rename to Autoupdate/SUBinaryDeltaApply.h diff --git a/Sparkle/SUBinaryDeltaApply.m b/Autoupdate/SUBinaryDeltaApply.m similarity index 100% rename from Sparkle/SUBinaryDeltaApply.m rename to Autoupdate/SUBinaryDeltaApply.m diff --git a/Sparkle/SUBinaryDeltaCommon.h b/Autoupdate/SUBinaryDeltaCommon.h similarity index 100% rename from Sparkle/SUBinaryDeltaCommon.h rename to Autoupdate/SUBinaryDeltaCommon.h diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Autoupdate/SUBinaryDeltaCommon.m similarity index 100% rename from Sparkle/SUBinaryDeltaCommon.m rename to Autoupdate/SUBinaryDeltaCommon.m diff --git a/Sparkle/SUBinaryDeltaCreate.h b/Autoupdate/SUBinaryDeltaCreate.h similarity index 100% rename from Sparkle/SUBinaryDeltaCreate.h rename to Autoupdate/SUBinaryDeltaCreate.h diff --git a/Sparkle/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m similarity index 100% rename from Sparkle/SUBinaryDeltaCreate.m rename to Autoupdate/SUBinaryDeltaCreate.m diff --git a/Sparkle/SUBinaryDeltaTool.m b/Autoupdate/SUBinaryDeltaTool.m similarity index 100% rename from Sparkle/SUBinaryDeltaTool.m rename to Autoupdate/SUBinaryDeltaTool.m diff --git a/Sparkle/SUBinaryDeltaUnarchiver.h b/Autoupdate/SUBinaryDeltaUnarchiver.h similarity index 100% rename from Sparkle/SUBinaryDeltaUnarchiver.h rename to Autoupdate/SUBinaryDeltaUnarchiver.h diff --git a/Sparkle/SUBinaryDeltaUnarchiver.m b/Autoupdate/SUBinaryDeltaUnarchiver.m similarity index 100% rename from Sparkle/SUBinaryDeltaUnarchiver.m rename to Autoupdate/SUBinaryDeltaUnarchiver.m diff --git a/Sparkle/SUCodeSigningVerifier.h b/Autoupdate/SUCodeSigningVerifier.h similarity index 100% rename from Sparkle/SUCodeSigningVerifier.h rename to Autoupdate/SUCodeSigningVerifier.h diff --git a/Sparkle/SUCodeSigningVerifier.m b/Autoupdate/SUCodeSigningVerifier.m similarity index 100% rename from Sparkle/SUCodeSigningVerifier.m rename to Autoupdate/SUCodeSigningVerifier.m diff --git a/Sparkle/SUDSAVerifier.h b/Autoupdate/SUDSAVerifier.h similarity index 100% rename from Sparkle/SUDSAVerifier.h rename to Autoupdate/SUDSAVerifier.h diff --git a/Sparkle/SUDSAVerifier.m b/Autoupdate/SUDSAVerifier.m similarity index 100% rename from Sparkle/SUDSAVerifier.m rename to Autoupdate/SUDSAVerifier.m diff --git a/Sparkle/SUDiskImageUnarchiver.h b/Autoupdate/SUDiskImageUnarchiver.h similarity index 100% rename from Sparkle/SUDiskImageUnarchiver.h rename to Autoupdate/SUDiskImageUnarchiver.h diff --git a/Sparkle/SUDiskImageUnarchiver.m b/Autoupdate/SUDiskImageUnarchiver.m similarity index 100% rename from Sparkle/SUDiskImageUnarchiver.m rename to Autoupdate/SUDiskImageUnarchiver.m diff --git a/Sparkle/SUGuidedPackageInstaller.h b/Autoupdate/SUGuidedPackageInstaller.h similarity index 100% rename from Sparkle/SUGuidedPackageInstaller.h rename to Autoupdate/SUGuidedPackageInstaller.h diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Autoupdate/SUGuidedPackageInstaller.m similarity index 96% rename from Sparkle/SUGuidedPackageInstaller.m rename to Autoupdate/SUGuidedPackageInstaller.m index 4ef0bf17..b7caa211 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Autoupdate/SUGuidedPackageInstaller.m @@ -60,6 +60,7 @@ - (BOOL)performThirdStage:(NSError * __autoreleasing *)error { +#warning this probably shouldn't be part of file manager anymore return [self.fileManager executePackageAtURL:[NSURL fileURLWithPath:self.packagePath] error:error]; } diff --git a/Sparkle/Autoupdate/SUInstallationInfo.h b/Autoupdate/SUInstallationInfo.h similarity index 100% rename from Sparkle/Autoupdate/SUInstallationInfo.h rename to Autoupdate/SUInstallationInfo.h diff --git a/Sparkle/Autoupdate/SUInstallationInfo.m b/Autoupdate/SUInstallationInfo.m similarity index 100% rename from Sparkle/Autoupdate/SUInstallationInfo.m rename to Autoupdate/SUInstallationInfo.m diff --git a/Sparkle/Autoupdate/SUInstallationInputData.h b/Autoupdate/SUInstallationInputData.h similarity index 100% rename from Sparkle/Autoupdate/SUInstallationInputData.h rename to Autoupdate/SUInstallationInputData.h diff --git a/Sparkle/Autoupdate/SUInstallationInputData.m b/Autoupdate/SUInstallationInputData.m similarity index 100% rename from Sparkle/Autoupdate/SUInstallationInputData.m rename to Autoupdate/SUInstallationInputData.m diff --git a/Sparkle/SUInstaller.h b/Autoupdate/SUInstaller.h similarity index 100% rename from Sparkle/SUInstaller.h rename to Autoupdate/SUInstaller.h diff --git a/Sparkle/SUInstaller.m b/Autoupdate/SUInstaller.m similarity index 100% rename from Sparkle/SUInstaller.m rename to Autoupdate/SUInstaller.m diff --git a/Sparkle/Autoupdate/SUInstallerProtocol.h b/Autoupdate/SUInstallerProtocol.h similarity index 100% rename from Sparkle/Autoupdate/SUInstallerProtocol.h rename to Autoupdate/SUInstallerProtocol.h diff --git a/Sparkle/Autoupdate/SUMessageTypes.h b/Autoupdate/SUMessageTypes.h similarity index 100% rename from Sparkle/Autoupdate/SUMessageTypes.h rename to Autoupdate/SUMessageTypes.h diff --git a/Sparkle/Autoupdate/SUMessageTypes.m b/Autoupdate/SUMessageTypes.m similarity index 100% rename from Sparkle/Autoupdate/SUMessageTypes.m rename to Autoupdate/SUMessageTypes.m diff --git a/Sparkle/SUPackageInstaller.h b/Autoupdate/SUPackageInstaller.h similarity index 100% rename from Sparkle/SUPackageInstaller.h rename to Autoupdate/SUPackageInstaller.h diff --git a/Sparkle/SUPackageInstaller.m b/Autoupdate/SUPackageInstaller.m similarity index 100% rename from Sparkle/SUPackageInstaller.m rename to Autoupdate/SUPackageInstaller.m diff --git a/Sparkle/SUPipedUnarchiver.h b/Autoupdate/SUPipedUnarchiver.h similarity index 100% rename from Sparkle/SUPipedUnarchiver.h rename to Autoupdate/SUPipedUnarchiver.h diff --git a/Sparkle/SUPipedUnarchiver.m b/Autoupdate/SUPipedUnarchiver.m similarity index 100% rename from Sparkle/SUPipedUnarchiver.m rename to Autoupdate/SUPipedUnarchiver.m diff --git a/Sparkle/SUPlainInstaller.h b/Autoupdate/SUPlainInstaller.h similarity index 100% rename from Sparkle/SUPlainInstaller.h rename to Autoupdate/SUPlainInstaller.h diff --git a/Sparkle/SUPlainInstaller.m b/Autoupdate/SUPlainInstaller.m similarity index 100% rename from Sparkle/SUPlainInstaller.m rename to Autoupdate/SUPlainInstaller.m diff --git a/Sparkle/Autoupdate/SUStatusInfoProtocol.h b/Autoupdate/SUStatusInfoProtocol.h similarity index 100% rename from Sparkle/Autoupdate/SUStatusInfoProtocol.h rename to Autoupdate/SUStatusInfoProtocol.h diff --git a/Sparkle/SUUnarchiver.h b/Autoupdate/SUUnarchiver.h similarity index 100% rename from Sparkle/SUUnarchiver.h rename to Autoupdate/SUUnarchiver.h diff --git a/Sparkle/SUUnarchiver.m b/Autoupdate/SUUnarchiver.m similarity index 100% rename from Sparkle/SUUnarchiver.m rename to Autoupdate/SUUnarchiver.m diff --git a/Sparkle/SUUnarchiverProtocol.h b/Autoupdate/SUUnarchiverProtocol.h similarity index 100% rename from Sparkle/SUUnarchiverProtocol.h rename to Autoupdate/SUUnarchiverProtocol.h diff --git a/Sparkle/Autoupdate/StatusInfo.h b/Autoupdate/StatusInfo.h similarity index 100% rename from Sparkle/Autoupdate/StatusInfo.h rename to Autoupdate/StatusInfo.h diff --git a/Sparkle/Autoupdate/StatusInfo.m b/Autoupdate/StatusInfo.m similarity index 100% rename from Sparkle/Autoupdate/StatusInfo.m rename to Autoupdate/StatusInfo.m diff --git a/Sparkle/Autoupdate/TerminationListener.h b/Autoupdate/TerminationListener.h similarity index 100% rename from Sparkle/Autoupdate/TerminationListener.h rename to Autoupdate/TerminationListener.h diff --git a/Sparkle/Autoupdate/TerminationListener.m b/Autoupdate/TerminationListener.m similarity index 100% rename from Sparkle/Autoupdate/TerminationListener.m rename to Autoupdate/TerminationListener.m diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Autoupdate/main.m similarity index 100% rename from Sparkle/Autoupdate/Autoupdate.m rename to Autoupdate/main.m diff --git a/Configurations/ConfigRelaunch.xcconfig b/Configurations/ConfigRelaunch.xcconfig index 412771c6..b2de1b6c 100644 --- a/Configurations/ConfigRelaunch.xcconfig +++ b/Configurations/ConfigRelaunch.xcconfig @@ -1,6 +1,5 @@ // Relaunch Tool only -INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME) SKIP_INSTALL = YES CLANG_ENABLE_MODULES = NO diff --git a/InstallerLauncher/SUSubmitInstaller.m b/InstallerLauncher/SUSubmitInstaller.m index 50dff100..8b5fb2f5 100644 --- a/InstallerLauncher/SUSubmitInstaller.m +++ b/InstallerLauncher/SUSubmitInstaller.m @@ -22,23 +22,14 @@ NSError *quarantineError = nil; if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { - // This may or may not be a fatal error depending on if the process is sandboxed or not + // Probably not a fatal error because we are submitting the executable through launchd SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); } - NSString *executablePath = [[NSBundle bundleWithURL:installerURL] executablePath]; - assert(executablePath != nil); - - NSError *ownershipError = nil; - if (![fileManager changeOwnerAndGroupOfItemAtRootURL:[NSURL fileURLWithPath:executablePath] toMatchURL:installerURL error:&ownershipError]) { - // This may or may not be a fatal error - SULog(@"Failed to change ownership on installer executable at %@ with error %@", executablePath, ownershipError); - } - NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; assert(hostBundleIdentifier != nil); - NSArray *arguments = @[executablePath, hostBundleIdentifier, @(allowingInteraction).stringValue]; + NSArray *arguments = @[installerPath, hostBundleIdentifier, @(allowingInteraction).stringValue]; AuthorizationRef auth = NULL; OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 7f08d890..6d92d672 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 14950066195FB8A600BC5B5B /* PBXTargetDependency */, 14950068195FB8A600BC5B5B /* PBXTargetDependency */, 1495006A195FB8A600BC5B5B /* PBXTargetDependency */, - 1495006C195FB8A600BC5B5B /* PBXTargetDependency */, ); name = All; productName = All; @@ -28,10 +27,7 @@ 1420DF50196247F900203BB0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1420DF4F196247F900203BB0 /* Images.xcassets */; }; 142E0E0019A6954400E4312B /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 142E0E0219A6A14700E4312B /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 142E0E0419A6A26F00E4312B /* Autoupdate.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 55C14BB7136EEF1500649790 /* Autoupdate.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */; }; - 14652F7C19A9725300959E44 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */; }; - 14652F7D19A9726700959E44 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */; }; 14652F7E19A9728A00959E44 /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; }; 14652F8019A9740F00959E44 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 14652F8219A9746000959E44 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; @@ -42,27 +38,17 @@ 14732BD319610A1800593899 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14732BD219610A1800593899 /* XCTest.framework */; }; 1495006E195FCE1100BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; 1495006F195FCE1800BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; - 14950070195FCE3A00BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; 14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; 14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; 14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */ = {isa = PBXBuildFile; fileRef = 14958C6B19AEBC530061B14F /* signed-test-file.txt */; }; 14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */ = {isa = PBXBuildFile; fileRef = 14958C6C19AEBC610061B14F /* test-pubkey.pem */; }; 3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 55C14BD4136EEFCE00649790 /* Autoupdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14BD3136EEFCE00649790 /* Autoupdate.m */; }; 55C14BEF136EF21700649790 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; }; 55C14C04136EF26100649790 /* SUUpdateAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BF0136EF26100649790 /* SUUpdateAlert.xib */; }; 55C14C19136EF2C700649790 /* SUUpdatePermissionPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14C05136EF2C700649790 /* SUUpdatePermissionPrompt.xib */; }; - 55C14F00136EF6B700649790 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 55C14F06136EF6DB00649790 /* SULog.h in Headers */ = {isa = PBXBuildFile; fileRef = 55C14F04136EF6DB00649790 /* SULog.h */; }; 55C14F07136EF6DB00649790 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; - 55C14F08136EF6DB00649790 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; - 55C14F0C136EF6EA00649790 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; - 55C14F0D136EF6F200649790 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; }; - 55C14F21136EF84D00649790 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; }; - 55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; }; - 55C14F24136EF86F00649790 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; }; 55C14F32136EFC2400649790 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55C14F31136EFC2400649790 /* SystemConfiguration.framework */; }; - 55C14F9A136F045400649790 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E6F33219EC9F6C00005E76 /* SUErrors.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */; }; 5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */; }; @@ -72,25 +58,17 @@ 5AF6C7541AEA49840014A3AB /* SUInstallerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF6C74C1AEA40760014A3AB /* SUInstallerTest.m */; }; 5AF9DC3C1981DBEE001EA135 /* SUDSAVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */; }; 5D06E8E90FD68CDB005AE3F6 /* bsdiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */; }; - 5D06E8EA0FD68CDB005AE3F6 /* SUBinaryDeltaTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E30FD68CC7005AE3F6 /* SUBinaryDeltaTool.m */; }; 5D06E8FF0FD68D6D005AE3F6 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; }; 5D06E9050FD68D7D005AE3F6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; 5D1AF58B0FD7678C0065DB48 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; }; 5D1AF5900FD767AD0065DB48 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF58F0FD767AD0065DB48 /* libxml2.dylib */; }; 5D1AF59A0FD767E50065DB48 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5990FD767E50065DB48 /* libz.dylib */; }; 5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5F1510A11C96E591006E1629 /* testnamespaces.xml */; }; - 6102FE460E077FCE00F85D09 /* SUPipedUnarchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6102FE440E077FCE00F85D09 /* SUPipedUnarchiver.h */; settings = {ATTRIBUTES = (); }; }; - 6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6102FE480E07803800F85D09 /* SUDiskImageUnarchiver.h */; settings = {ATTRIBUTES = (); }; }; - 61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299A2D09CA2DAB00B7442F /* SUDSAVerifier.h */; settings = {ATTRIBUTES = (); }; }; 61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299A5B09CA6D4500B7442F /* SUConstants.h */; settings = {ATTRIBUTES = (); }; }; 61299A6009CA6EB100B7442F /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 61299A8D09CA790200B7442F /* SUUnarchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299A8B09CA790200B7442F /* SUUnarchiver.h */; }; 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 */; }; - 618FA5010DAE88B40026945C /* SUInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 618FA4FF0DAE88B40026945C /* SUInstaller.h */; settings = {ATTRIBUTES = (); }; }; - 618FA5050DAE8AB80026945C /* SUPlainInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 618FA5030DAE8AB80026945C /* SUPlainInstaller.h */; settings = {ATTRIBUTES = (); }; }; - 618FA5220DAE8E8A0026945C /* SUPackageInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 618FA5200DAE8E8A0026945C /* SUPackageInstaller.h */; settings = {ATTRIBUTES = (); }; }; 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, ); }; }; @@ -99,7 +77,6 @@ 61A2279C0D1CEE7600430CCD /* SUSystemProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A2279A0D1CEE7600430CCD /* SUSystemProfiler.h */; settings = {ATTRIBUTES = (); }; }; 61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A2279B0D1CEE7600430CCD /* SUSystemProfiler.m */; }; 61AAE8280A321A7F00D8810D /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; }; - 61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B078CC15A5FB6100600039 /* SUCodeSigningVerifier.h */; }; 61B5F8ED09C4CE3C00B25A18 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; }; 61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */; }; 61B5F8F709C4CEB300B25A18 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; @@ -133,7 +110,6 @@ 721C245C1CB7576E005440CB /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; }; 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; 721C245E1CB757DE005440CB /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 721C245F1CB75A6B005440CB /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; 721C24611CB75C5D005440CB /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; 721C24621CB75C68005440CB /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 721CF1A71AD7643600D9AC09 /* bsdiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */; settings = {COMPILER_FLAGS = "-w"; }; }; @@ -141,10 +117,8 @@ 721CF1A91AD7644C00D9AC09 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; settings = {COMPILER_FLAGS = "-w"; }; }; 721CF1AA1AD7647000D9AC09 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; }; 721CF1AB1AD764EB00D9AC09 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; }; - 722194551D3C0135004C34FF /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194541D3C0135004C34FF /* AgentConnection.m */; }; 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 7221947A1D3C42EA004C34FF /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */; }; - 7221947B1D3C42F7004C34FF /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7229E1B61C97C91100CB50D0 /* SUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SUUpdateDriver.h */; }; @@ -161,14 +135,12 @@ 724A0A3B1CF7AEEA00D8C3D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A351CF7AEEA00D8C3D5 /* main.m */; }; 724A0A3D1CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A381CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m */; }; 724A0A3E1CF7AF0E00D8C3D5 /* SUTemporaryDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A381CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m */; }; - 724BB3671D30B2C5005D534A /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; 724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */; }; 724BB3731D31D0B7005D534A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3721D31D0B7005D534A /* main.m */; }; 724BB3841D3203BA005D534A /* SparkleInstallerConnection.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 724BB3871D32A167005D534A /* SUXPCInstallerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */; }; 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */; }; 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */; }; - 724BB38D1D33283C005D534A /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB38C1D33283C005D534A /* StatusInfo.m */; }; 724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; 724BB39A1D333832005D534A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3991D333832005D534A /* main.m */; }; 724BB39E1D333832005D534A /* SparkleInstallerStatus.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -193,26 +165,81 @@ 725F97A51C8B304D00265BE4 /* SUInstallUpdateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97A31C8B304D00265BE4 /* SUInstallUpdateViewController.m */; }; 725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 725F97A41C8B304D00265BE4 /* SUInstallUpdateViewController.xib */; }; 725F97A81C8B42D700265BE4 /* SUStandardUserDriverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 725F97A71C8B42D700265BE4 /* SUStandardUserDriverProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; + 7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */; }; + 7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */; }; + 7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; }; + 7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; }; + 7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; }; + 7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; }; + 7267E57C1D3D895B00D1BF90 /* SUBinaryDeltaTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */; }; + 7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; }; + 7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */; }; + 7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; }; + 7267E5881D3D89B300D1BF90 /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5851D3D89B300D1BF90 /* SUUnarchiver.m */; }; + 7267E59C1D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; }; + 7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */; }; + 7267E59F1D3D8A6F00D1BF90 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59E1D3D8A6F00D1BF90 /* main.m */; }; + 7267E5A21D3D8A7E00D1BF90 /* AppInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */; }; + 7267E5A51D3D8A8A00D1BF90 /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */; }; + 7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */; }; + 7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */; }; + 7267E5AE1D3D8AB700D1BF90 /* SUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SUInstallationInputData.m */; }; + 7267E5B11D3D8AD500D1BF90 /* SUMessageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5AF1D3D8AD500D1BF90 /* SUMessageTypes.h */; }; + 7267E5B21D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */; }; + 7267E5B31D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */; }; + 7267E5B61D3D8AEE00D1BF90 /* SUInstallationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5B41D3D8AEE00D1BF90 /* SUInstallationInfo.h */; }; + 7267E5B71D3D8AEE00D1BF90 /* SUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SUInstallationInfo.m */; }; + 7267E5B81D3D8AEE00D1BF90 /* SUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SUInstallationInfo.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 */; }; + 7267E5CB1D3D8C6400D1BF90 /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; }; + 7267E5CC1D3D8C6B00D1BF90 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 7267E5CD1D3D8C7200D1BF90 /* SUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */; }; + 7267E5CE1D3D8C7500D1BF90 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; + 7267E5D11D3D8CD900D1BF90 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; + 7267E5D21D3D8CE800D1BF90 /* bsdiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */; }; + 7267E5D31D3D8CF200D1BF90 /* bscommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B09CE91CEA18900052EF9E /* bscommon.c */; }; + 7267E5D41D3D8CF200D1BF90 /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; }; + 7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; }; + 7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; }; + 7267E5D71D3D8D3F00D1BF90 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; + 7267E5D81D3D8D4400D1BF90 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; }; + 7267E5D91D3D8D4B00D1BF90 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; + 7267E5DC1D3D8F1E00D1BF90 /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */; }; + 7267E5DF1D3D8FFA00D1BF90 /* SUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SUInstallationInputData.m */; }; + 7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */; }; + 7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5E31D3D90AA00D1BF90 /* SUFileManager.h */; }; + 7267E5E61D3D90AA00D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5E71D3D90AA00D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5E81D3D90AA00D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5E91D3D90AA00D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5EA1D3D90AA00D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5EB1D3D90C200D1BF90 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; }; + 7267E5EC1D3D912900D1BF90 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BD1D3D8B2700D1BF90 /* SUInstaller.m */; }; + 7267E5ED1D3D912E00D1BF90 /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5851D3D89B300D1BF90 /* SUUnarchiver.m */; }; + 7267E5EE1D3D915900D1BF90 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */; }; + 7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; }; + 7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; }; + 7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; }; + 7267E5F21D3D918000D1BF90 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */; }; + 7267E5F31D3D918500D1BF90 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.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 */; }; + 7267E5F91D3D92DA00D1BF90 /* Autoupdate in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72B398D21D3D879300EE297F /* Autoupdate */; }; 726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; }; 726E075C1CA3A6D6001A286B /* SUSecureCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */; }; 726E075D1CA3A6D6001A286B /* SUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */; }; - 726E07601CA4E9A5001A286B /* SUInstallationInputData.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */; }; - 726E07611CA4E9A5001A286B /* SUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075F1CA4E9A5001A286B /* SUInstallationInputData.m */; }; - 726E07621CA4E9A5001A286B /* SUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075F1CA4E9A5001A286B /* SUInstallationInputData.m */; }; - 726E07631CA4F35F001A286B /* SUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */; }; - 726E07641CA615ED001A286B /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */; }; - 726E07651CA61603001A286B /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */; }; - 726E07661CA61621001A286B /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; }; - 726E07671CA61648001A286B /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */; }; - 726E07691CA616A4001A286B /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; }; - 726E076B1CA616B3001A286B /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; }; - 726E076D1CA66180001A286B /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */; }; 726E078D1CA891E9001A286B /* SUUpdaterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E078B1CA891E9001A286B /* SUUpdaterSettings.h */; settings = {ATTRIBUTES = (Public, ); }; }; 726E078E1CA891E9001A286B /* SUUpdaterSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E078C1CA891E9001A286B /* SUUpdaterSettings.m */; }; 726E07B21CAF08D6001A286B /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; }; 726E07B41CAF08D6001A286B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B31CAF08D6001A286B /* main.m */; }; - 726E07BE1CAF0C5C001A286B /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 726E07C01CAF15B7001A286B /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 726E4A0E1C86881600C57C6A /* SUStandardUserDriverUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0D1C86881600C57C6A /* SUStandardUserDriverUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -225,16 +252,11 @@ 726E4A341C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E4A321C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m */; }; 726E4A351C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 726E4A331C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib */; }; 726E4A371C89116000C57C6A /* SUStandardUserDriverDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A361C89116000C57C6A /* SUStandardUserDriverDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; }; 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; - 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */; }; - 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; - 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 728337A61C9E6FF40085AA99 /* SUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SUProbeInstallStatus.h */; }; 728337A71C9E6FF40085AA99 /* SUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SUProbeInstallStatus.m */; }; 728638ED1CAF50CE00783084 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; @@ -242,30 +264,10 @@ 7293A1AF1CEE933800B957A7 /* SUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SUURLRequest.m */; }; 7293A1B01CEE9B9800B957A7 /* SUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SUURLRequest.m */; }; 7293A1B11CEE9B9F00B957A7 /* SUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SUURLRequest.m */; }; - 729746201C8E8D9A00FC134E /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7297461F1C8E8D9A00FC134E /* TerminationListener.m */; }; - 729746231C8E8F1100FC134E /* AppInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746221C8E8F1100FC134E /* AppInstaller.m */; }; - 729746371C8FC04600FC134E /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A8C09CA790200B7442F /* SUUnarchiver.m */; }; - 729746381C8FC04B00FC134E /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6129C0B90E0B79810062CE76 /* SUPipedUnarchiver.m */; }; - 729746391C8FC04F00FC134E /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; }; - 7297463A1C8FCA4900FC134E /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */; }; - 7297463C1C8FF6AE00FC134E /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; }; - 729746571C936D5E00FC134E /* SUMessageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 729746551C936D5E00FC134E /* SUMessageTypes.h */; }; - 729746581C936D5E00FC134E /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; - 729746591C936D5E00FC134E /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; 72A1C2631CD6849C004CD282 /* SUUpdatePermissionPrompt.h in Headers */ = {isa = PBXBuildFile; fileRef = 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */; }; 72A450531C69A68900D67EEA /* SUUpdatePermission.h in Headers */ = {isa = PBXBuildFile; fileRef = 72A450511C69A68900D67EEA /* SUUpdatePermission.h */; settings = {ATTRIBUTES = (Public, ); }; }; 72A450541C69A68900D67EEA /* SUUpdatePermission.m in Sources */ = {isa = PBXBuildFile; fileRef = 72A450521C69A68900D67EEA /* SUUpdatePermission.m */; }; 72A4A2401BB6567D00E7820D /* SUFileManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */; }; - 72A6F97E1C94C370005F404C /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */; }; - 72A6F97F1C94C392005F404C /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A8C09CA790200B7442F /* SUUnarchiver.m */; }; - 72A6F9801C94C397005F404C /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; }; - 72A6F9811C94C3BB005F404C /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; }; - 72A6F9821C94C3BB005F404C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; }; - 72A6F9831C94C3BF005F404C /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; }; - 72A6F9841C94C3FE005F404C /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */; }; - 72A6F9851C94C3FE005F404C /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */; }; - 72A6F9861C94C49C005F404C /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6129C0B90E0B79810062CE76 /* SUPipedUnarchiver.m */; }; - 72A6F9871C94C4AE005F404C /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; }; 72A6F98A1C94E2D6005F404C /* SUUpdaterDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72A6F9891C94E2D6005F404C /* SUUpdaterDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 72AC6B261B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B251B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz */; }; 72AC6B281B9AAD6700F62325 /* SparkleTestCodeSignApp.tar in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B271B9AAD6700F62325 /* SparkleTestCodeSignApp.tar */; }; @@ -275,11 +277,6 @@ 72B09CE71CE6BCBD0052EF9E /* SUURLDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B09CE51CE6BCBD0052EF9E /* SUURLDownload.h */; }; 72B09CE81CE6BCBD0052EF9E /* SUURLDownload.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B09CE61CE6BCBD0052EF9E /* SUURLDownload.m */; }; 72B09CEC1CEA18900052EF9E /* bscommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B09CE91CEA18900052EF9E /* bscommon.c */; }; - 72B09CEE1CEA21CD0052EF9E /* bscommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B09CE91CEA18900052EF9E /* bscommon.c */; }; - 72B144501CF8826900B971EE /* SUAuthorizationEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B1444E1CF8826900B971EE /* SUAuthorizationEnvironment.h */; }; - 72B144511CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */; }; - 72B144521CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */; }; - 72B52A1E1D3CA4560085AC99 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 721BC20A1D17A5AD002BC71E /* CoreServices.framework */; }; 72B767CA1C9B707000A07552 /* SUAppcastDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767C81C9B707000A07552 /* SUAppcastDriver.h */; }; 72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767C91C9B707000A07552 /* SUAppcastDriver.m */; }; 72B767CE1C9B924900A07552 /* SUInstallerDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767CC1C9B924900A07552 /* SUInstallerDriver.h */; }; @@ -296,11 +293,6 @@ 72B767E31C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767E11C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m */; }; 72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767E41C9CFD7200A07552 /* SUAutomaticUpdateDriver.h */; }; 72B767E71C9CFD7200A07552 /* SUAutomaticUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767E51C9CFD7200A07552 /* SUAutomaticUpdateDriver.m */; }; - 72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; - 72D9547B1CBA1FFF006F28BD /* SUInstallationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 72D954791CBA1FFE006F28BD /* SUInstallationInfo.h */; }; - 72D9547C1CBA1FFF006F28BD /* SUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D9547A1CBA1FFE006F28BD /* SUInstallationInfo.m */; }; - 72D9547D1CBA1FFF006F28BD /* SUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D9547A1CBA1FFE006F28BD /* SUInstallationInfo.m */; }; - 72D9547E1CBA221E006F28BD /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; }; 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */; }; 72D954831CBAD34F006F28BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954821CBAD34F006F28BD /* main.m */; }; 72D954861CBB179D006F28BD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1420DF4F196247F900203BB0 /* Images.xcassets */; }; @@ -324,12 +316,9 @@ 72F94F5D1CC455B4002DEE68 /* SparkleInstallerLauncher.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* SparkleInstallerLauncher.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72F94F5E1CC455B4002DEE68 /* SparklePersistentDownloader.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* SparklePersistentDownloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72F94F5F1CC455B4002DEE68 /* SparkleTemporaryDownloader.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 728638F31CAF5A5F00783084 /* SparkleTemporaryDownloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */; }; - 767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; }; C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; }; F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; }; F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; }; - F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -389,20 +378,6 @@ remoteGlobalIDString = 5D06E8CF0FD68C7C005AE3F6; remoteInfo = BinaryDelta; }; - 1495006B195FB8A600BC5B5B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 55C14BB6136EEF1500649790; - remoteInfo = Autoupdate; - }; - 55C14F96136F044100649790 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 55C14BB6136EEF1500649790; - remoteInfo = Autoupdate; - }; 61B5F91B09C4CF7200B25A18 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -521,8 +496,8 @@ dstPath = ""; dstSubfolderSpec = 12; files = ( + 7267E5F91D3D92DA00D1BF90 /* Autoupdate in CopyFiles */, 72EB87EB1CB8859100C37F42 /* Updater.app in CopyFiles */, - 142E0E0419A6A26F00E4312B /* Autoupdate.app in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -553,6 +528,15 @@ name = "Embed XPC Services"; runOnlyForDeploymentPostprocessing = 0; }; + 72B398D01D3D879300EE297F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; 72D954B41CBB4469006F28BD /* Copy Sparkle */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -643,9 +627,6 @@ 555CF29A196C52330000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Sparkle.strings; sourceTree = ""; }; 555CF29C196C52460000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = el; path = el.lproj/SUUpdateAlert.xib; sourceTree = ""; }; 555CF29D196C524C0000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = el; path = el.lproj/SUUpdatePermissionPrompt.xib; sourceTree = ""; }; - 55C14BB7136EEF1500649790 /* Autoupdate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Autoupdate.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 55C14BB9136EEF1500649790 /* Autoupdate-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Autoupdate-Info.plist"; sourceTree = ""; }; - 55C14BD3136EEFCE00649790 /* Autoupdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Autoupdate.m; sourceTree = ""; }; 55C14BD8136EF00C00649790 /* SUStatus.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUStatus.xib; sourceTree = ""; }; 55C14BF1136EF26100649790 /* cs */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = cs; path = cs.lproj/SUUpdateAlert.xib; sourceTree = ""; }; 55C14BF2136EF26100649790 /* da */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = da; path = da.lproj/SUUpdateAlert.xib; sourceTree = ""; }; @@ -696,22 +677,12 @@ 5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BinaryDelta; sourceTree = BUILT_PRODUCTS_DIR; }; 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */ = {isa = PBXFileReference; comments = "-Wno-shorten-64-to-32"; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bsdiff.c; sourceTree = ""; }; 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = ""; }; - 5D06E8DF0FD68CC7005AE3F6 /* SUBinaryDeltaApply.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaApply.h; sourceTree = ""; }; - 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaApply.m; sourceTree = ""; }; - 5D06E8E10FD68CC7005AE3F6 /* SUBinaryDeltaCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaCommon.h; sourceTree = ""; }; - 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaCommon.m; sourceTree = ""; }; - 5D06E8E30FD68CC7005AE3F6 /* SUBinaryDeltaTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaTool.m; sourceTree = ""; usesTabs = 0; }; 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigBinaryDelta.xcconfig; sourceTree = ""; }; 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; }; - 5D06E9370FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaUnarchiver.h; sourceTree = ""; }; - 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaUnarchiver.m; sourceTree = ""; }; 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxar.1.dylib; path = usr/lib/libxar.1.dylib; sourceTree = SDKROOT; }; 5D1AF58F0FD767AD0065DB48 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; 5D1AF5990FD767E50065DB48 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 5F1510A11C96E591006E1629 /* testnamespaces.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testnamespaces.xml; sourceTree = ""; }; - 6102FE440E077FCE00F85D09 /* SUPipedUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPipedUnarchiver.h; sourceTree = ""; }; - 6102FE480E07803800F85D09 /* SUDiskImageUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUDiskImageUnarchiver.h; sourceTree = ""; }; - 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUDiskImageUnarchiver.m; sourceTree = ""; }; 611142E810FB1BE5009810AA /* bspatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bspatch.h; sourceTree = ""; }; 61131A050F846CE600E97AF6 /* da */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Sparkle.strings; sourceTree = ""; }; 61131A090F846D0A00E97AF6 /* zh_CN */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Sparkle.strings; sourceTree = ""; }; @@ -722,14 +693,9 @@ 612279D90DB5470200AB99EA /* Sparkle Unit Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Sparkle Unit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 612279DA0DB5470200AB99EA /* SparkleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SparkleTests-Info.plist"; sourceTree = ""; }; 61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUVersionComparisonTest.m; sourceTree = ""; }; - 61299A2D09CA2DAB00B7442F /* SUDSAVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUDSAVerifier.h; sourceTree = ""; }; - 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUDSAVerifier.m; sourceTree = ""; }; 61299A5B09CA6D4500B7442F /* SUConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUConstants.h; sourceTree = ""; }; 61299A5F09CA6EB100B7442F /* SUConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUConstants.m; sourceTree = ""; }; - 61299A8B09CA790200B7442F /* SUUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUnarchiver.h; sourceTree = ""; }; - 61299A8C09CA790200B7442F /* SUUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUnarchiver.m; sourceTree = ""; }; 61299B3509CB04E000B7442F /* Sparkle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sparkle.h; sourceTree = ""; }; - 6129C0B90E0B79810062CE76 /* SUPipedUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPipedUnarchiver.m; sourceTree = ""; }; 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionPrompt.h; sourceTree = ""; }; 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionPrompt.m; sourceTree = ""; }; 613151B20FB4946A000DCD59 /* is */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Sparkle.strings; sourceTree = ""; }; @@ -744,12 +710,6 @@ 615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SUModelTranslation.plist; sourceTree = ""; }; 6186554310D7484E00B1E074 /* pt_PT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Sparkle.strings; sourceTree = ""; }; 618915730E35937600B5E981 /* sv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Sparkle.strings; sourceTree = ""; }; - 618FA4FF0DAE88B40026945C /* SUInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstaller.h; sourceTree = ""; }; - 618FA5000DAE88B40026945C /* SUInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstaller.m; sourceTree = ""; }; - 618FA5030DAE8AB80026945C /* SUPlainInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPlainInstaller.h; sourceTree = ""; }; - 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPlainInstaller.m; sourceTree = ""; }; - 618FA5200DAE8E8A0026945C /* SUPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPackageInstaller.h; sourceTree = ""; }; - 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPackageInstaller.m; sourceTree = ""; }; 6195D4920E404AD700D41A50 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Sparkle.strings; sourceTree = ""; }; 6196CFE309C71ADE000DC222 /* SUStatusController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusController.h; sourceTree = ""; }; 6196CFE409C71ADE000DC222 /* SUStatusController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUStatusController.m; sourceTree = ""; }; @@ -763,8 +723,6 @@ 61AAE84F0A321AF700D8810D /* es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Sparkle.strings; sourceTree = ""; }; 61AAE8590A321B0400D8810D /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Sparkle.strings; sourceTree = ""; }; 61AAE8710A321F7700D8810D /* nl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Sparkle.strings; sourceTree = ""; }; - 61B078CC15A5FB6100600039 /* SUCodeSigningVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUCodeSigningVerifier.h; sourceTree = ""; }; - 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifier.m; sourceTree = ""; }; 61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SUUpdater.h; sourceTree = ""; }; 61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SUUpdater.m; sourceTree = ""; }; 61B5F8F609C4CEB300B25A18 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -812,8 +770,6 @@ 721C24581CB7567D005440CB /* InstallerProgress-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "InstallerProgress-Info.plist"; path = "Sparkle/InstallerProgress/InstallerProgress-Info.plist"; sourceTree = SOURCE_ROOT; }; 722194511D3BF987004C34FF /* SUInstallerAgentProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentProtocol.h; sourceTree = SOURCE_ROOT; }; 722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentInitiationProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h; sourceTree = SOURCE_ROOT; }; - 722194531D3C0135004C34FF /* AgentConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AgentConnection.h; sourceTree = ""; }; - 722194541D3C0135004C34FF /* AgentConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AgentConnection.m; sourceTree = ""; }; 722194761D3C4251004C34FF /* SUSubmitInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSubmitInstaller.h; sourceTree = ""; }; 722194771D3C4251004C34FF /* SUSubmitInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSubmitInstaller.m; sourceTree = ""; }; 7223E7611AD1AEFF008E3161 /* sais.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sais.c; sourceTree = ""; }; @@ -849,9 +805,6 @@ 724BB3801D31F186005D534A /* SUInstallerCommunicationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerCommunicationProtocol.h; sourceTree = ""; }; 724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstallerConnection.h; sourceTree = ""; }; 724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstallerConnection.m; sourceTree = ""; }; - 724BB38B1D33283C005D534A /* StatusInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusInfo.h; sourceTree = ""; }; - 724BB38C1D33283C005D534A /* StatusInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusInfo.m; sourceTree = ""; }; - 724BB38E1D332EA6005D534A /* SUStatusInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUStatusInfoProtocol.h; path = ../Sparkle/Autoupdate/SUStatusInfoProtocol.h; sourceTree = ""; }; 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleInstallerStatus.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; 724BB3951D333832005D534A /* SUInstallerStatusProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatusProtocol.h; sourceTree = ""; }; 724BB3961D333832005D534A /* SUInstallerStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatus.h; sourceTree = ""; }; @@ -880,17 +833,60 @@ 725F97A31C8B304D00265BE4 /* SUInstallUpdateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallUpdateViewController.m; sourceTree = ""; }; 725F97A41C8B304D00265BE4 /* SUInstallUpdateViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUInstallUpdateViewController.xib; sourceTree = ""; }; 725F97A71C8B42D700265BE4 /* SUStandardUserDriverProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStandardUserDriverProtocol.h; sourceTree = ""; }; - 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaCreate.m; sourceTree = ""; }; - 7268AC641AD634E400C3E0C1 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaCreate.h; sourceTree = ""; }; + 7267E56E1D3D895B00D1BF90 /* SUBinaryDeltaApply.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaApply.h; path = Autoupdate/SUBinaryDeltaApply.h; sourceTree = SOURCE_ROOT; }; + 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaApply.m; path = Autoupdate/SUBinaryDeltaApply.m; sourceTree = SOURCE_ROOT; }; + 7267E5701D3D895B00D1BF90 /* SUBinaryDeltaCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaCommon.h; path = Autoupdate/SUBinaryDeltaCommon.h; sourceTree = SOURCE_ROOT; }; + 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaCommon.m; path = Autoupdate/SUBinaryDeltaCommon.m; sourceTree = SOURCE_ROOT; }; + 7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaCreate.h; path = Autoupdate/SUBinaryDeltaCreate.h; sourceTree = SOURCE_ROOT; }; + 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaCreate.m; path = Autoupdate/SUBinaryDeltaCreate.m; sourceTree = SOURCE_ROOT; }; + 7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaTool.m; path = Autoupdate/SUBinaryDeltaTool.m; sourceTree = SOURCE_ROOT; }; + 7267E57D1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaUnarchiver.h; path = Autoupdate/SUBinaryDeltaUnarchiver.h; sourceTree = SOURCE_ROOT; }; + 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaUnarchiver.m; path = Autoupdate/SUBinaryDeltaUnarchiver.m; sourceTree = SOURCE_ROOT; }; + 7267E5801D3D89B300D1BF90 /* SUDiskImageUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDiskImageUnarchiver.h; path = Autoupdate/SUDiskImageUnarchiver.h; sourceTree = SOURCE_ROOT; }; + 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUDiskImageUnarchiver.m; path = Autoupdate/SUDiskImageUnarchiver.m; sourceTree = SOURCE_ROOT; }; + 7267E5821D3D89B300D1BF90 /* SUPipedUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUPipedUnarchiver.h; path = Autoupdate/SUPipedUnarchiver.h; sourceTree = SOURCE_ROOT; }; + 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUPipedUnarchiver.m; path = Autoupdate/SUPipedUnarchiver.m; sourceTree = SOURCE_ROOT; }; + 7267E5841D3D89B300D1BF90 /* SUUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUnarchiver.h; path = Autoupdate/SUUnarchiver.h; sourceTree = SOURCE_ROOT; }; + 7267E5851D3D89B300D1BF90 /* SUUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUUnarchiver.m; path = Autoupdate/SUUnarchiver.m; sourceTree = SOURCE_ROOT; }; + 7267E5891D3D89CA00D1BF90 /* SUUnarchiverProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUUnarchiverProtocol.h; path = Autoupdate/SUUnarchiverProtocol.h; sourceTree = SOURCE_ROOT; }; + 7267E5981D3D8A5A00D1BF90 /* SUCodeSigningVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUCodeSigningVerifier.h; path = Autoupdate/SUCodeSigningVerifier.h; sourceTree = SOURCE_ROOT; }; + 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUCodeSigningVerifier.m; path = Autoupdate/SUCodeSigningVerifier.m; sourceTree = SOURCE_ROOT; }; + 7267E59A1D3D8A5A00D1BF90 /* SUDSAVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDSAVerifier.h; path = Autoupdate/SUDSAVerifier.h; sourceTree = SOURCE_ROOT; }; + 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUDSAVerifier.m; path = Autoupdate/SUDSAVerifier.m; sourceTree = SOURCE_ROOT; }; + 7267E59E1D3D8A6F00D1BF90 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Autoupdate/main.m; sourceTree = SOURCE_ROOT; }; + 7267E5A01D3D8A7E00D1BF90 /* AppInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppInstaller.h; path = Autoupdate/AppInstaller.h; sourceTree = SOURCE_ROOT; }; + 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppInstaller.m; path = Autoupdate/AppInstaller.m; sourceTree = SOURCE_ROOT; }; + 7267E5A31D3D8A8A00D1BF90 /* StatusInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StatusInfo.h; path = Autoupdate/StatusInfo.h; sourceTree = SOURCE_ROOT; }; + 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StatusInfo.m; path = Autoupdate/StatusInfo.m; sourceTree = SOURCE_ROOT; }; + 7267E5A61D3D8A9900D1BF90 /* AgentConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AgentConnection.h; path = Autoupdate/AgentConnection.h; sourceTree = SOURCE_ROOT; }; + 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AgentConnection.m; path = Autoupdate/AgentConnection.m; sourceTree = SOURCE_ROOT; }; + 7267E5A91D3D8AA800D1BF90 /* TerminationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TerminationListener.h; path = Autoupdate/TerminationListener.h; sourceTree = SOURCE_ROOT; }; + 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TerminationListener.m; path = Autoupdate/TerminationListener.m; sourceTree = SOURCE_ROOT; }; + 7267E5AC1D3D8AB700D1BF90 /* SUInstallationInputData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstallationInputData.h; path = Autoupdate/SUInstallationInputData.h; sourceTree = SOURCE_ROOT; }; + 7267E5AD1D3D8AB700D1BF90 /* SUInstallationInputData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUInstallationInputData.m; path = Autoupdate/SUInstallationInputData.m; sourceTree = SOURCE_ROOT; }; + 7267E5AF1D3D8AD500D1BF90 /* SUMessageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUMessageTypes.h; path = Autoupdate/SUMessageTypes.h; sourceTree = SOURCE_ROOT; }; + 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUMessageTypes.m; path = Autoupdate/SUMessageTypes.m; sourceTree = SOURCE_ROOT; }; + 7267E5B41D3D8AEE00D1BF90 /* SUInstallationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstallationInfo.h; path = Autoupdate/SUInstallationInfo.h; sourceTree = SOURCE_ROOT; }; + 7267E5B51D3D8AEE00D1BF90 /* SUInstallationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUInstallationInfo.m; path = Autoupdate/SUInstallationInfo.m; sourceTree = SOURCE_ROOT; }; + 7267E5B91D3D8B0B00D1BF90 /* SUInstallerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerProtocol.h; path = Autoupdate/SUInstallerProtocol.h; sourceTree = SOURCE_ROOT; }; + 7267E5BA1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUGuidedPackageInstaller.h; path = Autoupdate/SUGuidedPackageInstaller.h; sourceTree = SOURCE_ROOT; }; + 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; }; + 7267E5DD1D3D8F5A00D1BF90 /* SUStatusInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUStatusInfoProtocol.h; path = Autoupdate/SUStatusInfoProtocol.h; sourceTree = SOURCE_ROOT; }; + 7267E5E31D3D90AA00D1BF90 /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = ""; }; + 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUFileManager.m; sourceTree = ""; }; 726B2B5D1C645FC900388755 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusCompletionResults.h; sourceTree = ""; }; 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUSecureCoding.h; path = Sparkle/SUSecureCoding.h; sourceTree = SOURCE_ROOT; }; 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUSecureCoding.m; path = Sparkle/SUSecureCoding.m; sourceTree = SOURCE_ROOT; }; - 726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstallationInputData.h; sourceTree = ""; }; - 726E075F1CA4E9A5001A286B /* SUInstallationInputData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallationInputData.m; sourceTree = ""; }; 726E07681CA616A4001A286B /* libxar.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxar.tbd; path = usr/lib/libxar.tbd; sourceTree = SDKROOT; }; 726E076A1CA616B3001A286B /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; - 726E076C1CA64B9C001A286B /* SUUnarchiverProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUnarchiverProtocol.h; sourceTree = ""; }; 726E078B1CA891E9001A286B /* SUUpdaterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterSettings.h; sourceTree = ""; }; 726E078C1CA891E9001A286B /* SUUpdaterSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterSettings.m; sourceTree = ""; }; 726E07AD1CAF08D6001A286B /* SparkleInstallerLauncher.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleInstallerLauncher.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -917,8 +913,6 @@ 726E4A361C89116000C57C6A /* SUStandardUserDriverDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStandardUserDriverDelegate.h; sourceTree = ""; }; 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = ""; }; 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = ""; }; - 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = ""; }; - 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUFileManager.m; sourceTree = ""; }; 728337A41C9E6FF40085AA99 /* SUProbeInstallStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUProbeInstallStatus.h; sourceTree = ""; }; 728337A51C9E6FF40085AA99 /* SUProbeInstallStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUProbeInstallStatus.m; sourceTree = ""; }; 728638EE1CAF589C00783084 /* ConfigPersistentDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigPersistentDownloader.xcconfig; sourceTree = ""; }; @@ -926,18 +920,11 @@ 728639041CAF614000783084 /* ConfigTemporaryDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTemporaryDownloader.xcconfig; sourceTree = ""; }; 7293A1AC1CEE933800B957A7 /* SUURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUURLRequest.h; sourceTree = ""; }; 7293A1AD1CEE933800B957A7 /* SUURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUURLRequest.m; sourceTree = ""; }; - 7297461E1C8E8D9A00FC134E /* TerminationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminationListener.h; sourceTree = ""; }; - 7297461F1C8E8D9A00FC134E /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TerminationListener.m; sourceTree = ""; }; - 729746211C8E8F1100FC134E /* AppInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInstaller.h; sourceTree = ""; }; - 729746221C8E8F1100FC134E /* AppInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppInstaller.m; sourceTree = ""; }; - 729746551C936D5E00FC134E /* SUMessageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUMessageTypes.h; sourceTree = ""; }; - 729746561C936D5E00FC134E /* SUMessageTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUMessageTypes.m; sourceTree = ""; }; 729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITest.xcconfig; sourceTree = ""; }; 729F10FE1C65A9B500DFCCC5 /* ConfigUITestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestCoverage.xcconfig; sourceTree = ""; }; 72A450511C69A68900D67EEA /* SUUpdatePermission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermission.h; sourceTree = ""; }; 72A450521C69A68900D67EEA /* SUUpdatePermission.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermission.m; sourceTree = ""; }; 72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = ""; }; - 72A6F97D1C94A5C2005F404C /* SUInstallerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstallerProtocol.h; path = Autoupdate/SUInstallerProtocol.h; sourceTree = ""; }; 72A6F9891C94E2D6005F404C /* SUUpdaterDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterDelegate.h; sourceTree = ""; }; 72AC6B251B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = SparkleTestCodeSignApp.tar.gz; sourceTree = ""; }; 72AC6B271B9AAD6700F62325 /* SparkleTestCodeSignApp.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = SparkleTestCodeSignApp.tar; sourceTree = ""; }; @@ -949,8 +936,7 @@ 72B09CE61CE6BCBD0052EF9E /* SUURLDownload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUURLDownload.m; sourceTree = ""; }; 72B09CE91CEA18900052EF9E /* bscommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bscommon.c; sourceTree = ""; }; 72B09CEA1CEA18900052EF9E /* bscommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bscommon.h; sourceTree = ""; }; - 72B1444E1CF8826900B971EE /* SUAuthorizationEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAuthorizationEnvironment.h; sourceTree = ""; }; - 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAuthorizationEnvironment.m; sourceTree = ""; }; + 72B398D21D3D879300EE297F /* Autoupdate */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Autoupdate; sourceTree = BUILT_PRODUCTS_DIR; }; 72B767C81C9B707000A07552 /* SUAppcastDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAppcastDriver.h; sourceTree = ""; }; 72B767C91C9B707000A07552 /* SUAppcastDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAppcastDriver.m; sourceTree = ""; }; 72B767CC1C9B924900A07552 /* SUInstallerDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstallerDriver.h; sourceTree = ""; }; @@ -967,8 +953,6 @@ 72B767E11C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCoreBasedUpdateDriver.m; sourceTree = ""; }; 72B767E41C9CFD7200A07552 /* SUAutomaticUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAutomaticUpdateDriver.h; sourceTree = ""; }; 72B767E51C9CFD7200A07552 /* SUAutomaticUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAutomaticUpdateDriver.m; sourceTree = ""; }; - 72D954791CBA1FFE006F28BD /* SUInstallationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstallationInfo.h; sourceTree = ""; }; - 72D9547A1CBA1FFE006F28BD /* SUInstallationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallationInfo.m; sourceTree = ""; }; 72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressAppController.h; path = Sparkle/InstallerProgress/InstallerProgressAppController.h; sourceTree = SOURCE_ROOT; }; 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressAppController.m; path = Sparkle/InstallerProgress/InstallerProgressAppController.m; sourceTree = SOURCE_ROOT; }; 72D954821CBAD34F006F28BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sparkle/InstallerProgress/main.m; sourceTree = SOURCE_ROOT; }; @@ -1000,8 +984,6 @@ 72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppHelperDebug.xcconfig; sourceTree = ""; }; 72F94F561CC44DE1002DEE68 /* SUXPCServiceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCServiceInfo.h; sourceTree = ""; }; 72F94F571CC44DE1002DEE68 /* SUXPCServiceInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCServiceInfo.m; sourceTree = ""; }; - 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUGuidedPackageInstaller.h; sourceTree = ""; }; - 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUGuidedPackageInstaller.m; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Sparkle-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Sparkle-Info.plist"; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* Sparkle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sparkle.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A5BF4F1B1BC7668B007A052A /* SUTestWebServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTestWebServer.h; sourceTree = ""; }; @@ -1022,18 +1004,6 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 55C14BB5136EEF1500649790 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 726E076B1CA616B3001A286B /* libbz2.tbd in Frameworks */, - 726E07691CA616A4001A286B /* libxar.tbd in Frameworks */, - 14950070195FCE3A00BC5B5B /* Foundation.framework in Frameworks */, - 72B52A1E1D3CA4560085AC99 /* CoreServices.framework in Frameworks */, - 55C14F9A136F045400649790 /* Security.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 5D06E8CE0FD68C7C005AE3F6 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1130,6 +1100,18 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72B398CF1D3D879300EE297F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */, + 7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */, + 7267E5D11D3D8CD900D1BF90 /* Security.framework in Frameworks */, + 7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */, + 7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 72D9549B1CBB415B006F28BD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1157,7 +1139,6 @@ isa = PBXGroup; children = ( 5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */, - 55C14BB7136EEF1500649790 /* Autoupdate.app */, 61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */, 612279D90DB5470200AB99EA /* Sparkle Unit Tests.xctest */, 8DC2EF5B0486A6940098B216 /* Sparkle.framework */, @@ -1170,6 +1151,7 @@ 72D9549E1CBB415B006F28BD /* sparkle.app */, 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */, 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */, + 72B398D21D3D879300EE297F /* Autoupdate */, ); name = Products; sourceTree = ""; @@ -1186,6 +1168,7 @@ FA1941C40D94A6EA00DD942E /* Configurations */, 726B2B5E1C645FC900388755 /* UI Tests */, 72D9549F1CBB415C006F28BD /* sparkle-cli */, + 72B398D31D3D879400EE297F /* Autoupdate */, 0867D69AFE84028FC02AAC07 /* Frameworks */, 034768DFFF38A50411DB9C8B /* Products */, ); @@ -1196,6 +1179,7 @@ 0867D69AFE84028FC02AAC07 /* Frameworks */ = { isa = PBXGroup; children = ( + 7267E5CF1D3D8C8500D1BF90 /* SecurityFoundation.framework */, 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */, 721BC20A1D17A5AD002BC71E /* CoreServices.framework */, 721BC2081D17A553002BC71E /* Carbon.framework */, @@ -1328,18 +1312,17 @@ 61CFB2C10E384958007A1735 /* Verifiers */, 6101354A0DD25B7F0049ACDF /* Unarchiving */, 618FA6DB0DB485440026945C /* Installation */, - 55C14BB9136EEF1500649790 /* Autoupdate-Info.plist */, - 55C14BD3136EEFCE00649790 /* Autoupdate.m */, - 729746211C8E8F1100FC134E /* AppInstaller.h */, - 729746221C8E8F1100FC134E /* AppInstaller.m */, - 724BB38B1D33283C005D534A /* StatusInfo.h */, - 724BB38C1D33283C005D534A /* StatusInfo.m */, - 722194531D3C0135004C34FF /* AgentConnection.h */, - 722194541D3C0135004C34FF /* AgentConnection.m */, - 7297461E1C8E8D9A00FC134E /* TerminationListener.h */, - 7297461F1C8E8D9A00FC134E /* TerminationListener.m */, - 726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */, - 726E075F1CA4E9A5001A286B /* SUInstallationInputData.m */, + 7267E59E1D3D8A6F00D1BF90 /* main.m */, + 7267E5A01D3D8A7E00D1BF90 /* AppInstaller.h */, + 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */, + 7267E5A31D3D8A8A00D1BF90 /* StatusInfo.h */, + 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */, + 7267E5A61D3D8A9900D1BF90 /* AgentConnection.h */, + 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */, + 7267E5A91D3D8AA800D1BF90 /* TerminationListener.h */, + 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */, + 7267E5AC1D3D8AB700D1BF90 /* SUInstallationInputData.h */, + 7267E5AD1D3D8AB700D1BF90 /* SUInstallationInputData.m */, ); path = Autoupdate; sourceTree = ""; @@ -1347,15 +1330,15 @@ 5D06E8D90FD68C95005AE3F6 /* Binary Delta */ = { isa = PBXGroup; children = ( - 5D06E8DF0FD68CC7005AE3F6 /* SUBinaryDeltaApply.h */, - 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */, - 5D06E8E10FD68CC7005AE3F6 /* SUBinaryDeltaCommon.h */, - 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */, - 7268AC641AD634E400C3E0C1 /* SUBinaryDeltaCreate.h */, - 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */, - 5D06E8E30FD68CC7005AE3F6 /* SUBinaryDeltaTool.m */, - 5D06E9370FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.h */, - 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */, + 7267E56E1D3D895B00D1BF90 /* SUBinaryDeltaApply.h */, + 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */, + 7267E5701D3D895B00D1BF90 /* SUBinaryDeltaCommon.h */, + 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */, + 7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */, + 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */, + 7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */, + 7267E57D1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.h */, + 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */, ); name = "Binary Delta"; sourceTree = ""; @@ -1364,13 +1347,13 @@ isa = PBXGroup; children = ( 5D06E8D90FD68C95005AE3F6 /* Binary Delta */, - 6102FE480E07803800F85D09 /* SUDiskImageUnarchiver.h */, - 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */, - 6102FE440E077FCE00F85D09 /* SUPipedUnarchiver.h */, - 6129C0B90E0B79810062CE76 /* SUPipedUnarchiver.m */, - 726E076C1CA64B9C001A286B /* SUUnarchiverProtocol.h */, - 61299A8B09CA790200B7442F /* SUUnarchiver.h */, - 61299A8C09CA790200B7442F /* SUUnarchiver.m */, + 7267E5891D3D89CA00D1BF90 /* SUUnarchiverProtocol.h */, + 7267E5801D3D89B300D1BF90 /* SUDiskImageUnarchiver.h */, + 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */, + 7267E5821D3D89B300D1BF90 /* SUPipedUnarchiver.h */, + 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */, + 7267E5841D3D89B300D1BF90 /* SUUnarchiver.h */, + 7267E5851D3D89B300D1BF90 /* SUUnarchiver.m */, ); name = Unarchiving; path = ..; @@ -1435,19 +1418,15 @@ 618FA6DB0DB485440026945C /* Installation */ = { isa = PBXGroup; children = ( - 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */, - 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */, - 72B1444E1CF8826900B971EE /* SUAuthorizationEnvironment.h */, - 72B1444F1CF8826900B971EE /* SUAuthorizationEnvironment.m */, - 72A6F97D1C94A5C2005F404C /* SUInstallerProtocol.h */, - 618FA4FF0DAE88B40026945C /* SUInstaller.h */, - 618FA5000DAE88B40026945C /* SUInstaller.m */, - 618FA5030DAE8AB80026945C /* SUPlainInstaller.h */, - 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */, - 618FA5200DAE8E8A0026945C /* SUPackageInstaller.h */, - 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */, - 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */, - 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */, + 7267E5B91D3D8B0B00D1BF90 /* SUInstallerProtocol.h */, + 7267E5BC1D3D8B2700D1BF90 /* SUInstaller.h */, + 7267E5BD1D3D8B2700D1BF90 /* SUInstaller.m */, + 7267E5C01D3D8B2700D1BF90 /* SUPlainInstaller.h */, + 7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */, + 7267E5BA1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.h */, + 7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */, + 7267E5BE1D3D8B2700D1BF90 /* SUPackageInstaller.h */, + 7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */, ); name = Installation; path = ..; @@ -1465,6 +1444,8 @@ 14652F8319A9759F00959E44 /* SUExport.h */, 61EF67580E25C5B400F754E0 /* SUHost.h */, 61EF67550E25B58D00F754E0 /* SUHost.m */, + 7267E5E31D3D90AA00D1BF90 /* SUFileManager.h */, + 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */, 721BC20C1D1CDE55002BC71E /* SULocalCacheDirectory.h */, 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */, 55C14F04136EF6DB00649790 /* SULog.h */, @@ -1514,10 +1495,10 @@ 61CFB2C10E384958007A1735 /* Verifiers */ = { isa = PBXGroup; children = ( - 61B078CC15A5FB6100600039 /* SUCodeSigningVerifier.h */, - 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */, - 61299A2D09CA2DAB00B7442F /* SUDSAVerifier.h */, - 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */, + 7267E5981D3D8A5A00D1BF90 /* SUCodeSigningVerifier.h */, + 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */, + 7267E59A1D3D8A5A00D1BF90 /* SUDSAVerifier.h */, + 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */, ); name = Verifiers; path = ..; @@ -1602,7 +1583,7 @@ 724BB3941D333832005D534A /* InstallerStatus */ = { isa = PBXGroup; children = ( - 724BB38E1D332EA6005D534A /* SUStatusInfoProtocol.h */, + 7267E5DD1D3D8F5A00D1BF90 /* SUStatusInfoProtocol.h */, 724BB3951D333832005D534A /* SUInstallerStatusProtocol.h */, 724BB3961D333832005D534A /* SUInstallerStatus.h */, 724BB3971D333832005D534A /* SUInstallerStatus.m */, @@ -1703,12 +1684,12 @@ 729746481C91483B00FC134E /* IPC */ = { isa = PBXGroup; children = ( - 729746551C936D5E00FC134E /* SUMessageTypes.h */, - 729746561C936D5E00FC134E /* SUMessageTypes.m */, + 7267E5AF1D3D8AD500D1BF90 /* SUMessageTypes.h */, + 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */, 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */, 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */, - 72D954791CBA1FFE006F28BD /* SUInstallationInfo.h */, - 72D9547A1CBA1FFE006F28BD /* SUInstallationInfo.m */, + 7267E5B41D3D8AEE00D1BF90 /* SUInstallationInfo.h */, + 7267E5B51D3D8AEE00D1BF90 /* SUInstallationInfo.m */, 724BB3AB1D347EDE005D534A /* SUSystemAuthorization.h */, 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */, ); @@ -1716,6 +1697,13 @@ path = Autoupdate; sourceTree = ""; }; + 72B398D31D3D879400EE297F /* Autoupdate */ = { + isa = PBXGroup; + children = ( + ); + path = Autoupdate; + sourceTree = ""; + }; 72B767E81C9D114F00A07552 /* Update Drivers */ = { isa = PBXGroup; children = ( @@ -1809,7 +1797,6 @@ files = ( 725F977B1C8A896F00265BE4 /* SUUserDriverCoreComponent.h in Headers */, 726E078D1CA891E9001A286B /* SUUpdaterSettings.h in Headers */, - 72B144501CF8826900B971EE /* SUAuthorizationEnvironment.h in Headers */, 720E217B1D0D00BF003A311C /* SUUpdaterCycle.h in Headers */, 72A6F98A1C94E2D6005F404C /* SUUpdaterDelegate.h in Headers */, 726E4A371C89116000C57C6A /* SUStandardUserDriverDelegate.h in Headers */, @@ -1821,9 +1808,9 @@ 725CB95A1C7121830064365A /* SUStandardUserDriver.h in Headers */, 725CB9571C7120410064365A /* SUUserDriver.h in Headers */, 72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */, - 729746571C936D5E00FC134E /* SUMessageTypes.h in Headers */, 726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */, 72A450531C69A68900D67EEA /* SUUpdatePermission.h in Headers */, + 7267E5B61D3D8AEE00D1BF90 /* SUInstallationInfo.h in Headers */, 7229E1B61C97C91100CB50D0 /* SUUpdateDriver.h in Headers */, 61299B3609CB04E000B7442F /* Sparkle.h in Headers */, 72F94F581CC44DE1002DEE68 /* SUXPCServiceInfo.h in Headers */, @@ -1832,30 +1819,19 @@ 72A1C2631CD6849C004CD282 /* SUUpdatePermissionPrompt.h in Headers */, 724BB3A81D33461B005D534A /* SUXPCInstallerStatus.h in Headers */, 7246E0A31C83B685003B4E75 /* SUStandardUpdaterController.h in Headers */, - 61299A8D09CA790200B7442F /* SUUnarchiver.h in Headers */, 61B5FC7009C51F4A00B25A18 /* SUAppcastItem.h in Headers */, 72B767D61C9C8B5C00A07552 /* SUBasicUpdateDriver.h in Headers */, 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */, - 61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */, 61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */, - 6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */, - 61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */, 55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */, 14652F8419A978C200959E44 /* SUExport.h in Headers */, - 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */, - 726E07601CA4E9A5001A286B /* SUInstallationInputData.h in Headers */, 725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */, - 767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */, - 618FA5010DAE88B40026945C /* SUInstaller.h in Headers */, 55C14F06136EF6DB00649790 /* SULog.h in Headers */, 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */, 72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */, - 618FA5220DAE8E8A0026945C /* SUPackageInstaller.h in Headers */, 728337A61C9E6FF40085AA99 /* SUProbeInstallStatus.h in Headers */, 72B767CA1C9B707000A07552 /* SUAppcastDriver.h in Headers */, - 6102FE460E077FCE00F85D09 /* SUPipedUnarchiver.h in Headers */, 726E075C1CA3A6D6001A286B /* SUSecureCoding.h in Headers */, - 618FA5050DAE8AB80026945C /* SUPlainInstaller.h in Headers */, 72B767E21C9CE90A00A07552 /* SUCoreBasedUpdateDriver.h in Headers */, 72B09CE71CE6BCBD0052EF9E /* SUURLDownload.h in Headers */, 61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */, @@ -1864,15 +1840,16 @@ 6196CFF909C72148000DC222 /* SUStatusController.h in Headers */, 72B767DE1C9CDB9700A07552 /* SUUserInitiatedUpdateDriver.h in Headers */, 61A2279C0D1CEE7600430CCD /* SUSystemProfiler.h in Headers */, - 72D9547B1CBA1FFF006F28BD /* SUInstallationInfo.h in Headers */, 72B767D21C9C7B9300A07552 /* SUProbingUpdateDriver.h in Headers */, 7229E1BD1C98EFF200CB50D0 /* SUDownloadDriver.h in Headers */, 72B767CE1C9B924900A07552 /* SUInstallerDriver.h in Headers */, 724BB3871D32A167005D534A /* SUXPCInstallerConnection.h in Headers */, 61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */, + 7267E5B11D3D8AD500D1BF90 /* SUMessageTypes.h in Headers */, 61B5F8ED09C4CE3C00B25A18 /* SUUpdater.h in Headers */, 61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */, 3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */, + 7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1917,22 +1894,6 @@ /* End PBXLegacyTarget section */ /* Begin PBXNativeTarget section */ - 55C14BB6136EEF1500649790 /* Autoupdate */ = { - isa = PBXNativeTarget; - buildConfigurationList = 55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "Autoupdate" */; - buildPhases = ( - 55C14BB4136EEF1500649790 /* Sources */, - 55C14BB5136EEF1500649790 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Autoupdate; - productName = Autoupdate; - productReference = 55C14BB7136EEF1500649790 /* Autoupdate.app */; - productType = "com.apple.product-type.application"; - }; 5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */ = { isa = PBXNativeTarget; buildConfigurationList = 5D06E8DA0FD68C95005AE3F6 /* Build configuration list for PBXNativeTarget "BinaryDelta" */; @@ -2133,6 +2094,23 @@ productReference = 728638F31CAF5A5F00783084 /* SparkleTemporaryDownloader.xpc */; productType = "com.apple.product-type.xpc-service"; }; + 72B398D11D3D879300EE297F /* Autoupdate */ = { + isa = PBXNativeTarget; + buildConfigurationList = 72B398D61D3D879400EE297F /* Build configuration list for PBXNativeTarget "Autoupdate" */; + buildPhases = ( + 72B398CE1D3D879300EE297F /* Sources */, + 72B398CF1D3D879300EE297F /* Frameworks */, + 72B398D01D3D879300EE297F /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Autoupdate; + productName = Autoupdate; + productReference = 72B398D21D3D879300EE297F /* Autoupdate */; + productType = "com.apple.product-type.tool"; + }; 72D9549D1CBB415B006F28BD /* sparkle-cli */ = { isa = PBXNativeTarget; buildConfigurationList = 72D954AF1CBB415C006F28BD /* Build configuration list for PBXNativeTarget "sparkle-cli" */; @@ -2169,7 +2147,6 @@ ); dependencies = ( 72D954BA1CBB6E27006F28BD /* PBXTargetDependency */, - 55C14F97136F044100649790 /* PBXTargetDependency */, ); name = Sparkle; productInstallPath = "$(HOME)/Library/Frameworks"; @@ -2238,6 +2215,9 @@ }; }; }; + 72B398D11D3D879300EE297F = { + CreatedOnToolsVersion = 7.3.1; + }; 72D9549D1CBB415B006F28BD = { CreatedOnToolsVersion = 7.3; }; @@ -2302,6 +2282,7 @@ projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* Sparkle */, + 72B398D11D3D879300EE297F /* Autoupdate */, 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */, 724BB36B1D31D0B7005D534A /* SparkleInstallerConnection */, 724BB3921D333832005D534A /* SparkleInstallerStatus */, @@ -2312,7 +2293,6 @@ 612279D80DB5470200AB99EA /* Sparkle Unit Tests */, 5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */, 72D9549D1CBB415B006F28BD /* sparkle-cli */, - 55C14BB6136EEF1500649790 /* Autoupdate */, 721C24441CB753E6005440CB /* Installer Progress */, 14732BC51960F69300593899 /* Distribution */, 1420DF491962329200203BB0 /* Documentation */, @@ -2517,59 +2497,21 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 55C14BB4136EEF1500649790 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 722194551D3C0135004C34FF /* AgentConnection.m in Sources */, - 72B09CEE1CEA21CD0052EF9E /* bscommon.c in Sources */, - 72D9547E1CBA221E006F28BD /* SUAppcastItem.m in Sources */, - 72B144521CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */, - 726E07671CA61648001A286B /* SUBinaryDeltaCommon.m in Sources */, - 726E07661CA61621001A286B /* bspatch.c in Sources */, - 726E07651CA61603001A286B /* SUBinaryDeltaApply.m in Sources */, - 726E07641CA615ED001A286B /* SUBinaryDeltaUnarchiver.m in Sources */, - 726E07631CA4F35F001A286B /* SUSecureCoding.m in Sources */, - 72D9547D1CBA1FFF006F28BD /* SUInstallationInfo.m in Sources */, - 7297463A1C8FCA4900FC134E /* SUDSAVerifier.m in Sources */, - 729746391C8FC04F00FC134E /* SUDiskImageUnarchiver.m in Sources */, - 729746381C8FC04B00FC134E /* SUPipedUnarchiver.m in Sources */, - 729746371C8FC04600FC134E /* SUUnarchiver.m in Sources */, - 729746201C8E8D9A00FC134E /* TerminationListener.m in Sources */, - 55C14BD4136EEFCE00649790 /* Autoupdate.m in Sources */, - F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */, - 55C14F00136EF6B700649790 /* SUConstants.m in Sources */, - 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */, - 767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */, - 55C14F0C136EF6EA00649790 /* SUHost.m in Sources */, - 55C14F0D136EF6F200649790 /* SUInstaller.m in Sources */, - 724BB38D1D33283C005D534A /* StatusInfo.m in Sources */, - 729746231C8E8F1100FC134E /* AppInstaller.m in Sources */, - 55C14F08136EF6DB00649790 /* SULog.m in Sources */, - 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */, - 55C14F24136EF86F00649790 /* SUPackageInstaller.m in Sources */, - 55C14F21136EF84D00649790 /* SUPlainInstaller.m in Sources */, - 55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */, - 726E07621CA4E9A5001A286B /* SUInstallationInputData.m in Sources */, - 729746591C936D5E00FC134E /* SUMessageTypes.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 5D06E8CD0FD68C7C005AE3F6 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */, 5D06E8E90FD68CDB005AE3F6 /* bsdiff.c in Sources */, 14652F7E19A9728A00959E44 /* bspatch.c in Sources */, 7223E7631AD1AEFF008E3161 /* sais.c in Sources */, 72B09CEC1CEA18900052EF9E /* bscommon.c in Sources */, - 14652F7D19A9726700959E44 /* SUBinaryDeltaApply.m in Sources */, - 14652F7C19A9725300959E44 /* SUBinaryDeltaCommon.m in Sources */, - 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */, - 5D06E8EA0FD68CDB005AE3F6 /* SUBinaryDeltaTool.m in Sources */, + 7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */, 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */, - 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */, + 7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */, + 7267E57C1D3D895B00D1BF90 /* SUBinaryDeltaTool.m in Sources */, 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */, + 7267E5EA1D3D90AA00D1BF90 /* SUFileManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2577,23 +2519,24 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */, + 7267E5F71D3D919600D1BF90 /* SUPlainInstaller.m in Sources */, + 7267E5F61D3D919000D1BF90 /* SUDiskImageUnarchiver.m in Sources */, + 7267E5F41D3D918B00D1BF90 /* SUGuidedPackageInstaller.m in Sources */, + 7267E5F51D3D918B00D1BF90 /* SUPackageInstaller.m in Sources */, + 7267E5F31D3D918500D1BF90 /* SUCodeSigningVerifier.m in Sources */, + 7267E5F21D3D918000D1BF90 /* SUDSAVerifier.m in Sources */, + 7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */, + 7267E5EE1D3D915900D1BF90 /* SUBinaryDeltaApply.m in Sources */, + 7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */, + 7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */, + 7267E5ED1D3D912E00D1BF90 /* SUUnarchiver.m in Sources */, + 7267E5EC1D3D912900D1BF90 /* SUInstaller.m in Sources */, 723B252A1CEA7F3B00909873 /* bscommon.c in Sources */, - 726E076D1CA66180001A286B /* SUBinaryDeltaUnarchiver.m in Sources */, - 72A6F9871C94C4AE005F404C /* SUDiskImageUnarchiver.m in Sources */, - 72A6F9861C94C49C005F404C /* SUPipedUnarchiver.m in Sources */, - 72A6F9841C94C3FE005F404C /* SUBinaryDeltaApply.m in Sources */, - 72A6F9851C94C3FE005F404C /* SUBinaryDeltaCommon.m in Sources */, - 72A6F9831C94C3BF005F404C /* SUPlainInstaller.m in Sources */, - 72A6F9811C94C3BB005F404C /* SUPackageInstaller.m in Sources */, - 72A6F9821C94C3BB005F404C /* SUGuidedPackageInstaller.m in Sources */, - 72A6F9801C94C397005F404C /* SUInstaller.m in Sources */, - 72A6F97F1C94C392005F404C /* SUUnarchiver.m in Sources */, - 72A6F97E1C94C370005F404C /* SUDSAVerifier.m in Sources */, 721CF1A71AD7643600D9AC09 /* bsdiff.c in Sources */, 721CF1A81AD7644100D9AC09 /* bspatch.c in Sources */, 721CF1A91AD7644C00D9AC09 /* sais.c in Sources */, 5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */, - 72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */, 142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */, F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */, 725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */, @@ -2602,6 +2545,7 @@ 5AF6C7541AEA49840014A3AB /* SUInstallerTest.m in Sources */, 14652F8219A9746000959E44 /* SULog.m in Sources */, 7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */, + 7267E5E91D3D90AA00D1BF90 /* SUFileManager.m in Sources */, 5AE459001C34118500E3BB47 /* SUUpdaterTest.m in Sources */, 5AE459021C34118500E3BB47 /* SUVersionComparisonTest.m in Sources */, ); @@ -2626,15 +2570,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5EB1D3D90C200D1BF90 /* SUFileManager.m in Sources */, + 7267E5DC1D3D8F1E00D1BF90 /* SUMessageTypes.m in Sources */, 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */, - 7221947B1D3C42F7004C34FF /* SUFileManager.m in Sources */, 72D954831CBAD34F006F28BD /* main.m in Sources */, 721C24621CB75C68005440CB /* SULog.m in Sources */, 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */, 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */, 721C24611CB75C5D005440CB /* SUHost.m in Sources */, 721652651D3C744700FD13D8 /* InstallerProgressLauncher.m in Sources */, - 721C245F1CB75A6B005440CB /* SUMessageTypes.m in Sources */, 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */, 721C245E1CB757DE005440CB /* SUConstants.m in Sources */, 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */, @@ -2674,12 +2618,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */, 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */, 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */, - 724BB3671D30B2C5005D534A /* SUMessageTypes.m in Sources */, 726E07C01CAF15B7001A286B /* SULog.m in Sources */, 726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */, - 726E07BE1CAF0C5C001A286B /* SUFileManager.m in Sources */, + 7267E5E81D3D90AA00D1BF90 /* SUFileManager.m in Sources */, 726E07B41CAF08D6001A286B /* main.m in Sources */, 726E07B21CAF08D6001A286B /* SUInstallerLauncher.m in Sources */, ); @@ -2717,6 +2661,45 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72B398CE1D3D879300EE297F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7267E5D91D3D8D4B00D1BF90 /* sais.c in Sources */, + 7267E5D81D3D8D4400D1BF90 /* SUStandardVersionComparator.m in Sources */, + 7267E5D71D3D8D3F00D1BF90 /* SUHost.m in Sources */, + 7267E5D31D3D8CF200D1BF90 /* bscommon.c in Sources */, + 7267E5D41D3D8CF200D1BF90 /* bspatch.c in Sources */, + 7267E5D21D3D8CE800D1BF90 /* bsdiff.c in Sources */, + 7267E5CE1D3D8C7500D1BF90 /* SULog.m in Sources */, + 7267E5CD1D3D8C7200D1BF90 /* SUSecureCoding.m in Sources */, + 7267E5CC1D3D8C6B00D1BF90 /* SUConstants.m in Sources */, + 7267E5CB1D3D8C6400D1BF90 /* SUAppcastItem.m in Sources */, + 7267E5C31D3D8B2700D1BF90 /* SUInstaller.m in Sources */, + 7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */, + 7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */, + 7267E5E71D3D90AA00D1BF90 /* SUFileManager.m in Sources */, + 7267E59C1D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m in Sources */, + 7267E5C51D3D8B2700D1BF90 /* SUPlainInstaller.m in Sources */, + 7267E5B31D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */, + 7267E5881D3D89B300D1BF90 /* SUUnarchiver.m in Sources */, + 7267E5AE1D3D8AB700D1BF90 /* SUInstallationInputData.m in Sources */, + 7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */, + 7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */, + 7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */, + 7267E5A51D3D8A8A00D1BF90 /* StatusInfo.m in Sources */, + 7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */, + 7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */, + 7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */, + 7267E5C21D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m in Sources */, + 7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */, + 7267E59F1D3D8A6F00D1BF90 /* main.m in Sources */, + 7267E5A21D3D8A7E00D1BF90 /* AppInstaller.m in Sources */, + 7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */, + 7267E5B81D3D8AEE00D1BF90 /* SUInstallationInfo.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 72D9549A1CBB415B006F28BD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2731,19 +2714,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5DF1D3D8FFA00D1BF90 /* SUInstallationInputData.m in Sources */, 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */, 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */, 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */, 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */, 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */, + 7267E5B71D3D8AEE00D1BF90 /* SUInstallationInfo.m in Sources */, 724A0A3E1CF7AF0E00D8C3D5 /* SUTemporaryDownloader.m in Sources */, 723B5DAA1CF7AB6A00365F95 /* SUPersistentDownloader.m in Sources */, 72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */, 724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */, 72B767E31C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m in Sources */, - 7297463C1C8FF6AE00FC134E /* SUCodeSigningVerifier.m in Sources */, - 72D9547C1CBA1FFF006F28BD /* SUInstallationInfo.m in Sources */, 72B767E71C9CFD7200A07552 /* SUAutomaticUpdateDriver.m in Sources */, + 7267E5E61D3D90AA00D1BF90 /* SUFileManager.m in Sources */, 61B5FBB709C4FAFF00B25A18 /* SUAppcast.m in Sources */, 72F94F591CC44DE1002DEE68 /* SUXPCServiceInfo.m in Sources */, 726E078E1CA891E9001A286B /* SUUpdaterSettings.m in Sources */, @@ -2759,8 +2743,6 @@ 72A450541C69A68900D67EEA /* SUUpdatePermission.m in Sources */, 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */, 7229E1BA1C97CC4D00CB50D0 /* SUScheduledUpdateDriver.m in Sources */, - 726E07611CA4E9A5001A286B /* SUInstallationInputData.m in Sources */, - 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */, 725CB95B1C7121830064365A /* SUStandardUserDriver.m in Sources */, 61EF67560E25B58D00F754E0 /* SUHost.m in Sources */, 55C14F07136EF6DB00649790 /* SULog.m in Sources */, @@ -2775,12 +2757,11 @@ 61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */, 612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */, 61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */, - 72B144511CF8826900B971EE /* SUAuthorizationEnvironment.m in Sources */, 72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */, 726E075D1CA3A6D6001A286B /* SUSecureCoding.m in Sources */, + 7267E5B21D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */, 72B767DB1C9CD2E400A07552 /* SUUIBasedUpdateDriver.m in Sources */, 72B09CE81CE6BCBD0052EF9E /* SUURLDownload.m in Sources */, - 729746581C936D5E00FC134E /* SUMessageTypes.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2827,16 +2808,6 @@ target = 5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */; targetProxy = 14950069195FB8A600BC5B5B /* PBXContainerItemProxy */; }; - 1495006C195FB8A600BC5B5B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 55C14BB6136EEF1500649790 /* Autoupdate */; - targetProxy = 1495006B195FB8A600BC5B5B /* PBXContainerItemProxy */; - }; - 55C14F97136F044100649790 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 55C14BB6136EEF1500649790 /* Autoupdate */; - targetProxy = 55C14F96136F044100649790 /* PBXContainerItemProxy */; - }; 61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8DC2EF4F0486A6940098B216 /* Sparkle */; @@ -3139,13 +3110,6 @@ }; name = Coverage; }; - 149B785F1B7D398100D7D62C /* Coverage */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; - buildSettings = { - }; - name = Coverage; - }; 149B78601B7D398100D7D62C /* Coverage */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3192,20 +3156,6 @@ }; name = Release; }; - 55C14BBB136EEF1500649790 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 55C14BBC136EEF1500649790 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; - buildSettings = { - }; - name = Release; - }; 5D06E8D20FD68C7D005AE3F6 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */; @@ -3441,6 +3391,34 @@ }; name = Release; }; + 72B398D71D3D879400EE297F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 72B398D81D3D879400EE297F /* Coverage */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; + buildSettings = { + }; + name = Coverage; + }; + 72B398D91D3D879400EE297F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 72B398DA1D3D879400EE297F /* Release-HTTP */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; + buildSettings = { + }; + name = "Release-HTTP"; + }; 72D954AC1CBB415C006F28BD /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */; @@ -3538,13 +3516,6 @@ }; name = "Release-HTTP"; }; - 72F94EAA1CC2A23A002DEE68 /* Release-HTTP */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */; - buildSettings = { - }; - name = "Release-HTTP"; - }; 72F94EAB1CC2A23A002DEE68 /* Release-HTTP */ = { isa = XCBuildConfiguration; baseConfigurationReference = 721C24571CB754E8005440CB /* ConfigInstallerProgress.xcconfig */; @@ -3636,17 +3607,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "Autoupdate" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 55C14BBB136EEF1500649790 /* Debug */, - 149B785F1B7D398100D7D62C /* Coverage */, - 55C14BBC136EEF1500649790 /* Release */, - 72F94EAA1CC2A23A002DEE68 /* Release-HTTP */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 5D06E8DA0FD68C95005AE3F6 /* Build configuration list for PBXNativeTarget "BinaryDelta" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3768,6 +3728,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 72B398D61D3D879400EE297F /* Build configuration list for PBXNativeTarget "Autoupdate" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 72B398D71D3D879400EE297F /* Debug */, + 72B398D81D3D879400EE297F /* Coverage */, + 72B398D91D3D879400EE297F /* Release */, + 72B398DA1D3D879400EE297F /* Release-HTTP */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 72D954AF1CBB415C006F28BD /* Build configuration list for PBXNativeTarget "sparkle-cli" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Sparkle/Autoupdate/Autoupdate-Info.plist b/Sparkle/Autoupdate/Autoupdate-Info.plist deleted file mode 100644 index f5a076f7..00000000 --- a/Sparkle/Autoupdate/Autoupdate-Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - ${CURRENT_PROJECT_VERSION} - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - LSBackgroundOnly - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - LSUIElement - 1 - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index c3c92027..146c7e96 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -376,7 +376,7 @@ // Copy the relauncher into a temporary directory so we can get to it after the new version's installed. // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. NSError *relaunchError = nil; - NSString *relaunchToolPath = [self copyPathToCacheDirectory:[self.sparkleBundle pathForResource:@""SPARKLE_RELAUNCH_TOOL_NAME ofType:@"app"] error:&relaunchError]; + NSString *relaunchToolPath = [self copyPathToCacheDirectory:[self.sparkleBundle pathForResource:@""SPARKLE_RELAUNCH_TOOL_NAME ofType:@""] error:&relaunchError]; if (relaunchToolPath == nil) { completionHandler(relaunchError); return; diff --git a/Sparkle/SUSystemAuthorization.m b/Sparkle/SUSystemAuthorization.m index 924bb379..8afe4d9b 100644 --- a/Sparkle/SUSystemAuthorization.m +++ b/Sparkle/SUSystemAuthorization.m @@ -49,7 +49,7 @@ BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nulla } else if (guided) { result = YES; } else { -#pragma what about symbolic links? +#warning what about symbolic links? NSFileManager *fileManager = [NSFileManager defaultManager]; result = ![fileManager isWritableFileAtPath:path] || ![fileManager isWritableFileAtPath:[path stringByDeletingLastPathComponent]]; } From 50594dda57e0923907ad4a57da6c813311fc978a Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 18 Jul 2016 19:48:25 -0400 Subject: [PATCH 03/29] Move execute package out from SUFileManager --- Autoupdate/SUGuidedPackageInstaller.m | 28 ++++++++++++++++++-- Sparkle/SUFileManager.h | 12 --------- Sparkle/SUFileManager.m | 38 --------------------------- 3 files changed, 26 insertions(+), 52 deletions(-) diff --git a/Autoupdate/SUGuidedPackageInstaller.m b/Autoupdate/SUGuidedPackageInstaller.m index b7caa211..cb9d73d7 100644 --- a/Autoupdate/SUGuidedPackageInstaller.m +++ b/Autoupdate/SUGuidedPackageInstaller.m @@ -60,8 +60,32 @@ - (BOOL)performThirdStage:(NSError * __autoreleasing *)error { -#warning this probably shouldn't be part of file manager anymore - return [self.fileManager executePackageAtURL:[NSURL fileURLWithPath:self.packagePath] error:error]; + // This command *must* be run as root + NSString *installerPath = @"/usr/sbin/installer"; + + NSTask *task = [[NSTask alloc] init]; + task.launchPath = installerPath; + task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"]; + task.standardError = [NSPipe pipe]; + task.standardOutput = [NSPipe pipe]; + + BOOL success = YES; + @try { + [task launch]; + [task waitUntilExit]; + if (task.terminationStatus != EXIT_SUCCESS) { + success = NO; + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }]; + } + } + } @catch (NSException *) { + success = NO; + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }]; + } + } + return success; } - (BOOL)displaysUserProgress diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 032ef60c..9ab64a22 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -155,18 +155,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL error:(NSError **)error; -/** - * Runs an installer package (pkg) in a headless mode using /usr/sbin/installer - * @param packageURL A URL pointing to the package to execute. The item at this URL must exist. - * @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL. - * @return YES if the installer ran the package successfully, otherwise NO with a populated error object - * - * This method uses the system wide installer tool to run the provided package. This process does not show any UI, except for - * an initial authorization prompt if the calling process does not have root privileges. In other words, root privileges are required to use this method, and the file manager instance must have been created by allowing authorization. - * An error can occur if the package is unable to be ran by the installer, or if the installer reports a non-zero exit status code. - */ -- (BOOL)executePackageAtURL:(NSURL *)packageURL error:(NSError **)error; - @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 7365c380..29f64232 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -727,44 +727,6 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { return success; } -// Unlike other methods, authorization is required to execute this method successfully -- (BOOL)executePackageAtURL:(NSURL *)packageURL error:(NSError * __autoreleasing *)error -{ - if (![self _itemExistsAtURL:packageURL]) { - if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to execute package %@ because the file does not exist.", packageURL.path.lastPathComponent] }]; - } - return NO; - } - - // This command *must* be run as root - NSString *installerPath = @"/usr/sbin/installer"; - - NSTask *task = [[NSTask alloc] init]; - task.launchPath = installerPath; - task.arguments = @[@"-pkg", packageURL.path, @"-target", @"/"]; - task.standardError = [NSPipe pipe]; - task.standardOutput = [NSPipe pipe]; - - BOOL success = YES; - @try { - [task launch]; - [task waitUntilExit]; - if (task.terminationStatus != EXIT_SUCCESS) { - success = NO; - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }]; - } - } - } @catch (NSException *) { - success = NO; - if (error != NULL) { - *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }]; - } - } - return success; -} - @end #pragma clang diagnostic pop From 3244bf7f14afd46f145c99e91244c18494e72afb Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 18 Jul 2016 21:14:33 -0400 Subject: [PATCH 04/29] Move installer status info service to progress agent --- Autoupdate/AppInstaller.m | 31 ++++++------------- InstallerLauncher/SUInstallerLauncher.m | 6 +++- InstallerLauncher/SUSubmitInstaller.m | 2 +- Sparkle.xcodeproj/project.pbxproj | 8 ++--- .../InstallerProgressAppController.m | 20 ++++++++++++ .../SUInstallerAgentProtocol.h | 2 ++ 6 files changed, 42 insertions(+), 27 deletions(-) diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index caef3a7f..ef84f3f3 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -8,7 +8,6 @@ #import "AppInstaller.h" #import "TerminationListener.h" -#import "StatusInfo.h" #import "SUInstaller.h" #import "SULog.h" #import "SUHost.h" @@ -54,7 +53,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @property (nonatomic) NSXPCListener* xpcListener; @property (nonatomic) NSXPCConnection *activeConnection; @property (nonatomic) id communicator; -@property (nonatomic) StatusInfo *statusInfo; @property (nonatomic) AgentConnection *agentConnection; @property (nonatomic) BOOL receivedUpdaterPong; @@ -85,7 +83,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @synthesize xpcListener = _xpcListener; @synthesize activeConnection = _activeConnection; @synthesize communicator = _communicator; -@synthesize statusInfo = _statusInfo; @synthesize agentConnection = _agentConnection; @synthesize receivedUpdaterPong = _receivedUpdaterPong; @synthesize hostBundleIdentifier = _hostBundleIdentifier; @@ -117,7 +114,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)]; _xpcListener.delegate = self; - _statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier]; _agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self]; return self; @@ -169,7 +165,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; - (void)start { [self.xpcListener resume]; - [self.statusInfo startListener]; [self.agentConnection startListener]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ @@ -399,12 +394,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; } }); } else if (identifier == SUSentUpdateAppcastItemData) { - if (self.statusInfo.installationInfoData == nil) { - SUAppcastItem *updateItem = (SUAppcastItem *)SUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]); - if (updateItem != nil) { - SUInstallationInfo *installationInfo = [[SUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]]; - - self.statusInfo.installationInfoData = SUArchiveRootObjectSecurely(installationInfo); + SUAppcastItem *updateItem = (SUAppcastItem *)SUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]); + if (updateItem != nil) { + SUInstallationInfo *installationInfo = [[SUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]]; + + NSData *archivedData = SUArchiveRootObjectSecurely(installationInfo); + if (archivedData != nil) { + [self.agentConnection.agent registerInstallationInfoData:archivedData]; } } } else if (identifier == SUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) { @@ -583,18 +579,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; self.performedStage3Installation = YES; dispatch_async(dispatch_get_main_queue(), ^{ - // Make sure to terminate our displayed progress before we move onto cleanup + // Make sure to terminate our displayed progress before we move onto cleanup & relaunch + // This will also stop the agent from broadcasting the status info service, which we want to do before + // we relaunch the app because the relaunched app could check the service upon launch.. [self.agentConnection.agent stopProgress]; shouldLaunchInstallerProgress = NO; [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage3 data:[NSData data]]; - // Invalidate the status info listener before re-launching the updated app - // If we don't do this, the updated app could think the installation can be resumable, - // if it checks for updates immediately on launch - [self.statusInfo invalidate]; - self.statusInfo = nil; - NSString *installationPath = [SUInstaller installationPathForHost:self.host]; if (self.shouldRelaunch) { @@ -632,9 +624,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; [self.xpcListener invalidate]; self.xpcListener = nil; - [self.statusInfo invalidate]; - self.statusInfo = nil; - [self.agentConnection invalidate]; self.agentConnection = nil; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 19857f5d..423d0f46 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -80,10 +80,14 @@ jobDictionary[@"NICE"] = @0; jobDictionary[@"LaunchOnlyOnce"] = @YES; + NSMutableDictionary *machServicesDictionary = [[NSMutableDictionary alloc] init]; + machServicesDictionary[SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier)] = @YES; if (shouldSubmitInstaller) { - jobDictionary[@"MachServices"] = @{SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}; + machServicesDictionary[SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier)] = @YES; } + jobDictionary[@"MachServices"] = [machServicesDictionary copy]; + CFErrorRef submitError = NULL; submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); if (!submittedJob) { diff --git a/InstallerLauncher/SUSubmitInstaller.m b/InstallerLauncher/SUSubmitInstaller.m index 8b5fb2f5..47f93c30 100644 --- a/InstallerLauncher/SUSubmitInstaller.m +++ b/InstallerLauncher/SUSubmitInstaller.m @@ -83,7 +83,7 @@ } } - NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; + NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; CFErrorRef submitError = NULL; submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 6d92d672..789753cb 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -180,7 +180,6 @@ 7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */; }; 7267E59F1D3D8A6F00D1BF90 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59E1D3D8A6F00D1BF90 /* main.m */; }; 7267E5A21D3D8A7E00D1BF90 /* AppInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */; }; - 7267E5A51D3D8A8A00D1BF90 /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */; }; 7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */; }; 7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */; }; 7267E5AE1D3D8AB700D1BF90 /* SUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SUInstallationInputData.m */; }; @@ -233,6 +232,7 @@ 7267E5F71D3D919600D1BF90 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5C11D3D8B2700D1BF90 /* SUPlainInstaller.m */; }; 7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; }; 7267E5F91D3D92DA00D1BF90 /* Autoupdate in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72B398D21D3D879300EE297F /* Autoupdate */; }; + 7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */; }; 726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; }; 726E075C1CA3A6D6001A286B /* SUSecureCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */; }; 726E075D1CA3A6D6001A286B /* SUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */; }; @@ -1315,8 +1315,6 @@ 7267E59E1D3D8A6F00D1BF90 /* main.m */, 7267E5A01D3D8A7E00D1BF90 /* AppInstaller.h */, 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */, - 7267E5A31D3D8A8A00D1BF90 /* StatusInfo.h */, - 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */, 7267E5A61D3D8A9900D1BF90 /* AgentConnection.h */, 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */, 7267E5A91D3D8AA800D1BF90 /* TerminationListener.h */, @@ -1557,6 +1555,8 @@ 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */, 72D954841CBAD418006F28BD /* ShowInstallerProgress.h */, 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */, + 7267E5A31D3D8A8A00D1BF90 /* StatusInfo.h */, + 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */, 72D954821CBAD34F006F28BD /* main.m */, 721C24581CB7567D005440CB /* InstallerProgress-Info.plist */, ); @@ -2570,6 +2570,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */, 7267E5EB1D3D90C200D1BF90 /* SUFileManager.m in Sources */, 7267E5DC1D3D8F1E00D1BF90 /* SUMessageTypes.m in Sources */, 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */, @@ -2687,7 +2688,6 @@ 7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */, 7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */, 7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */, - 7267E5A51D3D8A8A00D1BF90 /* StatusInfo.m in Sources */, 7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */, 7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */, 7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */, diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index 9260bce5..f1f58843 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -14,6 +14,7 @@ #import "SUInstallerAgentProtocol.h" #import "SUInstallerAgentInitiationProtocol.h" #import "InstallerProgressLauncher.h" +#import "StatusInfo.h" #import /*! @@ -32,6 +33,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @property (nonatomic) BOOL repliedToRegistration; @property (nonatomic, readonly) NSBundle *hostBundle; @property (nonatomic, readonly, nullable) InstallerProgressLauncher *progressLauncher; +@property (nonatomic) StatusInfo *statusInfo; @property (nonatomic) BOOL submittedLauncherJob; @end @@ -47,6 +49,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @synthesize repliedToRegistration = _repliedToRegistration; @synthesize hostBundle = _hostBundle; @synthesize progressLauncher = _progressLauncher; +@synthesize statusInfo = _statusInfo; @synthesize submittedLauncherJob = _submittedLauncherJob; - (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate @@ -89,6 +92,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; _progressLauncher = [[InstallerProgressLauncher alloc] initWithHostBundle:_hostBundle installerPath:installerPath allowingInteraction:allowingInteraction delegate:self]; } + _statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier]; + application.delegate = self; _application = application; @@ -130,6 +135,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; - (void)startConnection { + [self.statusInfo startListener]; + [self.connection resume]; [self.connection.remoteObjectProxy connectionDidInitiateWithReply:^{ dispatch_async(dispatch_get_main_queue(), ^{ @@ -156,6 +163,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; - (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn)) { + [self.statusInfo invalidate]; [self.connection invalidate]; [self.progressLauncher invalidate]; @@ -194,6 +202,15 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; }); } +- (void)registerInstallationInfoData:(NSData *)installationInfoData +{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.statusInfo.installationInfoData == nil) { + self.statusInfo.installationInfoData = installationInfoData; + } + }); +} + - (void)relaunchPath:(NSString *)pathToRelaunch { dispatch_async(dispatch_get_main_queue(), ^{ @@ -229,6 +246,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; - (void)_stopProgress { + [self.statusInfo invalidate]; + self.statusInfo = nil; + [self.delegate installerProgressShouldStop]; self.delegate = nil; } diff --git a/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h b/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h index d4b33db4..caed5391 100644 --- a/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h +++ b/Sparkle/InstallerProgress/SUInstallerAgentProtocol.h @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)registerRelaunchBundlePath:(NSString *)relaunchBundlePath reply:(void (^)(NSNumber * _Nullable processIdentifier))reply; +- (void)registerInstallationInfoData:(NSData *)installationInfoData; + - (void)showProgress; - (void)stopProgress; From b014737e8383d6dfee58e2a712c39e6c8854af9b Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 18 Jul 2016 23:25:44 -0400 Subject: [PATCH 05/29] Group appcast update item, download name, and temp directory into one class --- Sparkle.xcodeproj/project.pbxproj | 12 ++++++++++++ Sparkle/SUCoreBasedUpdateDriver.m | 11 +++-------- Sparkle/SUDownloadDriver.h | 8 +++----- Sparkle/SUDownloadDriver.m | 5 ++++- Sparkle/SUDownloadedUpdate.h | 25 +++++++++++++++++++++++++ Sparkle/SUDownloadedUpdate.m | 28 ++++++++++++++++++++++++++++ Sparkle/SUInstallerDriver.h | 4 ++-- Sparkle/SUInstallerDriver.m | 9 +++++---- 8 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 Sparkle/SUDownloadedUpdate.h create mode 100644 Sparkle/SUDownloadedUpdate.m diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 789753cb..32bc7445 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -233,6 +233,10 @@ 7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; }; 7267E5F91D3D92DA00D1BF90 /* Autoupdate in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72B398D21D3D879300EE297F /* Autoupdate */; }; 7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */; }; + 7267E5FD1D3DD1B700D1BF90 /* SUDownloadedUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5FB1D3DD1B700D1BF90 /* SUDownloadedUpdate.h */; }; + 7267E5FE1D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5FC1D3DD1B700D1BF90 /* SUDownloadedUpdate.m */; }; + 7267E5FF1D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5FC1D3DD1B700D1BF90 /* SUDownloadedUpdate.m */; }; + 7267E6001D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5FC1D3DD1B700D1BF90 /* SUDownloadedUpdate.m */; }; 726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; }; 726E075C1CA3A6D6001A286B /* SUSecureCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */; }; 726E075D1CA3A6D6001A286B /* SUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */; }; @@ -881,6 +885,8 @@ 7267E5DD1D3D8F5A00D1BF90 /* SUStatusInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUStatusInfoProtocol.h; path = Autoupdate/SUStatusInfoProtocol.h; sourceTree = SOURCE_ROOT; }; 7267E5E31D3D90AA00D1BF90 /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = ""; }; 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUFileManager.m; sourceTree = ""; }; + 7267E5FB1D3DD1B700D1BF90 /* SUDownloadedUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUDownloadedUpdate.h; sourceTree = ""; }; + 7267E5FC1D3DD1B700D1BF90 /* SUDownloadedUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUDownloadedUpdate.m; sourceTree = ""; }; 726B2B5D1C645FC900388755 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusCompletionResults.h; sourceTree = ""; }; 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUSecureCoding.h; path = Sparkle/SUSecureCoding.h; sourceTree = SOURCE_ROOT; }; @@ -1520,6 +1526,8 @@ 72B767C91C9B707000A07552 /* SUAppcastDriver.m */, 728337A41C9E6FF40085AA99 /* SUProbeInstallStatus.h */, 728337A51C9E6FF40085AA99 /* SUProbeInstallStatus.m */, + 7267E5FB1D3DD1B700D1BF90 /* SUDownloadedUpdate.h */, + 7267E5FC1D3DD1B700D1BF90 /* SUDownloadedUpdate.m */, ); name = Drivers; sourceTree = ""; @@ -1825,6 +1833,7 @@ 61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */, 55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */, 14652F8419A978C200959E44 /* SUExport.h in Headers */, + 7267E5FD1D3DD1B700D1BF90 /* SUDownloadedUpdate.h in Headers */, 725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */, 55C14F06136EF6DB00649790 /* SULog.h in Headers */, 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */, @@ -2504,6 +2513,7 @@ 7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */, 5D06E8E90FD68CDB005AE3F6 /* bsdiff.c in Sources */, 14652F7E19A9728A00959E44 /* bspatch.c in Sources */, + 7267E6001D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */, 7223E7631AD1AEFF008E3161 /* sais.c in Sources */, 72B09CEC1CEA18900052EF9E /* bscommon.c in Sources */, 7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */, @@ -2522,6 +2532,7 @@ 7267E5F81D3D91A800D1BF90 /* SUPipedUnarchiver.m in Sources */, 7267E5F71D3D919600D1BF90 /* SUPlainInstaller.m in Sources */, 7267E5F61D3D919000D1BF90 /* SUDiskImageUnarchiver.m in Sources */, + 7267E5FF1D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */, 7267E5F41D3D918B00D1BF90 /* SUGuidedPackageInstaller.m in Sources */, 7267E5F51D3D918B00D1BF90 /* SUPackageInstaller.m in Sources */, 7267E5F31D3D918500D1BF90 /* SUCodeSigningVerifier.m in Sources */, @@ -2755,6 +2766,7 @@ 7246E0A41C83B685003B4E75 /* SUStandardUpdaterController.m in Sources */, 725F977C1C8A896F00265BE4 /* SUUserDriverCoreComponent.m in Sources */, 61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */, + 7267E5FE1D3DD1B700D1BF90 /* SUDownloadedUpdate.m in Sources */, 612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */, 61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */, 72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */, diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 7b8db88d..0a7ee5de 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -15,6 +15,7 @@ #import "SULocalCacheDirectory.h" #import "SULog.h" #import "SUErrors.h" +#import "SUDownloadedUpdate.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -134,20 +135,14 @@ } } -- (void)downloadDriverDidDownloadUpdate +- (void)downloadDriverDidDownloadUpdate:(SUDownloadedUpdate *)downloadedUpdate { // Now we have to extract the downloaded archive. if ([self.delegate respondsToSelector:@selector(coreDriverDidFinishDownloadingUpdate)]) { [self.delegate coreDriverDidFinishDownloadingUpdate]; } - NSString *downloadName = self.downloadDriver.downloadName; - assert(downloadName != nil); - - NSString *temporaryDirectory = self.downloadDriver.temporaryDirectory; - assert(temporaryDirectory != nil); - - [self.installerDriver extractDownloadName:downloadName withUpdateItem:self.updateItem temporaryDirectory:temporaryDirectory completion:^(NSError * _Nullable error) { + [self.installerDriver extractDownloadedUpdate:downloadedUpdate completion:^(NSError * _Nullable error) { if (error != nil) { [self.delegate coreDriverIsRequestingAbortUpdateWithError:(error.code == SUInstallationCancelledError) ? nil : error]; } diff --git a/Sparkle/SUDownloadDriver.h b/Sparkle/SUDownloadDriver.h index cecc3a11..a38c0867 100644 --- a/Sparkle/SUDownloadDriver.h +++ b/Sparkle/SUDownloadDriver.h @@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN +@class SUAppcastItem, SUHost, SUDownloadedUpdate; + @protocol SUDownloadDriverDelegate - (void)downloadDriverWillBeginDownload; @@ -18,14 +20,12 @@ NS_ASSUME_NONNULL_BEGIN - (void)downloadDriverDidReceiveDataOfLength:(NSUInteger)length; -- (void)downloadDriverDidDownloadUpdate; +- (void)downloadDriverDidDownloadUpdate:(SUDownloadedUpdate *)downloadedUpdate; - (void)downloadDriverDidFailToDownloadUpdateWithError:(NSError *)error; @end -@class SUAppcastItem, SUHost; - @interface SUDownloadDriver : NSObject - (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem host:(SUHost *)host userAgent:(NSString *)userAgent delegate:(id)delegate; @@ -33,8 +33,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)downloadUpdate; @property (nonatomic, readonly) NSMutableURLRequest *request; -@property (nullable, nonatomic, readonly, copy) NSString *temporaryDirectory; -@property (nullable, nonatomic, readonly, copy) NSString *downloadName; - (void)cleanup; diff --git a/Sparkle/SUDownloadDriver.m b/Sparkle/SUDownloadDriver.m index 531202f2..2fd87827 100644 --- a/Sparkle/SUDownloadDriver.m +++ b/Sparkle/SUDownloadDriver.m @@ -17,6 +17,7 @@ #import "SULog.h" #import "SUErrors.h" #import "SUURLRequest.h" +#import "SUDownloadedUpdate.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -148,7 +149,9 @@ SULog(@"Warning: Downloader's expected content length (%lu) != Appcast item's length (%lu)", self.expectedContentLength, self.updateItem.contentLength); } - [self.delegate downloadDriverDidDownloadUpdate]; + SUDownloadedUpdate *downloadedUpdate = [[SUDownloadedUpdate alloc] initWithAppcastItem:self.updateItem downloadName:self.downloadName temporaryDirectory:self.temporaryDirectory]; + + [self.delegate downloadDriverDidDownloadUpdate:downloadedUpdate]; [self cleanup]; }); } diff --git a/Sparkle/SUDownloadedUpdate.h b/Sparkle/SUDownloadedUpdate.h new file mode 100644 index 00000000..fd729dae --- /dev/null +++ b/Sparkle/SUDownloadedUpdate.h @@ -0,0 +1,25 @@ +// +// SUDownloadedUpdate.h +// Sparkle +// +// Created by Mayur Pawashe on 7/18/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class SUAppcastItem; + +@interface SUDownloadedUpdate : NSObject + +- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory; + +@property (nonatomic, readonly) SUAppcastItem *updateItem; +@property (nonatomic, copy, readonly) NSString *downloadName; +@property (nonatomic, copy, readonly) NSString *temporaryDirectory; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUDownloadedUpdate.m b/Sparkle/SUDownloadedUpdate.m new file mode 100644 index 00000000..2d7577bb --- /dev/null +++ b/Sparkle/SUDownloadedUpdate.m @@ -0,0 +1,28 @@ +// +// SUDownloadedUpdate.m +// Sparkle +// +// Created by Mayur Pawashe on 7/18/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUDownloadedUpdate.h" + +@implementation SUDownloadedUpdate + +@synthesize updateItem = _updateItem; +@synthesize downloadName = _downloadName; +@synthesize temporaryDirectory = _temporaryDirectory; + +- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory +{ + self = [super init]; + if (self != nil) { + _updateItem = updateItem; + _downloadName = [downloadName copy]; + _temporaryDirectory = [temporaryDirectory copy]; + } + return self; +} + +@end diff --git a/Sparkle/SUInstallerDriver.h b/Sparkle/SUInstallerDriver.h index f0fd63fe..f804cbef 100644 --- a/Sparkle/SUInstallerDriver.h +++ b/Sparkle/SUInstallerDriver.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol SUUpdaterDelegate; -@class SUHost, SUAppcastItem; +@class SUHost, SUAppcastItem, SUDownloadedUpdate; @protocol SUInstallerDriverDelegate @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem; -- (void)extractDownloadName:(NSString *)downloadName withUpdateItem:(SUAppcastItem *)updateItem temporaryDirectory:(NSString *)temporaryDirectory completion:(void (^)(NSError * _Nullable))completionHandler; +- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(void (^)(NSError * _Nullable))completionHandler; - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 146c7e96..864893cd 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -24,6 +24,7 @@ #import "SUInstallerConnection.h" #import "SUInstallerConnectionProtocol.h" #import "SUXPCInstallerConnection.h" +#import "SUDownloadedUpdate.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -129,11 +130,11 @@ } // This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item) -- (void)extractDownloadName:(NSString *)downloadName withUpdateItem:(SUAppcastItem *)updateItem temporaryDirectory:(NSString *)temporaryDirectory completion:(void (^)(NSError * _Nullable))completionHandler +- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(void (^)(NSError * _Nullable))completionHandler { - self.updateItem = updateItem; - self.temporaryDirectory = temporaryDirectory; - self.downloadName = downloadName; + self.updateItem = downloadedUpdate.updateItem; + self.temporaryDirectory = downloadedUpdate.temporaryDirectory; + self.downloadName = downloadedUpdate.downloadName; self.currentStage = SUInstallerNotStarted; From 345ed3b60ec97e87fe332d9154f8290dd01100e7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jul 2016 09:08:29 -0400 Subject: [PATCH 06/29] Add resuming downloaded updates without starting the installer automatically This allows automatically downloading updates, and having them prompt up later, so the user can perform authorization later for starting up the installer --- InstallerLauncher/SUAuthorizationReply.h | 3 +- InstallerLauncher/SUInstallerLauncher.m | 18 +++++---- Sparkle/SUAutomaticUpdateDriver.m | 17 ++++---- Sparkle/SUBasicUpdateDriver.h | 6 +-- Sparkle/SUBasicUpdateDriver.m | 36 +++++++++++------ Sparkle/SUCoreBasedUpdateDriver.h | 12 ++++-- Sparkle/SUCoreBasedUpdateDriver.m | 50 +++++++++++++++++++----- Sparkle/SUErrors.h | 3 +- Sparkle/SUInstallerDriver.h | 2 +- Sparkle/SUInstallerDriver.m | 35 +++++++++-------- Sparkle/SUProbingUpdateDriver.m | 18 +++++---- Sparkle/SUScheduledUpdateDriver.m | 5 +++ Sparkle/SUStandardUserDriver.m | 13 +++++- Sparkle/SUUIBasedUpdateDriver.h | 4 +- Sparkle/SUUIBasedUpdateDriver.m | 26 +++++++----- Sparkle/SUUpdateDriver.h | 6 ++- Sparkle/SUUpdater.m | 16 +++++--- Sparkle/SUUserInitiatedUpdateDriver.m | 5 +++ 18 files changed, 187 insertions(+), 88 deletions(-) diff --git a/InstallerLauncher/SUAuthorizationReply.h b/InstallerLauncher/SUAuthorizationReply.h index 1b8d0c97..3b5ef276 100644 --- a/InstallerLauncher/SUAuthorizationReply.h +++ b/InstallerLauncher/SUAuthorizationReply.h @@ -12,5 +12,6 @@ typedef NS_ENUM(NSUInteger, SUAuthorizationReply) { SUAuthorizationReplySuccess = 0, SUAuthorizationReplyCancelled = 1, - SUAuthorizationReplyFailure = 2 + SUAuthorizationReplyFailure = 2, + SUAuthorizationReplyTryAgainLater = 3 }; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 423d0f46..405a8fd3 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -175,14 +175,18 @@ submittedInstaller = ([SUSubmitInstaller submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); } - BOOL submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle allowingInteraction:allowingInteraction installerPath:installerPath shouldSubmitInstaller:!shouldSubmitInstallerImmediately]; - - if (!submittedProgressTool) { - completionHandler(SUAuthorizationReplyFailure); - } else if (shouldSubmitInstallerImmediately) { - completionHandler(submittedInstaller ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); + if (needsSystemAuthorization && !preflighted && !allowingInteraction) { + completionHandler(SUAuthorizationReplyTryAgainLater); } else { - [self waitForProgressAgentWithHostBundle:hostBundle completion:completionHandler]; + BOOL submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle allowingInteraction:allowingInteraction installerPath:installerPath shouldSubmitInstaller:!shouldSubmitInstallerImmediately]; + + if (!submittedProgressTool) { + completionHandler(SUAuthorizationReplyFailure); + } else if (shouldSubmitInstallerImmediately) { + completionHandler(submittedInstaller ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); + } else { + [self waitForProgressAgentWithHostBundle:hostBundle completion:completionHandler]; + } } }); } diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index 03840c4b..caf1518e 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -49,7 +49,7 @@ - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock { - [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO completion:completionBlock]; + [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO requiresSilentInstall:YES completion:completionBlock]; } - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn)) @@ -59,6 +59,13 @@ abort(); } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)__unused downloadedUpdate completion:(SUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn)) +{ + // Nothing really to do here.. this shouldn't be called. + SULog(@"Error: resumeDownloadedUpdate:completion: called on SUAutomaticUpdateDriver"); + abort(); +} + - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem { self.updateItem = updateItem; @@ -99,11 +106,6 @@ } } -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately -{ - return (!self.willInstallSilently || self.updateItem.isCriticalUpdate); -} - - (void)basicDriverIsRequestingAbortUpdateWithError:(NSError *)error { [self abortUpdateWithError:error]; @@ -121,7 +123,8 @@ - (void)abortUpdateWithError:(NSError *)error { - [self.coreDriver abortUpdateWithError:error]; + BOOL startNextUpdateImmediately = (error == nil) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate); + [self.coreDriver abortUpdateAndSignalShowingNextUpdateImmediately:startNextUpdateImmediately error:error]; } @end diff --git a/Sparkle/SUBasicUpdateDriver.h b/Sparkle/SUBasicUpdateDriver.h index 6939c0a8..ad62d2c7 100644 --- a/Sparkle/SUBasicUpdateDriver.h +++ b/Sparkle/SUBasicUpdateDriver.h @@ -20,8 +20,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately; - @optional - (void)basicDriverDidFinishLoadingAppcast; @@ -36,9 +34,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; + @property (nullable, nonatomic, readonly) SUAppcastItem *nonDeltaUpdateItem; -- (void)abortUpdateWithError:(nullable NSError *)error; +- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error; @end diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index acedf2e8..75c6796b 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -16,6 +16,7 @@ #import "SUAppcastItem.h" #import "SUProbeInstallStatus.h" #import "SUInstallationInfo.h" +#import "SUDownloadedUpdate.h" @interface SUBasicUpdateDriver () @@ -64,26 +65,37 @@ } } +- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem +{ + if (updateItem == nil) { + [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]]; + } else { + // Kind of lying, but triggering the notification so drivers can know when to stop showing initial fetching progress + [self notifyFinishLoadingAppcast]; + + SUAppcastItem *nonNullUpdateItem = updateItem; + [self didFindValidUpdateWithAppcastItem:nonNullUpdateItem]; + } +} + - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { self.completionBlock = completionBlock; [SUProbeInstallStatus probeInstallerUpdateItemForHost:self.host completion:^(SUInstallationInfo * _Nullable installationInfo) { dispatch_async(dispatch_get_main_queue(), ^{ - SUAppcastItem *updateItem = installationInfo.appcastItem; - if (updateItem == nil) { - [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]]; - } else { - // Kind of lying, but triggering the notification so drivers can know when to stop showing initial fetching progress - [self notifyFinishLoadingAppcast]; - - SUAppcastItem *nonNullUpdateItem = updateItem; - [self didFindValidUpdateWithAppcastItem:nonNullUpdateItem]; - } + [self notifyResumableUpdateItem:installationInfo.appcastItem]; }); }]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + self.completionBlock = completionBlock; + + [self notifyResumableUpdateItem:downloadedUpdate.updateItem]; +} + - (SUAppcastItem *)nonDeltaUpdateItem { return self.appcastDriver.nonDeltaUpdateItem; @@ -141,7 +153,7 @@ [self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError]; } -- (void)abortUpdateWithError:(nullable NSError *)error +- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error { if (error != nil) { if ([error code] != SUNoUpdateError) { // Let's not bother logging this. @@ -160,7 +172,7 @@ } if (self.completionBlock != nil) { - self.completionBlock([self.delegate basicDriverShouldSignalShowingUpdateImmediately]); + self.completionBlock(shouldSignalShowingUpdate, downloadedUpdate); self.completionBlock = nil; } } diff --git a/Sparkle/SUCoreBasedUpdateDriver.h b/Sparkle/SUCoreBasedUpdateDriver.h index 97d4d94e..3fb0e8fd 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.h +++ b/Sparkle/SUCoreBasedUpdateDriver.h @@ -25,8 +25,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately; - @optional - (void)basicDriverDidFinishLoadingAppcast; @@ -53,15 +51,21 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate; -- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock; +- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall completion:(SUUpdateDriverCompletion)completionBlock; - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; + - (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem; +- (void)extractDownloadedUpdate; + +- (void)clearDownloadedUpdate; + - (void)finishInstallationWithResponse:(SUInstallUpdateStatus)installUpdateStatus displayingUserInterface:(BOOL)displayingUserInterface; -- (void)abortUpdateWithError:(nullable NSError *)error; +- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate error:(nullable NSError *)error; @end diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 0a7ee5de..fa3845a4 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -28,9 +28,11 @@ @property (nonatomic, readonly) SUInstallerDriver *installerDriver; @property (nonatomic, weak, readonly) id delegate; @property (nonatomic) SUAppcastItem *updateItem; +@property (nonatomic) SUDownloadedUpdate *downloadedUpdate; @property (nonatomic, readonly) SUHost *host; @property (nonatomic) BOOL resumingUpdate; +@property (nonatomic) BOOL silentInstall; @property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this.. @property (nullable, nonatomic, readonly, weak) id updaterDelegate; @property (nonatomic) NSString *userAgent; @@ -46,9 +48,11 @@ @synthesize updateItem = _updateItem; @synthesize host = _host; @synthesize resumingUpdate = _resumingUpdate; +@synthesize silentInstall = _silentInstall; @synthesize updater = _updater; @synthesize updaterDelegate = _updaterDelegate; @synthesize userAgent = _userAgent; +@synthesize downloadedUpdate = _downloadedUpdate; - (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate { @@ -70,9 +74,10 @@ return self; } -- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock +- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall completion:(SUUpdateDriverCompletion)completionBlock { self.userAgent = userAgent; + self.silentInstall = silentInstall; [self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:includesSkippedUpdates completion:completionBlock]; } @@ -80,9 +85,19 @@ - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { self.resumingUpdate = YES; + self.silentInstall = NO; + [self.basicDriver resumeUpdateWithCompletion:completionBlock]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + self.downloadedUpdate = downloadedUpdate; + self.silentInstall = NO; + + [self.basicDriver resumeDownloadedUpdate:downloadedUpdate completion:completionBlock]; +} + - (void)basicDriverDidFinishLoadingAppcast { if ([self.delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) { @@ -136,15 +151,33 @@ } - (void)downloadDriverDidDownloadUpdate:(SUDownloadedUpdate *)downloadedUpdate +{ + self.downloadedUpdate = downloadedUpdate; + [self extractUpdate:downloadedUpdate]; +} + +- (void)extractDownloadedUpdate +{ + assert(self.downloadedUpdate != nil); + [self extractUpdate:self.downloadedUpdate]; +} + +- (void)clearDownloadedUpdate +{ + self.downloadedUpdate = nil; +} + +- (void)extractUpdate:(SUDownloadedUpdate *)downloadedUpdate { // Now we have to extract the downloaded archive. if ([self.delegate respondsToSelector:@selector(coreDriverDidFinishDownloadingUpdate)]) { [self.delegate coreDriverDidFinishDownloadingUpdate]; } - [self.installerDriver extractDownloadedUpdate:downloadedUpdate completion:^(NSError * _Nullable error) { + [self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) { if (error != nil) { - [self.delegate coreDriverIsRequestingAbortUpdateWithError:(error.code == SUInstallationCancelledError) ? nil : error]; + BOOL silentError = (error.code == SUInstallationCancelledError || error.code == SUInstallationTryAgainLaterError); + [self.delegate coreDriverIsRequestingAbortUpdateWithError:silentError ? nil : error]; } }]; } @@ -244,16 +277,13 @@ [self downloadUpdateFromAppcastItem:nonDeltaUpdateItem]; } -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately -{ - return [self.delegate basicDriverShouldSignalShowingUpdateImmediately]; -} - -- (void)abortUpdateWithError:(nullable NSError *)error +- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate error:(nullable NSError *)error { [self.installerDriver abortInstall]; [self.downloadDriver cleanup]; - [self.basicDriver abortUpdateWithError:error]; + + SUDownloadedUpdate *downloadedUpdate = (error == nil) ? self.downloadedUpdate : nil; + [self.basicDriver abortUpdateAndSignalShowingNextUpdateImmediately:shouldSignalShowingUpdate downloadedUpdate:downloadedUpdate error:error]; } @end diff --git a/Sparkle/SUErrors.h b/Sparkle/SUErrors.h index cbcb70f5..a5dc353d 100644 --- a/Sparkle/SUErrors.h +++ b/Sparkle/SUErrors.h @@ -54,7 +54,8 @@ typedef NS_ENUM(OSStatus, SUError) { SURelaunchError = 4004, SUInstallationError = 4005, SUDowngradeError = 4006, - SUInstallationCancelledError = 4007 + SUInstallationCancelledError = 4007, + SUInstallationTryAgainLaterError = 4008 }; #endif diff --git a/Sparkle/SUInstallerDriver.h b/Sparkle/SUInstallerDriver.h index f804cbef..6fc40490 100644 --- a/Sparkle/SUInstallerDriver.h +++ b/Sparkle/SUInstallerDriver.h @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem; -- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(void (^)(NSError * _Nullable))completionHandler; +- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler; - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 864893cd..8e079045 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -130,7 +130,7 @@ } // This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item) -- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(void (^)(NSError * _Nullable))completionHandler +- (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler { self.updateItem = downloadedUpdate.updateItem; self.temporaryDirectory = downloadedUpdate.temporaryDirectory; @@ -139,7 +139,7 @@ self.currentStage = SUInstallerNotStarted; if (self.installerConnection == nil) { - [self launchAutoUpdateWithCompletion:completionHandler]; + [self launchAutoUpdateSilently:silently completion:completionHandler]; } else { // The Install tool is already alive; just send out installation input data again [self sendInstallationData]; @@ -372,7 +372,7 @@ return cachePath; } -- (void)launchAutoUpdateWithCompletion:(void (^)(NSError *_Nullable))completionHandler +- (void)launchAutoUpdateSilently:(BOOL)silently completion:(void (^)(NSError *_Nullable))completionHandler { // Copy the relauncher into a temporary directory so we can get to it after the new version's installed. // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. @@ -426,7 +426,8 @@ installerLauncher = launcherConnection.remoteObjectProxy; } - BOOL shouldAllowInstallerInteraction = NO; +#warning review this... + BOOL shouldAllowInstallerInteraction = !silently; if ([self.updaterDelegate respondsToSelector:@selector(updaterShouldAllowInstallerInteraction:)]) { shouldAllowInstallerInteraction = [self.updaterDelegate updaterShouldAllowInstallerInteraction:self.updater]; } @@ -440,18 +441,20 @@ retrievedLaunchStatus = YES; [launcherConnection invalidate]; - if (result == SUAuthorizationReplyFailure) { - NSError *error = - [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while launching the installer. Please try again later.", nil) }]; - - completionHandler(error); - } else if (result == SUAuthorizationReplyCancelled) { - NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:nil]; - completionHandler(error); - } else { - [self setUpConnection]; - - completionHandler(nil); + switch (result) { + case SUAuthorizationReplyFailure: + completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while launching the installer. Please try again later.", nil) }]); + break; + case SUAuthorizationReplyCancelled: + completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:nil]); + break; + case SUAuthorizationReplyTryAgainLater: + completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationTryAgainLaterError userInfo:nil]); + break; + case SUAuthorizationReplySuccess: + [self setUpConnection]; + completionHandler(nil); + break; } }); }]; diff --git a/Sparkle/SUProbingUpdateDriver.m b/Sparkle/SUProbingUpdateDriver.m index 422fccb8..21cdfb1d 100644 --- a/Sparkle/SUProbingUpdateDriver.m +++ b/Sparkle/SUProbingUpdateDriver.m @@ -16,12 +16,14 @@ @interface SUProbingUpdateDriver () @property (nonatomic, readonly) SUBasicUpdateDriver *basicDriver; +@property (nonatomic) SUDownloadedUpdate *downloadedUpdate; @end @implementation SUProbingUpdateDriver @synthesize basicDriver = _basicDriver; +@synthesize downloadedUpdate = _downloadedUpdate; - (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id )updaterDelegate { @@ -37,16 +39,18 @@ [self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO completion:completionBlock]; } -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately -{ - return NO; -} - - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { [self.basicDriver resumeUpdateWithCompletion:completionBlock]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + self.downloadedUpdate = downloadedUpdate; + + [self.basicDriver resumeDownloadedUpdate:downloadedUpdate completion:completionBlock]; +} + - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem { // Stop as soon as we have an answer @@ -55,9 +59,7 @@ - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error { - [self abortUpdateWithError:error]; - } - (void)abortUpdate @@ -67,7 +69,7 @@ - (void)abortUpdateWithError:(nullable NSError *)error { - [self.basicDriver abortUpdateWithError:error]; + [self.basicDriver abortUpdateAndSignalShowingNextUpdateImmediately:NO downloadedUpdate:self.downloadedUpdate error:error]; } @end diff --git a/Sparkle/SUScheduledUpdateDriver.m b/Sparkle/SUScheduledUpdateDriver.m index 6bc7483d..dd31f8e7 100644 --- a/Sparkle/SUScheduledUpdateDriver.m +++ b/Sparkle/SUScheduledUpdateDriver.m @@ -45,6 +45,11 @@ [self.uiDriver resumeUpdateWithCompletion:completionBlock]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + [self.uiDriver resumeDownloadedUpdate:downloadedUpdate completion:completionBlock]; +} + - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)__unused error { // Don't tell the user that no update was found or some appcast fetch error occurred for scheduled update checks diff --git a/Sparkle/SUStandardUserDriver.m b/Sparkle/SUStandardUserDriver.m index b0f250fe..be0741e4 100644 --- a/Sparkle/SUStandardUserDriver.m +++ b/Sparkle/SUStandardUserDriver.m @@ -318,15 +318,22 @@ #pragma mark Download & Install Updates +- (void)showStatusController +{ + if (self.statusController == nil) { + self.statusController = [[SUStatusController alloc] initWithHost:self.host]; + [self.statusController showWindow:self]; + } +} + - (void)showDownloadInitiatedWithCompletion:(void (^)(SUDownloadUpdateStatus))downloadUpdateStatusCompletion { dispatch_async(dispatch_get_main_queue(), ^{ [self.coreComponent registerDownloadStatusHandler:downloadUpdateStatusCompletion]; - self.statusController = [[SUStatusController alloc] initWithHost:self.host]; + [self showStatusController]; [self.statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil]; [self.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO]; - [self.statusController showWindow:self]; }); } @@ -364,7 +371,9 @@ dispatch_async(dispatch_get_main_queue(), ^{ [self.coreComponent completeDownloadStatus]; + [self showStatusController]; [self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil]; + [self.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:nil action:nil isDefault:NO]; [self.statusController setButtonEnabled:NO]; }); } diff --git a/Sparkle/SUUIBasedUpdateDriver.h b/Sparkle/SUUIBasedUpdateDriver.h index 443352df..37161ac7 100644 --- a/Sparkle/SUUIBasedUpdateDriver.h +++ b/Sparkle/SUUIBasedUpdateDriver.h @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @end -@class SUHost; +@class SUHost, SUDownloadedUpdate; @protocol SUUserDriver, SUUpdaterDelegate; @interface SUUIBasedUpdateDriver : NSObject @@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; + - (void)abortUpdateWithError:(nullable NSError *)error; @end diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 8a4d61f7..ca68b8b2 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -29,6 +29,7 @@ @property (nonatomic, weak, readonly) id delegate; @property (nonatomic, readonly) id userDriver; @property (nonatomic) BOOL resumingUpdate; +@property (nonatomic) BOOL resumingDownloadedUpdate; @end @@ -41,6 +42,7 @@ @synthesize userDriver = _userDriver; @synthesize delegate = _delegate; @synthesize resumingUpdate = _resumingUpdate; +@synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate; - (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate { @@ -59,7 +61,7 @@ - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock { - [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:includesSkippedUpdates completion:completionBlock]; + [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:includesSkippedUpdates requiresSilentInstall:NO completion:completionBlock]; } - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock @@ -68,6 +70,12 @@ [self.coreDriver resumeUpdateWithCompletion:completionBlock]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + self.resumingDownloadedUpdate = YES; + [self.coreDriver resumeDownloadedUpdate:downloadedUpdate completion:completionBlock]; +} + - (void)basicDriverDidFinishLoadingAppcast { if ([self.delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) { @@ -77,15 +85,20 @@ - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem { - if (!self.resumingUpdate) { + if (!self.resumingUpdate || self.resumingDownloadedUpdate) { [self.userDriver showUpdateFoundWithAppcastItem:updateItem reply:^(SUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { case SUInstallUpdateChoice: - [self.coreDriver downloadUpdateFromAppcastItem:updateItem]; + if (!self.resumingDownloadedUpdate) { + [self.coreDriver downloadUpdateFromAppcastItem:updateItem]; + } else { + [self.coreDriver extractDownloadedUpdate]; + } break; case SUSkipThisVersionChoice: + [self.coreDriver clearDownloadedUpdate]; [self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; // Fall through case SUInstallLaterChoice: @@ -183,11 +196,6 @@ [self.userDriver showUpdateInstallationDidFinish]; } -- (BOOL)basicDriverShouldSignalShowingUpdateImmediately -{ - return NO; -} - - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error { // A delegate may want to handle this type of error specially @@ -203,7 +211,7 @@ { void (^abortUpdate)(void) = ^{ [self.userDriver dismissUpdateInstallation]; - [self.coreDriver abortUpdateWithError:error]; + [self.coreDriver abortUpdateAndSignalShowingNextUpdateImmediately:NO error:error]; }; if (error != nil) { diff --git a/Sparkle/SUUpdateDriver.h b/Sparkle/SUUpdateDriver.h index 8c925404..08d8a633 100644 --- a/Sparkle/SUUpdateDriver.h +++ b/Sparkle/SUUpdateDriver.h @@ -8,7 +8,9 @@ NS_ASSUME_NONNULL_BEGIN -typedef void (^SUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately); +@class SUDownloadedUpdate; + +typedef void (^SUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, SUDownloadedUpdate * _Nullable resumableUpdate); @protocol SUUpdateDriver @@ -16,6 +18,8 @@ typedef void (^SUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately); - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; + - (void)abortUpdate; @end diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index f614acad..8deeb9ac 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -27,6 +27,7 @@ #import "SUErrors.h" #import "SUXPCServiceInfo.h" #import "SUUpdaterCycle.h" +#import "SUDownloadedUpdate.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -49,6 +50,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @property (nonatomic, readonly) SUUpdaterCycle *updaterCycle; @property (nonatomic) BOOL startedUpdater; @property (nonatomic, copy) void (^preStartedScheduledUpdateBlock)(void); +@property (nonatomic, nullable) SUDownloadedUpdate *resumableUpdate; @end @@ -65,6 +67,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @synthesize sparkleBundle = _sparkleBundle; @synthesize startedUpdater = _startedUpdater; @synthesize preStartedScheduledUpdateBlock = _preStartedScheduledUpdateBlock; +@synthesize resumableUpdate = _resumableUpdate; #ifdef DEBUG + (void)load @@ -376,7 +379,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification } id updateDriver; - if (!installerIsRunning && [strongSelf automaticallyDownloadsUpdates] && [strongSelf allowsAutomaticUpdates]) { + if (!installerIsRunning && [strongSelf automaticallyDownloadsUpdates] && [strongSelf allowsAutomaticUpdates] && strongSelf.resumableUpdate == nil) { updateDriver = [[SUAutomaticUpdateDriver alloc] initWithHost:strongSelf.host @@ -479,9 +482,10 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification // Use a NIL URL to cancel quietly. if (theFeedURL) { __weak SUUpdater *weakSelf = self; - SUUpdateDriverCompletion completionBlock = ^(BOOL shouldShowUpdateImmediately) { + SUUpdateDriverCompletion completionBlock = ^(BOOL shouldShowUpdateImmediately, SUDownloadedUpdate * _Nullable resumableUpdate) { SUUpdater *strongSelf = weakSelf; if (strongSelf != nil) { + strongSelf.resumableUpdate = resumableUpdate; strongSelf.driver = nil; [strongSelf updateLastUpdateCheckDate]; [strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately]; @@ -490,10 +494,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification [self.userDriver showCanCheckForUpdates:NO]; - if (!installerInProgress) { - [self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders] completion:completionBlock]; - } else { + if (installerInProgress) { [self.driver resumeUpdateWithCompletion:completionBlock]; + } else if (self.resumableUpdate != nil) { + [self.driver resumeDownloadedUpdate:(SUDownloadedUpdate * _Nonnull)self.resumableUpdate completion:completionBlock]; + } else { + [self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders] completion:completionBlock]; } } else { [self.driver abortUpdate]; diff --git a/Sparkle/SUUserInitiatedUpdateDriver.m b/Sparkle/SUUserInitiatedUpdateDriver.m index 21b9b586..c6e62fa3 100644 --- a/Sparkle/SUUserInitiatedUpdateDriver.m +++ b/Sparkle/SUUserInitiatedUpdateDriver.m @@ -65,6 +65,11 @@ [self.uiDriver resumeUpdateWithCompletion:completionBlock]; } +- (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock +{ + [self.uiDriver resumeDownloadedUpdate:downloadedUpdate completion:completionBlock]; +} + - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error { [self abortUpdateWithError:error]; From 350aeb1c81b8006e489209e0b092e4d85743d364 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jul 2016 13:50:14 -0400 Subject: [PATCH 07/29] Change how errors are passed & clear download after installer starts --- Sparkle/SUAutomaticUpdateDriver.m | 5 +++-- Sparkle/SUBasicUpdateDriver.h | 2 +- Sparkle/SUBasicUpdateDriver.m | 6 +++--- Sparkle/SUCoreBasedUpdateDriver.h | 2 +- Sparkle/SUCoreBasedUpdateDriver.m | 13 ++++++++----- Sparkle/SUProbingUpdateDriver.m | 2 +- Sparkle/SUUIBasedUpdateDriver.m | 4 +++- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index caf1518e..d84d4ff5 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -13,6 +13,7 @@ #import "SUCoreBasedUpdateDriver.h" #import "SULog.h" #import "SUAppcastItem.h" +#import "SUErrors.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -123,8 +124,8 @@ - (void)abortUpdateWithError:(NSError *)error { - BOOL startNextUpdateImmediately = (error == nil) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate); - [self.coreDriver abortUpdateAndSignalShowingNextUpdateImmediately:startNextUpdateImmediately error:error]; + BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationTryAgainLaterError) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate); + [self.coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error]; } @end diff --git a/Sparkle/SUBasicUpdateDriver.h b/Sparkle/SUBasicUpdateDriver.h index ad62d2c7..7ae89b28 100644 --- a/Sparkle/SUBasicUpdateDriver.h +++ b/Sparkle/SUBasicUpdateDriver.h @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, readonly) SUAppcastItem *nonDeltaUpdateItem; -- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error; +- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error; @end diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 75c6796b..7859d063 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -153,10 +153,10 @@ [self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError]; } -- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error +- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error { if (error != nil) { - if ([error code] != SUNoUpdateError) { // Let's not bother logging this. + if (error.code != SUNoUpdateError && error.code != SUInstallationCancelledError && error.code != SUInstallationTryAgainLaterError) { // Let's not bother logging this. NSError *errorToDisplay = error; int finiteRecursion=5; do { @@ -172,7 +172,7 @@ } if (self.completionBlock != nil) { - self.completionBlock(shouldSignalShowingUpdate, downloadedUpdate); + self.completionBlock(shouldShowUpdateImmediately, downloadedUpdate); self.completionBlock = nil; } } diff --git a/Sparkle/SUCoreBasedUpdateDriver.h b/Sparkle/SUCoreBasedUpdateDriver.h index 3fb0e8fd..e8289c86 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.h +++ b/Sparkle/SUCoreBasedUpdateDriver.h @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)finishInstallationWithResponse:(SUInstallUpdateStatus)installUpdateStatus displayingUserInterface:(BOOL)displayingUserInterface; -- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate error:(nullable NSError *)error; +- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error; @end diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index fa3845a4..aaad1867 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -176,8 +176,11 @@ [self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) { if (error != nil) { - BOOL silentError = (error.code == SUInstallationCancelledError || error.code == SUInstallationTryAgainLaterError); - [self.delegate coreDriverIsRequestingAbortUpdateWithError:silentError ? nil : error]; + [self.delegate coreDriverIsRequestingAbortUpdateWithError:error]; + } else { + // If the installer started properly, we can't use the downloaded update archive anymore + // Especially if the installer fails later and we try resuming the update with a missing archive file + [self clearDownloadedUpdate]; } }]; } @@ -277,13 +280,13 @@ [self downloadUpdateFromAppcastItem:nonDeltaUpdateItem]; } -- (void)abortUpdateAndSignalShowingNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate error:(nullable NSError *)error +- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error { [self.installerDriver abortInstall]; [self.downloadDriver cleanup]; - SUDownloadedUpdate *downloadedUpdate = (error == nil) ? self.downloadedUpdate : nil; - [self.basicDriver abortUpdateAndSignalShowingNextUpdateImmediately:shouldSignalShowingUpdate downloadedUpdate:downloadedUpdate error:error]; + SUDownloadedUpdate *downloadedUpdate = (error == nil || error.code == SUInstallationTryAgainLaterError) ? self.downloadedUpdate : nil; + [self.basicDriver abortUpdateAndShowNextUpdateImmediately:shouldShowUpdateImmediately downloadedUpdate:downloadedUpdate error:error]; } @end diff --git a/Sparkle/SUProbingUpdateDriver.m b/Sparkle/SUProbingUpdateDriver.m index 21cdfb1d..c61f7fd6 100644 --- a/Sparkle/SUProbingUpdateDriver.m +++ b/Sparkle/SUProbingUpdateDriver.m @@ -69,7 +69,7 @@ - (void)abortUpdateWithError:(nullable NSError *)error { - [self.basicDriver abortUpdateAndSignalShowingNextUpdateImmediately:NO downloadedUpdate:self.downloadedUpdate error:error]; + [self.basicDriver abortUpdateAndShowNextUpdateImmediately:NO downloadedUpdate:self.downloadedUpdate error:error]; } @end diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index ca68b8b2..c5d80d7e 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -211,7 +211,7 @@ { void (^abortUpdate)(void) = ^{ [self.userDriver dismissUpdateInstallation]; - [self.coreDriver abortUpdateAndSignalShowingNextUpdateImmediately:NO error:error]; + [self.coreDriver abortUpdateAndShowNextUpdateImmediately:NO error:error]; }; if (error != nil) { @@ -223,6 +223,8 @@ abortUpdate(); }); }]; + } else if (error.code == SUInstallationCancelledError || error.code == SUInstallationTryAgainLaterError) { + abortUpdate(); } else { [self.userDriver showUpdaterError:nonNullError acknowledgement:^{ dispatch_async(dispatch_get_main_queue(), ^{ From c2db46f6563b1755ceeb3cc49c664ac55e7588fe Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jul 2016 14:46:35 -0400 Subject: [PATCH 08/29] Add error codes to log messages --- InstallerLauncher/SUSubmitInstaller.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InstallerLauncher/SUSubmitInstaller.m b/InstallerLauncher/SUSubmitInstaller.m index 47f93c30..1efc9ec6 100644 --- a/InstallerLauncher/SUSubmitInstaller.m +++ b/InstallerLauncher/SUSubmitInstaller.m @@ -35,7 +35,7 @@ OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); if (createStatus != errAuthorizationSuccess) { auth = NULL; - SULog(@"Failed to create authorization reference"); + SULog(@"Failed to create authorization reference: %d", createStatus); } BOOL canceledAuthorization = NO; @@ -55,7 +55,7 @@ OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); if (copyStatus != errAuthorizationSuccess) { - SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons"); + SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons: %d", copyStatus); failedToUseSystemDomain = YES; if (copyStatus == errAuthorizationCanceled) { From 41ee168f2cde64d1963257467467195cf17d952f Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jul 2016 14:49:19 -0400 Subject: [PATCH 09/29] Change try again error to authorize later error --- InstallerLauncher/SUAuthorizationReply.h | 2 +- InstallerLauncher/SUInstallerLauncher.m | 2 +- Sparkle/SUAutomaticUpdateDriver.m | 2 +- Sparkle/SUBasicUpdateDriver.m | 2 +- Sparkle/SUCoreBasedUpdateDriver.m | 2 +- Sparkle/SUErrors.h | 2 +- Sparkle/SUInstallerDriver.m | 4 ++-- Sparkle/SUUIBasedUpdateDriver.m | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/InstallerLauncher/SUAuthorizationReply.h b/InstallerLauncher/SUAuthorizationReply.h index 3b5ef276..941bd17a 100644 --- a/InstallerLauncher/SUAuthorizationReply.h +++ b/InstallerLauncher/SUAuthorizationReply.h @@ -13,5 +13,5 @@ typedef NS_ENUM(NSUInteger, SUAuthorizationReply) SUAuthorizationReplySuccess = 0, SUAuthorizationReplyCancelled = 1, SUAuthorizationReplyFailure = 2, - SUAuthorizationReplyTryAgainLater = 3 + SUAuthorizationReplyAuthorizeLater = 3 }; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 405a8fd3..90d01c30 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -176,7 +176,7 @@ } if (needsSystemAuthorization && !preflighted && !allowingInteraction) { - completionHandler(SUAuthorizationReplyTryAgainLater); + completionHandler(SUAuthorizationReplyAuthorizeLater); } else { BOOL submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle allowingInteraction:allowingInteraction installerPath:installerPath shouldSubmitInstaller:!shouldSubmitInstallerImmediately]; diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index d84d4ff5..a07c7013 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -124,7 +124,7 @@ - (void)abortUpdateWithError:(NSError *)error { - BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationTryAgainLaterError) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate); + BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate); [self.coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error]; } diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 7859d063..0daca9f4 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -156,7 +156,7 @@ - (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error { if (error != nil) { - if (error.code != SUNoUpdateError && error.code != SUInstallationCancelledError && error.code != SUInstallationTryAgainLaterError) { // Let's not bother logging this. + if (error.code != SUNoUpdateError && error.code != SUInstallationCancelledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this. NSError *errorToDisplay = error; int finiteRecursion=5; do { diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index aaad1867..5ab29075 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -285,7 +285,7 @@ [self.installerDriver abortInstall]; [self.downloadDriver cleanup]; - SUDownloadedUpdate *downloadedUpdate = (error == nil || error.code == SUInstallationTryAgainLaterError) ? self.downloadedUpdate : nil; + SUDownloadedUpdate *downloadedUpdate = (error == nil || error.code == SUInstallationAuthorizeLaterError) ? self.downloadedUpdate : nil; [self.basicDriver abortUpdateAndShowNextUpdateImmediately:shouldShowUpdateImmediately downloadedUpdate:downloadedUpdate error:error]; } diff --git a/Sparkle/SUErrors.h b/Sparkle/SUErrors.h index a5dc353d..ec68ebac 100644 --- a/Sparkle/SUErrors.h +++ b/Sparkle/SUErrors.h @@ -55,7 +55,7 @@ typedef NS_ENUM(OSStatus, SUError) { SUInstallationError = 4005, SUDowngradeError = 4006, SUInstallationCancelledError = 4007, - SUInstallationTryAgainLaterError = 4008 + SUInstallationAuthorizeLaterError = 4008 }; #endif diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 8e079045..3d31944a 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -448,8 +448,8 @@ case SUAuthorizationReplyCancelled: completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:nil]); break; - case SUAuthorizationReplyTryAgainLater: - completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationTryAgainLaterError userInfo:nil]); + case SUAuthorizationReplyAuthorizeLater: + completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationAuthorizeLaterError userInfo:nil]); break; case SUAuthorizationReplySuccess: [self setUpConnection]; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index c5d80d7e..4c092e28 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -223,7 +223,7 @@ abortUpdate(); }); }]; - } else if (error.code == SUInstallationCancelledError || error.code == SUInstallationTryAgainLaterError) { + } else if (error.code == SUInstallationCancelledError || error.code == SUInstallationAuthorizeLaterError) { abortUpdate(); } else { [self.userDriver showUpdaterError:nonNullError acknowledgement:^{ From 320002915765e6793f3a58037a45c483ad47f321 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jul 2016 23:31:00 -0400 Subject: [PATCH 10/29] Include adopted protocol methods in SUInstallerStatusProtocol This is because of compatibility issues with 10.8 --- InstallerStatus/SUInstallerStatusProtocol.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/InstallerStatus/SUInstallerStatusProtocol.h b/InstallerStatus/SUInstallerStatusProtocol.h index 0a73e226..bc7c2d88 100644 --- a/InstallerStatus/SUInstallerStatusProtocol.h +++ b/InstallerStatus/SUInstallerStatusProtocol.h @@ -9,9 +9,17 @@ #import #import "SUStatusInfoProtocol.h" +NS_ASSUME_NONNULL_BEGIN + // The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service. @protocol SUInstallerStatusProtocol +// Even though this is declared in SUStatusInfoProtocol, we should declare it here because macOS 10.8 doesn't traverse adopted protocols +- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply; + +// Even though this is declared in SUStatusInfoProtocol, we should declare it here because macOS 10.8 doesn't traverse adopted protocols +- (void)probeStatusConnectivityWithReply:(void (^)(void))reply; + - (void)setInvalidationHandler:(void (^)(void))invalidationHandler; - (void)setServiceName:(NSString *)serviceName; @@ -19,3 +27,5 @@ - (void)invalidate; @end + +NS_ASSUME_NONNULL_END From 21ad3587721c275172daeb199722f16694a23ed0 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 11:06:37 -0400 Subject: [PATCH 11/29] Add JoinExistingSession key to InstallerLauncher service This is necessary for older OS versions (10.8 & 10.9), otherwise authorization interaction will not be allowed --- InstallerLauncher/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/InstallerLauncher/Info.plist b/InstallerLauncher/Info.plist index 5bdbec87..7d209361 100644 --- a/InstallerLauncher/Info.plist +++ b/InstallerLauncher/Info.plist @@ -26,6 +26,8 @@ ServiceType Application + JoinExistingSession + From a1d43997d9b524a4595301a7bd38f053f7ccaa72 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 13:03:39 -0400 Subject: [PATCH 12/29] With JoinExistingSession, the agent doesn't need to submit the intaller ever --- InstallerLauncher/InstallerProgressLauncher.h | 30 ---- InstallerLauncher/InstallerProgressLauncher.m | 140 ------------------ InstallerLauncher/SUInstallerLauncher.m | 110 +++----------- .../SUInstallerProgressLauncherProtocol.h | 24 --- Sparkle.xcodeproj/project.pbxproj | 10 +- .../InstallerProgressAppController.m | 48 +----- 6 files changed, 26 insertions(+), 336 deletions(-) delete mode 100644 InstallerLauncher/InstallerProgressLauncher.h delete mode 100644 InstallerLauncher/InstallerProgressLauncher.m delete mode 100644 InstallerLauncher/SUInstallerProgressLauncherProtocol.h diff --git a/InstallerLauncher/InstallerProgressLauncher.h b/InstallerLauncher/InstallerProgressLauncher.h deleted file mode 100644 index 0e1e6d6e..00000000 --- a/InstallerLauncher/InstallerProgressLauncher.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// InstallerProgressLauncher.h -// Sparkle -// -// Created by Mayur Pawashe on 7/17/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol InstallerProgressLauncherDelegate - -- (void)installerProgressLauncherDidInvalidate; -- (void)installerProgressLauncherDidSubmitJob; - -@end - -@interface InstallerProgressLauncher : NSObject - -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle installerPath:(NSString *)installerPath allowingInteraction:(BOOL)allowingInteraction delegate:(id)delegate; - -- (void)startListener; - -- (void)invalidate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/InstallerLauncher/InstallerProgressLauncher.m b/InstallerLauncher/InstallerProgressLauncher.m deleted file mode 100644 index 79903605..00000000 --- a/InstallerLauncher/InstallerProgressLauncher.m +++ /dev/null @@ -1,140 +0,0 @@ -// -// InstallerProgressLauncher.m -// Sparkle -// -// Created by Mayur Pawashe on 7/17/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "InstallerProgressLauncher.h" -#import "SUMessageTypes.h" -#import "SUInstallerProgressLauncherProtocol.h" -#import "SUSubmitInstaller.h" -#import "SULog.h" - -#define REQUEST_AUTHORIZATION_TIMEOUT 7ull - -@interface InstallerProgressLauncher () - -@property (nonatomic) NSXPCListener *xpcListener; -@property (nonatomic) NSXPCConnection *activeConnection; -@property (nonatomic, readonly) NSBundle *hostBundle; -@property (nonatomic, copy, readonly) NSString *installerPath; -@property (nonatomic, readonly) BOOL allowsInteraction; -@property (nonatomic, weak) id delegate; -@property (nonatomic) BOOL connected; - -@end - -@implementation InstallerProgressLauncher - -@synthesize xpcListener = _xpcListener; -@synthesize activeConnection = _activeConnection; -@synthesize hostBundle = _hostBundle; -@synthesize installerPath = _installerPath; -@synthesize allowsInteraction = _allowsInteraction; -@synthesize delegate = _delegate; -@synthesize connected = _connected; - -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle installerPath:(NSString *)installerPath allowingInteraction:(BOOL)allowingInteraction delegate:(id)delegate -{ - self = [super init]; - if (self != nil) { - NSString *bundleIdentifier = hostBundle.bundleIdentifier; - assert(bundleIdentifier != nil); - - _hostBundle = hostBundle; - _installerPath = [installerPath copy]; - _allowsInteraction = allowingInteraction; - _delegate = delegate; - - _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUProgressAgentLauncherServiceNameForBundleIdentifier(bundleIdentifier)]; - _xpcListener.delegate = self; - } - return self; -} - -- (void)startListener -{ - [self.xpcListener resume]; -} - -- (void)invalidate -{ - // Declare local variable for the delegate, so that if the delegate invokes -invalidate, we won't be in an infinite recursion - id delegate = self.delegate; - self.delegate = nil; - [delegate installerProgressLauncherDidInvalidate]; - - [self.activeConnection invalidate]; - [self.xpcListener invalidate]; - - self.activeConnection = nil; - self.xpcListener = nil; -} - -- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)connection -{ - if (self.activeConnection != nil) { - SULog(@"Error: active connection for progress launcher already exists"); - [connection invalidate]; - return NO; - } - - connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerProgressLauncherProtocol)]; - connection.exportedObject = self; - - self.activeConnection = connection; - - __weak InstallerProgressLauncher *weakSelf = self; - connection.interruptionHandler = ^{ - [weakSelf.activeConnection invalidate]; - }; - - connection.invalidationHandler = ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - InstallerProgressLauncher *strongSelf = weakSelf; - if (strongSelf != nil) { - strongSelf.activeConnection = nil; - [strongSelf invalidate]; - } - }); - }; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(REQUEST_AUTHORIZATION_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - SULog(@"Dispatch timeout invoked"); - if (!self.connected) { - [self invalidate]; - } - }); - - [connection resume]; - - return YES; -} - -- (void)requestUserAuthorizationWithReply:(void (^)(SUAuthorizationReply))reply -{ - dispatch_async(dispatch_get_main_queue(), ^{ - self.connected = YES; - - SUAuthorizationReply submissionReply = [SUSubmitInstaller submitInstallerAtPath:self.installerPath withHostBundle:self.hostBundle allowingInteraction:self.allowsInteraction inSystemDomain:YES]; - - if (submissionReply == SUAuthorizationReplyFailure) { - SULog(@"Error: failed to submit installer in system domain"); - } - - reply(submissionReply); - - if (submissionReply == SUAuthorizationReplySuccess) { - [self.delegate installerProgressLauncherDidSubmitJob]; - } - }); -} - -- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement -{ - acknowledgement(); -} - -@end diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 90d01c30..8b4ee411 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -12,21 +12,10 @@ #import "SUMessageTypes.h" #import "SUSystemAuthorization.h" #import "SUSubmitInstaller.h" -#import "SUInstallerProgressLauncherProtocol.h" - -#define AUTHORIZATION_REPLY_TIMEOUT 7ull - -@interface SUInstallerLauncher () - -@property (nonatomic, nullable) NSXPCConnection *activeConnection; - -@end @implementation SUInstallerLauncher -@synthesize activeConnection = _activeConnection; - -- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction installerPath:(NSString *)installerPath shouldSubmitInstaller:(BOOL)shouldSubmitInstaller +- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle inSystemDomainForInstaller:(BOOL)inSystemDomainForInstaller { SUFileManager *fileManager = [SUFileManager defaultManager]; @@ -47,7 +36,7 @@ NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; assert(hostBundleIdentifier != nil); - NSArray *arguments = @[executablePath, hostBundlePath, @(allowingInteraction).stringValue, installerPath, @(shouldSubmitInstaller).stringValue]; + NSArray *arguments = @[executablePath, hostBundlePath, @(inSystemDomainForInstaller).stringValue]; #warning support running under system domain if updater is running as root - this means we would have to try running job under a different user CFStringRef domain = kSMDomainUserLaunchd; @@ -79,14 +68,7 @@ jobDictionary[@"RunAtLoad"] = @NO; jobDictionary[@"NICE"] = @0; jobDictionary[@"LaunchOnlyOnce"] = @YES; - - NSMutableDictionary *machServicesDictionary = [[NSMutableDictionary alloc] init]; - machServicesDictionary[SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier)] = @YES; - if (shouldSubmitInstaller) { - machServicesDictionary[SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier)] = @YES; - } - - jobDictionary[@"MachServices"] = [machServicesDictionary copy]; + jobDictionary[@"MachServices"] = @{SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}; CFErrorRef submitError = NULL; submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); @@ -103,90 +85,34 @@ return (submittedJob == true); } -- (void)waitForProgressAgentWithHostBundle:(NSBundle *)hostBundle completion:(void (^)(SUAuthorizationReply))completionHandler -{ - NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; - assert(hostBundleIdentifier != nil); - - NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentLauncherServiceNameForBundleIdentifier(hostBundleIdentifier) options:(NSXPCConnectionOptions)0]; - - connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerProgressLauncherProtocol)]; - - self.activeConnection = connection; - - __weak SUInstallerLauncher *weakSelf = self; - connection.interruptionHandler = ^{ - [weakSelf.activeConnection invalidate]; - }; - - __block BOOL invokedCompletion = NO; - - connection.invalidationHandler = ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - if (!invokedCompletion) { - invokedCompletion = YES; - completionHandler(SUAuthorizationReplyFailure); - } - }); - }; - - [connection resume]; - - id launcher = connection.remoteObjectProxy; - - __block BOOL intiatedConnection = NO; - [launcher connectionDidInitiateWithReply:^{ - dispatch_async(dispatch_get_main_queue(), ^{ - intiatedConnection = YES; - - [launcher requestUserAuthorizationWithReply:^(SUAuthorizationReply reply) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (!invokedCompletion) { - invokedCompletion = YES; - [weakSelf.activeConnection invalidate]; - completionHandler(reply); - } - }); - }]; - }); - }]; - - // If we initiated a connection, we can't time out because the user could just be taking a really long time to reply - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AUTHORIZATION_REPLY_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - if (!intiatedConnection && !invokedCompletion) { - [weakSelf.activeConnection invalidate]; - } - }); -} - - (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; - BOOL submittedInstaller = NO; BOOL preflighted = NO; - - // Only submit a job here if we are preflighted (already running root in which case we use system domain), - // or if we do not have to ask the user for authorization BOOL needsSystemAuthorization = SUNeedsSystemAuthorizationAccess(hostBundlePath, guidedInstallation, &preflighted); - BOOL shouldSubmitInstallerImmediately = (!needsSystemAuthorization || preflighted); - if (shouldSubmitInstallerImmediately) { - submittedInstaller = ([SUSubmitInstaller submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); - } + // if we need to use the system domain and we aren't already root and we aren't allowed interaction, then try sometime later when interaction is allowed if (needsSystemAuthorization && !preflighted && !allowingInteraction) { completionHandler(SUAuthorizationReplyAuthorizeLater); } else { - BOOL submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle allowingInteraction:allowingInteraction installerPath:installerPath shouldSubmitInstaller:!shouldSubmitInstallerImmediately]; + BOOL submittedInstaller = ([SUSubmitInstaller submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); - if (!submittedProgressTool) { - completionHandler(SUAuthorizationReplyFailure); - } else if (shouldSubmitInstallerImmediately) { - completionHandler(submittedInstaller ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); - } else { - [self waitForProgressAgentWithHostBundle:hostBundle completion:completionHandler]; + if (!submittedInstaller) { + SULog(@"Failed to submit installer job"); } + + BOOL submittedProgressTool = NO; + if (submittedInstaller) { + submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:needsSystemAuthorization]; + + if (!submittedProgressTool) { + SULog(@"Failed to submit progress tool job"); + } + } + + completionHandler(submittedProgressTool ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); } }); } diff --git a/InstallerLauncher/SUInstallerProgressLauncherProtocol.h b/InstallerLauncher/SUInstallerProgressLauncherProtocol.h deleted file mode 100644 index dc30099b..00000000 --- a/InstallerLauncher/SUInstallerProgressLauncherProtocol.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SUInstallerProgressLauncherProtocol.h -// Sparkle -// -// Created by Mayur Pawashe on 7/17/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SUInstallerAgentInitiationProtocol.h" -#import "SUAuthorizationReply.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol SUInstallerProgressLauncherProtocol - -- (void)requestUserAuthorizationWithReply:(void (^)(SUAuthorizationReply))reply; - -// Redeclare this method from SUInstallerAgentInitiationProtocol because XPC decoders on older OS systems (eg: 10.8) do not traverse parent protocols -- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 32bc7445..c690a9e7 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -102,7 +102,6 @@ 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B071C82C9600013C1C5 /* SULocalizations.h */; }; 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; - 721652651D3C744700FD13D8 /* InstallerProgressLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */; }; 721BC20E1D1CDE55002BC71E /* SULocalCacheDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 721BC20C1D1CDE55002BC71E /* SULocalCacheDirectory.h */; }; 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; 721BC2101D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; @@ -760,9 +759,6 @@ 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUParameterAssert.h; sourceTree = ""; }; 72162B071C82C9600013C1C5 /* SULocalizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULocalizations.h; sourceTree = ""; }; - 721652631D3C744700FD13D8 /* InstallerProgressLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressLauncher.h; path = InstallerLauncher/InstallerProgressLauncher.h; sourceTree = SOURCE_ROOT; }; - 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressLauncher.m; path = InstallerLauncher/InstallerProgressLauncher.m; sourceTree = SOURCE_ROOT; }; - 721652661D3C76E500FD13D8 /* SUInstallerProgressLauncherProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstallerProgressLauncherProtocol.h; path = InstallerLauncher/SUInstallerProgressLauncherProtocol.h; sourceTree = SOURCE_ROOT; }; 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUAuthorizationReply.h; path = InstallerLauncher/SUAuthorizationReply.h; sourceTree = SOURCE_ROOT; }; 721BC2061D17A532002BC71E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 721BC2081D17A553002BC71E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; @@ -1557,10 +1553,6 @@ 722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */, 72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */, 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */, - 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */, - 721652661D3C76E500FD13D8 /* SUInstallerProgressLauncherProtocol.h */, - 721652631D3C744700FD13D8 /* InstallerProgressLauncher.h */, - 721652641D3C744700FD13D8 /* InstallerProgressLauncher.m */, 72D954841CBAD418006F28BD /* ShowInstallerProgress.h */, 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */, 7267E5A31D3D8A8A00D1BF90 /* StatusInfo.h */, @@ -1635,6 +1627,7 @@ 726E07AE1CAF08D6001A286B /* InstallerLauncher */ = { isa = PBXGroup; children = ( + 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */, 726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */, 726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */, 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */, @@ -2590,7 +2583,6 @@ 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */, 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */, 721C24611CB75C5D005440CB /* SUHost.m in Sources */, - 721652651D3C744700FD13D8 /* InstallerProgressLauncher.m in Sources */, 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */, 721C245E1CB757DE005440CB /* SUConstants.m in Sources */, 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */, diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index f1f58843..2468a913 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -13,7 +13,6 @@ #import "SUApplicationInfo.h" #import "SUInstallerAgentProtocol.h" #import "SUInstallerAgentInitiationProtocol.h" -#import "InstallerProgressLauncher.h" #import "StatusInfo.h" #import @@ -24,7 +23,7 @@ */ static const NSTimeInterval SUTerminationTimeDelay = 0.3; -@interface InstallerProgressAppController () +@interface InstallerProgressAppController () @property (nonatomic, readonly) NSApplication *application; @property (nonatomic, weak) id delegate; @@ -32,7 +31,6 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @property (nonatomic) BOOL connected; @property (nonatomic) BOOL repliedToRegistration; @property (nonatomic, readonly) NSBundle *hostBundle; -@property (nonatomic, readonly, nullable) InstallerProgressLauncher *progressLauncher; @property (nonatomic) StatusInfo *statusInfo; @property (nonatomic) BOOL submittedLauncherJob; @@ -48,7 +46,6 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @synthesize connected = _connected; @synthesize repliedToRegistration = _repliedToRegistration; @synthesize hostBundle = _hostBundle; -@synthesize progressLauncher = _progressLauncher; @synthesize statusInfo = _statusInfo; @synthesize submittedLauncherJob = _submittedLauncherJob; @@ -56,8 +53,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; { self = [super init]; if (self != nil) { - if (arguments.count != 5) { - SULog(@"Error: Invalid arguments"); + if (arguments.count != 3) { + SULog(@"Error: Invalid number of arguments supplied: %@", arguments); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } @@ -79,18 +76,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; [self cleanupAndExitWithStatus:EXIT_FAILURE]; } - BOOL allowingInteraction = arguments[2].boolValue; - - NSString *installerPath = arguments[3]; - if (installerPath.length == 0) { - SULog(@"Error: Installer path length is 0"); - [self cleanupAndExitWithStatus:EXIT_FAILURE]; - } - - BOOL shouldSubmitInstaller = arguments[4].boolValue; - if (shouldSubmitInstaller) { - _progressLauncher = [[InstallerProgressLauncher alloc] initWithHostBundle:_hostBundle installerPath:installerPath allowingInteraction:allowingInteraction delegate:self]; - } + BOOL systemDomain = arguments[2].boolValue; + NSXPCConnectionOptions connectionOptions = systemDomain ? NSXPCConnectionPrivileged : 0; + _connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions]; _statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier]; @@ -99,9 +87,6 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; _application = application; _delegate = delegate; - NSXPCConnectionOptions connectionOptions = shouldSubmitInstaller ? NSXPCConnectionPrivileged : 0; - _connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions]; - _connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentProtocol)]; _connection.exportedObject = self; @@ -154,36 +139,17 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; - (void)applicationDidFinishLaunching:(NSNotification *)__unused notification { - if (self.progressLauncher == nil) { - [self startConnection]; - } else { - [self.progressLauncher startListener]; - } + [self startConnection]; } - (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn)) { [self.statusInfo invalidate]; [self.connection invalidate]; - [self.progressLauncher invalidate]; exit(status); } -- (void)installerProgressLauncherDidSubmitJob -{ - self.submittedLauncherJob = YES; - [self startConnection]; -} - -- (void)installerProgressLauncherDidInvalidate -{ - if (!self.submittedLauncherJob) { - SULog(@"Installer progress launcher invalidated"); - [self cleanupAndExitWithStatus:EXIT_FAILURE]; - } -} - - (void)registerRelaunchBundlePath:(NSString *)relaunchBundlePath reply:(void (^)(NSNumber *))reply { dispatch_async(dispatch_get_main_queue(), ^{ From 48938d0e78717224edb886b2afda0cdc202e243d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 13:13:17 -0400 Subject: [PATCH 13/29] Clear downloaded update if delta extraction fails --- Sparkle/SUCoreBasedUpdateDriver.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 5ab29075..5d44d602 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -275,6 +275,8 @@ SUAppcastItem *nonDeltaUpdateItem = self.basicDriver.nonDeltaUpdateItem; assert(nonDeltaUpdateItem != nil); + [self clearDownloadedUpdate]; + // Fall back to the non-delta update. Note that we don't want to trigger another update was found event. self.updateItem = nonDeltaUpdateItem; [self downloadUpdateFromAppcastItem:nonDeltaUpdateItem]; From 5c0ee2d74a20bbcd82c409eae8dc5880a278c530 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 13:29:03 -0400 Subject: [PATCH 14/29] Rename did finish downloaading callbacks to did start extracting --- Sparkle/SUCoreBasedUpdateDriver.h | 2 +- Sparkle/SUCoreBasedUpdateDriver.m | 4 ++-- Sparkle/SUStandardUserDriver.m | 2 +- Sparkle/SUUIBasedUpdateDriver.m | 4 ++-- Sparkle/SUUserDriver.h | 6 +++--- TestApplication/SUPopUpTitlebarUserDriver.m | 2 +- Tests/SUUpdaterTest.m | 2 +- sparkle-cli/SUCommandLineUserDriver.m | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Sparkle/SUCoreBasedUpdateDriver.h b/Sparkle/SUCoreBasedUpdateDriver.h index e8289c86..bf4d7e0a 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.h +++ b/Sparkle/SUCoreBasedUpdateDriver.h @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)downloadDriverDidReceiveDataOfLength:(NSUInteger)length; -- (void)coreDriverDidFinishDownloadingUpdate; +- (void)coreDriverDidStartExtractingUpdate; - (void)installerDidStartInstalling; diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 5d44d602..04f4d9f7 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -170,8 +170,8 @@ - (void)extractUpdate:(SUDownloadedUpdate *)downloadedUpdate { // Now we have to extract the downloaded archive. - if ([self.delegate respondsToSelector:@selector(coreDriverDidFinishDownloadingUpdate)]) { - [self.delegate coreDriverDidFinishDownloadingUpdate]; + if ([self.delegate respondsToSelector:@selector(coreDriverDidStartExtractingUpdate)]) { + [self.delegate coreDriverDidStartExtractingUpdate]; } [self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) { diff --git a/Sparkle/SUStandardUserDriver.m b/Sparkle/SUStandardUserDriver.m index be0741e4..2803a400 100644 --- a/Sparkle/SUStandardUserDriver.m +++ b/Sparkle/SUStandardUserDriver.m @@ -366,7 +366,7 @@ }); } -- (void)showDownloadFinishedAndStartedExtractingUpdate +- (void)showDownloadDidStartExtractingUpdate { dispatch_async(dispatch_get_main_queue(), ^{ [self.coreComponent completeDownloadStatus]; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 4c092e28..3fb9c111 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -160,9 +160,9 @@ [self.userDriver showDownloadDidReceiveDataOfLength:length]; } -- (void)coreDriverDidFinishDownloadingUpdate +- (void)coreDriverDidStartExtractingUpdate { - [self.userDriver showDownloadFinishedAndStartedExtractingUpdate]; + [self.userDriver showDownloadDidStartExtractingUpdate]; } - (void)installerDidStartInstalling diff --git a/Sparkle/SUUserDriver.h b/Sparkle/SUUserDriver.h index 3e68fdd3..3a6f9aa7 100644 --- a/Sparkle/SUUserDriver.h +++ b/Sparkle/SUUserDriver.h @@ -200,9 +200,9 @@ NS_ASSUME_NONNULL_BEGIN * Let the user know that downloading the new update started. * * @param downloadUpdateStatusCompletion A reply of SUDownloadUpdateCancelled can be used to cancel - * the download at any point before -showDownloadFinishedAndStartedExtractingUpdate is invoked. + * the download at any point before -showDownloadDidStartExtractingUpdate is invoked. * A reply of SUDownloadUpdateDone signifies that the download is done, which should not be invoked until - * -showDownloadFinishedAndStartedExtractingUpdate + * -showDownloadDidStartExtractingUpdate * * This can be called from any thread */ @@ -235,7 +235,7 @@ NS_ASSUME_NONNULL_BEGIN * * This can be called from any thread */ -- (void)showDownloadFinishedAndStartedExtractingUpdate; +- (void)showDownloadDidStartExtractingUpdate; /*! * Show the user that the update is extracting with progress diff --git a/TestApplication/SUPopUpTitlebarUserDriver.m b/TestApplication/SUPopUpTitlebarUserDriver.m index 4f5d345c..9b410000 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.m +++ b/TestApplication/SUPopUpTitlebarUserDriver.m @@ -304,7 +304,7 @@ }); } -- (void)showDownloadFinishedAndStartedExtractingUpdate +- (void)showDownloadDidStartExtractingUpdate { dispatch_async(dispatch_get_main_queue(), ^{ [self.coreComponent completeDownloadStatus]; diff --git a/Tests/SUUpdaterTest.m b/Tests/SUUpdaterTest.m index 2927701f..00b2ede4 100644 --- a/Tests/SUUpdaterTest.m +++ b/Tests/SUUpdaterTest.m @@ -51,7 +51,7 @@ - (void)showDownloadDidReceiveDataOfLength:(NSUInteger)__unused length {} -- (void)showDownloadFinishedAndStartedExtractingUpdate {} +- (void)showDownloadDidStartExtractingUpdate {} - (void)showExtractionReceivedProgress:(double)__unused progress {} diff --git a/sparkle-cli/SUCommandLineUserDriver.m b/sparkle-cli/SUCommandLineUserDriver.m index b1892560..129f9b95 100644 --- a/sparkle-cli/SUCommandLineUserDriver.m +++ b/sparkle-cli/SUCommandLineUserDriver.m @@ -234,7 +234,7 @@ }); } -- (void)showDownloadFinishedAndStartedExtractingUpdate +- (void)showDownloadDidStartExtractingUpdate { dispatch_async(dispatch_get_main_queue(), ^{ [self.coreComponent completeDownloadStatus]; From ec7766022dd9cf92d214e3b486c64c60557ad52a Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 14:24:04 -0400 Subject: [PATCH 15/29] Add callback for showing downloaded updates that haven't started --- Sparkle/SUStandardUserDriver.m | 12 ++++++++- Sparkle/SUUIBasedUpdateDriver.m | 27 ++++++++++++++----- Sparkle/SUUpdateAlert.h | 2 +- Sparkle/SUUpdateAlert.m | 18 +++++++------ Sparkle/SUUserDriver.h | 18 +++++++++---- .../SUInstallUpdateViewController.h | 2 +- .../SUInstallUpdateViewController.m | 10 +++---- TestApplication/SUPopUpTitlebarUserDriver.m | 15 ++++++++--- Tests/SUUpdaterTest.m | 2 ++ sparkle-cli/SUCommandLineUserDriver.m | 8 ++++++ 10 files changed, 82 insertions(+), 32 deletions(-) diff --git a/Sparkle/SUStandardUserDriver.m b/Sparkle/SUStandardUserDriver.m index 2803a400..93f53703 100644 --- a/Sparkle/SUStandardUserDriver.m +++ b/Sparkle/SUStandardUserDriver.m @@ -162,7 +162,17 @@ - (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply { [self showUpdateFoundWithAlertHandler:^SUUpdateAlert *(SUStandardUserDriver *weakSelf, SUHost *host, id versionDisplayer) { - return [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem host:host versionDisplayer:versionDisplayer completionBlock:^(SUUpdateAlertChoice choice) { + return [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem alreadyDownloaded:NO host:host versionDisplayer:versionDisplayer completionBlock:^(SUUpdateAlertChoice choice) { + reply(choice); + weakSelf.activeUpdateAlert = nil; + }]; + }]; +} + +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply +{ + [self showUpdateFoundWithAlertHandler:^SUUpdateAlert *(SUStandardUserDriver *weakSelf, SUHost *host, id versionDisplayer) { + return [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem alreadyDownloaded:YES host:host versionDisplayer:versionDisplayer completionBlock:^(SUUpdateAlertChoice choice) { reply(choice); weakSelf.activeUpdateAlert = nil; }]; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 3fb9c111..0c5d99f5 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -85,20 +85,33 @@ - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem { - if (!self.resumingUpdate || self.resumingDownloadedUpdate) { + if (self.resumingDownloadedUpdate) { + [self.userDriver showDownloadedUpdateFoundWithAppcastItem:updateItem reply:^(SUUpdateAlertChoice choice) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; + switch (choice) { + case SUInstallUpdateChoice: + [self.coreDriver extractDownloadedUpdate]; + break; + case SUSkipThisVersionChoice: + [self.coreDriver clearDownloadedUpdate]; + [self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; + // Fall through + case SUInstallLaterChoice: + [self.delegate uiDriverIsRequestingAbortUpdateWithError:nil]; + break; + } + }); + }]; + } else if (!self.resumingUpdate) { [self.userDriver showUpdateFoundWithAppcastItem:updateItem reply:^(SUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { case SUInstallUpdateChoice: - if (!self.resumingDownloadedUpdate) { - [self.coreDriver downloadUpdateFromAppcastItem:updateItem]; - } else { - [self.coreDriver extractDownloadedUpdate]; - } + [self.coreDriver downloadUpdateFromAppcastItem:updateItem]; break; case SUSkipThisVersionChoice: - [self.coreDriver clearDownloadedUpdate]; [self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; // Fall through case SUInstallLaterChoice: diff --git a/Sparkle/SUUpdateAlert.h b/Sparkle/SUUpdateAlert.h index 428fad0a..63325b05 100644 --- a/Sparkle/SUUpdateAlert.h +++ b/Sparkle/SUUpdateAlert.h @@ -20,7 +20,7 @@ @property (nonatomic, weak, readonly) id versionDisplayer; -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost versionDisplayer:(id )aVersionDisplayer completionBlock:(void (^)(SUUpdateAlertChoice))block; +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item alreadyDownloaded:(BOOL)alreadyDownloaded host:(SUHost *)aHost versionDisplayer:(id )aVersionDisplayer completionBlock:(void (^)(SUUpdateAlertChoice))block; - (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost versionDisplayer:(id )aVersionDisplayer resumableCompletionBlock:(void (^)(SUInstallUpdateStatus))block; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 16405c63..488f699d 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -34,6 +34,7 @@ @interface SUUpdateAlert () @property (strong) SUAppcastItem *updateItem; +@property (nonatomic) BOOL alreadyDownloaded; @property (strong) SUHost *host; @property (nonatomic) BOOL allowsAutomaticUpdates; @property (nonatomic, copy, nullable) void(^completionBlock)(SUUpdateAlertChoice); @@ -55,6 +56,7 @@ @implementation SUUpdateAlert @synthesize completionBlock = _completionBlock; +@synthesize alreadyDownloaded = _alreadyDownloaded; @synthesize resumableCompletionBlock = _resumableCompletionBlock; @synthesize versionDisplayer; @@ -93,12 +95,13 @@ return self; } -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost versionDisplayer:(id )aVersionDisplayer completionBlock:(void (^)(SUUpdateAlertChoice))block +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item alreadyDownloaded:(BOOL)alreadyDownloaded host:(SUHost *)aHost versionDisplayer:(id )aVersionDisplayer completionBlock:(void (^)(SUUpdateAlertChoice))block { self = [self initWithAppcastItem:item host:aHost versionDisplayer:aVersionDisplayer]; if (self != nil) { _completionBlock = [block copy]; + _alreadyDownloaded = alreadyDownloaded; } return self; } @@ -109,6 +112,7 @@ if (self != nil) { _resumableCompletionBlock = [block copy]; + _alreadyDownloaded = YES; } return self; } @@ -264,9 +268,9 @@ [self.automaticallyInstallUpdatesButton removeFromSuperview]; } - BOOL alreadyDownloaded = (self.resumableCompletionBlock != nil); - if (alreadyDownloaded) { - // Should we hide the button or disable the button if the update has already been downloaded? + BOOL startedInstalling = (self.resumableCompletionBlock != nil); + if (startedInstalling) { + // Should we hide the button or disable the button if the update has already started installing? // Personally I think it looks better when the button is visible on the window... // Anyway an already downloaded update can't be skipped self.skipButton.enabled = NO; @@ -315,8 +319,6 @@ } else { [self.versionDisplayer formatVersion:&updateItemVersion andVersion:&hostVersion]; } - - BOOL alreadyDownloaded = (self.resumableCompletionBlock != nil); // We display a different summary depending on if it's an "info-only" item, or a "critical update" item, or if we've already downloaded the update and just need to relaunch NSString *finalString = nil; @@ -324,13 +326,13 @@ if (self.updateItem.isInformationOnlyUpdate) { finalString = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?", @"Description text for SUUpdateAlert when the update informational with no download."), self.host.name, updateItemVersion, hostVersion]; } else if ([self.updateItem isCriticalUpdate]) { - if (!alreadyDownloaded) { + if (!self.alreadyDownloaded) { finalString = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?", @"Description text for SUUpdateAlert when the critical update is downloadable."), self.host.name, updateItemVersion, hostVersion]; } else { finalString = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?", @"Description text for SUUpdateAlert when the critical update has already been downloaded and ready to install."), self.host.name, updateItemVersion]; } } else { - if (!alreadyDownloaded) { + if (!self.alreadyDownloaded) { finalString = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available--you have %@. Would you like to download it now?", @"Description text for SUUpdateAlert when the update is downloadable."), self.host.name, updateItemVersion, hostVersion]; } else { finalString = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", @"Description text for SUUpdateAlert when the update has already been downloaded and ready to install."), self.host.name, updateItemVersion]; diff --git a/Sparkle/SUUserDriver.h b/Sparkle/SUUserDriver.h index 3a6f9aa7..5428bdcf 100644 --- a/Sparkle/SUUserDriver.h +++ b/Sparkle/SUUserDriver.h @@ -130,16 +130,24 @@ NS_ASSUME_NONNULL_BEGIN - (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply; /*! - * Show the user a downloaded update can be resumed and installed immediately + * Show the user a new update has been downloaded and can be installed * - * Let the user know a downloaded update can be installed ask them what they want to do. + * This method behaves just like -showUpdateFoundWithAppcastItem:reply: except the update has already been downloaded. + */ +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply; + +/*! + * Show the user an update that has started installing can be resumed and installed immediately + * + * Let the user know an update that has already been downloaded and started installing can be resumed. + * Note at this point the update cannot be cancelled. * * @param appcastItem The Appcast Item containing information that reflects the new update * * @param reply A reply of SUInstallAndRelaunchUpdateNow installs the update immediately and relaunches the new update. - * A reply of SUInstallUpdateNow installes the update immediately but does not relaunch the new update. - * A reply of SUDismissUpdateInstallation dismisses the update installation. Note the update may still be installed after - * the application terminates, however there is not a strong guarantee that this will happen. + * A reply of SUInstallUpdateNow installs the update immediately but does not relaunch the new update. + * A reply of SUDismissUpdateInstallation dismisses the update installation. Note the update will attempt to finish installation + * after the application terminates. * * This can be called from any thread */ diff --git a/TestApplication/SUInstallUpdateViewController.h b/TestApplication/SUInstallUpdateViewController.h index 15e82bb9..aaa862e2 100644 --- a/TestApplication/SUInstallUpdateViewController.h +++ b/TestApplication/SUInstallUpdateViewController.h @@ -13,6 +13,6 @@ @interface SUInstallUpdateViewController : NSViewController -- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem alreadyDownloaded:(BOOL)alreadyDownloaded reply:(void (^)(SUUpdateAlertChoice))reply; +- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem skippable:(BOOL)skippable reply:(void (^)(SUUpdateAlertChoice))reply; @end diff --git a/TestApplication/SUInstallUpdateViewController.m b/TestApplication/SUInstallUpdateViewController.m index b080272d..42d417b4 100644 --- a/TestApplication/SUInstallUpdateViewController.m +++ b/TestApplication/SUInstallUpdateViewController.m @@ -15,7 +15,7 @@ @property (nonatomic) IBOutlet NSTextView *textView; @property (nonatomic, readonly) SUAppcastItem *appcastItem; @property (nonatomic, copy) void (^reply)(SUUpdateAlertChoice); -@property (nonatomic, readonly) BOOL alreadyDownloaded; +@property (nonatomic, readonly) BOOL skippable; @end @@ -25,14 +25,14 @@ @synthesize textView = _textView; @synthesize appcastItem = _appcastItem; @synthesize reply = _reply; -@synthesize alreadyDownloaded = _alreadyDownloaded; +@synthesize skippable = _skippable; -- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem alreadyDownloaded:(BOOL)alreadyDownloaded reply:(void (^)(SUUpdateAlertChoice))reply +- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem skippable:(BOOL)skippable reply:(void (^)(SUUpdateAlertChoice))reply { self = [super initWithNibName:@"SUInstallUpdateViewController" bundle:nil]; if (self != nil) { _appcastItem = appcastItem; - _alreadyDownloaded = alreadyDownloaded; + _skippable = skippable; self.reply = reply; } return self; @@ -42,7 +42,7 @@ { [super viewDidLoad]; - self.skipUpdatesButton.enabled = !self.alreadyDownloaded; + self.skipUpdatesButton.enabled = self.skippable; [[self.textView enclosingScrollView] setDrawsBackground:NO]; [self.textView setDrawsBackground:NO]; diff --git a/TestApplication/SUPopUpTitlebarUserDriver.m b/TestApplication/SUPopUpTitlebarUserDriver.m index 9b410000..5dcea2dc 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.m +++ b/TestApplication/SUPopUpTitlebarUserDriver.m @@ -160,14 +160,14 @@ #pragma mark Update Found -- (void)showUpdateWithAppcastItem:(SUAppcastItem *)appcastItem alreadyDownloaded:(BOOL)alreadyDownloaded reply:(void (^)(SUUpdateAlertChoice))reply +- (void)showUpdateWithAppcastItem:(SUAppcastItem *)appcastItem skippable:(BOOL)skippable reply:(void (^)(SUUpdateAlertChoice))reply { NSPopover *popover = [[NSPopover alloc] init]; popover.behavior = NSPopoverBehaviorTransient; [self addUpdateButtonWithTitle:@"Update Available" action:^(NSButton *button) { if (popover.contentViewController == nil) { - popover.contentViewController = [[SUInstallUpdateViewController alloc] initWithAppcastItem:appcastItem alreadyDownloaded:alreadyDownloaded reply:^(SUUpdateAlertChoice choice) { + popover.contentViewController = [[SUInstallUpdateViewController alloc] initWithAppcastItem:appcastItem skippable:skippable reply:^(SUUpdateAlertChoice choice) { reply(choice); [popover close]; @@ -182,14 +182,21 @@ - (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply { dispatch_async(dispatch_get_main_queue(), ^{ - [self showUpdateWithAppcastItem:appcastItem alreadyDownloaded:NO reply:reply]; + [self showUpdateWithAppcastItem:appcastItem skippable:YES reply:reply]; + }); +} + +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self showUpdateWithAppcastItem:appcastItem skippable:YES reply:reply]; }); } - (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUInstallUpdateStatus))reply { dispatch_async(dispatch_get_main_queue(), ^{ - [self showUpdateWithAppcastItem:appcastItem alreadyDownloaded:YES reply:^(SUUpdateAlertChoice choice) { + [self showUpdateWithAppcastItem:appcastItem skippable:NO reply:^(SUUpdateAlertChoice choice) { switch (choice) { case SUInstallUpdateChoice: reply(SUInstallAndRelaunchUpdateNow); diff --git a/Tests/SUUpdaterTest.m b/Tests/SUUpdaterTest.m index 00b2ede4..6c731e68 100644 --- a/Tests/SUUpdaterTest.m +++ b/Tests/SUUpdaterTest.m @@ -35,6 +35,8 @@ - (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)__unused appcastItem reply:(void (^)(SUUpdateAlertChoice))__unused reply {} +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)__unused appcastItem reply:(void (^)(SUUpdateAlertChoice))__unused reply {} + - (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)__unused appcastItem reply:(void (^)(SUInstallUpdateStatus))__unused reply {} - (void)showUpdateReleaseNotes:(NSData *)__unused releaseNotes {} diff --git a/sparkle-cli/SUCommandLineUserDriver.m b/sparkle-cli/SUCommandLineUserDriver.m index 129f9b95..fbf05d9b 100644 --- a/sparkle-cli/SUCommandLineUserDriver.m +++ b/sparkle-cli/SUCommandLineUserDriver.m @@ -149,6 +149,14 @@ }); } +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self showUpdateWithAppcastItem:appcastItem updateAdjective:@"downloaded"]; + reply(SUInstallUpdateChoice); + }); +} + - (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUInstallUpdateStatus))reply { dispatch_async(dispatch_get_main_queue(), ^{ From e2a51347b98184d3284c1f7744df5b339d9e68cc Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 14:37:21 -0400 Subject: [PATCH 16/29] Differentiate between resuming an installing update & a downloaded one --- Sparkle/SUAutomaticUpdateDriver.m | 4 ++-- Sparkle/SUBasicUpdateDriver.h | 2 +- Sparkle/SUBasicUpdateDriver.m | 2 +- Sparkle/SUCoreBasedUpdateDriver.h | 2 +- Sparkle/SUCoreBasedUpdateDriver.m | 14 +++++++------- Sparkle/SUInstallerDriver.h | 2 +- Sparkle/SUInstallerDriver.m | 2 +- Sparkle/SUProbingUpdateDriver.m | 4 ++-- Sparkle/SUScheduledUpdateDriver.m | 4 ++-- Sparkle/SUUIBasedUpdateDriver.h | 2 +- Sparkle/SUUIBasedUpdateDriver.m | 12 ++++++------ Sparkle/SUUpdateDriver.h | 2 +- Sparkle/SUUpdater.m | 2 +- Sparkle/SUUserInitiatedUpdateDriver.m | 4 ++-- 14 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index a07c7013..75645bdc 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -53,10 +53,10 @@ [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO requiresSilentInstall:YES completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn)) +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn)) { // Nothing really to do here.. this shouldn't be called. - SULog(@"Error: resumeUpdateWithCompletion: called on SUAutomaticUpdateDriver"); + SULog(@"Error: resumeInstallingUpdateWithCompletion: called on SUAutomaticUpdateDriver"); abort(); } diff --git a/Sparkle/SUBasicUpdateDriver.h b/Sparkle/SUBasicUpdateDriver.h index 7ae89b28..b17db957 100644 --- a/Sparkle/SUBasicUpdateDriver.h +++ b/Sparkle/SUBasicUpdateDriver.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock; -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 0daca9f4..e60816f4 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -78,7 +78,7 @@ } } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { self.completionBlock = completionBlock; diff --git a/Sparkle/SUCoreBasedUpdateDriver.h b/Sparkle/SUCoreBasedUpdateDriver.h index bf4d7e0a..143b8e06 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.h +++ b/Sparkle/SUCoreBasedUpdateDriver.h @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall completion:(SUUpdateDriverCompletion)completionBlock; -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 04f4d9f7..371e923f 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -31,7 +31,7 @@ @property (nonatomic) SUDownloadedUpdate *downloadedUpdate; @property (nonatomic, readonly) SUHost *host; -@property (nonatomic) BOOL resumingUpdate; +@property (nonatomic) BOOL resumingInstallingUpdate; @property (nonatomic) BOOL silentInstall; @property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this.. @property (nullable, nonatomic, readonly, weak) id updaterDelegate; @@ -47,7 +47,7 @@ @synthesize delegate = _delegate; @synthesize updateItem = _updateItem; @synthesize host = _host; -@synthesize resumingUpdate = _resumingUpdate; +@synthesize resumingInstallingUpdate = _resumingInstallingUpdate; @synthesize silentInstall = _silentInstall; @synthesize updater = _updater; @synthesize updaterDelegate = _updaterDelegate; @@ -82,12 +82,12 @@ [self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:includesSkippedUpdates completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { - self.resumingUpdate = YES; + self.resumingInstallingUpdate = YES; self.silentInstall = NO; - [self.basicDriver resumeUpdateWithCompletion:completionBlock]; + [self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock]; } - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock @@ -109,8 +109,8 @@ { self.updateItem = updateItem; - if (self.resumingUpdate) { - [self.installerDriver resumeUpdateWithUpdateItem:updateItem]; + if (self.resumingInstallingUpdate) { + [self.installerDriver resumeInstallingUpdateWithUpdateItem:updateItem]; } [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem]; diff --git a/Sparkle/SUInstallerDriver.h b/Sparkle/SUInstallerDriver.h index 6fc40490..8b1d1583 100644 --- a/Sparkle/SUInstallerDriver.h +++ b/Sparkle/SUInstallerDriver.h @@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithHost:(SUHost *)host cachePath:(NSString *)cachePath sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id)updaterDelegate delegate:(nullable id)delegate; -- (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem; +- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem; - (void)extractDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 3d31944a..3d1e89cc 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -147,7 +147,7 @@ } } -- (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem +- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem { self.updateItem = updateItem; } diff --git a/Sparkle/SUProbingUpdateDriver.m b/Sparkle/SUProbingUpdateDriver.m index c61f7fd6..f1c891ea 100644 --- a/Sparkle/SUProbingUpdateDriver.m +++ b/Sparkle/SUProbingUpdateDriver.m @@ -39,9 +39,9 @@ [self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { - [self.basicDriver resumeUpdateWithCompletion:completionBlock]; + [self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock]; } - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock diff --git a/Sparkle/SUScheduledUpdateDriver.m b/Sparkle/SUScheduledUpdateDriver.m index dd31f8e7..92f83908 100644 --- a/Sparkle/SUScheduledUpdateDriver.m +++ b/Sparkle/SUScheduledUpdateDriver.m @@ -40,9 +40,9 @@ [self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { - [self.uiDriver resumeUpdateWithCompletion:completionBlock]; + [self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock]; } - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock diff --git a/Sparkle/SUUIBasedUpdateDriver.h b/Sparkle/SUUIBasedUpdateDriver.h index 37161ac7..a4a3bca0 100644 --- a/Sparkle/SUUIBasedUpdateDriver.h +++ b/Sparkle/SUUIBasedUpdateDriver.h @@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock; -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 0c5d99f5..3d3dc468 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -28,7 +28,7 @@ @property (weak, nonatomic, readonly) id updaterDelegate; @property (nonatomic, weak, readonly) id delegate; @property (nonatomic, readonly) id userDriver; -@property (nonatomic) BOOL resumingUpdate; +@property (nonatomic) BOOL resumingInstallingUpdate; @property (nonatomic) BOOL resumingDownloadedUpdate; @end @@ -41,7 +41,7 @@ @synthesize updaterDelegate = _updaterDelegate; @synthesize userDriver = _userDriver; @synthesize delegate = _delegate; -@synthesize resumingUpdate = _resumingUpdate; +@synthesize resumingInstallingUpdate = _resumingInstallingUpdate; @synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate; - (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate @@ -64,10 +64,10 @@ [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:includesSkippedUpdates requiresSilentInstall:NO completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { - self.resumingUpdate = YES; - [self.coreDriver resumeUpdateWithCompletion:completionBlock]; + self.resumingInstallingUpdate = YES; + [self.coreDriver resumeInstallingUpdateWithCompletion:completionBlock]; } - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock @@ -103,7 +103,7 @@ } }); }]; - } else if (!self.resumingUpdate) { + } else if (!self.resumingInstallingUpdate) { [self.userDriver showUpdateFoundWithAppcastItem:updateItem reply:^(SUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; diff --git a/Sparkle/SUUpdateDriver.h b/Sparkle/SUUpdateDriver.h index 08d8a633..aadce8b9 100644 --- a/Sparkle/SUUpdateDriver.h +++ b/Sparkle/SUUpdateDriver.h @@ -16,7 +16,7 @@ typedef void (^SUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, SUDow - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock; -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock; - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock; diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 8deeb9ac..645a98b3 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -495,7 +495,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification [self.userDriver showCanCheckForUpdates:NO]; if (installerInProgress) { - [self.driver resumeUpdateWithCompletion:completionBlock]; + [self.driver resumeInstallingUpdateWithCompletion:completionBlock]; } else if (self.resumableUpdate != nil) { [self.driver resumeDownloadedUpdate:(SUDownloadedUpdate * _Nonnull)self.resumableUpdate completion:completionBlock]; } else { diff --git a/Sparkle/SUUserInitiatedUpdateDriver.m b/Sparkle/SUUserInitiatedUpdateDriver.m index c6e62fa3..d42dd219 100644 --- a/Sparkle/SUUserInitiatedUpdateDriver.m +++ b/Sparkle/SUUserInitiatedUpdateDriver.m @@ -60,9 +60,9 @@ [self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:YES completion:completionBlock]; } -- (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock +- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { - [self.uiDriver resumeUpdateWithCompletion:completionBlock]; + [self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock]; } - (void)resumeDownloadedUpdate:(SUDownloadedUpdate *)downloadedUpdate completion:(SUUpdateDriverCompletion)completionBlock From 25a52439a134a70c449d27ee331318a1c049dedf Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 15:09:52 -0400 Subject: [PATCH 17/29] Remove stray reference to SUAuthorizationEnvironment --- Autoupdate/SUInstallerProtocol.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Autoupdate/SUInstallerProtocol.h b/Autoupdate/SUInstallerProtocol.h index 1c91c553..9cd28e0e 100644 --- a/Autoupdate/SUInstallerProtocol.h +++ b/Autoupdate/SUInstallerProtocol.h @@ -8,8 +8,6 @@ #import -@class SUAuthorizationEnvironment; - NS_ASSUME_NONNULL_BEGIN @protocol SUInstallerProtocol From c95b337b09dc21273b6673a9d2a4629439b7021d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 15:37:33 -0400 Subject: [PATCH 18/29] Don't need SUSubmitInstaller.h/m anymore --- InstallerLauncher/SUInstallerLauncher.m | 97 ++++++++++++++++++++- InstallerLauncher/SUSubmitInstaller.h | 20 ----- InstallerLauncher/SUSubmitInstaller.m | 111 ------------------------ Sparkle.xcodeproj/project.pbxproj | 10 --- 4 files changed, 95 insertions(+), 143 deletions(-) delete mode 100644 InstallerLauncher/SUSubmitInstaller.h delete mode 100644 InstallerLauncher/SUSubmitInstaller.m diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 8b4ee411..001e1fa2 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -11,7 +11,6 @@ #import "SULog.h" #import "SUMessageTypes.h" #import "SUSystemAuthorization.h" -#import "SUSubmitInstaller.h" @implementation SUInstallerLauncher @@ -85,6 +84,100 @@ return (submittedJob == true); } +- (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain +{ + SUFileManager *fileManager = [SUFileManager defaultManager]; + + NSURL *installerURL = [NSURL fileURLWithPath:installerPath]; + + NSError *quarantineError = nil; + if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { + // Probably not a fatal error because we are submitting the executable through launchd + SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); + } + + NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; + assert(hostBundleIdentifier != nil); + + NSArray *arguments = @[installerPath, hostBundleIdentifier, @(allowingInteraction).stringValue]; + + AuthorizationRef auth = NULL; + OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); + if (createStatus != errAuthorizationSuccess) { + auth = NULL; + SULog(@"Failed to create authorization reference: %d", createStatus); + } + + BOOL canceledAuthorization = NO; + BOOL failedToUseSystemDomain = NO; + if (auth != NULL && systemDomain) { + AuthorizationItem rightItems[] = { + { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} + }; + + AuthorizationRights rights = { + .count = sizeof(rightItems) / sizeof(*rightItems), + .items = rightItems, + }; + + AuthorizationFlags flags = + (AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed); + + OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); + if (copyStatus != errAuthorizationSuccess) { + SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons: %d", copyStatus); + failedToUseSystemDomain = YES; + + if (copyStatus == errAuthorizationCanceled) { + canceledAuthorization = YES; + } + } + } + + Boolean submittedJob = false; + if (!failedToUseSystemDomain && auth != NULL) { + CFStringRef domain = (systemDomain ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); + NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; + + // Try to remove the job from launchd if it is already running + // We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid + // using it because the headers indicate it may be removed one day without any replacement + CFErrorRef removeError = NULL; + if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { + if (removeError != NULL) { + // It's normal for a job to not be found, so this is not an interesting error + if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { + SULog(@"Remove error: %@", removeError); + } + CFRelease(removeError); + } + } + + NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; + + CFErrorRef submitError = NULL; + submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); + if (!submittedJob) { + if (submitError != NULL) { + SULog(@"Submit error: %@", submitError); + CFRelease(submitError); + } + } + + AuthorizationFree(auth, kAuthorizationFlagDefaults); + } + + SUAuthorizationReply reply; + if (submittedJob == true) { + reply = SUAuthorizationReplySuccess; + } else if (canceledAuthorization) { + reply = SUAuthorizationReplyCancelled; + } else { + reply = SUAuthorizationReplyFailure; + } + return reply; +} + - (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ @@ -97,7 +190,7 @@ if (needsSystemAuthorization && !preflighted && !allowingInteraction) { completionHandler(SUAuthorizationReplyAuthorizeLater); } else { - BOOL submittedInstaller = ([SUSubmitInstaller submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); + BOOL submittedInstaller = ([self submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); if (!submittedInstaller) { SULog(@"Failed to submit installer job"); diff --git a/InstallerLauncher/SUSubmitInstaller.h b/InstallerLauncher/SUSubmitInstaller.h deleted file mode 100644 index 4f0eb014..00000000 --- a/InstallerLauncher/SUSubmitInstaller.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SUSubmitInstaller.h -// Sparkle -// -// Created by Mayur Pawashe on 7/17/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SUAuthorizationReply.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SUSubmitInstaller : NSObject - -+ (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain; - -@end - -NS_ASSUME_NONNULL_END diff --git a/InstallerLauncher/SUSubmitInstaller.m b/InstallerLauncher/SUSubmitInstaller.m deleted file mode 100644 index 1efc9ec6..00000000 --- a/InstallerLauncher/SUSubmitInstaller.m +++ /dev/null @@ -1,111 +0,0 @@ -// -// SUSubmitInstaller.m -// Sparkle -// -// Created by Mayur Pawashe on 7/17/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SUSubmitInstaller.h" -#import "SUFileManager.h" -#import "SULog.h" -#import "SUMessageTypes.h" -#import - -@implementation SUSubmitInstaller - -+ (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain -{ - SUFileManager *fileManager = [SUFileManager defaultManager]; - - NSURL *installerURL = [NSURL fileURLWithPath:installerPath]; - - NSError *quarantineError = nil; - if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { - // Probably not a fatal error because we are submitting the executable through launchd - SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); - } - - NSString *hostBundleIdentifier = hostBundle.bundleIdentifier; - assert(hostBundleIdentifier != nil); - - NSArray *arguments = @[installerPath, hostBundleIdentifier, @(allowingInteraction).stringValue]; - - AuthorizationRef auth = NULL; - OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); - if (createStatus != errAuthorizationSuccess) { - auth = NULL; - SULog(@"Failed to create authorization reference: %d", createStatus); - } - - BOOL canceledAuthorization = NO; - BOOL failedToUseSystemDomain = NO; - if (auth != NULL && systemDomain) { - AuthorizationItem rightItems[] = { - { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} - }; - - AuthorizationRights rights = { - .count = sizeof(rightItems) / sizeof(*rightItems), - .items = rightItems, - }; - - AuthorizationFlags flags = - (AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed); - - OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); - if (copyStatus != errAuthorizationSuccess) { - SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons: %d", copyStatus); - failedToUseSystemDomain = YES; - - if (copyStatus == errAuthorizationCanceled) { - canceledAuthorization = YES; - } - } - } - - Boolean submittedJob = false; - if (!failedToUseSystemDomain && auth != NULL) { - CFStringRef domain = (systemDomain ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); - NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; - - // Try to remove the job from launchd if it is already running - // We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid - // using it because the headers indicate it may be removed one day without any replacement - CFErrorRef removeError = NULL; - if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { - if (removeError != NULL) { - // It's normal for a job to not be found, so this is not an interesting error - if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { - SULog(@"Remove error: %@", removeError); - } - CFRelease(removeError); - } - } - - NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; - - CFErrorRef submitError = NULL; - submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); - if (!submittedJob) { - if (submitError != NULL) { - SULog(@"Submit error: %@", submitError); - CFRelease(submitError); - } - } - - AuthorizationFree(auth, kAuthorizationFlagDefaults); - } - - SUAuthorizationReply reply; - if (submittedJob == true) { - reply = SUAuthorizationReplySuccess; - } else if (canceledAuthorization) { - reply = SUAuthorizationReplyCancelled; - } else { - reply = SUAuthorizationReplyFailure; - } - return reply; -} - -@end diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index c690a9e7..e92f2b9d 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; }; 72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */; }; 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B071C82C9600013C1C5 /* SULocalizations.h */; }; - 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; 721BC20E1D1CDE55002BC71E /* SULocalCacheDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 721BC20C1D1CDE55002BC71E /* SULocalCacheDirectory.h */; }; 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; @@ -116,9 +115,7 @@ 721CF1A91AD7644C00D9AC09 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; settings = {COMPILER_FLAGS = "-w"; }; }; 721CF1AA1AD7647000D9AC09 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; }; 721CF1AB1AD764EB00D9AC09 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; }; - 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 7221947A1D3C42EA004C34FF /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */; }; - 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 722194771D3C4251004C34FF /* SUSubmitInstaller.m */; }; 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7229E1B61C97C91100CB50D0 /* SUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SUUpdateDriver.h */; }; 7229E1B91C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h */; }; @@ -770,8 +767,6 @@ 721C24581CB7567D005440CB /* InstallerProgress-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "InstallerProgress-Info.plist"; path = "Sparkle/InstallerProgress/InstallerProgress-Info.plist"; sourceTree = SOURCE_ROOT; }; 722194511D3BF987004C34FF /* SUInstallerAgentProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentProtocol.h; sourceTree = SOURCE_ROOT; }; 722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentInitiationProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h; sourceTree = SOURCE_ROOT; }; - 722194761D3C4251004C34FF /* SUSubmitInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSubmitInstaller.h; sourceTree = ""; }; - 722194771D3C4251004C34FF /* SUSubmitInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSubmitInstaller.m; sourceTree = ""; }; 7223E7611AD1AEFF008E3161 /* sais.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sais.c; sourceTree = ""; }; 7223E7621AD1AEFF008E3161 /* sais.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sais.h; sourceTree = ""; }; 7229E1B51C97C91100CB50D0 /* SUUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateDriver.h; sourceTree = ""; }; @@ -1631,8 +1626,6 @@ 726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */, 726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */, 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */, - 722194761D3C4251004C34FF /* SUSubmitInstaller.h */, - 722194771D3C4251004C34FF /* SUSubmitInstaller.m */, 726E07B31CAF08D6001A286B /* main.m */, 726E07B51CAF08D6001A286B /* Info.plist */, ); @@ -2583,7 +2576,6 @@ 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */, 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */, 721C24611CB75C5D005440CB /* SUHost.m in Sources */, - 722194791D3C4251004C34FF /* SUSubmitInstaller.m in Sources */, 721C245E1CB757DE005440CB /* SUConstants.m in Sources */, 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */, 721C245C1CB7576E005440CB /* SUStatusController.m in Sources */, @@ -2623,7 +2615,6 @@ buildActionMask = 2147483647; files = ( 7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */, - 721652611D3C437E00FD13D8 /* SUSubmitInstaller.m in Sources */, 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */, 726E07C01CAF15B7001A286B /* SULog.m in Sources */, 726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */, @@ -2718,7 +2709,6 @@ buildActionMask = 2147483647; files = ( 7267E5DF1D3D8FFA00D1BF90 /* SUInstallationInputData.m in Sources */, - 7221947D1D3C433C004C34FF /* SUSubmitInstaller.m in Sources */, 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */, 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */, 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */, From e5643e29904ee5d765d195663c6223e26e527068 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 17:05:26 -0400 Subject: [PATCH 19/29] Improve authorization prompt handling We now present a better worded dialog (X wants to update. Please type your password to allow this. OK/Cancel) We still need to set the icon for the dialog window. I also fixed some issues with canceling the dialog still throwing an error. --- InstallerLauncher/SUInstallerLauncher.m | 53 ++++++++++++------- .../SUInstallerLauncherProtocol.h | 2 +- Sparkle/SUInstallerDriver.m | 4 +- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 001e1fa2..fae94cd9 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -84,7 +84,7 @@ return (submittedJob == true); } -- (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain +- (SUAuthorizationReply)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle authorizationPrompt:(NSString *)authorizationPrompt allowingInteraction:(BOOL)allowingInteraction inSystemDomain:(BOOL)systemDomain { SUFileManager *fileManager = [SUFileManager defaultManager]; @@ -111,31 +111,40 @@ BOOL canceledAuthorization = NO; BOOL failedToUseSystemDomain = NO; if (auth != NULL && systemDomain) { - AuthorizationItem rightItems[] = { - { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} - }; + // See Apple's 'EvenBetterAuthorizationSample' sample code and + // https://developer.apple.com/library/mac/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110-CH1-SECTION7 + // We can set a custom right name for authenticating as an administrator + // Using this right rather than using something like kSMRightModifySystemDaemons allows us to present a better worded prompt - AuthorizationRights rights = { - .count = sizeof(rightItems) / sizeof(*rightItems), - .items = rightItems, - }; + const char *rightName = [[NSString stringWithFormat:@"%@.sparkle-auth", hostBundleIdentifier] UTF8String]; + assert(rightName != NULL); - AuthorizationFlags flags = - (AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed); + OSStatus getRightResult = AuthorizationRightGet(rightName, NULL); + if (getRightResult == errAuthorizationDenied) { + if (AuthorizationRightSet(auth, rightName, (__bridge CFTypeRef _Nonnull)(@(kAuthorizationRuleAuthenticateAsAdmin)), (__bridge CFStringRef _Nullable)(authorizationPrompt), NULL, NULL) != errAuthorizationSuccess) { + SULog(@"Failed to make auth right set"); + } + } + + AuthorizationItem right = { .name = rightName, .valueLength = 0, .value = NULL, .flags = 0 }; + AuthorizationRights rights = { .count = 1, .items = &right }; + + AuthorizationFlags flags = (AuthorizationFlags)(kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed); OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); if (copyStatus != errAuthorizationSuccess) { - SULog(@"Failed copying system domain rights with kSMRightModifySystemDaemons: %d", copyStatus); failedToUseSystemDomain = YES; if (copyStatus == errAuthorizationCanceled) { canceledAuthorization = YES; + } else { + SULog(@"Failed copying system domain rights: %d", copyStatus); } } } Boolean submittedJob = false; - if (!failedToUseSystemDomain && auth != NULL) { + if (!canceledAuthorization && !failedToUseSystemDomain && auth != NULL) { CFStringRef domain = (systemDomain ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; @@ -147,7 +156,7 @@ if (removeError != NULL) { // It's normal for a job to not be found, so this is not an interesting error if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) { - SULog(@"Remove error: %@", removeError); + SULog(@"Remove job error: %@", removeError); } CFRelease(removeError); } @@ -163,7 +172,9 @@ CFRelease(submitError); } } - + } + + if (auth != NULL) { AuthorizationFree(auth, kAuthorizationFlagDefaults); } @@ -178,7 +189,7 @@ return reply; } -- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; @@ -190,14 +201,14 @@ if (needsSystemAuthorization && !preflighted && !allowingInteraction) { completionHandler(SUAuthorizationReplyAuthorizeLater); } else { - BOOL submittedInstaller = ([self submitInstallerAtPath:installerPath withHostBundle:hostBundle allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization] == SUAuthorizationReplySuccess); + SUAuthorizationReply installerReply = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle authorizationPrompt:authorizationPrompt allowingInteraction:allowingInteraction inSystemDomain:needsSystemAuthorization]; - if (!submittedInstaller) { + if (installerReply == SUAuthorizationReplyFailure) { SULog(@"Failed to submit installer job"); } BOOL submittedProgressTool = NO; - if (submittedInstaller) { + if (installerReply == SUAuthorizationReplySuccess) { submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:needsSystemAuthorization]; if (!submittedProgressTool) { @@ -205,7 +216,11 @@ } } - completionHandler(submittedProgressTool ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); + if (installerReply == SUAuthorizationReplyCancelled) { + completionHandler(installerReply); + } else { + completionHandler(submittedProgressTool ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); + } } }); } diff --git a/InstallerLauncher/SUInstallerLauncherProtocol.h b/InstallerLauncher/SUInstallerLauncherProtocol.h index aa76076f..d0175c2d 100644 --- a/InstallerLauncher/SUInstallerLauncherProtocol.h +++ b/InstallerLauncher/SUInstallerLauncherProtocol.h @@ -11,6 +11,6 @@ @protocol SUInstallerLauncherProtocol -- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler; +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler; @end diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 3d1e89cc..40d93b92 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -436,7 +436,9 @@ assert(hostBundlePath != nil); #warning pass actual guided flag eventually - [installerLauncher launchInstallerAtPath:relaunchToolPath progressToolPath:progressToolPath withHostBundlePath:hostBundlePath guidedInstallation:NO allowingInteraction:shouldAllowInstallerInteraction completion:^(SUAuthorizationReply result) { + // The installer launcher could be in a XPC service, so we don't want to do localization in there + NSString *authorizationPrompt = [NSString stringWithFormat:SULocalizedString(@"%1$@ wants to update.", nil), self.host.name]; + [installerLauncher launchInstallerAtPath:relaunchToolPath progressToolPath:progressToolPath withHostBundlePath:hostBundlePath authorizationPrompt:authorizationPrompt guidedInstallation:NO allowingInteraction:shouldAllowInstallerInteraction completion:^(SUAuthorizationReply result) { dispatch_async(dispatch_get_main_queue(), ^{ retrievedLaunchStatus = YES; [launcherConnection invalidate]; From 1d3776d5c78de12c36ce9e440ab753aed77c30bc Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 19:23:56 -0400 Subject: [PATCH 20/29] Show app icon in the prompt for authorization --- InstallerLauncher/SUInstallerLauncher.m | 77 ++++++++++++++++++++++++- Sparkle.xcodeproj/project.pbxproj | 12 ++++ Sparkle/SUApplicationInfo.m | 15 ++--- Sparkle/SUBundleIcon.h | 19 ++++++ Sparkle/SUBundleIcon.m | 33 +++++++++++ 5 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 Sparkle/SUBundleIcon.h create mode 100644 Sparkle/SUBundleIcon.m diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index fae94cd9..ecd6cd99 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -11,6 +11,11 @@ #import "SULog.h" #import "SUMessageTypes.h" #import "SUSystemAuthorization.h" +#import "SUBundleIcon.h" + +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif @implementation SUInstallerLauncher @@ -131,7 +136,73 @@ AuthorizationFlags flags = (AuthorizationFlags)(kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed); - OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); + AuthorizationItem iconAuthorizationItem = {.name = kAuthorizationEnvironmentIcon, .valueLength = 0, .value = NULL, .flags = 0}; + AuthorizationEnvironment authorizationEnvironment = {.count = 0, .items = NULL}; + + // Find a 32x32 image representation of the icon, and write out a PNG version of it to a temporary location + // Then use the icon (if one is available) for the authorization prompt + // NSImage is not used because it relies on AppKit + NSURL *tempIconDestinationURL = nil; + NSURL *iconURL = [SUBundleIcon iconURLForBundle:hostBundle]; + if (iconURL != nil) { + CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)iconURL, (CFDictionaryRef)@{}); + if (imageSource != NULL) { + size_t imageCount = CGImageSourceGetCount(imageSource); + for (size_t imageIndex = 0; imageIndex < imageCount; imageIndex++) { + CFDictionaryRef cfProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, imageIndex, (CFDictionaryRef)@{}); + NSDictionary *properties = (__bridge NSDictionary *)(cfProperties); + + NSNumber *pixelWidth = properties[(const NSString *)kCGImagePropertyPixelWidth]; + NSNumber *pixelHeight = properties[(const NSString *)kCGImagePropertyPixelHeight]; + + // If we don't find a 32x32 image representation, then we don't provide an icon + // Don't try to make up with it by eg: converting an image representation to this size + // The app developer should be providing the icon representation. + // The authorization API may not take other size dimensions. + NSNumber *targetDimension = @32; + if ([pixelWidth isKindOfClass:[NSNumber class]] && [pixelHeight isKindOfClass:[NSNumber class]] && [pixelWidth isEqualToNumber:targetDimension] && [pixelHeight isEqualToNumber:targetDimension]) { + + // Use /tmp rather than NSTemporaryDirectory() or SUFileManager's temp directory function because we want: + // a) no spaces in the path (SU/NSFileManager fails here) + // b) short file path that does not exceed a small threshold (NSTemporaryDirectory() fails here) + // These limitations only apply to older systems (eg: macOS 10.8) + // The file also needs to be placed in a system readable place such as /tmp + // See https://github.com/sparkle-project/Sparkle/issues/347#issuecomment-149523848 for more info + char pathBuffer[] = "/tmp/XXXXXX.png"; + int tempIconFile = mkstemps(pathBuffer, strlen(".png")); + if (tempIconFile == -1) { + SULog(@"Failed to open temp icon from path buffer with error: %d", errno); + } else { + close(tempIconFile); + + NSString *path = [[NSString alloc] initWithUTF8String:pathBuffer]; + tempIconDestinationURL = [NSURL fileURLWithPath:path]; + + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL); + if (imageDestination != NULL) { + CGImageDestinationAddImageFromSource(imageDestination, imageSource, imageIndex, (CFDictionaryRef)@{}); + if (CGImageDestinationFinalize(imageDestination)) { + iconAuthorizationItem.valueLength = strlen(pathBuffer); + iconAuthorizationItem.value = pathBuffer; + + authorizationEnvironment.count = 1; + authorizationEnvironment.items = &iconAuthorizationItem; + } + + CFRelease(imageDestination); + } + } + + break; + } + } + + CFRelease(imageSource); + } + } + + // This should prompt up the authorization dialog if necessary + OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, &authorizationEnvironment, flags, NULL); if (copyStatus != errAuthorizationSuccess) { failedToUseSystemDomain = YES; @@ -141,6 +212,10 @@ SULog(@"Failed copying system domain rights: %d", copyStatus); } } + + if (tempIconDestinationURL != nil) { + [fileManager removeItemAtURL:tempIconDestinationURL error:NULL]; + } } Boolean submittedJob = false; diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index e92f2b9d..ce58f98f 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -98,6 +98,10 @@ 720E217B1D0D00BF003A311C /* SUUpdaterCycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21791D0D00BF003A311C /* SUUpdaterCycle.h */; }; 720E217C1D0D00BF003A311C /* SUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SUUpdaterCycle.m */; }; 7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; }; + 7214B8811D456A8500CB5CED /* SUBundleIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 7214B87F1D456A8500CB5CED /* SUBundleIcon.h */; }; + 7214B8821D456A8500CB5CED /* SUBundleIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7214B8801D456A8500CB5CED /* SUBundleIcon.m */; }; + 7214B8831D456C2400CB5CED /* SUBundleIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7214B8801D456A8500CB5CED /* SUBundleIcon.m */; }; + 7214B8841D456C9500CB5CED /* SUBundleIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7214B8801D456A8500CB5CED /* SUBundleIcon.m */; }; 72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */; }; 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B071C82C9600013C1C5 /* SULocalizations.h */; }; 721652621D3C44A100FD13D8 /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; @@ -754,6 +758,8 @@ 720E21791D0D00BF003A311C /* SUUpdaterCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterCycle.h; sourceTree = ""; }; 720E217A1D0D00BF003A311C /* SUUpdaterCycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterCycle.m; sourceTree = ""; }; 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; + 7214B87F1D456A8500CB5CED /* SUBundleIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBundleIcon.h; sourceTree = ""; }; + 7214B8801D456A8500CB5CED /* SUBundleIcon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBundleIcon.m; sourceTree = ""; }; 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUParameterAssert.h; sourceTree = ""; }; 72162B071C82C9600013C1C5 /* SULocalizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULocalizations.h; sourceTree = ""; }; 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUAuthorizationReply.h; path = InstallerLauncher/SUAuthorizationReply.h; sourceTree = SOURCE_ROOT; }; @@ -1443,6 +1449,8 @@ 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */, 721BC20C1D1CDE55002BC71E /* SULocalCacheDirectory.h */, 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */, + 7214B87F1D456A8500CB5CED /* SUBundleIcon.h */, + 7214B8801D456A8500CB5CED /* SUBundleIcon.m */, 55C14F04136EF6DB00649790 /* SULog.h */, 55C14F05136EF6DB00649790 /* SULog.m */, 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */, @@ -1831,6 +1839,7 @@ 72B09CE71CE6BCBD0052EF9E /* SUURLDownload.h in Headers */, 61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */, 7229E1B91C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h in Headers */, + 7214B8811D456A8500CB5CED /* SUBundleIcon.h in Headers */, 7293A1AE1CEE933800B957A7 /* SUURLRequest.h in Headers */, 6196CFF909C72148000DC222 /* SUStatusController.h in Headers */, 72B767DE1C9CDB9700A07552 /* SUUserInitiatedUpdateDriver.h in Headers */, @@ -2567,6 +2576,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7214B8831D456C2400CB5CED /* SUBundleIcon.m in Sources */, 7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */, 7267E5EB1D3D90C200D1BF90 /* SUFileManager.m in Sources */, 7267E5DC1D3D8F1E00D1BF90 /* SUMessageTypes.m in Sources */, @@ -2614,6 +2624,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7214B8841D456C9500CB5CED /* SUBundleIcon.m in Sources */, 7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */, 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */, 726E07C01CAF15B7001A286B /* SULog.m in Sources */, @@ -2735,6 +2746,7 @@ 720E217C1D0D00BF003A311C /* SUUpdaterCycle.m in Sources */, 72A450541C69A68900D67EEA /* SUUpdatePermission.m in Sources */, 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */, + 7214B8821D456A8500CB5CED /* SUBundleIcon.m in Sources */, 7229E1BA1C97CC4D00CB50D0 /* SUScheduledUpdateDriver.m in Sources */, 725CB95B1C7121830064365A /* SUStandardUserDriver.m in Sources */, 61EF67560E25B58D00F754E0 /* SUHost.m in Sources */, diff --git a/Sparkle/SUApplicationInfo.m b/Sparkle/SUApplicationInfo.m index dfe0e250..c0633dd3 100644 --- a/Sparkle/SUApplicationInfo.m +++ b/Sparkle/SUApplicationInfo.m @@ -7,6 +7,7 @@ // #import "SUApplicationInfo.h" +#import "SUBundleIcon.h" @implementation SUApplicationInfo @@ -17,17 +18,9 @@ + (NSImage *)bestIconForBundle:(NSBundle *)bundle { - // Cache the application icon. - NSString *iconPath = [bundle pathForResource:[bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType:@"icns"]; - // According to the macOS docs, "CFBundleIconFile - This key identifies the file containing - // the icon for the bundle. The filename you specify does not need to include the .icns - // extension, although it may." - // - // However, if it *does* include the '.icns' the above method fails (tested on macOS 10.3.9) so we'll also try: - if (!iconPath) { - iconPath = [bundle pathForResource:[bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType:nil]; - } - NSImage *icon = [[NSImage alloc] initWithContentsOfFile:iconPath]; + NSURL *iconURL = [SUBundleIcon iconURLForBundle:bundle]; + + NSImage *icon = (iconURL == nil) ? nil : [[NSImage alloc] initWithContentsOfURL:iconURL]; // Use a default icon if none is defined. if (!icon) { // this asumption may not be correct (eg. even though we're not the main bundle, it could be still be a regular app) diff --git a/Sparkle/SUBundleIcon.h b/Sparkle/SUBundleIcon.h new file mode 100644 index 00000000..f42be2fd --- /dev/null +++ b/Sparkle/SUBundleIcon.h @@ -0,0 +1,19 @@ +// +// SUBundleIcon.h +// Sparkle +// +// Created by Mayur Pawashe on 7/24/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SUBundleIcon : NSObject + ++ (NSURL * _Nullable)iconURLForBundle:(NSBundle *)bundle; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUBundleIcon.m b/Sparkle/SUBundleIcon.m new file mode 100644 index 00000000..30a831a8 --- /dev/null +++ b/Sparkle/SUBundleIcon.m @@ -0,0 +1,33 @@ +// +// SUBundleIcon.m +// Sparkle +// +// Created by Mayur Pawashe on 7/24/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUBundleIcon.h" + +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + +@implementation SUBundleIcon + ++ (NSURL *)iconURLForBundle:(NSBundle *)bundle +{ + NSString *resource = [bundle objectForInfoDictionaryKey:@"CFBundleIconFile"]; + if (resource == nil || ![resource isKindOfClass:[NSString class]]) { + return nil; + } + + NSURL *iconURL = [bundle URLForResource:resource withExtension:@"icns"]; + + // The resource could already be containing the path extension, so try again without the extra extension + if (iconURL == nil) { + iconURL = [bundle URLForResource:resource withExtension:nil]; + } + return iconURL; +} + +@end From 8d93513813a6285e15bb7ab5ee4d6eb1a046c597 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 19:28:56 -0400 Subject: [PATCH 21/29] Don't need SUAuthorizationEnvironment anymore --- Sparkle/SUAuthorizationEnvironment.h | 43 ------------------------- Sparkle/SUAuthorizationEnvironment.m | 48 ---------------------------- 2 files changed, 91 deletions(-) delete mode 100644 Sparkle/SUAuthorizationEnvironment.h delete mode 100644 Sparkle/SUAuthorizationEnvironment.m diff --git a/Sparkle/SUAuthorizationEnvironment.h b/Sparkle/SUAuthorizationEnvironment.h deleted file mode 100644 index 6d8d3114..00000000 --- a/Sparkle/SUAuthorizationEnvironment.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// SUAuthorizationEnvironment.h -// Sparkle -// -// Created by Mayur Pawashe on 5/27/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A class used for specifying an environment for an authorization request. - * This includes a prompt message and an icon image that may show up on an authorization dialog - */ -@interface SUAuthorizationEnvironment : NSObject - -/** - * Creates an authorization environment - * - * @param prompt A message that will show up in the authorization prompt dialog. The system may append a message - * to this prompt. i.e, something like "Enter your password to allow changes." Supply empty string if the prompt is not important. - * - * @param iconPath A path to a icon on disk that will be used as the icon that shows up in the authorization dialog. - * This should be a PNG image that is 32x32 in dimension. It should also be a path that is readable from anybody, - * likely in a temporary directory. - * - * @return A new authorization environment instance - */ -- (instancetype)initWithPrompt:(NSString *)prompt iconPath:(NSString *)iconPath; - -/** - * Retrieve the authorization environment struct that can be used for the Authorization Service APIs - * - * @return A authorization environment reference. Because this returns an internal pointer, this may only be valid as long as this object instance is alive. - */ -@property (nonatomic, readonly) AuthorizationEnvironment *environment NS_RETURNS_INNER_POINTER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUAuthorizationEnvironment.m b/Sparkle/SUAuthorizationEnvironment.m deleted file mode 100644 index 407fa69d..00000000 --- a/Sparkle/SUAuthorizationEnvironment.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// SUAuthorizationEnvironment.m -// Sparkle -// -// Created by Mayur Pawashe on 5/27/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SUAuthorizationEnvironment.h" - -@implementation SUAuthorizationEnvironment -{ - // Declare data here so we won't have to do more dynamic allocations - char _prompt[1024]; - char _iconPath[PATH_MAX]; - AuthorizationItem _environmentItems[2]; - AuthorizationEnvironment _environment; -} - -- (instancetype)initWithPrompt:(NSString *)prompt iconPath:(NSString *)iconPath -{ - self = [super init]; - if (self != nil) { - if (![prompt getFileSystemRepresentation:_prompt maxLength:sizeof(_prompt)]) { - bzero(_prompt, sizeof(_prompt)); - } - - if (![iconPath getFileSystemRepresentation:_iconPath maxLength:sizeof(_iconPath)]) { - bzero(_iconPath, sizeof(_iconPath)); - } - - _environmentItems[0] = (AuthorizationItem){.name = kAuthorizationEnvironmentPrompt, .valueLength = strlen(_prompt), .value = _prompt, .flags = 0}; - _environmentItems[1] = (AuthorizationItem){.name = kAuthorizationEnvironmentIcon, .valueLength = strlen(_iconPath), .value = _iconPath, .flags = 0}; - - _environment = (AuthorizationEnvironment){.count = sizeof(_environmentItems) / sizeof(*_environmentItems), .items = _environmentItems}; - } - return self; -} - -- (AuthorizationEnvironment *)environment NS_RETURNS_INNER_POINTER -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdirect-ivar-access" - return &_environment; -#pragma clang diagnostic pop -} - -@end From da8065f67e2eafcd91772b0f7618b5049f4c1a46 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 19:54:05 -0400 Subject: [PATCH 22/29] Put preventive measures for aborting update more than once. This resolves issues with canceling not taking complete effect. --- Sparkle/SUBasicUpdateDriver.m | 65 ++++++++++++++++----------- Sparkle/SUDownloadDriver.m | 13 +++--- Sparkle/SUInstallerDriver.m | 6 ++- Sparkle/SUUserInitiatedUpdateDriver.m | 12 +++-- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index e60816f4..efa1ed51 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -28,6 +28,8 @@ @property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this.. @property (nullable, nonatomic, readonly, weak) id updaterDelegate; +@property (nonatomic) BOOL aborted; + @end @implementation SUBasicUpdateDriver @@ -38,6 +40,7 @@ @synthesize delegate = _delegate; @synthesize appcastDriver = _appcastDriver; @synthesize completionBlock = _completionBlock; +@synthesize aborted = _aborted; - (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id )updaterDelegate delegate:(id )delegate { @@ -103,7 +106,9 @@ - (void)didFailToFetchAppcastWithError:(NSError *)error { - [self.delegate basicDriverIsRequestingAbortUpdateWithError:error]; + if (!self.aborted) { + [self.delegate basicDriverIsRequestingAbortUpdateWithError:error]; + } } - (void)notifyFinishLoadingAppcast @@ -115,46 +120,54 @@ - (void)didFinishLoadingAppcast:(SUAppcast *)appcast { - if ([self.updaterDelegate respondsToSelector:@selector(updater:didFinishLoadingAppcast:)]) { - [self.updaterDelegate updater:self.updater didFinishLoadingAppcast:appcast]; + if (!self.aborted) { + if ([self.updaterDelegate respondsToSelector:@selector(updater:didFinishLoadingAppcast:)]) { + [self.updaterDelegate updater:self.updater didFinishLoadingAppcast:appcast]; + } + + [self notifyFinishLoadingAppcast]; } - - [self notifyFinishLoadingAppcast]; } - (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem { - [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification - object:self.updater - userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }]; - - if ([self.updaterDelegate respondsToSelector:@selector(updater:didFindValidUpdate:)]) { - [self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem]; + if (!self.aborted) { + [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification + object:self.updater + userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }]; + + if ([self.updaterDelegate respondsToSelector:@selector(updater:didFindValidUpdate:)]) { + [self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem]; + } + + [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem]; } - - [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem]; } - (void)didNotFindUpdate { - if ([self.updaterDelegate respondsToSelector:@selector(updaterDidNotFindUpdate:)]) { - [self.updaterDelegate updaterDidNotFindUpdate:self.updater]; + if (!self.aborted) { + if ([self.updaterDelegate respondsToSelector:@selector(updaterDidNotFindUpdate:)]) { + [self.updaterDelegate updaterDidNotFindUpdate:self.updater]; + } + [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater]; + + NSError *notFoundError = + [NSError + errorWithDomain:SUSparkleErrorDomain + code:SUNoUpdateError + userInfo:@{ + NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", "'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI)"), self.host.name] + } + ]; + [self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError]; } - [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater]; - - NSError *notFoundError = - [NSError - errorWithDomain:SUSparkleErrorDomain - code:SUNoUpdateError - userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", "'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI)"), self.host.name] - } - ]; - [self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError]; } - (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately downloadedUpdate:(SUDownloadedUpdate * _Nullable)downloadedUpdate error:(nullable NSError *)error { + self.aborted = YES; + if (error != nil) { if (error.code != SUNoUpdateError && error.code != SUInstallationCancelledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this. NSError *errorToDisplay = error; diff --git a/Sparkle/SUDownloadDriver.m b/Sparkle/SUDownloadDriver.m index 2fd87827..06971194 100644 --- a/Sparkle/SUDownloadDriver.m +++ b/Sparkle/SUDownloadDriver.m @@ -35,6 +35,7 @@ @property (nonatomic) BOOL retrievedDownloadResult; @property (nonatomic) BOOL retrievedDownloadResponse; @property (nonatomic) NSUInteger expectedContentLength; +@property (nonatomic) BOOL cleaningUp; @end @@ -51,6 +52,7 @@ @synthesize retrievedDownloadResult = _retrievedDownloadResult; @synthesize retrievedDownloadResponse = _retrievedDownloadResponse; @synthesize expectedContentLength = _expectedContentLength; +@synthesize cleaningUp = _cleaningUp; - (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem host:(SUHost *)host userAgent:(NSString *)userAgent delegate:(id)delegate { @@ -98,7 +100,7 @@ self.connection.invalidationHandler = ^{ dispatch_async(dispatch_get_main_queue(), ^{ SUDownloadDriver *strongSelf = weakSelf; - if (strongSelf != nil && !strongSelf.retrievedDownloadResult) { + if (strongSelf != nil && !strongSelf.retrievedDownloadResult && !strongSelf.cleaningUp) { SULog(@"Connection to update downloader was invalidated"); NSDictionary *userInfo = @@ -119,15 +121,14 @@ [self.downloader startDownloadWithRequest:[SUURLRequest URLRequestWithRequest:self.request] bundleIdentifier:bundleIdentifier desiredFilename:desiredFilename]; } -- (void)dealloc -{ - [self cleanup]; -} - - (void)cleanup { // It's very crucial to wait until they are done with completion before invalidating our XPC connection (if there is one) // Otherwise we can run into some unfortunate crashes + // Edit: I think this was an issue because -dealloc was implemented to invoke this method. I have since removed -dealloc + // Will have to test around with this later + self.cleaningUp = YES; + [self.downloader cleanupWithCompletion:^{ dispatch_async(dispatch_get_main_queue(), ^{ if (self.connection != nil) { diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 40d93b92..f28985e0 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -53,6 +53,8 @@ @property (nonatomic, copy) NSString *downloadName; @property (nonatomic, copy) NSString *temporaryDirectory; +@property (nonatomic) BOOL aborted; + @end @implementation SUInstallerDriver @@ -72,6 +74,7 @@ @synthesize updateItem = _updateItem; @synthesize downloadName = _downloadName; @synthesize temporaryDirectory = _temporaryDirectory; +@synthesize aborted = _aborted; - (instancetype)initWithHost:(SUHost *)host cachePath:(NSString *)cachePath sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(id)updaterDelegate delegate:(nullable id)delegate { @@ -106,7 +109,7 @@ [self.installerConnection setInvalidationHandler:^{ dispatch_async(dispatch_get_main_queue(), ^{ SUInstallerDriver *strongSelf = weakSelf; - if (strongSelf.installerConnection != nil) { + if (strongSelf.installerConnection != nil && !strongSelf.aborted) { NSError *remoteError = [NSError errorWithDomain:SUSparkleErrorDomain @@ -527,6 +530,7 @@ - (void)abortInstall { + self.aborted = YES; if (self.installerConnection != nil) { [self.installerConnection invalidate]; self.installerConnection = nil; diff --git a/Sparkle/SUUserInitiatedUpdateDriver.m b/Sparkle/SUUserInitiatedUpdateDriver.m index d42dd219..209624a2 100644 --- a/Sparkle/SUUserInitiatedUpdateDriver.m +++ b/Sparkle/SUUserInitiatedUpdateDriver.m @@ -19,7 +19,6 @@ @property (nonatomic, readonly) SUUIBasedUpdateDriver *uiDriver; @property (nonatomic, readonly) id userDriver; @property (nonatomic) BOOL showingUserInitiatedProgress; -@property (nonatomic) BOOL canceledCheckForUpdates; @end @@ -28,7 +27,6 @@ @synthesize uiDriver = _uiDriver; @synthesize userDriver = _userDriver; @synthesize showingUserInitiatedProgress = _showingUserInitiatedProgress; -@synthesize canceledCheckForUpdates = _canceledCheckForUpdates; - (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver updaterDelegate:(nullable id )updaterDelegate { @@ -50,8 +48,9 @@ break; case SUUserInitiatedCheckCancelled: dispatch_async(dispatch_get_main_queue(), ^{ - self.canceledCheckForUpdates = YES; - [self.userDriver dismissUserInitiatedUpdateCheck]; + if (self.showingUserInitiatedProgress) { + [self abortUpdate]; + } }); break; } @@ -82,9 +81,7 @@ - (void)basicDriverDidFinishLoadingAppcast { - if (self.canceledCheckForUpdates) { - [self abortUpdate]; - } else if (self.showingUserInitiatedProgress) { + if (self.showingUserInitiatedProgress) { self.showingUserInitiatedProgress = NO; [self.userDriver dismissUserInitiatedUpdateCheck]; } @@ -99,6 +96,7 @@ { if (self.showingUserInitiatedProgress) { [self.userDriver dismissUserInitiatedUpdateCheck]; + self.showingUserInitiatedProgress = NO; } [self.uiDriver abortUpdateWithError:error]; } From d8196e1c5db978d85f414240be0ad693866cd8f7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 20:17:09 -0400 Subject: [PATCH 23/29] s/cancelled/canceled/ --- Autoupdate/AppInstaller.m | 14 +++++++------- InstallerLauncher/SUAuthorizationReply.h | 2 +- InstallerLauncher/SUInstallerLauncher.m | 4 ++-- Sparkle/SUBasicUpdateDriver.m | 2 +- Sparkle/SUErrors.h | 2 +- Sparkle/SUInstallerDriver.m | 10 +++++----- Sparkle/SUStatusCompletionResults.h | 4 ++-- Sparkle/SUUIBasedUpdateDriver.m | 4 ++-- Sparkle/SUUserDriver.h | 6 +++--- Sparkle/SUUserDriverCoreComponent.m | 4 ++-- Sparkle/SUUserInitiatedUpdateDriver.m | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index ef84f3f3..41d973ba 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -503,25 +503,25 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; }); }; - // Let the other end know we cancelled so they can fail gracefully without disturbing the user - BOOL installationCancelled = (!performedSecondStage && secondStageError.code == SUInstallationCancelledError); - if (performedSecondStage || installationCancelled) { + // Let the other end know we canceled so they can fail gracefully without disturbing the user + BOOL installationCanceled = (!performedSecondStage && secondStageError.code == SUInstallationCanceledError); + if (performedSecondStage || installationCanceled) { dispatch_async(dispatch_get_main_queue(), ^{ - uint8_t cancelled = (uint8_t)installationCancelled; + uint8_t canceled = (uint8_t)installationCanceled; uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated; - uint8_t sendInfo[] = {cancelled, targetTerminated}; + uint8_t sendInfo[] = {canceled, targetTerminated}; NSData *sendData = [NSData dataWithBytes:sendInfo length:sizeof(sendInfo)]; [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage2 data:sendData]; - if (installationCancelled) { + if (installationCanceled) { cleanupAndExit(); } }); } - if (!performedSecondStage && !installationCancelled) { + if (!performedSecondStage && !installationCanceled) { cleanupAndExit(); } } diff --git a/InstallerLauncher/SUAuthorizationReply.h b/InstallerLauncher/SUAuthorizationReply.h index 941bd17a..cba296b2 100644 --- a/InstallerLauncher/SUAuthorizationReply.h +++ b/InstallerLauncher/SUAuthorizationReply.h @@ -11,7 +11,7 @@ typedef NS_ENUM(NSUInteger, SUAuthorizationReply) { SUAuthorizationReplySuccess = 0, - SUAuthorizationReplyCancelled = 1, + SUAuthorizationReplyCanceled = 1, SUAuthorizationReplyFailure = 2, SUAuthorizationReplyAuthorizeLater = 3 }; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index ecd6cd99..d8cbfdb6 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -257,7 +257,7 @@ if (submittedJob == true) { reply = SUAuthorizationReplySuccess; } else if (canceledAuthorization) { - reply = SUAuthorizationReplyCancelled; + reply = SUAuthorizationReplyCanceled; } else { reply = SUAuthorizationReplyFailure; } @@ -291,7 +291,7 @@ } } - if (installerReply == SUAuthorizationReplyCancelled) { + if (installerReply == SUAuthorizationReplyCanceled) { completionHandler(installerReply); } else { completionHandler(submittedProgressTool ? SUAuthorizationReplySuccess : SUAuthorizationReplyFailure); diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index efa1ed51..5a667472 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -169,7 +169,7 @@ self.aborted = YES; if (error != nil) { - if (error.code != SUNoUpdateError && error.code != SUInstallationCancelledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this. + if (error.code != SUNoUpdateError && error.code != SUInstallationCanceledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this. NSError *errorToDisplay = error; int finiteRecursion=5; do { diff --git a/Sparkle/SUErrors.h b/Sparkle/SUErrors.h index ec68ebac..aae5ca7b 100644 --- a/Sparkle/SUErrors.h +++ b/Sparkle/SUErrors.h @@ -54,7 +54,7 @@ typedef NS_ENUM(OSStatus, SUError) { SURelaunchError = 4004, SUInstallationError = 4005, SUDowngradeError = 4006, - SUInstallationCancelledError = 4007, + SUInstallationCanceledError = 4007, SUInstallationAuthorizeLaterError = 4008 }; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index f28985e0..f9cff8bd 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -262,12 +262,12 @@ } else if (identifier == SUInstallationFinishedStage2) { self.currentStage = identifier; - BOOL cancelledInstallation = NO; + BOOL canceledInstallation = NO; if (data.length >= sizeof(uint8_t)) { - cancelledInstallation = (*(const uint8_t *)data.bytes == 0x1); + canceledInstallation = (*(const uint8_t *)data.bytes == 0x1); } - if (cancelledInstallation) { + if (canceledInstallation) { [self.delegate installerIsRequestingAbortInstallWithError:nil]; } else { if (!self.startedInstalling) { @@ -450,8 +450,8 @@ case SUAuthorizationReplyFailure: completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while launching the installer. Please try again later.", nil) }]); break; - case SUAuthorizationReplyCancelled: - completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCancelledError userInfo:nil]); + case SUAuthorizationReplyCanceled: + completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationCanceledError userInfo:nil]); break; case SUAuthorizationReplyAuthorizeLater: completionHandler([NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationAuthorizeLaterError userInfo:nil]); diff --git a/Sparkle/SUStatusCompletionResults.h b/Sparkle/SUStatusCompletionResults.h index c92a4d27..ee7a81fa 100644 --- a/Sparkle/SUStatusCompletionResults.h +++ b/Sparkle/SUStatusCompletionResults.h @@ -18,12 +18,12 @@ typedef NS_ENUM(NSUInteger, SUUpdateCheckTimerStatus) { typedef NS_ENUM(NSUInteger, SUUserInitiatedCheckStatus) { SUUserInitiatedCheckDone, - SUUserInitiatedCheckCancelled + SUUserInitiatedCheckCanceled }; typedef NS_ENUM(NSUInteger, SUDownloadUpdateStatus) { SUDownloadUpdateDone, - SUDownloadUpdateCancelled + SUDownloadUpdateCanceled }; typedef NS_ENUM(NSUInteger, SUInstallUpdateStatus) { diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 3d3dc468..e124be4b 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -150,7 +150,7 @@ switch (downloadCompletionStatus) { case SUDownloadUpdateDone: break; - case SUDownloadUpdateCancelled: + case SUDownloadUpdateCanceled: dispatch_async(dispatch_get_main_queue(), ^{ if ([self.updaterDelegate respondsToSelector:@selector(userDidCancelDownload:)]) { [self.updaterDelegate userDidCancelDownload:self.updater]; @@ -236,7 +236,7 @@ abortUpdate(); }); }]; - } else if (error.code == SUInstallationCancelledError || error.code == SUInstallationAuthorizeLaterError) { + } else if (error.code == SUInstallationCanceledError || error.code == SUInstallationAuthorizeLaterError) { abortUpdate(); } else { [self.userDriver showUpdaterError:nonNullError acknowledgement:^{ diff --git a/Sparkle/SUUserDriver.h b/Sparkle/SUUserDriver.h index 5428bdcf..a1e10241 100644 --- a/Sparkle/SUUserDriver.h +++ b/Sparkle/SUUserDriver.h @@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN * * Respond to the user initiating an update check. Sparkle uses this to show the user a window with an indeterminate progress bar. * - * @param updateCheckStatusCompletion A reply indicating whether the initiated update check is done or cancelled. + * @param updateCheckStatusCompletion A reply indicating whether the initiated update check is done or canceled. * Attempts to canceling can be made before -dismissUserInitiatedUpdateCheck is invoked. Replying with SUUserInitiatedCheckDone * on the other hand should not be done until -dismissUserInitiatedUpdateCheck is invoked. * @@ -140,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN * Show the user an update that has started installing can be resumed and installed immediately * * Let the user know an update that has already been downloaded and started installing can be resumed. - * Note at this point the update cannot be cancelled. + * Note at this point the update cannot be canceled. * * @param appcastItem The Appcast Item containing information that reflects the new update * @@ -207,7 +207,7 @@ NS_ASSUME_NONNULL_BEGIN * * Let the user know that downloading the new update started. * - * @param downloadUpdateStatusCompletion A reply of SUDownloadUpdateCancelled can be used to cancel + * @param downloadUpdateStatusCompletion A reply of SUDownloadUpdateCanceled can be used to cancel * the download at any point before -showDownloadDidStartExtractingUpdate is invoked. * A reply of SUDownloadUpdateDone signifies that the download is done, which should not be invoked until * -showDownloadDidStartExtractingUpdate diff --git a/Sparkle/SUUserDriverCoreComponent.m b/Sparkle/SUUserDriverCoreComponent.m index 7ea17068..2711c379 100644 --- a/Sparkle/SUUserDriverCoreComponent.m +++ b/Sparkle/SUUserDriverCoreComponent.m @@ -155,7 +155,7 @@ - (void)cancelUpdateCheckStatus { if (self.updateCheckStatusCompletion != nil) { - self.updateCheckStatusCompletion(SUUserInitiatedCheckCancelled); + self.updateCheckStatusCompletion(SUUserInitiatedCheckCanceled); self.updateCheckStatusCompletion = nil; } } @@ -178,7 +178,7 @@ - (void)cancelDownloadStatus { if (self.downloadStatusCompletion != nil) { - self.downloadStatusCompletion(SUDownloadUpdateCancelled); + self.downloadStatusCompletion(SUDownloadUpdateCanceled); self.downloadStatusCompletion = nil; } } diff --git a/Sparkle/SUUserInitiatedUpdateDriver.m b/Sparkle/SUUserInitiatedUpdateDriver.m index 209624a2..4c2c3c12 100644 --- a/Sparkle/SUUserInitiatedUpdateDriver.m +++ b/Sparkle/SUUserInitiatedUpdateDriver.m @@ -46,7 +46,7 @@ switch (completionStatus) { case SUUserInitiatedCheckDone: break; - case SUUserInitiatedCheckCancelled: + case SUUserInitiatedCheckCanceled: dispatch_async(dispatch_get_main_queue(), ^{ if (self.showingUserInitiatedProgress) { [self abortUpdate]; From ec69aa07a31234af59455f94429286a1b5dee19d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 21:47:12 -0400 Subject: [PATCH 24/29] Add JoinExistingSession to TestAppHelper too --- TestAppHelper/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TestAppHelper/Info.plist b/TestAppHelper/Info.plist index 4ffe10a2..1f0842ff 100644 --- a/TestAppHelper/Info.plist +++ b/TestAppHelper/Info.plist @@ -30,6 +30,8 @@ NSRunLoop ServiceType Application + JoinExistingSession + NSAppTransportSecurity From 35801a22f23c39ad4d0a52bed7bea207ee18f883 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 21:51:36 -0400 Subject: [PATCH 25/29] Remove stray Autoupdate group folder reference --- Sparkle.xcodeproj/project.pbxproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index ce58f98f..dfe90726 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -1171,7 +1171,6 @@ FA1941C40D94A6EA00DD942E /* Configurations */, 726B2B5E1C645FC900388755 /* UI Tests */, 72D9549F1CBB415C006F28BD /* sparkle-cli */, - 72B398D31D3D879400EE297F /* Autoupdate */, 0867D69AFE84028FC02AAC07 /* Frameworks */, 034768DFFF38A50411DB9C8B /* Products */, ); @@ -1699,13 +1698,6 @@ path = Autoupdate; sourceTree = ""; }; - 72B398D31D3D879400EE297F /* Autoupdate */ = { - isa = PBXGroup; - children = ( - ); - path = Autoupdate; - sourceTree = ""; - }; 72B767E81C9D114F00A07552 /* Update Drivers */ = { isa = PBXGroup; children = ( From 1384b5a80f2c2d71609e0b6d7fd18908be3fd403 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 23:35:47 -0400 Subject: [PATCH 26/29] Allow tagging installation type in appcast item enclosure This is now necessary for package type installations so we can know whether or not we should authenticate ahead of time. Of course, we also verify that the download contains the type of installation we expect (because the appcast is not very trusted). --- Autoupdate/AppInstaller.m | 29 ++++++++----- Autoupdate/SUInstallationInputData.h | 3 +- Autoupdate/SUInstallationInputData.m | 17 +++++++- Autoupdate/SUInstaller.h | 2 +- Autoupdate/SUInstaller.m | 42 +++++++++++++++---- InstallerConnection/SUInstallerConnection.m | 4 +- .../SUInstallerConnectionProtocol.h | 2 +- .../SUXPCInstallerConnection.m | 4 +- InstallerLauncher/SUInstallerLauncher.m | 4 +- .../SUInstallerLauncherProtocol.h | 2 +- Sparkle.xcodeproj/project.pbxproj | 2 + Sparkle/SUAppcastItem.h | 1 + Sparkle/SUAppcastItem.m | 24 +++++++++++ Sparkle/SUConstants.h | 1 + Sparkle/SUConstants.m | 1 + Sparkle/SUInstallationType.h | 20 +++++++++ Sparkle/SUInstallerDriver.m | 13 +++--- Sparkle/SUSystemAuthorization.h | 2 +- Sparkle/SUSystemAuthorization.m | 7 +++- 19 files changed, 142 insertions(+), 38 deletions(-) create mode 100644 Sparkle/SUInstallationType.h diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index 41d973ba..23df75f3 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -26,6 +26,7 @@ #import "SUInstallerCommunicationProtocol.h" #import "AgentConnection.h" #import "SUInstallerAgentProtocol.h" +#import "SUInstallationType.h" #ifdef _APPKITDEFINES_H #error This is a "daemon-safe" class and should NOT import AppKit @@ -375,20 +376,26 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; NSBundle *hostBundle = [NSBundle bundleWithPath:nonNullInstallationData.hostBundlePath]; SUHost *host = [[SUHost alloc] initWithBundle:hostBundle]; - NSString *bundleIdentifier = hostBundle.bundleIdentifier; - if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) { - SULog(@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier); + NSString *installationType = nonNullInstallationData.installationType; + if (!SUValidInstallationType(installationType)) { + SULog(@"Error: Received invalid installation type: %@", installationType); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } else { - // This will be important later - if (nonNullInstallationData.relaunchPath == nil) { - SULog(@"Error: Failed to obtain relaunch path from installation data"); + NSString *bundleIdentifier = hostBundle.bundleIdentifier; + if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) { + SULog(@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } else { - self.host = host; - self.installationData = installationData; - - [self extractAndInstallUpdate]; + // This will be important later + if (nonNullInstallationData.relaunchPath == nil) { + SULog(@"Error: Failed to obtain relaunch path from installation data"); + [self cleanupAndExitWithStatus:EXIT_FAILURE]; + } else { + self.host = host; + self.installationData = installationData; + + [self extractAndInstallUpdate]; + } } } } @@ -436,7 +443,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; dispatch_async(self.installerQueue, ^{ NSError *installerError = nil; - id installer = [SUInstaller installerForHost:self.host updateDirectory:self.installationData.updateDirectoryPath allowingInteraction:self.allowsInteraction versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; + id installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationData.installationType updateDirectory:self.installationData.updateDirectoryPath allowingInteraction:self.allowsInteraction versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; if (installer == nil) { SULog(@"Error: Failed to create installer instance with error: %@", installerError); diff --git a/Autoupdate/SUInstallationInputData.h b/Autoupdate/SUInstallationInputData.h index 573916c3..d585ac72 100644 --- a/Autoupdate/SUInstallationInputData.h +++ b/Autoupdate/SUInstallationInputData.h @@ -20,12 +20,13 @@ NS_ASSUME_NONNULL_BEGIN * dsaSignature - DSA signature for the update that came from the appcast item * decryptionPassword - optional decryption password for dmg archives */ -- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword; +- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword; @property (nonatomic, copy, readonly) NSString *relaunchPath; @property (nonatomic, copy, readonly) NSString *hostBundlePath; @property (nonatomic, copy, readonly) NSString *updateDirectoryPath; @property (nonatomic, copy, readonly) NSString *downloadName; +@property (nonatomic, copy, readonly) NSString *installationType; @property (nonatomic, copy, readonly) NSString *dsaSignature; @property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword; diff --git a/Autoupdate/SUInstallationInputData.m b/Autoupdate/SUInstallationInputData.m index 93250523..4854677a 100644 --- a/Autoupdate/SUInstallationInputData.m +++ b/Autoupdate/SUInstallationInputData.m @@ -7,6 +7,7 @@ // #import "SUInstallationInputData.h" +#import "SUInstallationType.h" #ifdef _APPKITDEFINES_H #error This is a "daemon-safe" class and should NOT import AppKit @@ -18,6 +19,7 @@ static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath"; static NSString *SUDownloadNameKey = @"SUDownloadName"; static NSString *SUDSASignatureKey = @"SUDSASignature"; static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; +static NSString *SUInstallationTypeKey = @"SUInstallationType"; @implementation SUInstallationInputData @@ -27,8 +29,9 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; @synthesize downloadName = _downloadName; @synthesize dsaSignature = _dsaSignature; @synthesize decryptionPassword = _decryptionPassword; +@synthesize installationType = _installationType; -- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword +- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword { self = [super init]; if (self != nil) { @@ -36,6 +39,10 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; _hostBundlePath = [hostBundlePath copy]; _updateDirectoryPath = [updateDirectoryPath copy]; _downloadName = [downloadName copy]; + + _installationType = [installationType copy]; + assert(SUValidInstallationType(_installationType)); + _dsaSignature = [dsaSignature copy]; _decryptionPassword = [decryptionPassword copy]; } @@ -64,6 +71,11 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; return nil; } + NSString *installationType = [decoder decodeObjectOfClass:[NSString class] forKey:SUInstallationTypeKey]; + if (!SUValidInstallationType(installationType)) { + return nil; + } + NSString *dsaSignature = [decoder decodeObjectOfClass:[NSString class] forKey:SUDSASignatureKey]; if (dsaSignature == nil) { return nil; @@ -71,7 +83,7 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey]; - return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; + return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; } - (void)encodeWithCoder:(NSCoder *)coder @@ -79,6 +91,7 @@ static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword"; [coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey]; [coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey]; [coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey]; + [coder encodeObject:self.installationType forKey:SUInstallationTypeKey]; [coder encodeObject:self.downloadName forKey:SUDownloadNameKey]; [coder encodeObject:self.dsaSignature forKey:SUDSASignatureKey]; if (self.decryptionPassword != nil) { diff --git a/Autoupdate/SUInstaller.h b/Autoupdate/SUInstaller.h index d6fc3b96..9f8952fc 100644 --- a/Autoupdate/SUInstaller.h +++ b/Autoupdate/SUInstaller.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SUInstaller : NSObject -+ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError **)error; ++ (nullable id)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError **)error; + (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr; diff --git a/Autoupdate/SUInstaller.m b/Autoupdate/SUInstaller.m index 1e043c16..63604e33 100644 --- a/Autoupdate/SUInstaller.m +++ b/Autoupdate/SUInstaller.m @@ -15,6 +15,7 @@ #import "SULog.h" #import "SUParameterAssert.h" #import "SUErrors.h" +#import "SUInstallationType.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -112,7 +113,7 @@ return newAppDownloadPath; } -+ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError * __autoreleasing *)error ++ (nullable id)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError * __autoreleasing *)error { BOOL isPackage = NO; BOOL isGuided = NO; @@ -125,16 +126,43 @@ return nil; } - // If the installer does not allow interaction, we could be running as root - // If we are running as root, using a non-guided package installer does not work properly so avoid it at all costs + // Make sure we find the type of installer that we were expecting to find + // 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 installer = nil; - if (isPackage && (isGuided || !allowsInteraction)) { - installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath]; + if (isPackage && isGuided) { + if (![expectedInstallationType isEqualToString:SUInstallationTypeGuidedPackage]) { + 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, SUInstallationTypeGuidedPackage] }]; + } + } else { + installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath]; + } } else if (isPackage) { - installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath]; + if (![expectedInstallationType isEqualToString:SUInstallationTypePackage]) { + 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, SUInstallationTypePackage] }]; + } + } else { +#warning review this + // Even if we expect an ordinary package, if we don't allow interaction (eg: because we're already running root) - + // we should try a guided installation instead - because an ordinary package installation may not work well + if (allowsInteraction) { + installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath]; + } else { + installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath]; + } + } } else { - installer = [[SUPlainInstaller alloc] initWithHost:host applicationPath:newDownloadPath installationPath:[[self class] installationPathForHost:host] versionComparator:comparator]; + if (![expectedInstallationType isEqualToString:SUInstallationTypeApplication]) { + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }]; + } + } else { + installer = [[SUPlainInstaller alloc] initWithHost:host applicationPath:newDownloadPath installationPath:[[self class] installationPathForHost:host] versionComparator:comparator]; + } } + return installer; } diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m index 71246774..b4f26932 100644 --- a/InstallerConnection/SUInstallerConnection.m +++ b/InstallerConnection/SUInstallerConnection.m @@ -58,9 +58,9 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K [self enableAutomaticTermination]; } -- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType { - NSXPCConnectionOptions options = SUNeedsSystemAuthorizationAccess(hostPath, guided, NULL) ? NSXPCConnectionPrivileged : 0; + NSXPCConnectionOptions options = SUNeedsSystemAuthorizationAccess(hostPath, installationType, NULL) ? NSXPCConnectionPrivileged : 0; NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; diff --git a/InstallerConnection/SUInstallerConnectionProtocol.h b/InstallerConnection/SUInstallerConnectionProtocol.h index 8eeaeb0c..61bb80de 100644 --- a/InstallerConnection/SUInstallerConnectionProtocol.h +++ b/InstallerConnection/SUInstallerConnectionProtocol.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setInvalidationHandler:(void (^)(void))invalidationHandler; -- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided; +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType; - (void)invalidate; diff --git a/InstallerConnection/SUXPCInstallerConnection.m b/InstallerConnection/SUXPCInstallerConnection.m index 76cbe27e..ae04b223 100644 --- a/InstallerConnection/SUXPCInstallerConnection.m +++ b/InstallerConnection/SUXPCInstallerConnection.m @@ -59,9 +59,9 @@ }]; } -- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath guided:(BOOL)guided +- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType { - [self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath guided:guided]; + [self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath installationType:installationType]; } - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index d8cbfdb6..b04e0aa6 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -264,13 +264,13 @@ return reply; } -- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; BOOL preflighted = NO; - BOOL needsSystemAuthorization = SUNeedsSystemAuthorizationAccess(hostBundlePath, guidedInstallation, &preflighted); + BOOL needsSystemAuthorization = SUNeedsSystemAuthorizationAccess(hostBundlePath, installationType, &preflighted); // if we need to use the system domain and we aren't already root and we aren't allowed interaction, then try sometime later when interaction is allowed if (needsSystemAuthorization && !preflighted && !allowingInteraction) { diff --git a/InstallerLauncher/SUInstallerLauncherProtocol.h b/InstallerLauncher/SUInstallerLauncherProtocol.h index d0175c2d..5fd9fa3c 100644 --- a/InstallerLauncher/SUInstallerLauncherProtocol.h +++ b/InstallerLauncher/SUInstallerLauncherProtocol.h @@ -11,6 +11,6 @@ @protocol SUInstallerLauncherProtocol -- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt guidedInstallation:(BOOL)guidedInstallation allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler; +- (void)launchInstallerAtPath:(NSString *)installerPath progressToolPath:(NSString *)progressToolPath withHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(SUAuthorizationReply))completionHandler; @end diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index dfe90726..4a8843ef 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -760,6 +760,7 @@ 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; 7214B87F1D456A8500CB5CED /* SUBundleIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBundleIcon.h; sourceTree = ""; }; 7214B8801D456A8500CB5CED /* SUBundleIcon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBundleIcon.m; sourceTree = ""; }; + 7214B8851D45AD9A00CB5CED /* SUInstallationType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallationType.h; sourceTree = ""; }; 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUParameterAssert.h; sourceTree = ""; }; 72162B071C82C9600013C1C5 /* SULocalizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULocalizations.h; sourceTree = ""; }; 721652671D3C8FED00FD13D8 /* SUAuthorizationReply.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUAuthorizationReply.h; path = InstallerLauncher/SUAuthorizationReply.h; sourceTree = SOURCE_ROOT; }; @@ -1385,6 +1386,7 @@ 61B5FB9509C4F04600B25A18 /* SUAppcast.m */, 61B5FC5309C5182000B25A18 /* SUAppcastItem.h */, 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */, + 7214B8851D45AD9A00CB5CED /* SUInstallationType.h */, 72B09CE51CE6BCBD0052EF9E /* SUURLDownload.h */, 72B09CE61CE6BCBD0052EF9E /* SUURLDownload.m */, 7293A1AC1CEE933800B957A7 /* SUURLRequest.h */, diff --git a/Sparkle/SUAppcastItem.h b/Sparkle/SUAppcastItem.h index 69fa0286..54bbf509 100644 --- a/Sparkle/SUAppcastItem.h +++ b/Sparkle/SUAppcastItem.h @@ -30,6 +30,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject @property (copy, readonly) NSString *displayVersionString; @property (copy, readonly) NSDictionary *deltaUpdates; @property (strong, readonly) NSURL *infoURL; +@property (nonatomic, copy, readonly) NSString *installationType; // Initializes with data from a dictionary provided by the RSS class. - (instancetype)initWithDictionary:(NSDictionary *)dict; diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 855e5dd3..681b8db8 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -10,6 +10,7 @@ #import "SUVersionComparisonProtocol.h" #import "SULog.h" #import "SUConstants.h" +#import "SUInstallationType.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit @@ -28,6 +29,7 @@ static NSString *SUAppcastItemReleaseNotesURLKey = @"releaseNotesURL"; static NSString *SUAppcastItemTitleKey = @"title"; static NSString *SUAppcastItemVersionStringKey = @"versionString"; static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; +static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationType"; @implementation SUAppcastItem @@ -45,6 +47,7 @@ static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; @synthesize title = _title; @synthesize versionString = _versionString; @synthesize propertiesDictionary = _propertiesDictionary; +@synthesize installationType = _installationType; + (BOOL)supportsSecureCoding { @@ -67,6 +70,11 @@ static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; return nil; } + _installationType = [decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemInstallationTypeKey]; + if (!SUValidInstallationType(_installationType)) { + return nil; + } + _itemDescription = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDescriptionKey] copy]; _maximumSystemVersion = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy]; _minimumSystemVersion = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy]; @@ -130,6 +138,10 @@ static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; if (self.propertiesDictionary != nil) { [encoder encodeObject:self.propertiesDictionary forKey:SUAppcastItemPropertiesKey]; } + + if (self.installationType != nil) { + [encoder encodeObject:self.installationType forKey:SUAppcastItemInstallationTypeKey]; + } } - (BOOL)isDeltaUpdate @@ -263,6 +275,18 @@ static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; } else { _displayVersionString = [_versionString copy]; } + + _installationType = [enclosure objectForKey:SUAppcastAttributeInstallationType]; + if (_installationType == nil) { + _installationType = SUInstallationTypeDefault; + } else if (!SUValidInstallationType(_installationType)) { + if (error != NULL) { + *error = [NSString stringWithFormat:@"Feed item's enclosure lacks valid %@ (found %@)", SUAppcastAttributeInstallationType, _installationType]; + } + return nil; + } else if ([_installationType isEqualToString:SUInstallationTypePackage]) { + SULog(@"warning: '%@' for %@ is deprecated. Use '%@' instead.", SUInstallationTypePackage, SUAppcastAttributeInstallationType, SUInstallationTypeGuidedPackage); + } // Find the appropriate release notes URL. NSString *releaseNotesString = [dict objectForKey:SUAppcastElementReleaseNotesLink]; diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index ff36ab3b..ec0bad29 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -66,6 +66,7 @@ extern NSString *const SUAppcastAttributeDeltaFrom; extern NSString *const SUAppcastAttributeDSASignature; extern NSString *const SUAppcastAttributeShortVersionString; extern NSString *const SUAppcastAttributeVersion; +extern NSString *const SUAppcastAttributeInstallationType; extern NSString *const SUAppcastElementCriticalUpdate; extern NSString *const SUAppcastElementDeltas; diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 2c69d8ae..8e892e0e 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -64,6 +64,7 @@ NSString *const SUAppcastAttributeDeltaFrom = @"sparkle:deltaFrom"; NSString *const SUAppcastAttributeDSASignature = @"sparkle:dsaSignature"; NSString *const SUAppcastAttributeShortVersionString = @"sparkle:shortVersionString"; NSString *const SUAppcastAttributeVersion = @"sparkle:version"; +NSString *const SUAppcastAttributeInstallationType = @"sparkle:installationType"; NSString *const SUAppcastElementCriticalUpdate = @"sparkle:criticalUpdate"; NSString *const SUAppcastElementDeltas = @"sparkle:deltas"; diff --git a/Sparkle/SUInstallationType.h b/Sparkle/SUInstallationType.h new file mode 100644 index 00000000..e8830951 --- /dev/null +++ b/Sparkle/SUInstallationType.h @@ -0,0 +1,20 @@ +// +// SUInstallationType.h +// Sparkle +// +// Created by Mayur Pawashe on 7/24/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#ifndef SUInstallationType_h +#define SUInstallationType_h + +#define SUInstallationTypeApplication @"application" // the default installation type for ordinary application updates +#define SUInstallationTypeGuidedPackage @"guided-package" // the preferred installation type for package installations +#define SUInstallationTypePackage @"package" // the deprecated installation type; use guided package instead + +#define SUInstallationTypeDefault SUInstallationTypeApplication +#define SUInstallationTypesArray (@[SUInstallationTypeApplication, SUInstallationTypeGuidedPackage, SUInstallationTypePackage]) +#define SUValidInstallationType(x) ((x != nil) && [SUInstallationTypesArray containsObject:x]) + +#endif /* SUInstallationType_h */ diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index f9cff8bd..3aeed79d 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -125,9 +125,10 @@ }]; NSString *serviceName = SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier); + NSString *installationType = self.updateItem.installationType; + assert(installationType != nil); -#warning use self.updateItem later for passing guided option - [self.installerConnection setServiceName:serviceName hostPath:self.host.bundlePath guided:NO]; + [self.installerConnection setServiceName:serviceName hostPath:self.host.bundlePath installationType:installationType]; [self sendInstallationData]; } @@ -169,7 +170,7 @@ decryptionPassword = [self.updaterDelegate decryptionPasswordForUpdater:self.updater]; } - SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; + SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName installationType:self.updateItem.installationType dsaSignature:dsaSignature decryptionPassword:decryptionPassword]; NSData *archivedData = SUArchiveRootObjectSecurely(installationData); if (archivedData == nil) { @@ -438,10 +439,12 @@ NSString *hostBundlePath = self.host.bundle.bundlePath; assert(hostBundlePath != nil); -#warning pass actual guided flag eventually + NSString *installationType = self.updateItem.installationType; + assert(installationType != nil); + // The installer launcher could be in a XPC service, so we don't want to do localization in there NSString *authorizationPrompt = [NSString stringWithFormat:SULocalizedString(@"%1$@ wants to update.", nil), self.host.name]; - [installerLauncher launchInstallerAtPath:relaunchToolPath progressToolPath:progressToolPath withHostBundlePath:hostBundlePath authorizationPrompt:authorizationPrompt guidedInstallation:NO allowingInteraction:shouldAllowInstallerInteraction completion:^(SUAuthorizationReply result) { + [installerLauncher launchInstallerAtPath:relaunchToolPath progressToolPath:progressToolPath withHostBundlePath:hostBundlePath authorizationPrompt:authorizationPrompt installationType:installationType allowingInteraction:shouldAllowInstallerInteraction completion:^(SUAuthorizationReply result) { dispatch_async(dispatch_get_main_queue(), ^{ retrievedLaunchStatus = YES; [launcherConnection invalidate]; diff --git a/Sparkle/SUSystemAuthorization.h b/Sparkle/SUSystemAuthorization.h index 13fc0547..6e9232ce 100644 --- a/Sparkle/SUSystemAuthorization.h +++ b/Sparkle/SUSystemAuthorization.h @@ -11,6 +11,6 @@ NS_ASSUME_NONNULL_BEGIN -BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nullable preflighted); +BOOL SUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType, BOOL * _Nullable preflighted); NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUSystemAuthorization.m b/Sparkle/SUSystemAuthorization.m index 8afe4d9b..0b5a87e7 100644 --- a/Sparkle/SUSystemAuthorization.m +++ b/Sparkle/SUSystemAuthorization.m @@ -8,6 +8,7 @@ #import "SUSystemAuthorization.h" #import +#import "SUInstallationType.h" static BOOL SUPreflightSystemAuthorization(void) { @@ -38,7 +39,7 @@ static BOOL SUPreflightSystemAuthorization(void) return (copyStatus == errAuthorizationSuccess); } -BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nullable preflighted) +BOOL SUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType, BOOL * _Nullable preflighted) { BOOL result; if (SUPreflightSystemAuthorization()) { @@ -46,8 +47,10 @@ BOOL SUNeedsSystemAuthorizationAccess(NSString *path, BOOL guided, BOOL * _Nulla *preflighted = YES; } result = YES; - } else if (guided) { + } else if ([installationType isEqualToString:SUInstallationTypeGuidedPackage]) { result = YES; + } else if ([installationType isEqualToString:SUInstallationTypePackage]) { + result = NO; } else { #warning what about symbolic links? NSFileManager *fileManager = [NSFileManager defaultManager]; From 0cb59a1b02123721066774af34175cf953071917 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 23:44:37 -0400 Subject: [PATCH 27/29] Update user driver documentation --- Sparkle/SUUserDriver.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sparkle/SUUserDriver.h b/Sparkle/SUUserDriver.h index a1e10241..e710f2e4 100644 --- a/Sparkle/SUUserDriver.h +++ b/Sparkle/SUUserDriver.h @@ -241,6 +241,9 @@ NS_ASSUME_NONNULL_BEGIN * This is an appropriate time to reply with SUDownloadUpdateDone if not done so already * Sparkle uses this to show an indeterminate progress bar. * + * Note that an update can resume at this point after having been downloaded before, + * so this may be called without any of the download callbacks being invoked prior. + * * This can be called from any thread */ - (void)showDownloadDidStartExtractingUpdate; From 150f10ed05f4e8691b7a2f9f32276f5c1e9d69b3 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 24 Jul 2016 23:53:18 -0400 Subject: [PATCH 28/29] Update Installer unit test --- Tests/SUInstallerTest.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/SUInstallerTest.m b/Tests/SUInstallerTest.m index 1c32e810..50c5f3b4 100644 --- a/Tests/SUInstallerTest.m +++ b/Tests/SUInstallerTest.m @@ -12,6 +12,7 @@ #import "SUInstaller.h" #import "SUInstallerProtocol.h" #import "SUStandardVersionComparator.h" +#import "SUInstallationType.h" #import @interface SUInstallerTest : XCTestCase @@ -39,7 +40,7 @@ if (uid) { NSLog(@"Test must be run as root: sudo xctest -XCTest SUInstallerTest 'Sparkle Unit Tests.xctest'"); - return; // or just comment this line out and enter password when the auth. prompt comes up + return; } NSString *expectedDestination = @"/tmp/sparklepkgtest.app"; @@ -54,7 +55,7 @@ SUHost *host = [[SUHost alloc] initWithBundle:bundle]; NSError *installerError = nil; - id installer = [SUInstaller installerForHost:host updateDirectory:[path stringByDeletingLastPathComponent] allowingInteraction:NO versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; + id installer = [SUInstaller installerForHost:host expectedInstallationType:SUInstallationTypeGuidedPackage updateDirectory:[path stringByDeletingLastPathComponent] allowingInteraction:NO versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; if (installer == nil) { XCTFail(@"Installer is nil with error: %@", installerError); From 7d16e223c3684c12e8a7653dcab0e47c81ecdeb1 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 25 Jul 2016 00:05:42 -0400 Subject: [PATCH 29/29] Remove stray AuthorizationRef reference --- Sparkle/SUFileManager.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 29f64232..09907295 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -49,7 +49,6 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { @implementation SUFileManager { - AuthorizationRef _auth; NSFileManager *_fileManager; }