More SU -> SPU prefix changing

This commit is contained in:
Zorg committed 2016-08-06 21:00:14 -04:00
1 parent bdd2b7571b
commit 766dd50aeb
12 files changed
+196 -196

No files matched your search

+2 -2
View File
@@ -7,7 +7,7 @@
//
#import "AgentConnection.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SPUInstallerAgentProtocol.h"
#import "SUInstallerAgentInitiationProtocol.h"
@@ -39,7 +39,7 @@
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 = [[NSXPCListener alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
_delegate = delegate;
}
+15 -15
View File
@@ -14,7 +14,7 @@
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUStandardVersionComparator.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SPUSecureCoding.h"
#import "SPUInstallationInputData.h"
#import "SUUnarchiver.h"
@@ -114,7 +114,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
_hostBundleIdentifier = [hostBundleIdentifier copy];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
_xpcListener.delegate = self;
_agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self];
@@ -183,7 +183,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (void)extractAndInstallUpdate
{
[self.communicator handleMessageWithIdentifier:SUExtractionStarted data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword delegate:self];
@@ -213,7 +213,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
[self.communicator handleMessageWithIdentifier:SUExtractedArchiveWithProgress data:data];
[self.communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data];
}
}
@@ -233,12 +233,12 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
self.relaunchPath = nil;
self.host = nil;
[self.communicator handleMessageWithIdentifier:SUArchiveExtractionFailed data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:[NSData data]];
}
- (void)unarchiverDidFinish
{
[self.communicator handleMessageWithIdentifier:SUValidationStarted data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
@@ -268,7 +268,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
SULog(@"Error: update validation was a failure");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
} else {
[self.communicator handleMessageWithIdentifier:SUInstallationStartedStage1 data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
self.finishedValidation = YES;
if (self.agentInitiatedConnection) {
@@ -316,7 +316,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{
if (identifier == SUInstallationData && self.updateDirectoryPath == nil) {
if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
dispatch_async(dispatch_get_main_queue(), ^{
// Mark that we have received the installation data
// Do not rely on eg: self.ipdateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
@@ -389,7 +389,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self extractAndInstallUpdate];
});
} else if (identifier == SUSentUpdateAppcastItemData) {
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
@@ -399,7 +399,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self.agentConnection.agent registerInstallationInfoData:archivedData];
}
}
} else if (identifier == SUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
// Because anyone can ask us to resume the installation, it may be wise to think about backwards compatibility here if IPC changes
uint8_t relaunch = *((const uint8_t *)data.bytes);
uint8_t showsUI = *((const uint8_t *)data.bytes + 1);
@@ -420,7 +420,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
});
});
} else if (identifier == SUUpdaterAlivePong) {
} else if (identifier == SPUUpdaterAlivePong) {
self.receivedUpdaterPong = YES;
}
}
@@ -466,7 +466,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
[self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage1 data:sendData];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
self.performedStage1Installation = YES;
@@ -491,7 +491,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
[self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage2 data:sendData];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
});
} else {
SULog(@"Error: Failed to resume installer on stage 2 because installation cannot be installed silently");
@@ -521,7 +521,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side
self.receivedUpdaterPong = NO;
[self.communicator handleMessageWithIdentifier:SUUpdaterAlivePing data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
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
@@ -564,7 +564,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self.agentConnection.agent stopProgress];
shouldShowUIProgress = NO;
[self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage3 data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
NSString *installationPath = [SUInstaller installationPathForHost:self.host];
+48
View File
@@ -0,0 +1,48 @@
//
// SPUMessageTypes.h
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
extern NSString *SPUAppcastItemArchiveKey;
// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
{
SPUInstallerNotStarted = 0,
SPUExtractionStarted = 1,
SPUExtractedArchiveWithProgress = 2,
SPUArchiveExtractionFailed = 3,
SPUValidationStarted = 4,
SPUInstallationStartedStage1 = 5,
SPUInstallationFinishedStage1 = 6,
SPUInstallationFinishedStage2 = 7,
SPUInstallationFinishedStage3 = 8,
SPUUpdaterAlivePing = 9
};
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
{
SPUInstallationData = 0,
SPUSentUpdateAppcastItemData = 1,
SPUResumeInstallationToStage2 = 2,
SPUUpdaterAlivePong = 3
};
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NS_ASSUME_NONNULL_END
+86
View File
@@ -0,0 +1,86 @@
//
// SPUMessageTypes.m
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUMessageTypes.h"
#import "SUHost.h"
NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive";
// Tags added to the bundle identifier which is used as Mach service names
// 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
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
#define MAX_SERVICE_NAME_LENGTH 63u
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
{
BOOL legal;
switch (newMessageType) {
case SPUInstallerNotStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractionStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractedArchiveWithProgress:
case SPUArchiveExtractionFailed:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUValidationStarted:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUInstallationStartedStage1:
legal = (oldMessageType == SPUValidationStarted);
break;
case SPUInstallationFinishedStage1:
legal = (oldMessageType == SPUInstallationStartedStage1);
break;
case SPUInstallationFinishedStage2:
legal = (oldMessageType == SPUInstallationFinishedStage1);
break;
case SPUInstallationFinishedStage3:
legal = (oldMessageType == SPUInstallationFinishedStage2);
break;
case SPUUpdaterAlivePing:
// Having this state being dependent on other installation states would make the complicate our logic
// So just always allow this type of message
legal = YES;
break;
}
return legal;
}
static NSString *SPUServiceNameWithTag(NSString *tagName, NSString *bundleIdentifier)
{
NSString *serviceName = [bundleIdentifier stringByAppendingString:tagName];
NSUInteger length = MIN(serviceName.length, MAX_SERVICE_NAME_LENGTH);
// If the service name is too long, cut off the beginning rather than cutting off the end
// This should lead to a more unique name
return [serviceName substringFromIndex:serviceName.length - length];
}
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_INSTALLER_TAG, bundleIdentifier);
}
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier);
}
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier);
}
-48
View File
@@ -1,48 +0,0 @@
//
// SUMessageTypes.h
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
extern NSString *SUAppcastItemArchiveKey;
// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SUInstallerMessageType)
{
SUInstallerNotStarted = 0,
SUExtractionStarted = 1,
SUExtractedArchiveWithProgress = 2,
SUArchiveExtractionFailed = 3,
SUValidationStarted = 4,
SUInstallationStartedStage1 = 5,
SUInstallationFinishedStage1 = 6,
SUInstallationFinishedStage2 = 7,
SUInstallationFinishedStage3 = 8,
SUUpdaterAlivePing = 9
};
typedef NS_ENUM(int32_t, SUUpdaterMessageType)
{
SUInstallationData = 0,
SUSentUpdateAppcastItemData = 1,
SUResumeInstallationToStage2 = 2,
SUUpdaterAlivePong = 3
};
BOOL SUInstallerMessageTypeIsLegal(SUInstallerMessageType oldMessageType, SUInstallerMessageType newMessageType);
NSString *SUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NS_ASSUME_NONNULL_END
-86
View File
@@ -1,86 +0,0 @@
//
// SUMessageTypes.m
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SUMessageTypes.h"
#import "SUHost.h"
NSString *SUAppcastItemArchiveKey = @"SUAppcastItemArchive";
// Tags added to the bundle identifier which is used as Mach service names
// 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
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
#define MAX_SERVICE_NAME_LENGTH 63u
BOOL SUInstallerMessageTypeIsLegal(SUInstallerMessageType oldMessageType, SUInstallerMessageType newMessageType)
{
BOOL legal;
switch (newMessageType) {
case SUInstallerNotStarted:
legal = (oldMessageType == SUInstallerNotStarted);
break;
case SUExtractionStarted:
legal = (oldMessageType == SUInstallerNotStarted);
break;
case SUExtractedArchiveWithProgress:
case SUArchiveExtractionFailed:
legal = (oldMessageType == SUExtractionStarted || oldMessageType == SUExtractedArchiveWithProgress);
break;
case SUValidationStarted:
legal = (oldMessageType == SUExtractionStarted || oldMessageType == SUExtractedArchiveWithProgress);
break;
case SUInstallationStartedStage1:
legal = (oldMessageType == SUValidationStarted);
break;
case SUInstallationFinishedStage1:
legal = (oldMessageType == SUInstallationStartedStage1);
break;
case SUInstallationFinishedStage2:
legal = (oldMessageType == SUInstallationFinishedStage1);
break;
case SUInstallationFinishedStage3:
legal = (oldMessageType == SUInstallationFinishedStage2);
break;
case SUUpdaterAlivePing:
// Having this state being dependent on other installation states would make the complicate our logic
// So just always allow this type of message
legal = YES;
break;
}
return legal;
}
static NSString *SUServiceNameWithTag(NSString *tagName, NSString *bundleIdentifier)
{
NSString *serviceName = [bundleIdentifier stringByAppendingString:tagName];
NSUInteger length = MIN(serviceName.length, MAX_SERVICE_NAME_LENGTH);
// If the service name is too long, cut off the beginning rather than cutting off the end
// This should lead to a more unique name
return [serviceName substringFromIndex:serviceName.length - length];
}
NSString *SUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SUServiceNameWithTag(SPARKLE_INSTALLER_TAG, bundleIdentifier);
}
NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier);
}
NSString *SUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier);
}
+2 -2
View File
@@ -7,7 +7,7 @@
//
#import "StatusInfo.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#ifdef _APPKITDEFINES_H
#error This is a "daemon-safe" class and should NOT import AppKit
@@ -28,7 +28,7 @@
{
self = [super init];
if (self != nil) {
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
}
return self;
+3 -3
View File
@@ -9,7 +9,7 @@
#import "SUInstallerLauncher.h"
#import "SUFileManager.h"
#import "SULog.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SPUSystemAuthorization.h"
#import "SPUBundleIcon.h"
#import "SPULocalCacheDirectory.h"
@@ -75,7 +75,7 @@
jobDictionary[@"RunAtLoad"] = @NO;
jobDictionary[@"NICE"] = @0;
jobDictionary[@"LaunchOnlyOnce"] = @YES;
jobDictionary[@"MachServices"] = @{SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES};
jobDictionary[@"MachServices"] = @{SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES};
CFErrorRef submitError = NULL;
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
@@ -239,7 +239,7 @@
}
}
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
CFErrorRef submitError = NULL;
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
+14 -14
View File
@@ -187,9 +187,9 @@
7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */; };
7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */; };
7267E5AE1D3D8AB700D1BF90 /* SPUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.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 */; };
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5AF1D3D8AD500D1BF90 /* SPUMessageTypes.h */; };
7267E5B21D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */; };
7267E5B31D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */; };
7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5B41D3D8AEE00D1BF90 /* SPUInstallationInfo.h */; };
7267E5B71D3D8AEE00D1BF90 /* SPUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */; };
7267E5B81D3D8AEE00D1BF90 /* SPUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */; };
@@ -211,9 +211,9 @@
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 */; };
7267E5DC1D3D8F1E00D1BF90 /* SPUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */; };
7267E5DF1D3D8FFA00D1BF90 /* SPUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.m */; };
7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */; };
7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.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 */; };
@@ -897,8 +897,8 @@
7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TerminationListener.m; path = Autoupdate/TerminationListener.m; sourceTree = SOURCE_ROOT; };
7267E5AC1D3D8AB700D1BF90 /* SPUInstallationInputData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUInstallationInputData.h; path = Autoupdate/SPUInstallationInputData.h; sourceTree = SOURCE_ROOT; };
7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUInstallationInputData.m; path = Autoupdate/SPUInstallationInputData.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; };
7267E5AF1D3D8AD500D1BF90 /* SPUMessageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUMessageTypes.h; path = Autoupdate/SPUMessageTypes.h; sourceTree = SOURCE_ROOT; };
7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUMessageTypes.m; path = Autoupdate/SPUMessageTypes.m; sourceTree = SOURCE_ROOT; };
7267E5B41D3D8AEE00D1BF90 /* SPUInstallationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUInstallationInfo.h; path = Autoupdate/SPUInstallationInfo.h; sourceTree = SOURCE_ROOT; };
7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUInstallationInfo.m; path = Autoupdate/SPUInstallationInfo.m; sourceTree = SOURCE_ROOT; };
7267E5B91D3D8B0B00D1BF90 /* SPUInstallerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUInstallerProtocol.h; path = Autoupdate/SPUInstallerProtocol.h; sourceTree = SOURCE_ROOT; };
@@ -1727,8 +1727,8 @@
729746481C91483B00FC134E /* IPC */ = {
isa = PBXGroup;
children = (
7267E5AF1D3D8AD500D1BF90 /* SUMessageTypes.h */,
7267E5B01D3D8AD500D1BF90 /* SUMessageTypes.m */,
7267E5AF1D3D8AD500D1BF90 /* SPUMessageTypes.h */,
7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */,
726E075A1CA3A6D6001A286B /* SPUSecureCoding.h */,
726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */,
7267E5B41D3D8AEE00D1BF90 /* SPUInstallationInfo.h */,
@@ -1892,7 +1892,7 @@
72B767CE1C9B924900A07552 /* SUInstallerDriver.h in Headers */,
724BB3871D32A167005D534A /* SUXPCInstallerConnection.h in Headers */,
61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */,
7267E5B11D3D8AD500D1BF90 /* SUMessageTypes.h in Headers */,
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */,
61B5F8ED09C4CE3C00B25A18 /* SPUUpdater.h in Headers */,
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */,
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */,
@@ -2646,7 +2646,7 @@
7214B8831D456C2400CB5CED /* SPUBundleIcon.m in Sources */,
7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */,
7267E5EB1D3D90C200D1BF90 /* SUFileManager.m in Sources */,
7267E5DC1D3D8F1E00D1BF90 /* SUMessageTypes.m in Sources */,
7267E5DC1D3D8F1E00D1BF90 /* SPUMessageTypes.m in Sources */,
721652621D3C44A100FD13D8 /* SPUSystemAuthorization.m in Sources */,
72D954831CBAD34F006F28BD /* main.m in Sources */,
721C24621CB75C68005440CB /* SULog.m in Sources */,
@@ -2693,7 +2693,7 @@
files = (
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */,
7214B8841D456C9500CB5CED /* SPUBundleIcon.m in Sources */,
7267E5E11D3D901600D1BF90 /* SUMessageTypes.m in Sources */,
7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */,
724BB3AF1D34828A005D534A /* SPUSystemAuthorization.m in Sources */,
726E07C01CAF15B7001A286B /* SULog.m in Sources */,
726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */,
@@ -2757,7 +2757,7 @@
7267E5E71D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
7267E59C1D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m in Sources */,
7267E5C51D3D8B2700D1BF90 /* SUPlainInstaller.m in Sources */,
7267E5B31D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */,
7267E5B31D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */,
7267E5881D3D89B300D1BF90 /* SUUnarchiver.m in Sources */,
7267E5AE1D3D8AB700D1BF90 /* SPUInstallationInputData.m in Sources */,
7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */,
@@ -2837,7 +2837,7 @@
61B5F8EE09C4CE3C00B25A18 /* SPUUpdater.m in Sources */,
72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */,
726E075D1CA3A6D6001A286B /* SPUSecureCoding.m in Sources */,
7267E5B21D3D8AD500D1BF90 /* SUMessageTypes.m in Sources */,
7267E5B21D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */,
72B767DB1C9CD2E400A07552 /* SUUIBasedUpdateDriver.m in Sources */,
72B09CE81CE6BCBD0052EF9E /* SPUURLDownload.m in Sources */,
);
+2 -2
View File
@@ -8,7 +8,7 @@
#import "InstallerProgressAppController.h"
#import "InstallerProgressDelegate.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SULog.h"
#import "SPUApplicationInfo.h"
#import "SPUInstallerAgentProtocol.h"
@@ -82,7 +82,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
// nor have a model where a process that runs at the highest level (the installer can run as root) tries to connect to a user level agent or process
BOOL systemDomain = arguments[2].boolValue;
NSXPCConnectionOptions connectionOptions = systemDomain ? NSXPCConnectionPrivileged : 0;
_connection = [[NSXPCConnection alloc] initWithMachServiceName:SUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions];
_connection = [[NSXPCConnection alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) options:connectionOptions];
_statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
+21 -21
View File
@@ -8,7 +8,7 @@
#import "SUInstallerDriver.h"
#import "SULog.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SPUXPCServiceInfo.h"
#import "SUUpdaterDelegate.h"
#import "SUAppcastItem.h"
@@ -42,7 +42,7 @@
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, readonly) NSBundle *sparkleBundle;
@property (nonatomic, weak, readonly) id<SUInstallerDriverDelegate> delegate;
@property (nonatomic) SUInstallerMessageType currentStage;
@property (nonatomic) SPUInstallerMessageType currentStage;
@property (nonatomic) BOOL startedInstalling;
@property (nonatomic) id<SUInstallerConnectionProtocol> installerConnection;
@@ -126,7 +126,7 @@
});
}];
NSString *serviceName = SUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier);
NSString *serviceName = SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier);
NSString *installationType = self.updateItem.installationType;
assert(installationType != nil);
@@ -142,7 +142,7 @@
self.temporaryDirectory = downloadedUpdate.temporaryDirectory;
self.downloadName = downloadedUpdate.downloadName;
self.currentStage = SUInstallerNotStarted;
self.currentStage = SPUInstallerNotStarted;
if (self.installerConnection == nil) {
[self launchAutoUpdateSilently:silently completion:completionHandler];
@@ -184,9 +184,9 @@
return;
}
[self.installerConnection handleMessageWithIdentifier:SUInstallationData data:archivedData];
[self.installerConnection handleMessageWithIdentifier:SPUInstallationData data:archivedData];
self.currentStage = SUInstallerNotStarted;
self.currentStage = SPUInstallerNotStarted;
// If the number of extractions attempts stays the same, then we've waited too long and should abort the installation
// The extraction attempts is incremented when we receive an extraction should start message from the installer
@@ -196,7 +196,7 @@
__weak SUInstallerDriver *weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_INSTALLER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
SUInstallerDriver *strongSelf = weakSelf;
if (strongSelf != nil && strongSelf.currentStage == SUInstallerNotStarted && currentExtractionAttempts == self.extractionAttempts) {
if (strongSelf != nil && strongSelf.currentStage == SPUInstallerNotStarted && currentExtractionAttempts == self.extractionAttempts) {
SULog(@"Timeout: Installer never started archive extraction");
[strongSelf.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while starting the installer. Please try again later.", nil) }]];
}
@@ -212,22 +212,22 @@
- (void)_handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{
if (!SUInstallerMessageTypeIsLegal(self.currentStage, identifier)) {
if (!SPUInstallerMessageTypeIsLegal(self.currentStage, identifier)) {
SULog(@"Error: received out of order message with current stage: %d, requested stage: %d", self.currentStage, identifier);
return;
}
if (identifier == SUExtractionStarted) {
if (identifier == SPUExtractionStarted) {
self.extractionAttempts++;
self.currentStage = identifier;
} else if (identifier == SUExtractedArchiveWithProgress) {
} else if (identifier == SPUExtractedArchiveWithProgress) {
if (data.length == sizeof(double) && sizeof(double) == sizeof(uint64_t)) {
uint64_t progressValue = CFSwapInt64LittleToHost(*(const uint64_t *)data.bytes);
double progress = *(double *)&progressValue;
[self.delegate installerDidExtractUpdateWithProgress:progress];
self.currentStage = identifier;
}
} else if (identifier == SUArchiveExtractionFailed) {
} else if (identifier == SPUArchiveExtractionFailed) {
// If this is a delta update, there must be a regular update we can fall back to
if ([self.updateItem isDeltaUpdate]) {
[self.delegate installerDidFailToApplyDeltaUpdate];
@@ -235,14 +235,14 @@
// Don't have to store current stage because we're going to abort
[self.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) }]];
}
} else if (identifier == SUValidationStarted) {
} else if (identifier == SPUValidationStarted) {
self.currentStage = identifier;
} else if (identifier == SUInstallationStartedStage1) {
} else if (identifier == SPUInstallationStartedStage1) {
self.currentStage = identifier;
[self.delegate installerDidStartInstalling];
self.startedInstalling = YES;
} else if (identifier == SUInstallationFinishedStage1) {
} else if (identifier == SPUInstallationFinishedStage1) {
self.currentStage = identifier;
// Let the installer keep a copy of the appcast item data
@@ -250,7 +250,7 @@
NSData *updateItemData = SPUArchiveRootObjectSecurely(self.updateItem);
if (updateItemData != nil) {
[self.installerConnection handleMessageWithIdentifier:SUSentUpdateAppcastItemData data:updateItemData];
[self.installerConnection handleMessageWithIdentifier:SPUSentUpdateAppcastItemData data:updateItemData];
} else {
SULog(@"Error: Archived data to send for appcast item is nil");
}
@@ -266,7 +266,7 @@
}
[self.delegate installerDidFinishPreparationAndWillInstallImmediately:hasTargetTerminated silently:canInstallSilently];
} else if (identifier == SUInstallationFinishedStage2) {
} else if (identifier == SPUInstallationFinishedStage2) {
self.currentStage = identifier;
if (!self.startedInstalling) {
@@ -285,7 +285,7 @@
if (!hasTargetTerminated) {
[self.delegate installerIsRequestingAppTermination];
}
} else if (identifier == SUInstallationFinishedStage3) {
} else if (identifier == SPUInstallationFinishedStage3) {
self.currentStage = identifier;
[self.installerConnection invalidate];
@@ -293,9 +293,9 @@
[self.delegate installerDidFinishInstallation];
[self.delegate installerIsRequestingAbortInstallWithError:nil];
} else if (identifier == SUUpdaterAlivePing) {
} else if (identifier == SPUUpdaterAlivePing) {
// Don't update the current stage; a ping request has no effect on that.
[self.installerConnection handleMessageWithIdentifier:SUUpdaterAlivePong data:[NSData data]];
[self.installerConnection handleMessageWithIdentifier:SPUUpdaterAlivePong data:[NSData data]];
}
}
@@ -441,14 +441,14 @@
[self setUpConnection];
// For resumability, we'll assume we are far enough for the installation to continue
self.currentStage = SUInstallationFinishedStage1;
self.currentStage = SPUInstallationFinishedStage1;
self.willRelaunch = relaunch;
uint8_t response[2] = {(uint8_t)relaunch, (uint8_t)showUI};
NSData *responseData = [NSData dataWithBytes:response length:sizeof(response)];
[self.installerConnection handleMessageWithIdentifier:SUResumeInstallationToStage2 data:responseData];
[self.installerConnection handleMessageWithIdentifier:SPUResumeInstallationToStage2 data:responseData];
// we'll terminate later when the installer tells us stage 2 is done
}
+3 -3
View File
@@ -8,7 +8,7 @@
#import "SUProbeInstallStatus.h"
#import "SPUXPCServiceInfo.h"
#import "SUMessageTypes.h"
#import "SPUMessageTypes.h"
#import "SPUInstallationInfo.h"
#import "SPUSecureCoding.h"
#import "SUInstallerStatus.h"
@@ -41,7 +41,7 @@
});
}];
NSString *serviceName = SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier);
NSString *serviceName = SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier);
[installerStatus setServiceName:serviceName];
[installerStatus probeStatusConnectivityWithReply:^{
@@ -84,7 +84,7 @@
});
}];
NSString *serviceName = SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier);
NSString *serviceName = SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier);
[installerStatus setServiceName:serviceName];
[installerStatus probeStatusInfoWithReply:^(NSData * _Nullable installationInfoData) {