mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
141
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3389883b8 | ||
|
|
92baa74c99 | ||
|
|
12c2a52ddc | ||
|
|
3c00c7a4f8 | ||
|
|
b005fc5151 | ||
|
|
47d1aa0bcd | ||
|
|
dd2d8b1d26 | ||
|
|
d6b1b0adf5 | ||
|
|
b01c8ab023 | ||
|
|
62ee3fa6b1 | ||
|
|
d79643b458 | ||
|
|
08ad834d3f | ||
|
|
65ccd10a9c | ||
|
|
045875ae08 | ||
|
|
f5f5c517a5 | ||
|
|
3a1e60890e | ||
|
|
ba30bb137d | ||
|
|
d9e7ec2cf9 | ||
|
|
30d8815213 | ||
|
|
8a7857ba59 | ||
|
|
45345c0a44 | ||
|
|
bf11f076dc | ||
|
|
38ec6273fb | ||
|
|
a728f9a712 | ||
|
|
19ff4dce3d | ||
|
|
e649d2f4e1 | ||
|
|
80cb274d4c | ||
|
|
5a1732fdd8 | ||
|
|
fbd4272819 | ||
|
|
e6891906ef | ||
|
|
b4b8ac9e12 | ||
|
|
5593774b34 | ||
|
|
f343053e67 | ||
|
|
211f930059 | ||
|
|
7677f2d4ac | ||
|
|
e4c65a32de | ||
|
|
ef62c4ef15 | ||
|
|
e3990c0e42 | ||
|
|
d9e9a1bcee | ||
|
|
253de444e6 | ||
|
|
dd3aca874b | ||
|
|
90f35f87dc | ||
|
|
4149bf0103 | ||
|
|
af366b8b8c | ||
|
|
756023500c | ||
|
|
7f6cbe4577 | ||
|
|
c94eac3673 | ||
|
|
acea9b0d1d | ||
|
|
3b15ab08e1 | ||
|
|
02d5d44ffd | ||
|
|
1daba4d60f | ||
|
|
910f6a5966 | ||
|
|
5ed577fe78 | ||
|
|
d37bea0e67 | ||
|
|
5ca9c2fbbe | ||
|
|
bc1dc3ebf1 | ||
|
|
b9f6e9c8ae | ||
|
|
a30d745158 | ||
|
|
aa916f4bfe | ||
|
|
b820e4f288 | ||
|
|
2beaa9602c | ||
|
|
4953a96658 | ||
|
|
d47560283c | ||
|
|
b57ca4769c | ||
|
|
01b1ce7b9c | ||
|
|
32e59c6ea4 | ||
|
|
941a65f78f | ||
|
|
bd046ab1ad | ||
|
|
ebfb5f82b2 | ||
|
|
8039ce9862 | ||
|
|
26818ca11d | ||
|
|
1dcb87cc44 | ||
|
|
313daa4711 | ||
|
|
86278a2f32 | ||
|
|
a91749781d | ||
|
|
b52291cfc6 | ||
|
|
d5d9824b6c | ||
|
|
d487361cb9 | ||
|
|
5e906948f3 | ||
|
|
48ab89338b | ||
|
|
1c09a01ef9 | ||
|
|
4094dc3e83 | ||
|
|
d25e96f220 | ||
|
|
12531b635d | ||
|
|
bb645e9832 | ||
|
|
e24212f797 | ||
|
|
6b97e4a533 | ||
|
|
3956a27bd0 | ||
|
|
8a4578fe4d | ||
|
|
3c7b0805e1 | ||
|
|
d81139830e | ||
|
|
b6b704ea55 | ||
|
|
77fc6ca681 | ||
|
|
46c22e2bbf | ||
|
|
92d7b9f68f | ||
|
|
6b6b6b2405 | ||
|
|
b854b01e6a | ||
|
|
61e16cf276 | ||
|
|
e7088fc788 | ||
|
|
54aa6f2cc2 | ||
|
|
acf758e485 | ||
|
|
ceedfba634 | ||
|
|
addedeac13 | ||
|
|
eedb0ff0dd | ||
|
|
67a7bc3d62 | ||
|
|
65d7c38ab6 | ||
|
|
5b786043c2 | ||
|
|
ca23238d59 | ||
|
|
fc1870cbd2 | ||
|
|
659aec4eaf | ||
|
|
88a197a7f0 | ||
|
|
9119d287ab | ||
|
|
7797a8f58c | ||
|
|
1f0da95e59 | ||
|
|
84a2feb0ad | ||
|
|
bbe75fc6f2 | ||
|
|
9c8e08b7ae | ||
|
|
371c51fe5a | ||
|
|
feb2ad4b64 | ||
|
|
1e75acb963 | ||
|
|
b3c69f8b8c | ||
|
|
5cd9bdccf6 | ||
|
|
12eede4123 | ||
|
|
9633a57c6c | ||
|
|
ab389260be | ||
|
|
abf70ab8dc | ||
|
|
67ebc6ff74 | ||
|
|
1e14f7d7b6 | ||
|
|
5bd4c1ecb6 | ||
|
|
406f3da615 | ||
|
|
302eb082d6 | ||
|
|
16b75653dc | ||
|
|
fc8176a229 | ||
|
|
502c7fb6db | ||
|
|
71f747aec1 | ||
|
|
aebb767cfb | ||
|
|
04b1514452 | ||
|
|
22f9c96a1f | ||
|
|
78b08a0bee | ||
|
|
6fc58a1025 | ||
|
|
dbd2b9b30a |
No files matched your search
@@ -0,0 +1,4 @@
|
||||
// Common
|
||||
|
||||
ARCHS = x86_64
|
||||
VALID_ARCHS = x86_64
|
||||
@@ -0,0 +1,4 @@
|
||||
// Common
|
||||
|
||||
ARCHS = ppc i386 x86_64
|
||||
|
||||
@@ -9,5 +9,5 @@ INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
|
||||
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
|
||||
SKIP_INSTALL = YES
|
||||
DEFINES_MODULE = YES
|
||||
DEFINES_MODULE = NO
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Sandbox Service only
|
||||
|
||||
WRAPPER_EXTENSION = xpc
|
||||
MACH_O_TYPE = mh_execute
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.7
|
||||
|
||||
GCC_WARN_SHADOW = NO
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigService.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -DDEBUG
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigService.xcconfig"
|
||||
@@ -5,3 +5,4 @@ WRAPPER_EXTENSION = app
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) CODE_SIGN_IDENTITY="$(CODE_SIGN_IDENTITY)"
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
</plist>
|
||||
@@ -49,6 +49,82 @@
|
||||
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 */; };
|
||||
331726611B4ABAEB008B2D77 /* libDMCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 331726601B4ABABD008B2D77 /* libDMCore.a */; };
|
||||
3317266D1B4BDE4F008B2D77 /* SUUpdaterQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3317266B1B4BDE4F008B2D77 /* SUUpdaterQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317266E1B4BDE4F008B2D77 /* SUUpdaterQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3317266C1B4BDE4F008B2D77 /* SUUpdaterQueue.m */; };
|
||||
331726701B4D0FCD008B2D77 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
|
||||
331726801B4D3740008B2D77 /* SUModelTranslation.plist in Resources */ = {isa = PBXBuildFile; fileRef = 615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */; };
|
||||
331726811B4D374F008B2D77 /* SUAutomaticUpdateAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BDA136EF20D00649790 /* SUAutomaticUpdateAlert.xib */; };
|
||||
331726821B4D374F008B2D77 /* SUUpdateAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BF0136EF26100649790 /* SUUpdateAlert.xib */; };
|
||||
331726831B4D374F008B2D77 /* SUUpdatePermissionPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14C05136EF2C700649790 /* SUUpdatePermissionPrompt.xib */; };
|
||||
331726841B4D3752008B2D77 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
|
||||
331726851B4D3758008B2D77 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
|
||||
331726861B4D379B008B2D77 /* Autoupdate.app in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BB7136EEF1500649790 /* Autoupdate.app */; };
|
||||
331726891B4D37D7008B2D77 /* SUAppcast.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FB9409C4F04600B25A18 /* SUAppcast.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268A1B4D37D7008B2D77 /* SUAppcastItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FC5309C5182000B25A18 /* SUAppcastItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268B1B4D37D7008B2D77 /* SUUpdaterQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3317266B1B4BDE4F008B2D77 /* SUUpdaterQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268C1B4D37D7008B2D77 /* SUErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E6F33219EC9F6C00005E76 /* SUErrors.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268D1B4D37D7008B2D77 /* SUExport.h in Headers */ = {isa = PBXBuildFile; fileRef = 14652F8319A9759F00959E44 /* SUExport.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268E1B4D37D7008B2D77 /* SUStandardVersionComparator.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A225A20D1C4AC000430CCD /* SUStandardVersionComparator.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3317268F1B4D37D7008B2D77 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
331726901B4D37D7008B2D77 /* SUVersionComparisonProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A2259C0D1C495D00430CCD /* SUVersionComparisonProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
331726911B4D37D7008B2D77 /* SUVersionDisplayProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
331726B91B4D620C008B2D77 /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; settings = {COMPILER_FLAGS = "-w"; }; };
|
||||
331726BA1B4D6214008B2D77 /* NTSynchronousTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 610EC1BF0CF3914D00AE239E /* NTSynchronousTask.m */; };
|
||||
331726BB1B4D6225008B2D77 /* SUAppcast.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FB9509C4F04600B25A18 /* SUAppcast.m */; };
|
||||
331726BC1B4D6225008B2D77 /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; };
|
||||
331726BD1B4D6225008B2D77 /* SUAutomaticUpdateAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */; };
|
||||
331726BE1B4D6225008B2D77 /* SUAutomaticUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B93B260DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.m */; };
|
||||
331726BF1B4D624D008B2D77 /* SUBasicUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F83F700DBFE137006FDD30 /* SUBasicUpdateDriver.m */; };
|
||||
331726C01B4D624D008B2D77 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E00FD68CC7005AE3F6 /* SUBinaryDeltaApply.m */; };
|
||||
331726C11B4D624D008B2D77 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */; };
|
||||
331726C21B4D624D008B2D77 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */; };
|
||||
331726C31B4D624D008B2D77 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
|
||||
331726C41B4D624D008B2D77 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
|
||||
331726C51B4D624D008B2D77 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; };
|
||||
331726C61B4D624D008B2D77 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */; };
|
||||
331726C71B4D624D008B2D77 /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
|
||||
331726C81B4D625A008B2D77 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
|
||||
331726C91B4D625A008B2D77 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; };
|
||||
331726CA1B4D625A008B2D77 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
|
||||
331726CB1B4D625A008B2D77 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; };
|
||||
331726CC1B4D625A008B2D77 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6129C0B90E0B79810062CE76 /* SUPipedUnarchiver.m */; };
|
||||
331726CD1B4D625A008B2D77 /* SUXPCInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 33545B7C1B46774D0059250D /* SUXPCInstaller.m */; };
|
||||
331726CE1B4D625A008B2D77 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; };
|
||||
331726CF1B4D625A008B2D77 /* (null) in Sources */ = {isa = PBXBuildFile; };
|
||||
331726D01B4D625A008B2D77 /* SUProbingUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6101347A0DD2541A0049ACDF /* SUProbingUpdateDriver.m */; };
|
||||
331726D11B4D625A008B2D77 /* SUScheduledUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B93C080DD112FF00DCD2F8 /* SUScheduledUpdateDriver.m */; };
|
||||
331726D21B4D625A008B2D77 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
|
||||
331726D31B4D625A008B2D77 /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; };
|
||||
331726D41B4D625A008B2D77 /* SUSystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A2279B0D1CEE7600430CCD /* SUSystemProfiler.m */; };
|
||||
331726D51B4D625A008B2D77 /* SUUIBasedUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B93A3A0DD02D6400DCD2F8 /* SUUIBasedUpdateDriver.m */; };
|
||||
331726D61B4D625A008B2D77 /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A8C09CA790200B7442F /* SUUnarchiver.m */; };
|
||||
331726D71B4D625A008B2D77 /* SUUpdateAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */; };
|
||||
331726D81B4D625A008B2D77 /* SUUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 610134720DD250470049ACDF /* SUUpdateDriver.m */; };
|
||||
331726D91B4D625A008B2D77 /* SUUpdatePermissionPrompt.m in Sources */ = {isa = PBXBuildFile; fileRef = 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */; };
|
||||
331726DA1B4D625A008B2D77 /* SUUpdaterQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3317266C1B4BDE4F008B2D77 /* SUUpdaterQueue.m */; };
|
||||
331726DB1B4D625A008B2D77 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */; };
|
||||
331726DC1B4D625A008B2D77 /* SUUserInitiatedUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A354540DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.m */; };
|
||||
331726DD1B4D625A008B2D77 /* SUWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61180BC90D64138900B4E0D1 /* SUWindowController.m */; };
|
||||
331726E21B4D66EE008B2D77 /* DevMateSparkle.h in Headers */ = {isa = PBXBuildFile; fileRef = 331726DF1B4D6438008B2D77 /* DevMateSparkle.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
331726E31B4D697E008B2D77 /* SUUpdaterLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 331726E11B4D65AA008B2D77 /* SUUpdaterLoader.m */; };
|
||||
3329D9C41C7B03B800F1B058 /* com.devmate.UpdateInstaller.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
3329D9C61C7B217C00F1B058 /* com.devmate.UpdateInstaller.xpc in Copy XPC services */ = {isa = PBXBuildFile; fileRef = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
33545B921B4679810059250D /* install_service.m in Sources */ = {isa = PBXBuildFile; fileRef = 33545B771B46774D0059250D /* install_service.m */; };
|
||||
33545B931B4687CD0059250D /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
|
||||
33545B941B468A160059250D /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
|
||||
33545B961B468A730059250D /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; };
|
||||
33545B971B468ABB0059250D /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
|
||||
33545B981B468AC80059250D /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; };
|
||||
33545B991B468AD60059250D /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
|
||||
33545B9A1B468AE30059250D /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; };
|
||||
33545B9C1B46A5430059250D /* SUXPCInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 33545B7C1B46774D0059250D /* SUXPCInstaller.m */; };
|
||||
335698EA1C5FC8A600CE0FD4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
|
||||
335698EB1C5FC8AF00CE0FD4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
336475CE1C5B980500813E67 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
|
||||
336475CF1C5B980C00813E67 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
|
||||
336475D01C5B982900813E67 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
336475D11C5B984200813E67 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
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 */; };
|
||||
55C14BD9136EF00C00649790 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
|
||||
@@ -72,8 +148,6 @@
|
||||
55C14F9A136F045400649790 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
|
||||
55C14FC7136F05E100649790 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
|
||||
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E6F33219EC9F6C00005E76 /* SUErrors.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5A6D31EE1BF53245009C5157 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
|
||||
5A6D31EF1BF5325F009C5157 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
5AE459001C34118500E3BB47 /* SUUpdaterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 14950074195FDF5900BC5B5B /* SUUpdaterTest.m */; };
|
||||
5AE459021C34118500E3BB47 /* SUVersionComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */; };
|
||||
5AF6C74F1AEA46D10014A3AB /* test.sparkle_guided.pkg in Resources */ = {isa = PBXBuildFile; fileRef = 5AF6C74E1AEA46D10014A3AB /* test.sparkle_guided.pkg */; };
|
||||
@@ -272,6 +346,34 @@
|
||||
remoteGlobalIDString = 55C14BB6136EEF1500649790;
|
||||
remoteInfo = Autoupdate;
|
||||
};
|
||||
3317267C1B4D3704008B2D77 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 55C14BB6136EEF1500649790;
|
||||
remoteInfo = Autoupdate;
|
||||
};
|
||||
3317267E1B4D3704008B2D77 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 33545B801B4679080059250D;
|
||||
remoteInfo = "Installation XPC Service";
|
||||
};
|
||||
331726B71B4D61A8008B2D77 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 331726741B4D36F2008B2D77;
|
||||
remoteInfo = DevMateSparkle_lib_resources;
|
||||
};
|
||||
3329D9C11C7B03A700F1B058 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 33545B801B4679080059250D;
|
||||
remoteInfo = "Installation XPC Service";
|
||||
};
|
||||
55C14F96136F044100649790 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
@@ -324,6 +426,27 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3329D9C31C7B03AD00F1B058 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3329D9C41C7B03B800F1B058 /* com.devmate.UpdateInstaller.xpc in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3329D9C51C7B216500F1B058 /* Copy XPC services */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3329D9C61C7B217C00F1B058 /* com.devmate.UpdateInstaller.xpc in Copy XPC services */,
|
||||
);
|
||||
name = "Copy XPC services";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
61B5FB4D09C4E9FA00B25A18 /* Copy Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -374,6 +497,22 @@
|
||||
14958C6C19AEBC610061B14F /* test-pubkey.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "test-pubkey.pem"; sourceTree = "<group>"; };
|
||||
149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonCoverage.xcconfig; sourceTree = "<group>"; };
|
||||
149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUnitTestCoverage.xcconfig; sourceTree = "<group>"; };
|
||||
331726601B4ABABD008B2D77 /* libDMCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libDMCore.a; path = External/libDMCore.a; sourceTree = "<group>"; };
|
||||
3317266B1B4BDE4F008B2D77 /* SUUpdaterQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterQueue.h; sourceTree = "<group>"; };
|
||||
3317266C1B4BDE4F008B2D77 /* SUUpdaterQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterQueue.m; sourceTree = "<group>"; };
|
||||
331726751B4D36F2008B2D77 /* DevMateSparkle_Resources */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DevMateSparkle_Resources; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
331726971B4D5F27008B2D77 /* libDevMateSparkle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDevMateSparkle.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
331726DF1B4D6438008B2D77 /* DevMateSparkle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DevMateSparkle.h; sourceTree = "<group>"; };
|
||||
331726E01B4D6438008B2D77 /* DevMateSparkle.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DevMateSparkle.pch; sourceTree = "<group>"; };
|
||||
331726E11B4D65AA008B2D77 /* SUUpdaterLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterLoader.m; sourceTree = "<group>"; };
|
||||
33545B771B46774D0059250D /* install_service.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = install_service.m; sourceTree = "<group>"; };
|
||||
33545B781B46774D0059250D /* install_service.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = install_service.pch; sourceTree = "<group>"; };
|
||||
33545B791B46774D0059250D /* SandboxService.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = SandboxService.plist; sourceTree = "<group>"; };
|
||||
33545B7A1B46774D0059250D /* SUInstallServiceConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallServiceConstants.h; sourceTree = "<group>"; };
|
||||
33545B7B1B46774D0059250D /* SUXPCInstaller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUXPCInstaller.h; sourceTree = "<group>"; };
|
||||
33545B7C1B46774D0059250D /* SUXPCInstaller.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstaller.m; sourceTree = "<group>"; };
|
||||
33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = com.devmate.UpdateInstaller.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
33545B9B1B469BE60059250D /* Sparkle Test App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Sparkle Test App.entitlements"; sourceTree = "<group>"; };
|
||||
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUVersionDisplayProtocol.h; sourceTree = "<group>"; };
|
||||
4607BEA21948443800EF8DA4 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
4607BEA31948443800EF8DA4 /* nb */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nb; path = nb.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
|
||||
@@ -630,6 +769,27 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
331726721B4D36F2008B2D77 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
331726941B4D5F27008B2D77 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33545B7E1B4679080059250D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
55C14BB5136EEF1500649790 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -689,6 +849,7 @@
|
||||
61B5F8F709C4CEB300B25A18 /* Security.framework in Frameworks */,
|
||||
55C14F32136EFC2400649790 /* SystemConfiguration.framework in Frameworks */,
|
||||
61B5FC4C09C4FD5E00B25A18 /* WebKit.framework in Frameworks */,
|
||||
331726611B4ABAEB008B2D77 /* libDMCore.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -703,6 +864,9 @@
|
||||
61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */,
|
||||
612279D90DB5470200AB99EA /* Sparkle Unit Tests.xctest */,
|
||||
8DC2EF5B0486A6940098B216 /* Sparkle.framework */,
|
||||
33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */,
|
||||
331726751B4D36F2008B2D77 /* DevMateSparkle_Resources */,
|
||||
331726971B4D5F27008B2D77 /* libDevMateSparkle.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -710,6 +874,7 @@
|
||||
0867D691FE84028FC02AAC07 /* Sparkle */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33545B9B1B469BE60059250D /* Sparkle Test App.entitlements */,
|
||||
1495006D195FBBBD00BC5B5B /* Sparkle */,
|
||||
14732BB81960EEB600593899 /* Resources */,
|
||||
61227A100DB5484000AB99EA /* Tests */,
|
||||
@@ -727,6 +892,7 @@
|
||||
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
331726601B4ABABD008B2D77 /* libDMCore.a */,
|
||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
|
||||
525A278F133D6AE900FD8D70 /* Cocoa.framework */,
|
||||
0867D69BFE84028FC02AAC07 /* Foundation.framework */,
|
||||
@@ -824,6 +990,7 @@
|
||||
1495006D195FBBBD00BC5B5B /* Sparkle */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33545B761B46774D0059250D /* Installation XPC Service */,
|
||||
61299B3909CB055000B7442F /* Appcast Support */,
|
||||
55C14BD5136EEFD000649790 /* Autoupdate */,
|
||||
089C1665FE841158C02AAC07 /* Framework Resources */,
|
||||
@@ -832,6 +999,7 @@
|
||||
6101354A0DD25B7F0049ACDF /* Unarchiving */,
|
||||
61F83F6E0DBFE07A006FDD30 /* Update Control */,
|
||||
61299B3A09CB056100B7442F /* User Interface */,
|
||||
331726DE1B4D6403008B2D77 /* DevMate */,
|
||||
);
|
||||
path = Sparkle;
|
||||
sourceTree = "<group>";
|
||||
@@ -853,6 +1021,29 @@
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
331726DE1B4D6403008B2D77 /* DevMate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
331726DF1B4D6438008B2D77 /* DevMateSparkle.h */,
|
||||
331726E01B4D6438008B2D77 /* DevMateSparkle.pch */,
|
||||
331726E11B4D65AA008B2D77 /* SUUpdaterLoader.m */,
|
||||
);
|
||||
name = DevMate;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33545B761B46774D0059250D /* Installation XPC Service */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33545B771B46774D0059250D /* install_service.m */,
|
||||
33545B781B46774D0059250D /* install_service.pch */,
|
||||
33545B791B46774D0059250D /* SandboxService.plist */,
|
||||
33545B7A1B46774D0059250D /* SUInstallServiceConstants.h */,
|
||||
33545B7B1B46774D0059250D /* SUXPCInstaller.h */,
|
||||
33545B7C1B46774D0059250D /* SUXPCInstaller.m */,
|
||||
);
|
||||
path = "Installation XPC Service";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
55C14BD5136EEFD000649790 /* Autoupdate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1045,6 +1236,8 @@
|
||||
61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */,
|
||||
61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */,
|
||||
6158A1C4137904B300487EC1 /* SUUpdater_Private.h */,
|
||||
3317266B1B4BDE4F008B2D77 /* SUUpdaterQueue.h */,
|
||||
3317266C1B4BDE4F008B2D77 /* SUUpdaterQueue.m */,
|
||||
);
|
||||
name = "Update Control";
|
||||
sourceTree = "<group>";
|
||||
@@ -1083,6 +1276,30 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
331726871B4D37B6008B2D77 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3317268D1B4D37D7008B2D77 /* SUExport.h in Headers */,
|
||||
331726E21B4D66EE008B2D77 /* DevMateSparkle.h in Headers */,
|
||||
3317268B1B4D37D7008B2D77 /* SUUpdaterQueue.h in Headers */,
|
||||
331726901B4D37D7008B2D77 /* SUVersionComparisonProtocol.h in Headers */,
|
||||
3317268C1B4D37D7008B2D77 /* SUErrors.h in Headers */,
|
||||
331726891B4D37D7008B2D77 /* SUAppcast.h in Headers */,
|
||||
3317268A1B4D37D7008B2D77 /* SUAppcastItem.h in Headers */,
|
||||
3317268F1B4D37D7008B2D77 /* SUUpdater.h in Headers */,
|
||||
331726911B4D37D7008B2D77 /* SUVersionDisplayProtocol.h in Headers */,
|
||||
3317268E1B4D37D7008B2D77 /* SUStandardVersionComparator.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
331726951B4D5F27008B2D77 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DC2EF500486A6940098B216 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1099,6 +1316,7 @@
|
||||
5D06E9390FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.h in Headers */,
|
||||
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */,
|
||||
61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */,
|
||||
3317266D1B4BDE4F008B2D77 /* SUUpdaterQueue.h in Headers */,
|
||||
6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */,
|
||||
61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */,
|
||||
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
|
||||
@@ -1170,6 +1388,63 @@
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
331726741B4D36F2008B2D77 /* DevMateSparkle_lib_resources */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331726791B4D36F2008B2D77 /* Build configuration list for PBXNativeTarget "DevMateSparkle_lib_resources" */;
|
||||
buildPhases = (
|
||||
331726711B4D36F2008B2D77 /* Sources */,
|
||||
331726721B4D36F2008B2D77 /* Frameworks */,
|
||||
331726731B4D36F2008B2D77 /* Resources */,
|
||||
331726871B4D37B6008B2D77 /* Headers */,
|
||||
331726921B4D37FA008B2D77 /* Run Script: Update Locales */,
|
||||
3329D9C51C7B216500F1B058 /* Copy XPC services */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
3317267D1B4D3704008B2D77 /* PBXTargetDependency */,
|
||||
3317267F1B4D3704008B2D77 /* PBXTargetDependency */,
|
||||
);
|
||||
name = DevMateSparkle_lib_resources;
|
||||
productName = DevMateSparkle_lib_resources;
|
||||
productReference = 331726751B4D36F2008B2D77 /* DevMateSparkle_Resources */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
331726961B4D5F27008B2D77 /* DevMateSparkle_lib */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331726A81B4D5F28008B2D77 /* Build configuration list for PBXNativeTarget "DevMateSparkle_lib" */;
|
||||
buildPhases = (
|
||||
331726931B4D5F27008B2D77 /* Sources */,
|
||||
331726941B4D5F27008B2D77 /* Frameworks */,
|
||||
331726951B4D5F27008B2D77 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
331726B81B4D61A8008B2D77 /* PBXTargetDependency */,
|
||||
);
|
||||
name = DevMateSparkle_lib;
|
||||
productName = DevMateSparkle_lib;
|
||||
productReference = 331726971B4D5F27008B2D77 /* libDevMateSparkle.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
33545B801B4679080059250D /* Installation XPC Service */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 33545B8E1B4679080059250D /* Build configuration list for PBXNativeTarget "Installation XPC Service" */;
|
||||
buildPhases = (
|
||||
33545B7D1B4679080059250D /* Sources */,
|
||||
33545B7E1B4679080059250D /* Frameworks */,
|
||||
33545B7F1B4679080059250D /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Installation XPC Service";
|
||||
productName = "Installation XPC Service";
|
||||
productReference = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
55C14BB6136EEF1500649790 /* Autoupdate */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "Autoupdate" */;
|
||||
@@ -1255,10 +1530,12 @@
|
||||
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */,
|
||||
6195D4B40E40505A00D41A50 /* Run Script: Link fr_CA to fr */,
|
||||
61E31A85103299750051D188 /* Run Script: Link pt to pt_BR */,
|
||||
3329D9C31C7B03AD00F1B058 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
3329D9C21C7B03A700F1B058 /* PBXTargetDependency */,
|
||||
55C14F97136F044100649790 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Sparkle;
|
||||
@@ -1278,9 +1555,25 @@
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = "Sparkle Project";
|
||||
TargetAttributes = {
|
||||
331726741B4D36F2008B2D77 = {
|
||||
CreatedOnToolsVersion = 6.4;
|
||||
};
|
||||
331726961B4D5F27008B2D77 = {
|
||||
CreatedOnToolsVersion = 6.4;
|
||||
};
|
||||
33545B801B4679080059250D = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
};
|
||||
612279D80DB5470200AB99EA = {
|
||||
TestTargetID = 8DC2EF4F0486A6940098B216;
|
||||
};
|
||||
61B5F90109C4CEE200B25A18 = {
|
||||
SystemCapabilities = {
|
||||
com.apple.Sandbox = {
|
||||
enabled = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */;
|
||||
@@ -1340,9 +1633,12 @@
|
||||
612279D80DB5470200AB99EA /* Sparkle Unit Tests */,
|
||||
5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */,
|
||||
55C14BB6136EEF1500649790 /* Autoupdate */,
|
||||
33545B801B4679080059250D /* Installation XPC Service */,
|
||||
14732BC51960F69300593899 /* Distribution */,
|
||||
1420DF491962329200203BB0 /* Documentation */,
|
||||
1495005F195FB89400BC5B5B /* All */,
|
||||
331726741B4D36F2008B2D77 /* DevMateSparkle_lib_resources */,
|
||||
331726961B4D5F27008B2D77 /* DevMateSparkle_lib */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -1365,6 +1661,28 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
331726731B4D36F2008B2D77 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
331726801B4D3740008B2D77 /* SUModelTranslation.plist in Resources */,
|
||||
331726811B4D374F008B2D77 /* SUAutomaticUpdateAlert.xib in Resources */,
|
||||
331726841B4D3752008B2D77 /* SUStatus.xib in Resources */,
|
||||
331726821B4D374F008B2D77 /* SUUpdateAlert.xib in Resources */,
|
||||
331726831B4D374F008B2D77 /* SUUpdatePermissionPrompt.xib in Resources */,
|
||||
331726851B4D3758008B2D77 /* Sparkle.strings in Resources */,
|
||||
331726861B4D379B008B2D77 /* Autoupdate.app in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33545B7F1B4679080059250D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
331726701B4D0FCD008B2D77 /* Sparkle.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
55C14BB3136EEF1500649790 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1422,6 +1740,20 @@
|
||||
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
331726921B4D37FA008B2D77 /* Run Script: Update Locales */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script: Update Locales";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "IFS=$(echo -en \"\\n\\b\")\nRESOURCES_PATHS=(\n \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${SPARKLE_RELAUNCH_TOOL_NAME}.app/Contents/Resources\"\n \"${BUILT_PRODUCTS_DIR}/com.devmate.UpdateInstaller.xpc/Contents/Resources\")\n\nfor RESOURCES_PATH in \"${RESOURCES_PATHS[@]}\"\ndo\n echo \"Correcting... ${RESOURCES_PATH}\"\n if [ -e \"${RESOURCES_PATH}/pt_BR.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/pt-BR.lproj\"\n mv -f \"${RESOURCES_PATH}/pt_BR.lproj\" \"${RESOURCES_PATH}/pt-BR.lproj\"\n fi\n\n if [ -e \"${RESOURCES_PATH}/zh_CN.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hans.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_CN.lproj\" \"${RESOURCES_PATH}/zh-Hans.lproj\"\n fi\n\n if [ -e \"${RESOURCES_PATH}/zh_TW.lproj\" ]; then\n rm -Rf \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n mv -f \"${RESOURCES_PATH}/zh_TW.lproj\" \"${RESOURCES_PATH}/zh-Hant-TW.lproj\"\n fi\ndone\n\n";
|
||||
};
|
||||
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 12;
|
||||
@@ -1474,6 +1806,77 @@
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
331726711B4D36F2008B2D77 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
331726931B4D5F27008B2D77 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
331726CA1B4D625A008B2D77 /* SULog.m in Sources */,
|
||||
331726DC1B4D625A008B2D77 /* SUUserInitiatedUpdateDriver.m in Sources */,
|
||||
331726D51B4D625A008B2D77 /* SUUIBasedUpdateDriver.m in Sources */,
|
||||
331726D81B4D625A008B2D77 /* SUUpdateDriver.m in Sources */,
|
||||
331726CB1B4D625A008B2D77 /* SUPackageInstaller.m in Sources */,
|
||||
331726D01B4D625A008B2D77 /* SUProbingUpdateDriver.m in Sources */,
|
||||
331726C11B4D624D008B2D77 /* SUBinaryDeltaCommon.m in Sources */,
|
||||
331726BD1B4D6225008B2D77 /* SUAutomaticUpdateAlert.m in Sources */,
|
||||
331726BB1B4D6225008B2D77 /* SUAppcast.m in Sources */,
|
||||
331726CE1B4D625A008B2D77 /* SUPlainInstaller.m in Sources */,
|
||||
331726C71B4D624D008B2D77 /* SUGuidedPackageInstaller.m in Sources */,
|
||||
331726D11B4D625A008B2D77 /* SUScheduledUpdateDriver.m in Sources */,
|
||||
336475D01C5B982900813E67 /* SUOperatingSystem.m in Sources */,
|
||||
331726BF1B4D624D008B2D77 /* SUBasicUpdateDriver.m in Sources */,
|
||||
331726CC1B4D625A008B2D77 /* SUPipedUnarchiver.m in Sources */,
|
||||
331726DB1B4D625A008B2D77 /* SUUpdater.m in Sources */,
|
||||
331726CF1B4D625A008B2D77 /* (null) in Sources */,
|
||||
331726CD1B4D625A008B2D77 /* SUXPCInstaller.m in Sources */,
|
||||
331726C61B4D624D008B2D77 /* SUDSAVerifier.m in Sources */,
|
||||
331726BC1B4D6225008B2D77 /* SUAppcastItem.m in Sources */,
|
||||
331726C41B4D624D008B2D77 /* SUConstants.m in Sources */,
|
||||
331726C01B4D624D008B2D77 /* SUBinaryDeltaApply.m in Sources */,
|
||||
331726D41B4D625A008B2D77 /* SUSystemProfiler.m in Sources */,
|
||||
331726DD1B4D625A008B2D77 /* SUWindowController.m in Sources */,
|
||||
331726D21B4D625A008B2D77 /* SUStandardVersionComparator.m in Sources */,
|
||||
331726C91B4D625A008B2D77 /* SUInstaller.m in Sources */,
|
||||
336475CE1C5B980500813E67 /* SUFileManager.m in Sources */,
|
||||
331726C81B4D625A008B2D77 /* SUHost.m in Sources */,
|
||||
331726BA1B4D6214008B2D77 /* NTSynchronousTask.m in Sources */,
|
||||
331726BE1B4D6225008B2D77 /* SUAutomaticUpdateDriver.m in Sources */,
|
||||
331726DA1B4D625A008B2D77 /* SUUpdaterQueue.m in Sources */,
|
||||
331726D71B4D625A008B2D77 /* SUUpdateAlert.m in Sources */,
|
||||
331726D61B4D625A008B2D77 /* SUUnarchiver.m in Sources */,
|
||||
331726D91B4D625A008B2D77 /* SUUpdatePermissionPrompt.m in Sources */,
|
||||
331726D31B4D625A008B2D77 /* SUStatusController.m in Sources */,
|
||||
331726C31B4D624D008B2D77 /* SUCodeSigningVerifier.m in Sources */,
|
||||
331726E31B4D697E008B2D77 /* SUUpdaterLoader.m in Sources */,
|
||||
331726C21B4D624D008B2D77 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
||||
331726B91B4D620C008B2D77 /* bspatch.c in Sources */,
|
||||
331726C51B4D624D008B2D77 /* SUDiskImageUnarchiver.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33545B7D1B4679080059250D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33545B981B468AC80059250D /* SUInstaller.m in Sources */,
|
||||
336475D11C5B984200813E67 /* SUOperatingSystem.m in Sources */,
|
||||
33545B991B468AD60059250D /* SUGuidedPackageInstaller.m in Sources */,
|
||||
33545B9A1B468AE30059250D /* SUPackageInstaller.m in Sources */,
|
||||
33545B961B468A730059250D /* SUPlainInstaller.m in Sources */,
|
||||
33545B941B468A160059250D /* SULog.m in Sources */,
|
||||
33545B921B4679810059250D /* install_service.m in Sources */,
|
||||
33545B971B468ABB0059250D /* SUCodeSigningVerifier.m in Sources */,
|
||||
33545B931B4687CD0059250D /* SUConstants.m in Sources */,
|
||||
336475CF1C5B980C00813E67 /* SUFileManager.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
55C14BB4136EEF1500649790 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1524,7 +1927,6 @@
|
||||
142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */,
|
||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
|
||||
5AF9DC3C1981DBEE001EA135 /* SUDSAVerifierTest.m in Sources */,
|
||||
72A4A2411BB656FA00E7820D /* SUFileManager.m in Sources */,
|
||||
72A4A2401BB6567D00E7820D /* SUFileManagerTest.swift in Sources */,
|
||||
5AF6C7541AEA49840014A3AB /* SUInstallerTest.m in Sources */,
|
||||
14652F8219A9746000959E44 /* SULog.m in Sources */,
|
||||
@@ -1539,9 +1941,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
61B5F93009C4CFDC00B25A18 /* main.m in Sources */,
|
||||
335698EB1C5FC8AF00CE0FD4 /* SUOperatingSystem.m in Sources */,
|
||||
335698EA1C5FC8A600CE0FD4 /* SUFileManager.m in Sources */,
|
||||
726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */,
|
||||
5A6D31EE1BF53245009C5157 /* SUFileManager.m in Sources */,
|
||||
5A6D31EF1BF5325F009C5157 /* SUOperatingSystem.m in Sources */,
|
||||
72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */,
|
||||
A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */,
|
||||
72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */,
|
||||
@@ -1574,6 +1976,7 @@
|
||||
726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */,
|
||||
618FA5230DAE8E8A0026945C /* SUPackageInstaller.m in Sources */,
|
||||
61D85D6D0E10B2ED00F9B4A9 /* SUPipedUnarchiver.m in Sources */,
|
||||
33545B9C1B46A5430059250D /* SUXPCInstaller.m in Sources */,
|
||||
618FA5060DAE8AB80026945C /* SUPlainInstaller.m in Sources */,
|
||||
6101347C0DD2541A0049ACDF /* SUProbingUpdateDriver.m in Sources */,
|
||||
61B93C0A0DD112FF00DCD2F8 /* SUScheduledUpdateDriver.m in Sources */,
|
||||
@@ -1585,6 +1988,7 @@
|
||||
61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */,
|
||||
610134740DD250470049ACDF /* SUUpdateDriver.m in Sources */,
|
||||
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */,
|
||||
3317266E1B4BDE4F008B2D77 /* SUUpdaterQueue.m in Sources */,
|
||||
61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */,
|
||||
61A354560DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.m in Sources */,
|
||||
61180BCB0D64138900B4E0D1 /* SUWindowController.m in Sources */,
|
||||
@@ -1639,6 +2043,26 @@
|
||||
target = 55C14BB6136EEF1500649790 /* Autoupdate */;
|
||||
targetProxy = 1495006B195FB8A600BC5B5B /* PBXContainerItemProxy */;
|
||||
};
|
||||
3317267D1B4D3704008B2D77 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 55C14BB6136EEF1500649790 /* Autoupdate */;
|
||||
targetProxy = 3317267C1B4D3704008B2D77 /* PBXContainerItemProxy */;
|
||||
};
|
||||
3317267F1B4D3704008B2D77 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 33545B801B4679080059250D /* Installation XPC Service */;
|
||||
targetProxy = 3317267E1B4D3704008B2D77 /* PBXContainerItemProxy */;
|
||||
};
|
||||
331726B81B4D61A8008B2D77 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 331726741B4D36F2008B2D77 /* DevMateSparkle_lib_resources */;
|
||||
targetProxy = 331726B71B4D61A8008B2D77 /* PBXContainerItemProxy */;
|
||||
};
|
||||
3329D9C21C7B03A700F1B058 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 33545B801B4679080059250D /* Installation XPC Service */;
|
||||
targetProxy = 3329D9C11C7B03A700F1B058 /* PBXContainerItemProxy */;
|
||||
};
|
||||
55C14F97136F044100649790 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 55C14BB6136EEF1500649790 /* Autoupdate */;
|
||||
@@ -1860,6 +2284,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
@@ -1920,6 +2345,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
|
||||
buildSettings = {
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/External",
|
||||
);
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -1927,6 +2356,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941D50D94A70100DD942E /* ConfigFrameworkRelease.xcconfig */;
|
||||
buildSettings = {
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/External",
|
||||
);
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -1934,6 +2367,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941CF0D94A70100DD942E /* ConfigCommonDebug.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -1941,9 +2375,99 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941CC0D94A70100DD942E /* ConfigCommonRelease.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3317267A1B4D36F2008B2D77 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CONTENTS_FOLDER_PATH = "$(FULL_PRODUCT_NAME)";
|
||||
PRODUCT_NAME = DevMateSparkle_Resources;
|
||||
WRAPPER_SUFFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3317267B1B4D36F2008B2D77 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CONTENTS_FOLDER_PATH = "$(FULL_PRODUCT_NAME)";
|
||||
PRODUCT_NAME = DevMateSparkle_Resources;
|
||||
WRAPPER_SUFFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
331726A91B4D5F28008B2D77 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
GCC_PREFIX_HEADER = Sparkle/DevMateSparkle.pch;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"BUILDING_SPARKLE=1",
|
||||
);
|
||||
PRODUCT_NAME = DevMateSparkle;
|
||||
SPARKLE_BUNDLE_IDENTIFIER = com.devmate.DevMateKit;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
331726AA1B4D5F28008B2D77 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
GCC_PREFIX_HEADER = Sparkle/DevMateSparkle.pch;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"BUILDING_SPARKLE=1",
|
||||
);
|
||||
PRODUCT_NAME = DevMateSparkle;
|
||||
SPARKLE_BUNDLE_IDENTIFIER = com.devmate.DevMateKit;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
33545B8F1B4679080059250D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREFIX_HEADER = "Sparkle/Installation XPC Service/install_service.pch";
|
||||
INFOPLIST_FILE = "Sparkle/Installation XPC Service/SandboxService.plist";
|
||||
PRODUCT_NAME = com.devmate.UpdateInstaller;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
33545B901B4679080059250D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREFIX_HEADER = "Sparkle/Installation XPC Service/install_service.pch";
|
||||
INFOPLIST_FILE = "Sparkle/Installation XPC Service/SandboxService.plist";
|
||||
PRODUCT_NAME = com.devmate.UpdateInstaller;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
33E0CFB81B835C99003B201B /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "Installation XPC Service";
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
33E0CFB91B835C99003B201B /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
PRODUCT_NAME = DevMateSparkle_lib_resources;
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
33E0CFBA1B835C99003B201B /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
PRODUCT_NAME = DevMateSparkle_lib;
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
55C14BBB136EEF1500649790 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941D30D94A70100DD942E /* ConfigRelaunchDebug.xcconfig */;
|
||||
@@ -2053,6 +2577,36 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
331726791B4D36F2008B2D77 /* Build configuration list for PBXNativeTarget "DevMateSparkle_lib_resources" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3317267A1B4D36F2008B2D77 /* Debug */,
|
||||
3317267B1B4D36F2008B2D77 /* Release */,
|
||||
33E0CFB91B835C99003B201B /* Coverage */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
331726A81B4D5F28008B2D77 /* Build configuration list for PBXNativeTarget "DevMateSparkle_lib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
331726A91B4D5F28008B2D77 /* Debug */,
|
||||
331726AA1B4D5F28008B2D77 /* Release */,
|
||||
33E0CFBA1B835C99003B201B /* Coverage */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
33545B8E1B4679080059250D /* Build configuration list for PBXNativeTarget "Installation XPC Service" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
33545B8F1B4679080059250D /* Debug */,
|
||||
33545B901B4679080059250D /* Release */,
|
||||
33E0CFB81B835C99003B201B /* Coverage */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "Autoupdate" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0640"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331726961B4D5F27008B2D77"
|
||||
BuildableName = "libDevMateSparkle.a"
|
||||
BlueprintName = "DevMateSparkle_lib"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331726A01B4D5F27008B2D77"
|
||||
BuildableName = "DevMateSparkle_libTests.xctest"
|
||||
BlueprintName = "DevMateSparkle_libTests"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331726961B4D5F27008B2D77"
|
||||
BuildableName = "libDevMateSparkle.a"
|
||||
BlueprintName = "DevMateSparkle_lib"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331726961B4D5F27008B2D77"
|
||||
BuildableName = "libDevMateSparkle.a"
|
||||
BlueprintName = "DevMateSparkle_lib"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331726961B4D5F27008B2D77"
|
||||
BuildableName = "libDevMateSparkle.a"
|
||||
BlueprintName = "DevMateSparkle_lib"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
Vendored
+21
-1
@@ -104,6 +104,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
|
||||
@property (nonatomic, assign) BOOL isTerminating;
|
||||
|
||||
@property (nonatomic, strong) NSConnection *installationBeacon;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppInstaller
|
||||
@@ -116,6 +118,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
@synthesize shouldRelaunch = _shouldRelaunch;
|
||||
@synthesize shouldShowUI = _shouldShowUI;
|
||||
@synthesize isTerminating = _isTerminating;
|
||||
@synthesize installationBeacon = _installationBeacon;
|
||||
|
||||
- (instancetype)initWithHostPath:(NSString *)hostPath relaunchPath:(NSString *)relaunchPath parentProcessId:(pid_t)parentProcessId updateFolderPath:(NSString *)updateFolderPath shouldRelaunch:(BOOL)shouldRelaunch shouldShowUI:(BOOL)shouldShowUI
|
||||
{
|
||||
@@ -130,6 +133,18 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
self.shouldRelaunch = shouldRelaunch;
|
||||
self.shouldShowUI = shouldShowUI;
|
||||
|
||||
NSConnection *connection = [[NSConnection alloc] init];
|
||||
[connection setRootObject:self];
|
||||
NSString *connectionName = [NSString stringWithFormat:@"Sparkle-%@", [NSBundle bundleWithPath:hostPath].bundleIdentifier];
|
||||
if ([connection registerName:connectionName])
|
||||
{
|
||||
self.installationBeacon = connection;
|
||||
}
|
||||
else
|
||||
{
|
||||
SULog(@"%@ server: could not register server. Is one already running?\n", [NSProcessInfo processInfo].processName);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -221,6 +236,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
}
|
||||
|
||||
[self.statusController close];
|
||||
self.installationBeacon.rootObject = nil;
|
||||
self.installationBeacon = nil;
|
||||
|
||||
// Don't even think about hiding the app icon from the dock if we've already shown it
|
||||
// Transforming the app back to a background one has a backfiring effect, decreasing the likelihood
|
||||
@@ -258,8 +275,11 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
updateFolderPath:args[4]
|
||||
shouldRelaunch:(args.count > 5) ? [args[5] boolValue] : YES
|
||||
shouldShowUI:shouldShowUI];
|
||||
[application setDelegate:appInstaller];
|
||||
application.delegate = appInstaller;
|
||||
[application run];
|
||||
|
||||
// to avoid releaseing appInstaller by ARC
|
||||
[appInstaller class];
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// DevMateSparkle.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 10/1/14.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef Sparkle_DevMateSparkle_h
|
||||
#define Sparkle_DevMateSparkle_h
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// If you are using your own copy of Sparkle.framework just define
|
||||
// USED_CUSTOM_SPARKLE_FRAMEWORK macro.
|
||||
#ifndef USED_CUSTOM_SPARKLE_FRAMEWORK
|
||||
|
||||
#define SUUpdater DM_SUUpdater
|
||||
#define SUUpdaterQueue DM_SUUpdaterQueue
|
||||
#define SUAppcast DM_SUAppcast
|
||||
#define SUAppcastItem DM_SUAppcastItem
|
||||
#define SUUpdaterDelegate DM_SUUpdaterDelegate
|
||||
#define SUUpdaterDelegate_DevMateInteraction DM_SUUpdaterDelegate_DevMateInteraction
|
||||
#define SUVersionComparison DM_SUVersionComparison
|
||||
#define SUStandardVersionComparator DM_SUStandardVersionComparator
|
||||
#define SUVersionDisplay DM_SUVersionDisplay
|
||||
|
||||
#import <DevMateSparkle/SUExport.h>
|
||||
#import <DevMateSparkle/SUUpdater.h>
|
||||
#import <DevMateSparkle/SUUpdaterQueue.h>
|
||||
#import <DevMateSparkle/SUAppcast.h>
|
||||
#import <DevMateSparkle/SUAppcastItem.h>
|
||||
#import <DevMateSparkle/SUVersionComparisonProtocol.h>
|
||||
#import <DevMateSparkle/SUStandardVersionComparator.h>
|
||||
#import <DevMateSparkle/SUVersionDisplayProtocol.h>
|
||||
#import <DevMateSparkle/SUErrors.h>
|
||||
|
||||
#endif // USED_CUSTOM_SPARKLE_FRAMEWORK
|
||||
|
||||
#endif // Sparkle_DevMateSparkle_h
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// DevMateSparkle.pch
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 10/1/14.
|
||||
//
|
||||
//
|
||||
|
||||
#define SUUpdater DM_SUUpdater
|
||||
#define SUUpdaterQueue DM_SUUpdaterQueue
|
||||
#define SUAppcast DM_SUAppcast
|
||||
#define SUAppcastItem DM_SUAppcastItem
|
||||
#define SUUpdaterDelegate DM_SUUpdaterDelegate
|
||||
#define SUUpdaterDelegate_DevMateInteraction DM_SUUpdaterDelegate_DevMateInteraction
|
||||
#define SUVersionComparison DM_SUVersionComparison
|
||||
#define SUStandardVersionComparator DM_SUStandardVersionComparator
|
||||
#define SUVersionDisplay DM_SUVersionDisplay
|
||||
|
||||
#define SUPackageInstaller DM_SUPackageInstaller
|
||||
#define SUDSAVerifier DM_SUDSAVerifier
|
||||
#define SUUpdateAlert DM_SUUpdateAlert
|
||||
#define SUUIBasedUpdateDriver DM_SUUIBasedUpdateDriver
|
||||
#define SUSystemProfiler DM_SUSystemProfiler
|
||||
#define SUXPCInstaller DM_SUXPCInstaller
|
||||
#define SUPlainInstaller DM_SUPlainInstaller
|
||||
#define SUUpdatePermissionPrompt DM_SUUpdatePermissionPrompt
|
||||
#define SUUnarchiver DM_SUUnarchiver
|
||||
#define SUUserInitiatedUpdateDriver DM_SUUserInitiatedUpdateDriver
|
||||
#define SUUpdateDriver DM_SUUpdateDriver
|
||||
#define SUProbingUpdateDriver DM_SUProbingUpdateDriver
|
||||
#define SUAutomaticUpdateAlert DM_SUAutomaticUpdateAlert
|
||||
#define SUBasicUpdateDriver DM_SUBasicUpdateDriver
|
||||
#define SUWindowController DM_SUWindowController
|
||||
#define SUStatusController DM_SUStatusController
|
||||
#define SUHost DM_SUHost
|
||||
#define SUPipedUnarchiver DM_SUPipedUnarchiver
|
||||
#define SUAutomaticUpdateDriver DM_SUAutomaticUpdateDriver
|
||||
#define SUCodeSigningVerifier DM_SUCodeSigningVerifier
|
||||
#define SUBinaryDeltaUnarchiver DM_SUBinaryDeltaUnarchiver
|
||||
#define SUDelegateProxy DM_SUDelegateProxy
|
||||
#define SUInstaller DM_SUInstaller
|
||||
#define SUScheduledUpdateDriver DM_SUScheduledUpdateDriver
|
||||
#define SUDiskImageUnarchiver DM_SUDiskImageUnarchiver
|
||||
#define SUGuidedPackageInstaller DM_SUGuidedPackageInstaller
|
||||
#define NTSynchronousTask DM_NTSynchronousTask
|
||||
#define SUUpdaterWorking DM_SUUpdater // Used in SUUpdaterLoader.m file
|
||||
#define SUUpdaterLoader DM_SUUpdaterLoader
|
||||
|
||||
#import "Sparkle.pch"
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>XPCService</key>
|
||||
<dict>
|
||||
<key>ServiceType</key>
|
||||
<string>Application</string>
|
||||
<key>JoinExistingSession</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,4 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'Downloading XPC Service' target in the 'Downloading XPC Service' project
|
||||
//
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// SUDSDownloader.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 8/1/13.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define DEBUG_LOGGING_ENABLED defined(DEBUG) && 1
|
||||
|
||||
@class SUDSDownloader;
|
||||
|
||||
typedef void (^SUDSDownloadDidBegin)(SUDSDownloader *downloader);
|
||||
typedef void (^SUDSDownloadDidFinish)(SUDSDownloader *downloader);
|
||||
typedef void (^SUDSDownloadDidFail)(SUDSDownloader *downloader, NSError *error);
|
||||
typedef void (^SUDSDownloadDidReceiveResponse)(SUDSDownloader *downloader, NSURLResponse *response);
|
||||
typedef void (^SUDSDownloadDidReceiveData)(SUDSDownloader *downloader, NSUInteger dataLength);
|
||||
typedef void (^SUDSDownloadDidCreateDestination)(SUDSDownloader *downloader, NSString *destinationPath);
|
||||
typedef BOOL (^SUDSDownloadShouldDecodeSourceData)(SUDSDownloader *downloader, NSString *MIMEType);
|
||||
|
||||
typedef struct SUDSDownloaderCallBacks
|
||||
{
|
||||
SUDSDownloadDidBegin downloadDidBegin;
|
||||
SUDSDownloadDidFinish downloadDidFinish;
|
||||
SUDSDownloadDidFail downloadDidFail;
|
||||
|
||||
SUDSDownloadDidReceiveResponse downloadDidReceiveResponse;
|
||||
SUDSDownloadDidReceiveData downloadDidReceiveData;
|
||||
SUDSDownloadDidCreateDestination downloadDidCreateDestination;
|
||||
|
||||
SUDSDownloadShouldDecodeSourceData downloadShouldDecodeSourceData;
|
||||
} SUDSDownloaderCallBacks;
|
||||
|
||||
FOUNDATION_EXTERN SUDSDownloaderCallBacks SUDSCopyDownloaderCallBacks(SUDSDownloaderCallBacks callBacks);
|
||||
FOUNDATION_EXTERN void SUDSReleaseDownloaderCallBacks(SUDSDownloaderCallBacks callBacks);
|
||||
|
||||
@interface SUDSDownloader : NSObject <NSURLDownloadDelegate>
|
||||
{
|
||||
@private
|
||||
NSURLRequest *_request;
|
||||
NSString *_destFilePath;
|
||||
SUDSDownloaderCallBacks _callBacks;
|
||||
|
||||
NSURLDownload *_download;
|
||||
}
|
||||
|
||||
- (id)initWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath;
|
||||
+ (id)downloaderWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath;
|
||||
|
||||
- (NSURLRequest *)request;
|
||||
- (NSString *)destinationPath;
|
||||
- (void)setCallBacks:(SUDSDownloaderCallBacks)callBacks;
|
||||
|
||||
- (void)startDownload;
|
||||
- (void)stopDownload;
|
||||
- (BOOL)isInProgress;
|
||||
|
||||
@end
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
//
|
||||
// SUDSDownloader.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 8/1/13.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SUDSDownloader.h"
|
||||
|
||||
SUDSDownloaderCallBacks SUDSCopyDownloaderCallBacks(SUDSDownloaderCallBacks callBacks)
|
||||
{
|
||||
SUDSDownloaderCallBacks callBacksCopy = {0};
|
||||
|
||||
if (callBacks.downloadDidBegin)
|
||||
callBacksCopy.downloadDidBegin = Block_copy(callBacks.downloadDidBegin);
|
||||
if (callBacks.downloadDidFinish)
|
||||
callBacksCopy.downloadDidFinish = Block_copy(callBacks.downloadDidFinish);
|
||||
if (callBacks.downloadDidFail)
|
||||
callBacksCopy.downloadDidFail = Block_copy(callBacks.downloadDidFail);
|
||||
if (callBacks.downloadDidReceiveData)
|
||||
callBacksCopy.downloadDidReceiveData = Block_copy(callBacks.downloadDidReceiveData);
|
||||
if (callBacks.downloadDidCreateDestination)
|
||||
callBacksCopy.downloadDidCreateDestination = Block_copy(callBacks.downloadDidCreateDestination);
|
||||
if (callBacks.downloadDidReceiveResponse)
|
||||
callBacksCopy.downloadDidReceiveResponse = Block_copy(callBacks.downloadDidReceiveResponse);
|
||||
if (callBacks.downloadShouldDecodeSourceData)
|
||||
callBacksCopy.downloadShouldDecodeSourceData = Block_copy(callBacks.downloadShouldDecodeSourceData);
|
||||
|
||||
return callBacksCopy;
|
||||
}
|
||||
|
||||
void SUDSReleaseDownloaderCallBacks(SUDSDownloaderCallBacks callBacks)
|
||||
{
|
||||
if (callBacks.downloadDidBegin)
|
||||
Block_release(callBacks.downloadDidBegin);
|
||||
if (callBacks.downloadDidFinish)
|
||||
Block_release(callBacks.downloadDidFinish);
|
||||
if (callBacks.downloadDidFail)
|
||||
Block_release(callBacks.downloadDidFail);
|
||||
if (callBacks.downloadDidReceiveData)
|
||||
Block_release(callBacks.downloadDidReceiveData);
|
||||
if (callBacks.downloadDidCreateDestination)
|
||||
Block_release(callBacks.downloadDidCreateDestination);
|
||||
if (callBacks.downloadDidReceiveResponse)
|
||||
Block_release(callBacks.downloadDidReceiveResponse);
|
||||
if (callBacks.downloadShouldDecodeSourceData)
|
||||
Block_release(callBacks.downloadShouldDecodeSourceData);
|
||||
}
|
||||
|
||||
@implementation SUDSDownloader
|
||||
|
||||
- (id)initWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_request = [request retain];
|
||||
_destFilePath = [filePath copy];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (id)downloaderWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath
|
||||
{
|
||||
return [[[[self class] alloc] initWithURLRequest:request destinationPath:filePath] autorelease];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self stopDownload];
|
||||
|
||||
[_request release];
|
||||
[_destFilePath release];
|
||||
SUDSReleaseDownloaderCallBacks(_callBacks);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSURLRequest *)request
|
||||
{
|
||||
return _request;
|
||||
}
|
||||
|
||||
- (NSString *)destinationPath
|
||||
{
|
||||
return _destFilePath;
|
||||
}
|
||||
|
||||
- (void)setCallBacks:(SUDSDownloaderCallBacks)callBacks
|
||||
{
|
||||
SUDSDownloaderCallBacks oldCallBacks = _callBacks;
|
||||
_callBacks = SUDSCopyDownloaderCallBacks(callBacks);
|
||||
SUDSReleaseDownloaderCallBacks(oldCallBacks);
|
||||
}
|
||||
|
||||
- (void)startDownload
|
||||
{
|
||||
[self stopDownload];
|
||||
|
||||
// to ensure that parent folder exists
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:[_destFilePath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:NULL];
|
||||
NSURLDownload *urlDownload = [[NSURLDownload alloc] initWithRequest:_request delegate:self];
|
||||
@synchronized (self)
|
||||
{
|
||||
_download = urlDownload;
|
||||
}
|
||||
|
||||
[urlDownload setDestination:_destFilePath allowOverwrite:YES];
|
||||
}
|
||||
|
||||
- (void)stopDownload
|
||||
{
|
||||
@synchronized (self)
|
||||
{
|
||||
[_download cancel];
|
||||
[_download release];
|
||||
_download = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isInProgress
|
||||
{
|
||||
BOOL result = YES;
|
||||
@synchronized (self)
|
||||
{
|
||||
result = _download != nil;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)downloadDidBegin:(NSURLDownload *)download
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did begin process.");
|
||||
#endif
|
||||
if (_callBacks.downloadDidBegin)
|
||||
_callBacks.downloadDidBegin(self);
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did receive response: %@", [response description]);
|
||||
#endif
|
||||
if (_callBacks.downloadDidReceiveResponse)
|
||||
_callBacks.downloadDidReceiveResponse(self, response);
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did create destination: %@", path);
|
||||
#endif
|
||||
if (_callBacks.downloadDidCreateDestination)
|
||||
_callBacks.downloadDidCreateDestination(self, path);
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did receive data of length %ld bytes", (unsigned long)length);
|
||||
#endif
|
||||
if (_callBacks.downloadDidReceiveData)
|
||||
_callBacks.downloadDidReceiveData(self, length);
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did fail: %@", [error description]);
|
||||
#endif
|
||||
if (_callBacks.downloadDidFail)
|
||||
_callBacks.downloadDidFail(self, error);
|
||||
|
||||
[self stopDownload];
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)download
|
||||
{
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader did finish");
|
||||
#endif
|
||||
if (_callBacks.downloadDidFinish)
|
||||
_callBacks.downloadDidFinish(self);
|
||||
|
||||
[self stopDownload];
|
||||
}
|
||||
|
||||
- (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
|
||||
{
|
||||
BOOL shouldDecode = NO;
|
||||
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"XPC Downloader wants decode source data of MIME type: %@", encodingType);
|
||||
#endif
|
||||
if (_callBacks.downloadShouldDecodeSourceData)
|
||||
shouldDecode = _callBacks.downloadShouldDecodeSourceData(self, encodingType);
|
||||
|
||||
return shouldDecode;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// SUDownloadServiceConstants.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 7/29/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef Sparkle_SUDownloadServiceConstants_h
|
||||
#define Sparkle_SUDownloadServiceConstants_h
|
||||
|
||||
const char * SUDownloadServiceURLRequestDataKey = "request_data"; // data of archived NSURLRequest
|
||||
const char * SUDownloadServiceDelegateConnectionKey = "connection"; // xpc_connection_t
|
||||
const char * SUDownloadServiceFilePathKey = "file_path"; // c-string
|
||||
|
||||
const char * SUDownloadServiceReceivedDataLengthKey = "received_data_length"; // int64_t
|
||||
const char * SUDownloadServiceReceivedResponseDataKey = "received_response_data"; // data of archived NSURLResponse
|
||||
const char * SUDownloadServiceCreatedDestinationPathKey = "created_destination_path"; // c-string
|
||||
const char * SUDownloadServiceDidBeginDownloadingKey = "did_begin_downloading"; // bool 1
|
||||
const char * SUDownloadServiceDidFinishDownloadingKey = "did_finish_downloading"; // bool 1
|
||||
const char * SUDownloadServiceReceivedFailErrorKey = "received_fail_error"; // data of archived NSError
|
||||
const char * SUDownloadServiceMIMETypeToDecodeKey = "MIME_type_to_decode"; // c-string
|
||||
const char * SUDownloadServiceShouldDecodeMIMETypeKey = "should_decode_MIME_type"; // bool
|
||||
|
||||
const char * SUDownloadServiceErrorCodeKey = "errcode"; // int64_t
|
||||
const char * SUDownloadServiceErrorMessageKey = "errmsg"; // c-string
|
||||
const char * SUDownloadServiceErrorDomainKey = "errdomain"; // c-string
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// SUXPCURLDownload.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Erik Aderstedt on 2012-08-09.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SUXPCURLDownload : NSObject
|
||||
{
|
||||
@private
|
||||
id <NSURLDownloadDelegate> _delegate; // weak ref
|
||||
xpc_connection_t _connection;
|
||||
xpc_connection_t _delegateConnection;
|
||||
NSURLRequest *_request;
|
||||
NSThread *_startedThread; // weak ref
|
||||
BOOL _isDownloading;
|
||||
|
||||
BOOL _allowOverwrite;
|
||||
NSString *_destination;
|
||||
NSString *_connectionDestination;
|
||||
NSError *_downloadError;
|
||||
}
|
||||
|
||||
- (id <NSURLDownloadDelegate>)delegate;
|
||||
- (void)setDelegate:(id <NSURLDownloadDelegate>)delegate;
|
||||
|
||||
- (id)initWithRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate;
|
||||
- (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite;
|
||||
|
||||
// Delegate methods for this method will be called from another thread.
|
||||
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate;
|
||||
|
||||
@end
|
||||
+448
@@ -0,0 +1,448 @@
|
||||
//
|
||||
// SUXPCURLDownload.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Erik Aderstedt on 2012-08-09.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SUXPCURLDownload.h"
|
||||
#import "SUDownloadServiceConstants.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
|
||||
static NSString * const kSUFetchFolderName = @"fetch.XXXXXXXX";
|
||||
|
||||
@interface SUXPCURLDownload (Private)
|
||||
|
||||
- (void)performBlock:(void (^)(void))block onThread:(NSThread *)thread synchronous:(BOOL)flag;
|
||||
- (void)fireBlock:(void (^)(void))block;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUXPCURLDownload
|
||||
|
||||
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate
|
||||
{
|
||||
__block SUXPCURLDownload *download = nil;
|
||||
|
||||
static const char *sSynchronousDownloadQueueName = "com.devmate.SynchronousXPCDownloadQueue";
|
||||
dispatch_queue_t queue = dispatch_queue_create(sSynchronousDownloadQueueName, NULL);
|
||||
dispatch_sync(queue, ^{
|
||||
download = [[SUXPCURLDownload alloc] initWithRequest:request delegate:delegate];
|
||||
});
|
||||
|
||||
while (download && download->_isDownloading)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
|
||||
}
|
||||
|
||||
NSData *downloadData = (nil == download->_downloadError) ? [NSData dataWithContentsOfFile:download->_destination] : nil;
|
||||
[download release];
|
||||
dispatch_release(queue);
|
||||
|
||||
return downloadData;
|
||||
}
|
||||
|
||||
- (id)initWithRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_request = [request retain];
|
||||
_delegate = [delegate retain];
|
||||
_startedThread = [NSThread currentThread];
|
||||
|
||||
// Set up a connection.
|
||||
_connection = [self getSandboxXPCService];
|
||||
dispatch_async(dispatch_get_current_queue(), ^{
|
||||
[self startDownload:request];
|
||||
});
|
||||
|
||||
_isDownloading = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self cancel];
|
||||
|
||||
[_request release];
|
||||
[_destination release];
|
||||
[_connectionDestination release];
|
||||
[_downloadError release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSURLRequest *)request
|
||||
{
|
||||
return _request;
|
||||
}
|
||||
|
||||
- (void)startDownload:(NSURLRequest *)urlRequest
|
||||
{
|
||||
// Send a message to download a specific url.
|
||||
if ([_delegate respondsToSelector:@selector(download:decideDestinationWithSuggestedFilename:)] && _destination == nil)
|
||||
{
|
||||
void (^block)(void) = ^{
|
||||
[_delegate download:(NSURLDownload *)self decideDestinationWithSuggestedFilename:[[urlRequest URL] lastPathComponent]];
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:YES];
|
||||
}
|
||||
if (nil == _destination)
|
||||
{
|
||||
_destination = [[[urlRequest URL] lastPathComponent] copy];
|
||||
}
|
||||
|
||||
// ivar 'destination' now contains the destination URL.
|
||||
|
||||
NSURL *tempFolder = [NSURL fileURLWithPath:NSTemporaryDirectory()];
|
||||
NSString *tempFileTemplate = [[tempFolder URLByAppendingPathComponent:kSUFetchFolderName] path];
|
||||
NSString *tempFilePath = [tempFileTemplate stringByAppendingPathComponent:[_destination lastPathComponent]];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
if ([fileManager fileExistsAtPath:tempFilePath])
|
||||
[fileManager removeItemAtPath:tempFilePath error:nil];
|
||||
|
||||
_connectionDestination = [tempFilePath copy];
|
||||
|
||||
NSData *requestData = [NSKeyedArchiver archivedDataWithRootObject:urlRequest];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_data(message, SUDownloadServiceURLRequestDataKey, [requestData bytes], [requestData length]);
|
||||
xpc_dictionary_set_string(message, SUDownloadServiceFilePathKey, [tempFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
xpc_dictionary_set_connection(message, SUDownloadServiceDelegateConnectionKey, _delegateConnection);
|
||||
xpc_connection_send_message_with_reply(_connection, message, dispatch_get_main_queue(), ^(xpc_object_t object) {
|
||||
xpc_type_t type = xpc_get_type(object);
|
||||
|
||||
if (type == XPC_TYPE_ERROR && nil == _downloadError)
|
||||
{
|
||||
NSString *errMessage = @"";
|
||||
if (object == XPC_ERROR_CONNECTION_INTERRUPTED)
|
||||
{
|
||||
errMessage = @"Got XPC_ERROR_CONNECTION_INTERRUPTED error.";
|
||||
}
|
||||
else if (object == XPC_ERROR_CONNECTION_INVALID)
|
||||
{
|
||||
errMessage = @"Got XPC_ERROR_CONNECTION_INVALID error.";
|
||||
}
|
||||
|
||||
NSDictionary *errInfo = [NSDictionary dictionaryWithObject:errMessage forKey:NSLocalizedDescriptionKey];
|
||||
_downloadError = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errInfo];
|
||||
}
|
||||
else if (type == XPC_TYPE_DICTIONARY && noErr != xpc_dictionary_get_int64(object, SUDownloadServiceErrorCodeKey) && nil == _downloadError)
|
||||
{
|
||||
NSInteger errCode = (NSInteger)xpc_dictionary_get_int64(object, SUDownloadServiceErrorCodeKey);
|
||||
|
||||
const char *errDomainStr = xpc_dictionary_get_string(object, SUDownloadServiceErrorDomainKey);
|
||||
NSString *errDomain = errDomainStr ? [NSString stringWithUTF8String:errDomainStr] : NSCocoaErrorDomain;
|
||||
|
||||
const char *errMessage = xpc_dictionary_get_string(object, SUDownloadServiceErrorMessageKey) ? : "";
|
||||
NSDictionary *errInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:errMessage]
|
||||
forKey:NSLocalizedDescriptionKey];
|
||||
|
||||
_downloadError = [[NSError alloc] initWithDomain:errDomain code:errCode userInfo:errInfo];
|
||||
}
|
||||
|
||||
if (nil != _downloadError)
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(download:didFailWithError:)])
|
||||
{
|
||||
void (^block)(void) = ^{
|
||||
[_delegate download:(NSURLDownload *)self didFailWithError:_downloadError];
|
||||
_isDownloading = NO;
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
SULog(@"SUXPCURLDownload: got download error (%d - %@)", [_downloadError code], [_downloadError localizedDescription]);
|
||||
_isDownloading = NO;
|
||||
}
|
||||
}
|
||||
});
|
||||
xpc_release(message);
|
||||
}
|
||||
|
||||
- (id <NSURLDownloadDelegate>)delegate
|
||||
{
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id <NSURLDownloadDelegate>)delegate
|
||||
{
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
- (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite
|
||||
{
|
||||
[_destination release];
|
||||
_destination = [path copy];
|
||||
_allowOverwrite = allowOverwrite;
|
||||
}
|
||||
|
||||
- (void)cancel
|
||||
{
|
||||
if (_connection)
|
||||
{
|
||||
xpc_connection_cancel(_connection);
|
||||
xpc_release(_connection);
|
||||
_connection = NULL;
|
||||
}
|
||||
if (_delegateConnection)
|
||||
{
|
||||
xpc_connection_cancel(_delegateConnection);
|
||||
xpc_release(_delegateConnection);
|
||||
_delegateConnection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
- (xpc_connection_t)getSandboxXPCService
|
||||
{
|
||||
// Set up two connections, one for instructing the XPC and getting a response,
|
||||
// and another to listen for incoming connections for progress and file creation
|
||||
// notifications.
|
||||
|
||||
_connection = xpc_connection_create("com.devmate.UpdateDownloader", dispatch_get_main_queue());
|
||||
if (!_connection)
|
||||
{
|
||||
NSLog(@"Can't connect to XPC service");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
xpc_connection_set_event_handler(_connection, ^(xpc_object_t event) {
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
|
||||
if (type == XPC_TYPE_ERROR)
|
||||
{
|
||||
if (event == XPC_ERROR_CONNECTION_INTERRUPTED)
|
||||
{
|
||||
NSLog(@"Got XPC_ERROR_CONNECTION_INTERRUPTED error.");
|
||||
// The service has either cancaled itself, crashed, or been
|
||||
// terminated. The XPC connection is still valid and sending a
|
||||
// message to it will re-launch the service. If the service is
|
||||
// state-full, this is the time to initialize the new service.
|
||||
|
||||
}
|
||||
else if (event == XPC_ERROR_CONNECTION_INVALID)
|
||||
{
|
||||
NSLog(@"Got XPC_ERROR_CONNECTION_INVALID error.");
|
||||
// The service is invalid. Either the service name supplied to
|
||||
// xpc_connection_create() is incorrect or we (this process) have
|
||||
// canceled the service; we can do any cleanup of appliation
|
||||
// state at this point.
|
||||
if (_delegateConnection)
|
||||
{
|
||||
xpc_connection_cancel(_delegateConnection);
|
||||
xpc_release(_delegateConnection);
|
||||
_delegateConnection = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dispatch_queue_t delegate_queue = dispatch_queue_create("com.devmate.UpdateDownloader.delegate", NULL);
|
||||
assert(delegate_queue != NULL);
|
||||
|
||||
_delegateConnection = xpc_connection_create(NULL, delegate_queue);
|
||||
xpc_connection_set_event_handler(_delegateConnection, ^(xpc_object_t event) {
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
|
||||
if (type == XPC_TYPE_ERROR)
|
||||
{
|
||||
if (event == XPC_ERROR_TERMINATION_IMMINENT)
|
||||
{
|
||||
NSLog(@"received XPC_ERROR_TERMINATION_IMMINENT");
|
||||
}
|
||||
else if (event == XPC_ERROR_CONNECTION_INVALID)
|
||||
{
|
||||
NSLog(@"progress connection is closed");
|
||||
dispatch_release(delegate_queue);
|
||||
}
|
||||
}
|
||||
else if (type == XPC_TYPE_CONNECTION)
|
||||
{
|
||||
xpc_connection_t peer = (xpc_connection_t)event;
|
||||
// A new anonymous connection, from an XPC service that wants to supply us with updates.
|
||||
char *queue_name = NULL;
|
||||
dispatch_queue_t peer_event_queue = dispatch_queue_create(queue_name, NULL);
|
||||
assert(peer_event_queue != NULL);
|
||||
free(queue_name);
|
||||
|
||||
xpc_connection_set_target_queue(peer, peer_event_queue);
|
||||
xpc_connection_set_event_handler(peer, ^(xpc_object_t nevent) {
|
||||
xpc_type_t ntype = xpc_get_type(nevent);
|
||||
|
||||
if (ntype == XPC_TYPE_ERROR && nevent == XPC_ERROR_CONNECTION_INVALID)
|
||||
dispatch_release(peer_event_queue);
|
||||
if (ntype != XPC_TYPE_DICTIONARY)
|
||||
return;
|
||||
|
||||
__block xpc_object_t answer = xpc_dictionary_create_reply(nevent);
|
||||
|
||||
xpc_dictionary_apply(nevent, ^bool(const char *key, xpc_object_t value) {
|
||||
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (0 == strcmp(key, SUDownloadServiceDidBeginDownloadingKey))
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(downloadDidBegin:)])
|
||||
{
|
||||
void (^block)(void) = ^ {
|
||||
[_delegate downloadDidBegin:(NSURLDownload *)self];
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:NO];
|
||||
}
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceReceivedResponseDataKey))
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(download:didReceiveResponse:)])
|
||||
{
|
||||
size_t dataLength = 0;
|
||||
const void * responseDataBytes = xpc_dictionary_get_data(nevent, SUDownloadServiceReceivedResponseDataKey, &dataLength);
|
||||
NSData *responseData = [NSData dataWithBytes:responseDataBytes length:(NSUInteger)dataLength];
|
||||
|
||||
NSURLResponse *response = [NSKeyedUnarchiver unarchiveObjectWithData:responseData];
|
||||
void (^block)(void) = ^ {
|
||||
[_delegate download:(NSURLDownload *)self didReceiveResponse:response];
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:NO];
|
||||
}
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceReceivedDataLengthKey))
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(download:didReceiveDataOfLength:)])
|
||||
{
|
||||
int64_t dataLength = xpc_dictionary_get_int64(nevent, SUDownloadServiceReceivedDataLengthKey);
|
||||
void (^block)(void) = ^ {
|
||||
[_delegate download:(NSURLDownload *)self didReceiveDataOfLength:(NSUInteger)dataLength];
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:NO];
|
||||
}
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceCreatedDestinationPathKey))
|
||||
{
|
||||
[_connectionDestination release];
|
||||
_connectionDestination = [[NSString alloc] initWithCString:xpc_dictionary_get_string(nevent, SUDownloadServiceCreatedDestinationPathKey)
|
||||
encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceReceivedFailErrorKey))
|
||||
{
|
||||
size_t dataLength = 0;
|
||||
const void * errorDataBytes = xpc_dictionary_get_data(nevent, SUDownloadServiceReceivedFailErrorKey, &dataLength);
|
||||
NSData *errorData = [NSData dataWithBytes:errorDataBytes length:dataLength];
|
||||
|
||||
NSError *error = [NSKeyedUnarchiver unarchiveObjectWithData:errorData];
|
||||
_downloadError = [error retain];
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceDidFinishDownloadingKey))
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
|
||||
NSString *destPath = _destination;
|
||||
if (nil == destPath || [destPath isEqualToString:[destPath lastPathComponent]])
|
||||
{
|
||||
destPath = _connectionDestination;
|
||||
}
|
||||
else if (!_allowOverwrite)
|
||||
{
|
||||
NSUInteger index = 1;
|
||||
NSString *parentFolder = [destPath stringByDeletingLastPathComponent];
|
||||
NSString *initialFileName = [[destPath lastPathComponent] stringByDeletingPathExtension];
|
||||
NSString *fileExtension = [destPath pathExtension];
|
||||
|
||||
while ([fileManager fileExistsAtPath:destPath])
|
||||
{
|
||||
NSString *fileName = [initialFileName stringByAppendingFormat:@"_%ld", index];
|
||||
destPath = [[parentFolder stringByAppendingPathComponent:fileName] stringByAppendingPathExtension:fileExtension];
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
NSError *error = nil;
|
||||
BOOL success = YES;
|
||||
|
||||
if (![destPath isEqualToString:_connectionDestination])
|
||||
{
|
||||
success = success && [fileManager createDirectoryAtPath:[destPath stringByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error];
|
||||
if (success && [fileManager fileExistsAtPath:destPath])
|
||||
success = [fileManager removeItemAtPath:destPath error:&error];
|
||||
success = success && [fileManager moveItemAtPath:_connectionDestination toPath:destPath error:&error];
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
[self setDestination:destPath allowOverwrite:_allowOverwrite];
|
||||
|
||||
void (^block)(void) = ^ {
|
||||
if ([_delegate respondsToSelector:@selector(download:didCreateDestination:)])
|
||||
[_delegate download:(NSURLDownload *)self didCreateDestination:destPath];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(downloadDidFinish:)])
|
||||
[_delegate downloadDidFinish:(NSURLDownload *)self];
|
||||
|
||||
_isDownloading = NO;
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadError = [error retain];
|
||||
}
|
||||
}
|
||||
else if (0 == strcmp(key, SUDownloadServiceMIMETypeToDecodeKey))
|
||||
{
|
||||
void (^block)(void) = ^{
|
||||
BOOL shouldDecode = NO;
|
||||
if ([_delegate respondsToSelector:@selector(download:shouldDecodeSourceDataOfMIMEType:)])
|
||||
{
|
||||
NSString *MIMEType = [NSString stringWithCString:xpc_dictionary_get_string(nevent, SUDownloadServiceMIMETypeToDecodeKey)
|
||||
encoding:NSUTF8StringEncoding];
|
||||
shouldDecode = [_delegate download:(NSURLDownload *)self shouldDecodeSourceDataOfMIMEType:MIMEType];
|
||||
}
|
||||
xpc_dictionary_set_bool(answer, SUDownloadServiceShouldDecodeMIMETypeKey, YES);
|
||||
};
|
||||
[self performBlock:block onThread:_startedThread synchronous:YES];
|
||||
}
|
||||
|
||||
[localPool release];
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
xpc_connection_send_message(peer, answer);
|
||||
xpc_release(answer);
|
||||
});
|
||||
xpc_connection_resume(peer);
|
||||
}
|
||||
});
|
||||
|
||||
// Need to resume the service in order for it to process messages.
|
||||
xpc_connection_resume(_delegateConnection);
|
||||
xpc_connection_resume(_connection);
|
||||
return _connection;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)performBlock:(void (^)(void))block onThread:(NSThread *)thread synchronous:(BOOL)flag
|
||||
{
|
||||
void (^blockCopy)(void) = block != NULL ? Block_copy(block) : NULL;
|
||||
[self performSelector:@selector(fireBlock:) onThread:thread withObject:blockCopy waitUntilDone:flag];
|
||||
}
|
||||
|
||||
- (void)fireBlock:(void (^)(void))block
|
||||
{
|
||||
if (NULL == block)
|
||||
return;
|
||||
|
||||
block();
|
||||
Block_release(block);
|
||||
}
|
||||
|
||||
@end
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
//
|
||||
// main.m
|
||||
// Downloading XPC Service
|
||||
//
|
||||
// Created by Erik Aderstedt on 2012-08-09.
|
||||
// Based on the Apple sample code 'SandboxedFetch'.
|
||||
//
|
||||
|
||||
#import <xpc/xpc.h>
|
||||
#import <asl.h>
|
||||
#import <assert.h>
|
||||
#import <errno.h>
|
||||
#import <stdio.h>
|
||||
|
||||
#import "SUDownloadServiceConstants.h"
|
||||
#import "SUDSDownloader.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
static void fetch_process_request(xpc_object_t request, xpc_object_t reply);
|
||||
static void fetch_peer_event_handler(xpc_connection_t peer, xpc_object_t event);
|
||||
static void fetch_event_handler(xpc_connection_t peer);
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// Process the XPC request, create a temporary file to hold downloaded,
|
||||
// data, and build/return XPC reply.
|
||||
static void fetch_process_request(xpc_object_t request, xpc_object_t reply)
|
||||
{
|
||||
__block int32_t errcode = 0;
|
||||
__block const char *errmsg = NULL;
|
||||
__block const char *errdomain = NULL;
|
||||
|
||||
xpc_connection_t connection = NULL;
|
||||
|
||||
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
|
||||
do
|
||||
{
|
||||
size_t dataLength = 0;
|
||||
const void *data = xpc_dictionary_get_data(request, SUDownloadServiceURLRequestDataKey, &dataLength);
|
||||
NSData *requestData = [NSData dataWithBytes:data length:dataLength];
|
||||
|
||||
NSURLRequest *urlRequest = [NSKeyedUnarchiver unarchiveObjectWithData:requestData];
|
||||
if (nil == urlRequest)
|
||||
{
|
||||
errcode = SUXPCServiceError;
|
||||
errdomain = [SUSparkleErrorDomain cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
errmsg = "Invalid URL request data";
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the URL and XPC connection from the XPC request
|
||||
connection = xpc_dictionary_create_connection(request, SUDownloadServiceDelegateConnectionKey);
|
||||
if (connection == NULL)
|
||||
{
|
||||
errcode = SUXPCServiceError;
|
||||
errdomain = [SUSparkleErrorDomain cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
errmsg = "Invalid XPC delegate connection";
|
||||
break;
|
||||
}
|
||||
|
||||
// Set up XPC connection endpoint for sending progress reports and receiving cancel notification.
|
||||
__block BOOL shouldStopDownload = NO;
|
||||
xpc_connection_set_event_handler(connection, ^(xpc_object_t event) {
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
|
||||
// If the remote end of this connection has gone away then stop download
|
||||
if (XPC_TYPE_ERROR == type &&
|
||||
(XPC_ERROR_CONNECTION_INTERRUPTED == event || XPC_ERROR_CONNECTION_INVALID == event))
|
||||
{
|
||||
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "Stopping download process...\n");
|
||||
shouldStopDownload = YES;
|
||||
}
|
||||
});
|
||||
xpc_connection_resume(connection);
|
||||
|
||||
NSString *destinationPath = [NSString stringWithCString:xpc_dictionary_get_string(request, SUDownloadServiceFilePathKey)
|
||||
encoding:NSUTF8StringEncoding];
|
||||
SUDSDownloader *downloader = [SUDSDownloader downloaderWithURLRequest:urlRequest
|
||||
destinationPath:destinationPath];
|
||||
|
||||
SUDSDownloaderCallBacks callBacks = {0};
|
||||
|
||||
callBacks.downloadDidReceiveData = ^(SUDSDownloader *downloader, NSUInteger dataLength) {
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_int64(message, SUDownloadServiceReceivedDataLengthKey, (int64_t)dataLength);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadDidReceiveResponse = ^(SUDSDownloader *downloader, NSURLResponse *response) {
|
||||
NSData *responseData = [NSKeyedArchiver archivedDataWithRootObject:response];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_data(message, SUDownloadServiceReceivedResponseDataKey, [responseData bytes], [responseData length]);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadDidCreateDestination = ^(SUDSDownloader *downloader, NSString *destinationPath) {
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_string(message, SUDownloadServiceCreatedDestinationPathKey, [destinationPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadDidBegin = ^(SUDSDownloader *downloader) {
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_bool(message, SUDownloadServiceDidBeginDownloadingKey, true);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadDidFail = ^(SUDSDownloader *downloader, NSError *error) {
|
||||
errcode = (int32_t)[error code];
|
||||
errdomain = [[error domain] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
errmsg = [[error localizedDescription] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSData *errorData = [NSKeyedArchiver archivedDataWithRootObject:error];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_data(message, SUDownloadServiceReceivedFailErrorKey, [errorData bytes], [errorData length]);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadDidFinish = ^(SUDSDownloader *downloader) {
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_bool(message, SUDownloadServiceDidFinishDownloadingKey, true);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
xpc_release(answer);
|
||||
};
|
||||
|
||||
callBacks.downloadShouldDecodeSourceData = ^BOOL(SUDSDownloader *downloader, NSString *MIMEType) {
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_string(message, SUDownloadServiceMIMETypeToDecodeKey, [MIMEType cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
|
||||
xpc_release(message);
|
||||
|
||||
BOOL result = NO;
|
||||
if (xpc_get_type(answer) == XPC_TYPE_DICTIONARY)
|
||||
result = (BOOL)xpc_dictionary_get_bool(answer, SUDownloadServiceShouldDecodeMIMETypeKey);
|
||||
xpc_release(answer);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
[downloader setCallBacks:callBacks];
|
||||
|
||||
[downloader startDownload];
|
||||
while ([downloader isInProgress])
|
||||
{
|
||||
if (shouldStopDownload)
|
||||
{
|
||||
[downloader stopDownload];
|
||||
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "Download process stopped.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, true);
|
||||
}
|
||||
}
|
||||
while (NO);
|
||||
[localPool release];
|
||||
|
||||
#if DEBUG_LOGGING_ENABLED
|
||||
NSLog(@"Download process finished. Will send last message...");
|
||||
#endif
|
||||
// Clean up and add errcode/errmsg to reply
|
||||
if (connection)
|
||||
{
|
||||
xpc_connection_cancel(connection);
|
||||
xpc_release(connection);
|
||||
}
|
||||
|
||||
xpc_dictionary_set_int64(reply, SUDownloadServiceErrorCodeKey, (int64_t)errcode);
|
||||
if (errmsg)
|
||||
{
|
||||
xpc_dictionary_set_string(reply, SUDownloadServiceErrorMessageKey, errmsg);
|
||||
}
|
||||
if (errdomain)
|
||||
{
|
||||
xpc_dictionary_set_string(reply, SUDownloadServiceErrorDomainKey, errdomain);
|
||||
}
|
||||
}
|
||||
|
||||
static void fetch_peer_event_handler(xpc_connection_t peer, xpc_object_t event)
|
||||
{
|
||||
// Get the object type.
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
if (XPC_TYPE_ERROR == type)
|
||||
{
|
||||
// Handle an error.
|
||||
if (XPC_ERROR_CONNECTION_INVALID == event)
|
||||
{
|
||||
// The client process on the other end of the connection
|
||||
// has either crashed or cancelled the connection.
|
||||
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "peer(%d) received "
|
||||
"XPC_ERROR_CONNECTION_INVALID",
|
||||
xpc_connection_get_pid(peer));
|
||||
xpc_connection_cancel(peer);
|
||||
}
|
||||
else if (XPC_ERROR_TERMINATION_IMMINENT == event)
|
||||
{
|
||||
// Handle per-connection termination cleanup. This
|
||||
// service is about to exit.
|
||||
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "peer(%d) received "
|
||||
"XPC_ERROR_TERMINATION_IMMINENT",
|
||||
xpc_connection_get_pid(peer));
|
||||
}
|
||||
}
|
||||
else if (XPC_TYPE_DICTIONARY == type)
|
||||
{
|
||||
xpc_object_t requestMessage = event;
|
||||
xpc_object_t replyMessage = xpc_dictionary_create_reply(requestMessage);
|
||||
assert(replyMessage != NULL);
|
||||
|
||||
// Process request and build a reply message.
|
||||
fetch_process_request(requestMessage, replyMessage);
|
||||
|
||||
xpc_connection_send_message(peer, replyMessage);
|
||||
xpc_release(replyMessage);
|
||||
}
|
||||
}
|
||||
|
||||
static void release_dispatch_queue(void *queue)
|
||||
{
|
||||
dispatch_release(queue);
|
||||
}
|
||||
|
||||
static void fetch_event_handler(xpc_connection_t peer)
|
||||
{
|
||||
// Generate an unique name for the queue to handle messages from
|
||||
// this peer and create a new dispatch queue for it.
|
||||
char *queue_name = NULL;
|
||||
asprintf(&queue_name, "%s-peer-%d", "com.devmate.UpdateDownloader", xpc_connection_get_pid(peer));
|
||||
dispatch_queue_t peer_event_queue = dispatch_queue_create(queue_name, DISPATCH_QUEUE_SERIAL);
|
||||
assert(peer_event_queue != NULL);
|
||||
free(queue_name);
|
||||
|
||||
// Set the target queue for connection.
|
||||
xpc_connection_set_target_queue(peer, peer_event_queue);
|
||||
xpc_connection_set_context(peer, peer_event_queue);
|
||||
xpc_connection_set_finalizer_f(peer, release_dispatch_queue);
|
||||
|
||||
// Set the handler block for connection.
|
||||
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
|
||||
fetch_peer_event_handler(peer, event);
|
||||
});
|
||||
|
||||
// Enable the peer connection to receive messages.
|
||||
xpc_connection_resume(peer);
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
xpc_main(fetch_event_handler);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// SUInstallServiceConstants.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 8/2/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef Sparkle_SUInstallServiceConstants_h
|
||||
#define Sparkle_SUInstallServiceConstants_h
|
||||
|
||||
typedef NS_ENUM(UInt64, SUInstallServiceTask)
|
||||
{
|
||||
SUInstallServiceTaskUnknown = 0,
|
||||
SUInstallServiceTaskCopyPath = 1LL,
|
||||
SUInstallServiceTaskAuthReleaseFromQuarantine = 2LL,
|
||||
SUInstallServiceTaskLaunchTask = 3LL
|
||||
};
|
||||
|
||||
static const char * SUInstallServiceTaskTypeKey = "task_type"; // int64_t
|
||||
|
||||
// SUInstallServiceTaskCopyPath & SUInstallServiceTaskAuthCopyPath keys
|
||||
static const char * SUInstallServiceSourcePathKey = "source_path"; // c-string
|
||||
static const char * SUInstallServiceDestinationPathKey = "destination_path"; // c-string
|
||||
static const char * SUInslallServiceAllowsAuthKey = "allows_authorization"; // bool
|
||||
|
||||
// SUInstallServiceTaskLaunchTask keys
|
||||
static const char * SUInstallServiceLaunchTaksPathKey = "launch_task_path";
|
||||
static const char * SUInstallServiceLaunchTaskArgumentsKey = "launch_task_arguments"; // xpc_array of c-strings
|
||||
static const char * SUInstallServiceLaunchTaskEnvironmentKey = "launch_task_environment"; // xpc_dictionary with keys and values of c-strings
|
||||
static const char * SUInstallServiceLaunchTaskCurrentDirKey = "launch_task_cur_dir"; // c-string
|
||||
static const char * SUInstallServiceLaunchTaskInputDataKey = "launch_task_input_data"; // xpc_data
|
||||
static const char * SUInstallServiceLaunchTaskReplyImmediatelyKey = "launch_task_reply_immediately"; // bool
|
||||
|
||||
// Reply keys
|
||||
static const char * SUInstallServiceErrorCodeKey = "error_code"; // int64_t
|
||||
static const char * SUInstallServiceErrorLocalizedDescriptionKey = "error_localized_description"; // c-string
|
||||
static const char * SUInstallServiceLaunchTaskOutputDataKey = "launch_task_output_data"; // xpc_data
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// SUXPCInstaller.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Whitney Young on 3/19/12.
|
||||
// Copyright (c) 2012 FadingRed. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface SUXPCInstaller : NSObject
|
||||
|
||||
+ (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL allowsAuthorization:(BOOL)flag error:(NSError *__autoreleasing *)error;
|
||||
|
||||
+ (BOOL)copyPathContent:(NSString *)src toDirectory:(NSString *)dstDir error:(NSError *__autoreleasing *)outError; // dstDir will be created if absent
|
||||
|
||||
+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments;
|
||||
|
||||
+ (void)launchTaskWithPath:(NSString *)launchPath
|
||||
arguments:(NSArray *)arguments
|
||||
environment:(NSDictionary *)environment
|
||||
currentDirectoryPath:(NSString *)currentDirPath
|
||||
inputData:(NSData *)inputData
|
||||
waitUntilDone:(BOOL)waitUntilDone
|
||||
completionHandler:(void (^)(int result, NSData *outputData))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT BOOL SUShouldUseXPCInstaller(void);
|
||||
+288
@@ -0,0 +1,288 @@
|
||||
//
|
||||
// SUXPCInstaller.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Whitney Young on 3/19/12.
|
||||
// Copyright (c) 2012 FadingRed. All rights reserved.
|
||||
//
|
||||
|
||||
#import <xpc/xpc.h>
|
||||
#import "SUXPCInstaller.h"
|
||||
#import "SUInstallServiceConstants.h"
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
|
||||
BOOL SUShouldUseXPCInstaller(void)
|
||||
{
|
||||
if (![SUCodeSigningVerifier hostApplicationIsSandboxed])
|
||||
return NO;
|
||||
|
||||
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:[NSBundle mainBundle].bundleURL
|
||||
includingPropertiesForKeys:nil
|
||||
options:NSDirectoryEnumerationSkipsHiddenFiles
|
||||
errorHandler:nil];
|
||||
BOOL hasXPC = NO;
|
||||
for (NSURL *URL in enumerator)
|
||||
{
|
||||
if (![URL.lastPathComponent isEqualToString:@"com.devmate.UpdateInstaller.xpc"])
|
||||
continue;
|
||||
|
||||
if (![[URL URLByDeletingLastPathComponent].lastPathComponent isEqualToString:@"XPCServices"])
|
||||
continue;
|
||||
|
||||
hasXPC = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
return hasXPC;
|
||||
}
|
||||
|
||||
@implementation SUXPCInstaller
|
||||
|
||||
+ (xpc_connection_t)getSandboxXPCService
|
||||
{
|
||||
__block xpc_connection_t serviceConnection = xpc_connection_create("com.devmate.UpdateInstaller", dispatch_get_main_queue());
|
||||
|
||||
if (!serviceConnection)
|
||||
{
|
||||
NSLog(@"Can't connect to XPC service");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
xpc_connection_set_event_handler(serviceConnection, ^(xpc_object_t event) {
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
|
||||
if (type == XPC_TYPE_ERROR)
|
||||
{
|
||||
if (event == XPC_ERROR_CONNECTION_INVALID)
|
||||
{
|
||||
// The service is invalid. Either the service name supplied to
|
||||
// xpc_connection_create() is incorrect or we (this process) have
|
||||
// canceled the service; we can do any cleanup of appliation
|
||||
// state at this point.
|
||||
xpc_release(serviceConnection);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Need to resume the service in order for it to process messages.
|
||||
xpc_connection_resume(serviceConnection);
|
||||
return (serviceConnection);
|
||||
}
|
||||
|
||||
+ (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL allowsAuthorization:(BOOL)flag error:(NSError *__autoreleasing *)outError
|
||||
{
|
||||
xpc_connection_t connection = [self getSandboxXPCService];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskAuthReleaseFromQuarantine);
|
||||
|
||||
if (rootURL)
|
||||
xpc_dictionary_set_string(message, SUInstallServiceSourcePathKey, rootURL.path.fileSystemRepresentation);
|
||||
xpc_dictionary_set_bool(message, SUInslallServiceAllowsAuthKey, flag ? true : false);
|
||||
|
||||
__block BOOL xpcDidReply = NO;
|
||||
__block NSError *error = nil;
|
||||
|
||||
dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||
xpc_connection_send_message_with_reply(connection, message, queue, ^(xpc_object_t response) {
|
||||
if (XPC_TYPE_ERROR == xpc_get_type(response))
|
||||
{
|
||||
NSDictionary *errorInfo = @{NSLocalizedDescriptionKey : @"Internal XPC error."};
|
||||
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
}
|
||||
else if (XPC_TYPE_DICTIONARY == xpc_get_type(response))
|
||||
{
|
||||
const char *errorString = xpc_dictionary_get_string(response, SUInstallServiceErrorLocalizedDescriptionKey);
|
||||
if (errorString != NULL)
|
||||
{
|
||||
NSString *errorStr = [NSString stringWithCString:errorString encoding:NSUTF8StringEncoding];
|
||||
NSDictionary *errorInfo = @{NSLocalizedDescriptionKey : errorStr ? errorStr : @""};
|
||||
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
}
|
||||
}
|
||||
|
||||
xpcDidReply = YES;
|
||||
});
|
||||
|
||||
while (NO == xpcDidReply)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
|
||||
}
|
||||
|
||||
xpc_release(message);
|
||||
dispatch_release(queue);
|
||||
|
||||
if (nil != error && NULL != outError)
|
||||
{
|
||||
*outError = error;
|
||||
}
|
||||
|
||||
return (nil == error);
|
||||
}
|
||||
|
||||
+ (BOOL)copyPathContent:(NSString *)src toDirectory:(NSString *)dstDir error:(NSError * __autoreleasing*)outError
|
||||
{
|
||||
xpc_connection_t connection = [self getSandboxXPCService];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskCopyPath);
|
||||
|
||||
if (src)
|
||||
xpc_dictionary_set_string(message, SUInstallServiceSourcePathKey, [src fileSystemRepresentation]);
|
||||
if (dstDir)
|
||||
xpc_dictionary_set_string(message, SUInstallServiceDestinationPathKey, [dstDir fileSystemRepresentation]);
|
||||
|
||||
__block BOOL xpcDidReply = NO;
|
||||
__block NSError *error = nil;
|
||||
|
||||
dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||
xpc_connection_send_message_with_reply(connection, message, queue, ^(xpc_object_t response) {
|
||||
if (XPC_TYPE_ERROR == xpc_get_type(response))
|
||||
{
|
||||
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Internal XPC error."
|
||||
forKey:NSLocalizedDescriptionKey];
|
||||
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
}
|
||||
else if (XPC_TYPE_DICTIONARY == xpc_get_type(response))
|
||||
{
|
||||
const char *errorString = xpc_dictionary_get_string(response, SUInstallServiceErrorLocalizedDescriptionKey);
|
||||
if (errorString != NULL)
|
||||
{
|
||||
NSString *errorStr = [NSString stringWithCString:errorString encoding:NSUTF8StringEncoding];
|
||||
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:errorStr ? errorStr : @""
|
||||
forKey:NSLocalizedDescriptionKey];
|
||||
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
}
|
||||
}
|
||||
|
||||
xpcDidReply = YES;
|
||||
});
|
||||
|
||||
while (NO == xpcDidReply)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
|
||||
}
|
||||
|
||||
xpc_release(message);
|
||||
dispatch_release(queue);
|
||||
|
||||
if (nil != error && NULL != outError)
|
||||
{
|
||||
*outError = error;
|
||||
}
|
||||
|
||||
return (nil == error);
|
||||
}
|
||||
|
||||
+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments
|
||||
{
|
||||
[self launchTaskWithPath:path
|
||||
arguments:arguments
|
||||
environment:nil
|
||||
currentDirectoryPath:nil
|
||||
inputData:nil
|
||||
waitUntilDone:NO
|
||||
completionHandler:nil];
|
||||
}
|
||||
|
||||
+ (void)launchTaskWithPath:(NSString *)launchPath
|
||||
arguments:(NSArray *)arguments
|
||||
environment:(NSDictionary *)environment
|
||||
currentDirectoryPath:(NSString *)currentDirPath
|
||||
inputData:(NSData *)inputData
|
||||
waitUntilDone:(BOOL)waitUntilDone
|
||||
completionHandler:(void (^)(int result, NSData *outputData))completionHandler
|
||||
{
|
||||
xpc_connection_t connection = [self getSandboxXPCService];
|
||||
|
||||
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
|
||||
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskLaunchTask);
|
||||
|
||||
if ([launchPath length])
|
||||
{
|
||||
xpc_dictionary_set_string(message, SUInstallServiceLaunchTaksPathKey, [launchPath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
if ([arguments count])
|
||||
{
|
||||
xpc_object_t array = xpc_array_create(NULL, 0);
|
||||
for (id argument in arguments)
|
||||
{
|
||||
NSString *strArgument = argument;
|
||||
if (![strArgument isKindOfClass:[NSString class]])
|
||||
strArgument = [argument description];
|
||||
|
||||
xpc_array_set_string(array, XPC_ARRAY_APPEND, [strArgument UTF8String]);
|
||||
}
|
||||
xpc_dictionary_set_value(message, SUInstallServiceLaunchTaskArgumentsKey, array);
|
||||
xpc_release(array);
|
||||
}
|
||||
|
||||
if ([environment count])
|
||||
{
|
||||
__block xpc_object_t dict = xpc_dictionary_create(NULL, NULL, 0);
|
||||
[environment enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL __unused *stop) {
|
||||
NSString *xpc_key = [key isKindOfClass:[NSString class]] ? key : [key description];
|
||||
NSString *xpc_value = [obj isKindOfClass:[NSString class]] ? obj : [obj description];
|
||||
|
||||
xpc_dictionary_set_string(dict, [xpc_key UTF8String], [xpc_value UTF8String]);
|
||||
}];
|
||||
|
||||
xpc_dictionary_set_value(message, SUInstallServiceLaunchTaskEnvironmentKey, dict);
|
||||
xpc_release(dict);
|
||||
}
|
||||
|
||||
if ([currentDirPath length])
|
||||
{
|
||||
xpc_dictionary_set_string(message, SUInstallServiceLaunchTaskCurrentDirKey, [currentDirPath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
if ([inputData length])
|
||||
{
|
||||
xpc_dictionary_set_data(message, SUInstallServiceLaunchTaskInputDataKey, [inputData bytes], [inputData length]);
|
||||
}
|
||||
|
||||
BOOL replyImmediately = (waitUntilDone || completionHandler != nil) ? NO : YES;
|
||||
xpc_dictionary_set_bool(message, SUInstallServiceLaunchTaskReplyImmediatelyKey, replyImmediately);
|
||||
|
||||
__block BOOL xpcTaskDidReply = NO;
|
||||
xpc_connection_send_message_with_reply(connection, message, dispatch_get_current_queue(), ^(xpc_object_t response) {
|
||||
int taskResult = 0;
|
||||
NSData *outputData = nil;
|
||||
|
||||
if (completionHandler != NULL)
|
||||
{
|
||||
xpc_type_t type = xpc_get_type(response);
|
||||
if (type == XPC_TYPE_ERROR)
|
||||
{
|
||||
taskResult = SUXPCServiceError;
|
||||
}
|
||||
else if (type == XPC_TYPE_DICTIONARY)
|
||||
{
|
||||
taskResult = (int)xpc_dictionary_get_int64(response, SUInstallServiceErrorCodeKey);
|
||||
|
||||
size_t bytesLen = 0;
|
||||
const void *bytes = xpc_dictionary_get_data(response, SUInstallServiceLaunchTaskOutputDataKey, &bytesLen);
|
||||
if (NULL != bytes)
|
||||
{
|
||||
outputData = [NSData dataWithBytes:bytes length:bytesLen];
|
||||
}
|
||||
}
|
||||
|
||||
completionHandler(taskResult, outputData);
|
||||
}
|
||||
|
||||
xpcTaskDidReply = YES;
|
||||
});
|
||||
xpc_release(message);
|
||||
|
||||
if (replyImmediately || waitUntilDone)
|
||||
{
|
||||
while (NO == xpcTaskDidReply)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>XPCService</key>
|
||||
<dict>
|
||||
<key>ServiceType</key>
|
||||
<string>Application</string>
|
||||
<key>JoinExistingSession</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+374
@@ -0,0 +1,374 @@
|
||||
//
|
||||
// main.m
|
||||
// Update
|
||||
//
|
||||
// Created by Whitney Young on 3/19/12.
|
||||
// Copyright (c) 2012 FadingRed. All rights reserved.
|
||||
//
|
||||
|
||||
#include <xpc/xpc.h>
|
||||
#include <asl.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUFileManager.h"
|
||||
#import "SUInstallServiceConstants.h"
|
||||
|
||||
static xpc_object_t SUSICopyPathContent(xpc_object_t message)
|
||||
{
|
||||
if (NULL == message)
|
||||
return NULL;
|
||||
|
||||
const char *src = xpc_dictionary_get_string(message, SUInstallServiceSourcePathKey);
|
||||
const char *dst = xpc_dictionary_get_string(message, SUInstallServiceDestinationPathKey);
|
||||
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSString *sourcePath = src ? [manager stringWithFileSystemRepresentation:src length:strlen(src)] : nil;
|
||||
NSString *targetPath = dst ? [manager stringWithFileSystemRepresentation:dst length:strlen(dst)] : nil;
|
||||
|
||||
NSError *error = nil;
|
||||
do
|
||||
{
|
||||
if (nil == sourcePath)
|
||||
{
|
||||
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Source path is absent." forKey:NSLocalizedDescriptionKey];
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
break;
|
||||
}
|
||||
|
||||
if (nil == targetPath)
|
||||
{
|
||||
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Destination path is absent." forKey:NSLocalizedDescriptionKey];
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
break;
|
||||
}
|
||||
|
||||
NSArray *contents = nil;
|
||||
|
||||
BOOL isSrcDirectory = NO;
|
||||
BOOL isSrcExist = [manager fileExistsAtPath:sourcePath isDirectory:&isSrcDirectory];
|
||||
isSrcDirectory = isSrcDirectory && ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:sourcePath];
|
||||
if (isSrcExist && isSrcDirectory)
|
||||
{
|
||||
contents = [manager contentsOfDirectoryAtPath:sourcePath error:&error];
|
||||
}
|
||||
else if (isSrcExist)
|
||||
{
|
||||
contents = [NSArray arrayWithObject:@""];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Source does not exist on disk." forKey:NSLocalizedDescriptionKey];
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
|
||||
}
|
||||
|
||||
if (nil != error)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
BOOL isDstDirectory = NO;
|
||||
BOOL isDstExist = [manager fileExistsAtPath:targetPath isDirectory:&isDstDirectory];
|
||||
if (isSrcDirectory && (!isDstExist || !isDstDirectory))
|
||||
{
|
||||
if (isDstExist)
|
||||
[manager removeItemAtPath:targetPath error:&error];
|
||||
[manager createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
}
|
||||
else if (!isSrcDirectory)
|
||||
{
|
||||
if (isDstExist && !isDstDirectory)
|
||||
[manager removeItemAtPath:targetPath error:&error];
|
||||
[manager createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
}
|
||||
|
||||
if (nil != error)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
NSString *fromPath = [item length] ? [sourcePath stringByAppendingPathComponent:item] : sourcePath;
|
||||
NSString *toPath = [item length] ? [targetPath stringByAppendingPathComponent:item] : [targetPath stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
|
||||
if (![manager isReadableFileAtPath:fromPath])
|
||||
{
|
||||
SULog(@"XPC Install Service: will skip \"%@\"", fromPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
SULog(@"XPC Install Service: will copy \"%@\" to \"%@\"", fromPath, toPath);
|
||||
|
||||
if ([manager fileExistsAtPath:toPath])
|
||||
[manager removeItemAtPath:toPath error:&error];
|
||||
|
||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (NO);
|
||||
|
||||
xpc_object_t reply = xpc_dictionary_create_reply(message);
|
||||
if (nil != error)
|
||||
{
|
||||
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)[error code]);
|
||||
const char *errorMsg = [[error localizedDescription] length] ? [[error localizedDescription] UTF8String] : "";
|
||||
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, errorMsg);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static xpc_object_t SUISReleaseFromQuarantineWithAuthentication(xpc_object_t message)
|
||||
{
|
||||
if (NULL == message)
|
||||
return NULL;
|
||||
|
||||
const char *src = xpc_dictionary_get_string(message, SUInstallServiceSourcePathKey);
|
||||
bool allowsAuth = xpc_dictionary_get_bool(message, SUInslallServiceAllowsAuthKey);
|
||||
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSString *sourcePath = src ? [manager stringWithFileSystemRepresentation:src length:strlen(src)] : nil;
|
||||
NSURL *sourceURL = sourcePath ? [NSURL fileURLWithPath:sourcePath] : nil;
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:allowsAuth];
|
||||
NSError *error = nil;
|
||||
BOOL result = [fileManager releaseItemFromQuarantineAtRootURL:sourceURL error:&error];
|
||||
|
||||
// send response to indicate ok
|
||||
xpc_object_t reply = xpc_dictionary_create_reply(message);
|
||||
if (!result && error != nil)
|
||||
{
|
||||
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)[error code]);
|
||||
const char *errorMsg = [[error localizedDescription] length] ? [[error localizedDescription] UTF8String] : "";
|
||||
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, errorMsg);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static xpc_object_t SUISLaunchTask(xpc_object_t message)
|
||||
{
|
||||
if (NULL == message)
|
||||
return NULL;
|
||||
|
||||
const char *path = xpc_dictionary_get_string(message, SUInstallServiceLaunchTaksPathKey);
|
||||
NSString *launchPath = path ? [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)] : nil;
|
||||
|
||||
xpc_object_t array = xpc_dictionary_get_value(message, SUInstallServiceLaunchTaskArgumentsKey);
|
||||
NSArray *arguments = nil;
|
||||
if (NULL != array)
|
||||
{
|
||||
size_t count = xpc_array_get_count(array);
|
||||
NSMutableArray *mutableArgs = [NSMutableArray arrayWithCapacity:count];
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
NSString *argument = [NSString stringWithUTF8String:xpc_array_get_string(array, i)];
|
||||
[mutableArgs addObject: argument ? argument : @""];
|
||||
}
|
||||
|
||||
arguments = mutableArgs;
|
||||
}
|
||||
|
||||
xpc_object_t dict = xpc_dictionary_get_value(message, SUInstallServiceLaunchTaskEnvironmentKey);
|
||||
NSDictionary *environment = nil;
|
||||
if (NULL != dict)
|
||||
{
|
||||
size_t count = xpc_dictionary_get_count(dict);
|
||||
__block NSMutableDictionary *mutableEnv = [NSMutableDictionary dictionaryWithCapacity:count];
|
||||
|
||||
xpc_dictionary_apply(dict, ^bool(const char *key, xpc_object_t value) {
|
||||
NSString *envKey = [NSString stringWithUTF8String:key];
|
||||
NSString *envValue = [NSString stringWithUTF8String:value];
|
||||
[mutableEnv setObject:envValue forKey:envKey];
|
||||
return true;
|
||||
});
|
||||
|
||||
environment = mutableEnv;
|
||||
}
|
||||
|
||||
path = xpc_dictionary_get_string(message, SUInstallServiceLaunchTaskCurrentDirKey);
|
||||
NSString *currentDirPath = path ? [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)] : nil;
|
||||
|
||||
size_t bytesLen = 0;
|
||||
const void *bytes = xpc_dictionary_get_data(message, SUInstallServiceLaunchTaskInputDataKey, &bytesLen);
|
||||
NSData *inputData = bytes ? [NSData dataWithBytes:bytes length:bytesLen] : nil;
|
||||
|
||||
bool shouldReplyImmediatly = xpc_dictionary_get_bool(message, SUInstallServiceLaunchTaskReplyImmediatelyKey);
|
||||
|
||||
// prepare NSTask
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
NSPipe *inputPipe = [NSPipe pipe];
|
||||
NSPipe *outputPipe = [NSPipe pipe];
|
||||
|
||||
[task setStandardInput:inputPipe];
|
||||
[task setStandardOutput:outputPipe];
|
||||
[task setStandardError:outputPipe];
|
||||
|
||||
if (launchPath != nil)
|
||||
[task setLaunchPath:launchPath];
|
||||
if ([arguments count])
|
||||
[task setArguments:arguments];
|
||||
if ([environment count])
|
||||
[task setEnvironment:environment];
|
||||
if (currentDirPath != nil)
|
||||
[task setCurrentDirectoryPath:currentDirPath];
|
||||
|
||||
__block NSData *outputData = nil;
|
||||
__block int taskResult = 0;
|
||||
__block BOOL isTaskRunning = YES;
|
||||
|
||||
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
||||
NSArray *notificationObjects = nil;
|
||||
|
||||
if (!shouldReplyImmediatly)
|
||||
{
|
||||
id object1 = [notificationCenter addObserverForName:NSFileHandleReadToEndOfFileCompletionNotification
|
||||
object:[outputPipe fileHandleForReading]
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification *note) {
|
||||
outputData = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem];
|
||||
isTaskRunning = NO;
|
||||
}];
|
||||
|
||||
id object2 = [notificationCenter addObserverForName:NSTaskDidTerminateNotification
|
||||
object:task
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification __unused *note) {
|
||||
taskResult = [task terminationStatus];
|
||||
}];
|
||||
|
||||
notificationObjects = [NSArray arrayWithObjects:object1, object2, nil];
|
||||
}
|
||||
|
||||
[[outputPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
||||
|
||||
@try
|
||||
{
|
||||
[task launch];
|
||||
|
||||
if ([inputData length])
|
||||
{
|
||||
[[inputPipe fileHandleForWriting] writeData:inputData];
|
||||
[[inputPipe fileHandleForWriting] closeFile];
|
||||
}
|
||||
|
||||
if (!shouldReplyImmediatly)
|
||||
{
|
||||
// loop until we are done receiving the data
|
||||
while (YES == isTaskRunning)
|
||||
{
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@catch (...)
|
||||
{
|
||||
taskResult = SUXPCServiceError;
|
||||
}
|
||||
|
||||
// send response to indicate ok
|
||||
xpc_object_t reply = xpc_dictionary_create_reply(message);
|
||||
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)taskResult);
|
||||
if (outputData != nil)
|
||||
{
|
||||
xpc_dictionary_set_data(reply, SUInstallServiceLaunchTaskOutputDataKey, [outputData bytes], [outputData length]);
|
||||
}
|
||||
|
||||
for (id object in notificationObjects)
|
||||
{
|
||||
[notificationCenter removeObserver:object];
|
||||
}
|
||||
outputData = nil;
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static void peer_event_handler(xpc_connection_t peer, xpc_object_t event)
|
||||
{
|
||||
xpc_type_t type = xpc_get_type(event);
|
||||
if (type == XPC_TYPE_ERROR)
|
||||
{
|
||||
if (event == XPC_ERROR_CONNECTION_INVALID)
|
||||
{
|
||||
// The client process on the other end of the connection has either
|
||||
// crashed or cancelled the connection. After receiving this error,
|
||||
// the connection is in an invalid state, and you do not need to
|
||||
// call xpc_connection_cancel(). Just tear down any associated state
|
||||
// here.
|
||||
}
|
||||
else if (event == XPC_ERROR_TERMINATION_IMMINENT)
|
||||
{
|
||||
// Handle per-connection termination cleanup.
|
||||
}
|
||||
}
|
||||
else if (type == XPC_TYPE_DICTIONARY)
|
||||
{
|
||||
// Handle the message.
|
||||
int64_t task = xpc_dictionary_get_int64(event, SUInstallServiceTaskTypeKey);
|
||||
NSLog(@"XPC Installer: will do the task %lld", (int64_t)task);
|
||||
|
||||
xpc_object_t reply = NULL;
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
switch (task)
|
||||
{
|
||||
case SUInstallServiceTaskCopyPath:
|
||||
{
|
||||
reply = SUSICopyPathContent(event);
|
||||
break;
|
||||
}
|
||||
|
||||
case SUInstallServiceTaskAuthReleaseFromQuarantine:
|
||||
{
|
||||
reply = SUISReleaseFromQuarantineWithAuthentication(event);
|
||||
break;
|
||||
}
|
||||
|
||||
case SUInstallServiceTaskLaunchTask:
|
||||
{
|
||||
reply = SUISLaunchTask(event);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
SULog(@"XPC Install Service: Unknown XPC service task %lld", task);
|
||||
|
||||
reply = xpc_dictionary_create_reply(event);
|
||||
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)SUXPCServiceError);
|
||||
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, "Unknown install cervice task.");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == reply)
|
||||
{
|
||||
reply = xpc_dictionary_create_reply(event);
|
||||
}
|
||||
|
||||
xpc_connection_send_message(peer, reply);
|
||||
xpc_release(reply);
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler(xpc_connection_t peer)
|
||||
{
|
||||
// By defaults, new connections will target the default dispatch
|
||||
// concurrent queue.
|
||||
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
|
||||
peer_event_handler(peer, event);
|
||||
});
|
||||
|
||||
// This will tell the connection to begin listening for events. If you
|
||||
// have some other initialization that must be done asynchronously, then
|
||||
// you can defer this call until after that initialization is done.
|
||||
xpc_connection_resume(peer);
|
||||
}
|
||||
|
||||
int main(int __unused argc, const char __unused *argv[])
|
||||
{
|
||||
xpc_main(event_handler);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// install_service.pch
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 4/25/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Sparkle.pch"
|
||||
#import "SULog.h"
|
||||
Vendored
+34
-4
@@ -39,6 +39,11 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
@synthesize alert;
|
||||
@synthesize showUpdateAlertTimer;
|
||||
|
||||
- (BOOL)shouldShowUI
|
||||
{
|
||||
return self.showErrors;
|
||||
}
|
||||
|
||||
- (void)showUpdateAlert
|
||||
{
|
||||
self.interruptible = NO;
|
||||
@@ -60,6 +65,31 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)downloadReleaseNotesAndWaitUntilDone
|
||||
{
|
||||
NSURL *releaseNotesURL = self.updateItem.releaseNotesURL;
|
||||
if (nil == releaseNotesURL || [releaseNotesURL isFileURL])
|
||||
return;
|
||||
|
||||
static NSString * const kSUAutomaticUpdateParamName = @"autoupdate";
|
||||
|
||||
NSString *URLString = releaseNotesURL.absoluteString;
|
||||
URLString = [URLString stringByAppendingFormat:@"%@%@=1", (releaseNotesURL.query != nil) ? @"&" : @"?", kSUAutomaticUpdateParamName];
|
||||
releaseNotesURL = [NSURL URLWithString:URLString];
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:releaseNotesURL];
|
||||
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
|
||||
[self updateURLRequestHTTPHeaders:request];
|
||||
[NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:NULL];
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
// For correct DevMate statistics need to send request for Release Notes.
|
||||
[self downloadReleaseNotesAndWaitUntilDone];
|
||||
[super didFindValidUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)__unused ua
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
@@ -129,11 +159,11 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
[self invalidateShowUpdateAlertTimer];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason
|
||||
{
|
||||
[self stopUpdatingOnTermination];
|
||||
[self invalidateShowUpdateAlertTimer];
|
||||
[super abortUpdate];
|
||||
[super abortUpdate:reason];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)__unused aNotification
|
||||
@@ -161,7 +191,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
case SUDoNotInstallChoice:
|
||||
[self.host setObject:[self.updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +230,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
[updaterDelegate updater:self.updater didAbortWithError:error];
|
||||
}
|
||||
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortGotError];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -31,6 +31,7 @@
|
||||
- (void)didFindValidUpdate;
|
||||
- (void)didNotFindUpdate;
|
||||
|
||||
- (void)updateURLRequestHTTPHeaders:(NSMutableURLRequest *)request;
|
||||
- (void)downloadUpdate;
|
||||
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name;
|
||||
- (void)downloadDidFinish:(NSURLDownload *)d;
|
||||
@@ -47,7 +48,7 @@
|
||||
|
||||
- (void)cleanUpDownload;
|
||||
|
||||
- (void)abortUpdate;
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason;
|
||||
- (void)abortUpdateWithError:(NSError *)error;
|
||||
- (void)terminateApp;
|
||||
|
||||
|
||||
Vendored
+115
-69
@@ -20,6 +20,9 @@
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SUUpdater_Private.h"
|
||||
#import "SUFileManager.h"
|
||||
#import "SUXPCInstaller.h"
|
||||
|
||||
CF_EXPORT CFDictionaryRef DMCopyHTTPRequestHeaders(CFBundleRef appBundle, CFDataRef httpBodyData);
|
||||
|
||||
@interface SUBasicUpdateDriver ()
|
||||
|
||||
@@ -52,10 +55,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
|
||||
request.allHTTPHeaderFields = [self.updater httpHeaders];
|
||||
[self updateURLRequestHTTPHeaders:request];
|
||||
|
||||
SUAppcast *appcast = [[SUAppcast alloc] init];
|
||||
|
||||
[appcast setUserAgentString:[self.updater userAgentString]];
|
||||
[appcast setHttpHeaders:[self.updater httpHeaders]];
|
||||
[appcast setHttpHeaders:request.allHTTPHeaderFields];
|
||||
[appcast fetchAppcastFromURL:URL completionBlock:^(NSError *error) {
|
||||
if (error) {
|
||||
[self abortUpdateWithError:error];
|
||||
@@ -194,10 +201,27 @@
|
||||
}]];
|
||||
}
|
||||
|
||||
- (void)updateURLRequestHTTPHeaders:(NSMutableURLRequest *)request
|
||||
{
|
||||
NSURL *hostBundleURL = self.host.bundlePath.length ? [NSURL fileURLWithPath:self.host.bundlePath] : nil;
|
||||
CFBundleRef hostBundle = hostBundleURL ? CFBundleCreate(kCFAllocatorDefault, (__bridge CFURLRef)hostBundleURL) : NULL;
|
||||
NSDictionary *devmateHeaders = (__bridge_transfer NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL);
|
||||
if (devmateHeaders.count)
|
||||
{
|
||||
[request setAllHTTPHeaderFields:devmateHeaders];
|
||||
}
|
||||
|
||||
if (NULL != hostBundle)
|
||||
{
|
||||
CFRelease(hostBundle);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)downloadUpdate
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self.updateItem fileURL]];
|
||||
[request setValue:[self.updater userAgentString] forHTTPHeaderField:@"User-Agent"];
|
||||
[self updateURLRequestHTTPHeaders:request];
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updater:willDownloadUpdate:withRequest:)]) {
|
||||
[[self.updater delegate] updater:self.updater
|
||||
willDownloadUpdate:self.updateItem
|
||||
@@ -243,73 +267,81 @@
|
||||
*/
|
||||
- (BOOL)validateUpdateDownloadedToPath:(NSString *)downloadedPath extractedToPath:(NSString *)extractedPath DSASignature:(NSString *)DSASignature publicDSAKey:(NSString *)publicDSAKey
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
NSString *installSourcePath = [SUInstaller installSourcePathInUpdateFolder:extractedPath forHost:self.host isPackage:&isPackage isGuided:NULL];
|
||||
if (installSourcePath == nil) {
|
||||
SULog(@"No suitable install is found in the update. The update will be rejected.");
|
||||
return NO;
|
||||
}
|
||||
BOOL isUpdateValid = NO;
|
||||
|
||||
// Modern packages are not distributed as bundles and are code signed differently than regular applications
|
||||
if (isPackage) {
|
||||
if (nil == publicDSAKey) {
|
||||
SULog(@"The existing app bundle does not have a DSA key, so it can't verify installer packages.");
|
||||
do
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
NSString *installSourcePath = [SUInstaller installSourcePathInUpdateFolder:extractedPath forHost:self.host isPackage:&isPackage isGuided:NULL];
|
||||
if (installSourcePath == nil)
|
||||
{
|
||||
SULog(@"No suitable install is found in the update. The update will be rejected.");
|
||||
break;
|
||||
}
|
||||
|
||||
// Modern packages are not distributed as bundles and are code signed differently than regular applications
|
||||
if (isPackage)
|
||||
{
|
||||
if (nil == publicDSAKey)
|
||||
{
|
||||
SULog(@"The existing app bundle does not have a DSA key, so it can't verify installer packages.");
|
||||
}
|
||||
|
||||
BOOL packageValidated = [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
|
||||
|
||||
if (!packageValidated) {
|
||||
SULog(@"DSA signature validation of the package failed. The update contains an installer package, and valid DSA signatures are mandatory for all installer packages. The update will be rejected. Sign the installer with a valid DSA key or use an .app bundle update instead.");
|
||||
isUpdateValid = [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
|
||||
if (!isUpdateValid)
|
||||
{
|
||||
SULog(@"DSA signature validation of the package failed. The update contains an installer package, and valid DSA signatures are mandatory for all installer packages. The update will be rejected. Sign the installer with a valid DSA key or use an .app bundle update instead.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
NSBundle *newBundle = [NSBundle bundleWithPath:installSourcePath];
|
||||
if (newBundle == nil)
|
||||
{
|
||||
SULog(@"No suitable bundle is found in the update. The update will be rejected.");
|
||||
break;
|
||||
}
|
||||
|
||||
// Check Code Signing equality
|
||||
NSError *error = nil;
|
||||
BOOL updateIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath];
|
||||
updateIsCodeSigned = updateIsCodeSigned && [SUCodeSigningVerifier codeSignatureIsValidAtPath:installSourcePath error:&error];
|
||||
if (!updateIsCodeSigned)
|
||||
{
|
||||
SULog(@"Update has no valid Code Signing (%ld - %@)", error.code, error.localizedDescription);
|
||||
}
|
||||
|
||||
return packageValidated;
|
||||
}
|
||||
|
||||
NSBundle *newBundle = [NSBundle bundleWithPath:installSourcePath];
|
||||
if (newBundle == nil) {
|
||||
SULog(@"No suitable bundle is found in the update. The update will be rejected.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
|
||||
NSString *newPublicDSAKey = newHost.publicDSAKey;
|
||||
|
||||
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
|
||||
|
||||
if (newPublicDSAKey != nil) {
|
||||
if (![SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:newPublicDSAKey]) {
|
||||
SULog(@"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.",
|
||||
dsaKeysMatch ? @"public key" : @"new public key shipped with the update");
|
||||
return NO;
|
||||
BOOL shouldCheckCodeSignEquality = updateIsCodeSigned ? [SUCodeSigningVerifier applicationAtPathIsCodeSigned:self.host.bundlePath] : NO;
|
||||
if (shouldCheckCodeSignEquality && [SUCodeSigningVerifier codeSignatureAtPath:self.host.bundlePath matchesSignatureAtPath:installSourcePath error:&error])
|
||||
{
|
||||
isUpdateValid = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL updateIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath];
|
||||
|
||||
if (dsaKeysMatch) {
|
||||
NSError *error = nil;
|
||||
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtPath:installSourcePath error:&error]) {
|
||||
SULog(@"The update archive has a valid DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
|
||||
return NO;
|
||||
else
|
||||
{
|
||||
SULog(@"Code signatures differs in application and update (%ld - %@)", error.code, error.localizedDescription);
|
||||
}
|
||||
} else {
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned];
|
||||
|
||||
NSString *dsaStatus = newPublicDSAKey ? @"has a new DSA key that doesn't match the previous one" : (publicDSAKey ? @"removes the DSA key" : @"isn't signed with a DSA key");
|
||||
if (!hostIsCodeSigned || !updateIsCodeSigned) {
|
||||
NSString *acsStatus = !hostIsCodeSigned ? @"old app hasn't been signed with app Code Signing" : @"new app isn't signed with app Code Signing";
|
||||
SULog(@"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
|
||||
return NO;
|
||||
|
||||
// Check DSA signature
|
||||
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
|
||||
NSString *newPublicDSAKey = newHost.publicDSAKey;
|
||||
|
||||
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
|
||||
if (!dsaKeysMatch)
|
||||
{
|
||||
SULog(@"DSA keys are different for update and application.");
|
||||
}
|
||||
|
||||
NSError *error = nil;
|
||||
if (![SUCodeSigningVerifier codeSignatureMatchesHostAndIsValidAtPath:installSourcePath error:&error]) {
|
||||
SULog(@"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
|
||||
return NO;
|
||||
isUpdateValid = dsaKeysMatch && [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:newPublicDSAKey];
|
||||
if (!isUpdateValid)
|
||||
{
|
||||
SULog(@"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.", dsaKeysMatch ? @"public key" : @"new public key shipped with the update");
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
while (NO);
|
||||
|
||||
return isUpdateValid;
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)__unused d
|
||||
@@ -431,7 +463,7 @@
|
||||
|
||||
if (![self.updater mayUpdateAndRestart])
|
||||
{
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortForbiddenByDelegate];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -469,14 +501,20 @@
|
||||
|
||||
NSURL *relaunchURLToCopy = [NSURL fileURLWithPath:relaunchPathToCopy];
|
||||
NSURL *targetURL = [NSURL fileURLWithPath:targetPath];
|
||||
|
||||
|
||||
// We only need to run our copy of the app by spawning a task
|
||||
// Since we are copying the app to a directory that is write-accessible, we don't need to muck with owner/group IDs
|
||||
if ([self preparePathForRelaunchTool:targetPath error:&error] && [fileManager copyItemAtURL:relaunchURLToCopy toURL:targetURL error:&error]) {
|
||||
// We probably don't need to release the quarantine, but we'll do it just in case it's necessary.
|
||||
// Perhaps in a sandboxed environment this matters more. Note that this may not be a fatal error.
|
||||
NSError *quarantineError = nil;
|
||||
if (![fileManager releaseItemFromQuarantineAtRootURL:targetURL error:&quarantineError]) {
|
||||
if (SUShouldUseXPCInstaller()) {
|
||||
[SUXPCInstaller releaseItemFromQuarantineAtRootURL:targetURL allowsAuthorization:fileManager.allowsAuthorization error:&quarantineError];
|
||||
} else {
|
||||
[fileManager releaseItemFromQuarantineAtRootURL:targetURL error:&quarantineError];
|
||||
}
|
||||
|
||||
if (quarantineError != nil) {
|
||||
SULog(@"Failed to release quarantine on %@ with error %@", targetPath, quarantineError);
|
||||
}
|
||||
self.relaunchPath = targetPath;
|
||||
@@ -507,12 +545,20 @@
|
||||
if ([updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
pathToRelaunch = [updaterDelegate pathToRelaunchForUpdater:self.updater];
|
||||
}
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
|
||||
pathToRelaunch,
|
||||
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
self.tempDir,
|
||||
relaunch ? @"1" : @"0",
|
||||
showUI ? @"1" : @"0"]];
|
||||
NSArray *arguments = @[self.host.bundlePath.length ? self.host.bundlePath: @"",
|
||||
pathToRelaunch.length ? pathToRelaunch : @"",
|
||||
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
self.tempDir.length ? self.tempDir : @"",
|
||||
relaunch ? @"1" : @"0",
|
||||
showUI ? @"1" : @"0"];
|
||||
if (SUShouldUseXPCInstaller())
|
||||
{
|
||||
[SUXPCInstaller launchTaskWithPath:relaunchToolPath arguments:arguments environment:nil currentDirectoryPath:nil inputData:nil waitUntilDone:NO completionHandler:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:arguments];
|
||||
}
|
||||
[self terminateApp];
|
||||
}
|
||||
|
||||
@@ -547,12 +593,12 @@
|
||||
}]];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason
|
||||
{
|
||||
[self cleanUpDownload];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
self.updateItem = nil;
|
||||
[super abortUpdate];
|
||||
[super abortUpdate:reason];
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
@@ -570,7 +616,7 @@
|
||||
[updaterDelegate updater:self.updater didAbortWithError:error];
|
||||
}
|
||||
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortGotError];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+3
-2
@@ -12,10 +12,11 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SUCodeSigningVerifier : NSObject
|
||||
+ (BOOL)codeSignatureMatchesHostAndIsValidAtPath:(NSString *)applicationPath error:(NSError **)error;
|
||||
// pass nil as an application path to check a host one
|
||||
+ (BOOL)codeSignatureAtPath:(NSString *)hostPath matchesSignatureAtPath:(NSString *)otherAppPath error:(NSError **)error;
|
||||
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)applicationPath error:(NSError **)error;
|
||||
+ (BOOL)hostApplicationIsCodeSigned;
|
||||
+ (BOOL)applicationAtPathIsCodeSigned:(NSString *)applicationPath;
|
||||
+ (BOOL)hostApplicationIsSandboxed;
|
||||
@end
|
||||
|
||||
#endif
|
||||
Vendored
+104
-39
@@ -13,51 +13,92 @@
|
||||
|
||||
@implementation SUCodeSigningVerifier
|
||||
|
||||
+ (BOOL)codeSignatureMatchesHostAndIsValidAtPath:(NSString *)applicationPath error:(NSError *__autoreleasing *)error
|
||||
+ (BOOL)codeSignatureAtPath:(NSString *)hostPath matchesSignatureAtPath:(NSString *)otherAppPath error:(NSError *__autoreleasing *)error
|
||||
{
|
||||
OSStatus result;
|
||||
SecRequirementRef requirement = NULL;
|
||||
SecStaticCodeRef staticCode = NULL;
|
||||
SecCodeRef hostCode = NULL;
|
||||
NSBundle *newBundle;
|
||||
CFErrorRef cfError = NULL;
|
||||
SecStaticCodeRef staticHostCode = NULL;
|
||||
SecStaticCodeRef staticAppCode = NULL;
|
||||
|
||||
if (error) {
|
||||
*error = nil;
|
||||
}
|
||||
|
||||
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy host code %d", result);
|
||||
goto finally;
|
||||
if (0 == hostPath.length) {
|
||||
SecCodeRef hostCode = NULL;
|
||||
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy host code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecCodeCopyStaticCode(hostCode, kSecCSDefaultFlags, &staticHostCode);
|
||||
CFRelease(hostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy host code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
} else {
|
||||
NSBundle *hostAppBundle = [NSBundle bundleWithPath:hostPath];
|
||||
if (nil == hostAppBundle) {
|
||||
SULog(@"Failed to create bundle at path %@", hostPath);
|
||||
result = -1;
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)hostAppBundle.bundleURL, kSecCSDefaultFlags, &staticHostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy host code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
}
|
||||
|
||||
result = SecCodeCopyDesignatedRequirement(hostCode, kSecCSDefaultFlags, &requirement);
|
||||
|
||||
result = SecCodeCopyDesignatedRequirement(staticHostCode, kSecCSDefaultFlags, &requirement);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy designated requirement. Code Signing OSStatus code: %d", result);
|
||||
goto finally;
|
||||
}
|
||||
|
||||
newBundle = [NSBundle bundleWithPath:applicationPath];
|
||||
if (!newBundle) {
|
||||
SULog(@"Failed to load NSBundle for update");
|
||||
result = -1;
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)[newBundle bundleURL], kSecCSDefaultFlags, &staticCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to get static code %d", result);
|
||||
goto finally;
|
||||
if (0 == otherAppPath.length) {
|
||||
SecCodeRef hostCode = NULL;
|
||||
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy other app code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecCodeCopyStaticCode(hostCode, kSecCSDefaultFlags, &staticAppCode);
|
||||
CFRelease(hostCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy other app code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
} else {
|
||||
NSBundle *otherAppBundle = [NSBundle bundleWithPath:otherAppPath];
|
||||
if (nil == otherAppBundle) {
|
||||
SULog(@"Failed to create bundle at path %@", otherAppPath);
|
||||
result = -1;
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)otherAppBundle.bundleURL, kSecCSDefaultFlags, &staticAppCode);
|
||||
if (result != noErr) {
|
||||
SULog(@"Failed to copy other app code %d", result);
|
||||
goto finally;
|
||||
}
|
||||
}
|
||||
|
||||
// Note that kSecCSCheckNestedCode may not work with pre-Mavericks code signing.
|
||||
// See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206
|
||||
CFErrorRef cfError = NULL;
|
||||
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError);
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticAppCode, flags, requirement, &cfError);
|
||||
|
||||
if (cfError) {
|
||||
NSError *tmpError = CFBridgingRelease(cfError);
|
||||
if (error) *error = tmpError;
|
||||
if (error) {
|
||||
*error = tmpError;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != noErr) {
|
||||
@@ -71,14 +112,14 @@
|
||||
CFRelease(requirementString);
|
||||
}
|
||||
|
||||
[self logSigningInfoForCode:hostCode label:@"host info"];
|
||||
[self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
[self logSigningInfoForCode:staticHostCode label:@"host info"];
|
||||
[self logSigningInfoForCode:staticAppCode label:@"new info"];
|
||||
}
|
||||
}
|
||||
|
||||
finally:
|
||||
if (hostCode) CFRelease(hostCode);
|
||||
if (staticCode) CFRelease(staticCode);
|
||||
if (staticHostCode) CFRelease(staticHostCode);
|
||||
if (staticAppCode) CFRelease(staticAppCode);
|
||||
if (requirement) CFRelease(requirement);
|
||||
return (result == noErr);
|
||||
}
|
||||
@@ -150,18 +191,42 @@ static id valueOrNSNull(id value) {
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)hostApplicationIsCodeSigned
|
||||
+ (BOOL)hostApplicationIsSandboxed
|
||||
{
|
||||
OSStatus result;
|
||||
SecCodeRef hostCode = NULL;
|
||||
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
if (result != 0) return NO;
|
||||
|
||||
SecRequirementRef requirement = NULL;
|
||||
result = SecCodeCopyDesignatedRequirement(hostCode, kSecCSDefaultFlags, &requirement);
|
||||
if (hostCode) CFRelease(hostCode);
|
||||
if (requirement) CFRelease(requirement);
|
||||
return (result == 0);
|
||||
static BOOL sIsAppSandboxed = NO;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
__block SecCodeRef hostCode = NULL;
|
||||
__block SecRequirementRef hostRequirement = NULL;
|
||||
|
||||
void (^Cleanup)(void) = ^ {
|
||||
if (hostCode) { CFRelease(hostCode); hostCode = NULL; }
|
||||
if (hostRequirement) { CFRelease(hostRequirement); hostRequirement = NULL; }
|
||||
};
|
||||
|
||||
OSStatus status = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
if (status != noErr || hostCode == NULL)
|
||||
{
|
||||
Cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
CFStringRef requirementString = CFSTR("entitlement[\"com.apple.security.app-sandbox\"] exists");
|
||||
status = SecRequirementCreateWithString(requirementString, kSecCSDefaultFlags, &hostRequirement);
|
||||
|
||||
if (status != noErr || hostRequirement == NULL)
|
||||
{
|
||||
Cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
status = SecCodeCheckValidity(hostCode, kSecCSDefaultFlags, hostRequirement);
|
||||
sIsAppSandboxed = (noErr == status);
|
||||
Cleanup();
|
||||
});
|
||||
|
||||
return sIsAppSandboxed;
|
||||
}
|
||||
|
||||
+ (BOOL)applicationAtPathIsCodeSigned:(NSString *)applicationPath
|
||||
|
||||
Vendored
+15
@@ -12,6 +12,21 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Typedefs:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SUUpdateAbortReason)
|
||||
{
|
||||
SUUpdateAbortUndefined = 0,
|
||||
SUUpdateAbortForbiddenByDelegate,
|
||||
SUUpdateAbortTasksFinished,
|
||||
SUUpdateAbortCanceledByUser,
|
||||
SUUpdateAbortDidNotFind,
|
||||
SUUpdateAbortInterrupred,
|
||||
SUUpdateAbortGotError
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Misc:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Vendored
+1
@@ -12,6 +12,7 @@
|
||||
#import "SUAppcastItem.h"
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUErrors.h"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG 0
|
||||
|
||||
Vendored
+76
-37
@@ -11,6 +11,7 @@
|
||||
#import "NTSynchronousTask.h"
|
||||
#import "SULog.h"
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#import "SUXPCInstaller.h"
|
||||
|
||||
@implementation SUDiskImageUnarchiver
|
||||
|
||||
@@ -35,12 +36,6 @@
|
||||
|
||||
SULog(@"Extracting %@ as a DMG", self.archivePath);
|
||||
|
||||
// get a unique mount point path
|
||||
NSString *mountPoint = nil;
|
||||
FSRef tmpRef;
|
||||
NSFileManager *manager;
|
||||
NSError *error;
|
||||
NSArray *contents;
|
||||
// We have to declare these before a goto to prevent an error under ARC.
|
||||
// No, we cannot have them in the dispatch_async calls, as the goto "jump enters
|
||||
// lifetime of block which strongly captures a variable"
|
||||
@@ -50,7 +45,10 @@
|
||||
dispatch_block_t delegateSuccess = ^{
|
||||
[self notifyDelegateOfSuccess];
|
||||
};
|
||||
do
|
||||
|
||||
// get a unique mount point path
|
||||
NSString *mountPoint = nil;
|
||||
do
|
||||
{
|
||||
// Using NSUUID would make creating UUIDs be done in Cocoa,
|
||||
// and thus managed under ARC. Sadly, the class is in 10.8 and later.
|
||||
@@ -65,12 +63,14 @@
|
||||
CFRelease(uuid);
|
||||
}
|
||||
}
|
||||
while (noErr == FSPathMakeRefWithOptions((const UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]);
|
||||
|
||||
NSData *promptData = nil;
|
||||
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||
|
||||
NSMutableArray *arguments = [@[@"attach", self.archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"] mutableCopy];
|
||||
NSString *hdiutilPath = @"/usr/bin/hdiutil";
|
||||
NSString *currentDirPath = @"/";
|
||||
NSArray *arguments = @[@"attach", self.archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"];
|
||||
|
||||
if (self.decryptionPassword) {
|
||||
NSMutableData *passwordData = [[self.decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
|
||||
@@ -82,19 +82,31 @@
|
||||
[passwordData appendData:promptData];
|
||||
promptData = passwordData;
|
||||
|
||||
[arguments addObject:@"-stdinpass"];
|
||||
arguments = [arguments arrayByAddingObject:@"-stdinpass"];
|
||||
}
|
||||
|
||||
NSData *output = nil;
|
||||
NSInteger taskResult = -1;
|
||||
BOOL shouldUseXPC = SUShouldUseXPCInstaller();
|
||||
|
||||
__block NSData *output = nil;
|
||||
__block NSInteger taskResult = -1;
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask *task = [[NTSynchronousTask alloc] init];
|
||||
if (shouldUseXPC)
|
||||
{
|
||||
[SUXPCInstaller launchTaskWithPath:hdiutilPath arguments:arguments environment:nil currentDirectoryPath:currentDirPath inputData:promptData waitUntilDone:YES completionHandler:^(int result, NSData *outputData) {
|
||||
taskResult = (NSInteger)result;
|
||||
output = [outputData copy];
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
NTSynchronousTask *task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:promptData];
|
||||
[task run:hdiutilPath directory:currentDirPath withArgs:arguments input:promptData];
|
||||
|
||||
taskResult = [task result];
|
||||
output = [[task output] copy];
|
||||
taskResult = [task result];
|
||||
output = [[task output] copy];
|
||||
}
|
||||
}
|
||||
@catch (NSException *)
|
||||
{
|
||||
@@ -110,30 +122,45 @@
|
||||
mountedSuccessfully = YES;
|
||||
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
manager = [[NSFileManager alloc] init];
|
||||
contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
|
||||
if (error)
|
||||
{
|
||||
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
|
||||
goto reportError;
|
||||
if (shouldUseXPC)
|
||||
{
|
||||
NSError *error = nil;
|
||||
[SUXPCInstaller copyPathContent:mountPoint toDirectory:[self.archivePath stringByDeletingLastPathComponent] error:&error];
|
||||
|
||||
if (nil != error)
|
||||
{
|
||||
SULog(@"Couldn't copy volume content: %ld - %@", error.code, error.localizedDescription);
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
// We skip any files in the DMG which are not readable.
|
||||
if (![manager isReadableFileAtPath:fromPath]) {
|
||||
continue;
|
||||
else
|
||||
{
|
||||
NSFileManager *manager = [[NSFileManager alloc] init];
|
||||
NSError *error = nil;
|
||||
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
|
||||
if (error)
|
||||
{
|
||||
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||
{
|
||||
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
|
||||
goto reportError;
|
||||
// We skip any files in the DMG which are not readable.
|
||||
if (![manager isReadableFileAtPath:fromPath]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||
|
||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||
{
|
||||
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,9 +172,21 @@
|
||||
|
||||
finally:
|
||||
if (mountedSuccessfully)
|
||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:@[@"detach", mountPoint, @"-force"]];
|
||||
{
|
||||
arguments = @[@"detach", mountPoint, @"-force"];
|
||||
if (shouldUseXPC)
|
||||
{
|
||||
[SUXPCInstaller launchTaskWithPath:hdiutilPath arguments:arguments environment:nil currentDirectoryPath:nil inputData:nil waitUntilDone:NO completionHandler:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSTask launchedTaskWithLaunchPath:hdiutilPath arguments:arguments];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SULog(@"Can't mount DMG %@", self.archivePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -40,6 +40,8 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUInstallationError = 4005,
|
||||
SUDowngradeError = 4006,
|
||||
|
||||
SUXPCServiceError = 4007,
|
||||
|
||||
// System phase errors
|
||||
SUSystemPowerOffError = 5000
|
||||
};
|
||||
|
||||
Vendored
+2
@@ -25,6 +25,8 @@
|
||||
*/
|
||||
+ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization;
|
||||
|
||||
@property (nonatomic, assign, readonly) BOOL allowsAuthorization;
|
||||
|
||||
/**
|
||||
* 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 uncommon case this name is used, the temporary directory will be created inside the directory pointed by appropriateURL
|
||||
|
||||
Vendored
+5
@@ -94,6 +94,11 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return [[self alloc] initAllowingAuthorization:allowsAuthorization];
|
||||
}
|
||||
|
||||
- (BOOL)allowsAuthorization
|
||||
{
|
||||
return _allowsAuthorization;
|
||||
}
|
||||
|
||||
// Acquires an authorization reference which is intended to be used for future authorized file operations
|
||||
- (BOOL)_acquireAuthorizationWithError:(NSError *__autoreleasing *)error
|
||||
{
|
||||
|
||||
Vendored
+4
-1
@@ -63,7 +63,11 @@ void SULog(NSString *format, ...)
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
NSString *theStr = [[NSString alloc] initWithFormat:format arguments:ap];
|
||||
va_end(ap);
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"Sparkle: %@", theStr);
|
||||
#endif
|
||||
|
||||
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "a");
|
||||
if (logfile) {
|
||||
@@ -72,7 +76,6 @@ void SULog(NSString *format, ...)
|
||||
fwrite([theData bytes], 1, [theData length], logfile);
|
||||
fclose(logfile);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -21,7 +21,7 @@
|
||||
[updaterDelegate updater:self.updater didFindValidUpdate:self.updateItem];
|
||||
NSDictionary *userInfo = (self.updateItem != nil) ? @{ SUUpdaterAppcastItemNotificationKey: self.updateItem } : nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification object:self.updater userInfo:userInfo];
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortTasksFinished];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater];
|
||||
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortDidNotFind];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+7
-2
@@ -23,6 +23,11 @@
|
||||
|
||||
@synthesize showErrors;
|
||||
|
||||
- (BOOL)shouldShowUI
|
||||
{
|
||||
return self.showErrors;
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
self.showErrors = YES; // We only start showing errors after we present the UI for the first time.
|
||||
@@ -38,7 +43,7 @@
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater];
|
||||
|
||||
[self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update.
|
||||
[self abortUpdate:SUUpdateAbortDidNotFind]; // Don't tell the user that no update was found; this was a scheduled update.
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
@@ -53,7 +58,7 @@
|
||||
[updaterDelegate updater:self.updater didAbortWithError:error];
|
||||
}
|
||||
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortGotError];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+24
-7
@@ -50,6 +50,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowUI
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)]) {
|
||||
@@ -65,6 +70,11 @@
|
||||
[self updateAlertFinishedWithChoice:choice];
|
||||
}];
|
||||
|
||||
__weak SUUIBasedUpdateDriver *weakSelf = self;
|
||||
self.updateAlert.releaseNotesRequestModifier = ^(NSMutableURLRequest *request) {
|
||||
[weakSelf updateURLRequestHTTPHeaders:request];
|
||||
};
|
||||
|
||||
id<SUVersionDisplay> versDisp = nil;
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(versionDisplayerForUpdater:)]) {
|
||||
versDisp = [[self.updater delegate] versionDisplayerForUpdater:self.updater];
|
||||
@@ -98,7 +108,7 @@
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
[alert addButtonWithTitle:SULocalizedString(@"OK", nil)];
|
||||
[self showAlert:alert];
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortDidNotFind];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,16 +133,16 @@
|
||||
|
||||
case SUOpenInfoURLChoice:
|
||||
[[NSWorkspace sharedWorkspace] openURL:[self.updateItem infoURL]];
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
break;
|
||||
|
||||
case SUSkipThisVersionChoice:
|
||||
[self.host setObject:[self.updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
break;
|
||||
|
||||
case SURemindMeLaterChoice:
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -185,7 +195,7 @@
|
||||
[[self.updater delegate] userDidCancelDownload:self.updater];
|
||||
}
|
||||
}
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
}
|
||||
|
||||
- (void)extractUpdate
|
||||
@@ -257,18 +267,25 @@
|
||||
[super abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason
|
||||
{
|
||||
if (self.statusController)
|
||||
{
|
||||
[self.statusController close];
|
||||
self.statusController = nil;
|
||||
}
|
||||
[super abortUpdate];
|
||||
[super abortUpdate:reason];
|
||||
}
|
||||
|
||||
- (void)showAlert:(NSAlert *)alert
|
||||
{
|
||||
if ([self.updater.delegate respondsToSelector:@selector(updater:mayShowModalAlert:)] &&
|
||||
![self.updater.delegate updater:self.updater mayShowModalAlert:alert])
|
||||
{
|
||||
// delegate forbids to show this alert!
|
||||
return;
|
||||
}
|
||||
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updaterWillShowModalAlert:)]) {
|
||||
[[self.updater delegate] updaterWillShowModalAlert:self.updater];
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -25,6 +25,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
|
||||
@interface SUUpdateAlert : SUWindowController
|
||||
|
||||
@property (weak) id<SUVersionDisplay> versionDisplayer;
|
||||
@property (copy) void (^releaseNotesRequestModifier)(NSMutableURLRequest *request);
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host completionBlock:(void(^)(SUUpdateAlertChoice))c;
|
||||
|
||||
|
||||
Vendored
+10
-1
@@ -64,6 +64,8 @@
|
||||
@synthesize skipButton;
|
||||
@synthesize laterButton;
|
||||
|
||||
@synthesize releaseNotesRequestModifier;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUUpdateAlertChoice))block
|
||||
{
|
||||
self = [super initWithWindowNibName:@"SUUpdateAlert"];
|
||||
@@ -140,7 +142,14 @@
|
||||
// If there's a release notes URL, load it; otherwise, just stick the contents of the description into the web view.
|
||||
if ([self.updateItem releaseNotesURL])
|
||||
{
|
||||
[[self.releaseNotesView mainFrame] loadRequest:[NSURLRequest requestWithURL:[self.updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.updateItem.releaseNotesURL
|
||||
cachePolicy:NSURLRequestReloadIgnoringCacheData
|
||||
timeoutInterval:30];
|
||||
if (self.releaseNotesRequestModifier != nil)
|
||||
{
|
||||
self.releaseNotesRequestModifier(request);
|
||||
}
|
||||
[[self.releaseNotesView mainFrame] loadRequest:request];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Vendored
+4
-1
@@ -21,13 +21,16 @@ extern NSString *const SUUpdateDriverFinishedNotification;
|
||||
|
||||
- (instancetype)initWithUpdater:(SUUpdater *)updater;
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
|
||||
- (void)abortUpdate;
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason;
|
||||
|
||||
- (void)showAlert:(NSAlert *)alert;
|
||||
|
||||
@property (getter=isInterruptible, readonly) BOOL interruptible;
|
||||
@property (readonly) BOOL finished;
|
||||
@property BOOL automaticallyInstallUpdates;
|
||||
@property (readonly) SUUpdateAbortReason abortReason;
|
||||
|
||||
@property (nonatomic, readonly) BOOL shouldShowUI; // can change it's value during lifetime
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+8
-1
@@ -17,6 +17,7 @@ NSString *const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
@property (weak) SUUpdater *updater;
|
||||
@property (copy) NSURL *appcastURL;
|
||||
@property (getter=isInterruptible) BOOL interruptible;
|
||||
@property (assign) SUUpdateAbortReason abortReason;
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,6 +29,7 @@ NSString *const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
@synthesize finished;
|
||||
@synthesize appcastURL;
|
||||
@synthesize automaticallyInstallUpdates;
|
||||
@synthesize abortReason;
|
||||
|
||||
- (instancetype)initWithUpdater:(SUUpdater *)anUpdater
|
||||
{
|
||||
@@ -45,12 +47,17 @@ NSString *const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
self.host = h;
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason
|
||||
{
|
||||
self.abortReason = reason;
|
||||
[self setValue:@YES forKey:@"finished"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdateDriverFinishedNotification object:self];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowUI
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)showAlert:(NSAlert *)alert {
|
||||
// Only UI-based subclass shows the actual alert
|
||||
|
||||
Vendored
+39
@@ -118,6 +118,8 @@ SU_EXPORT @interface SUUpdater : NSObject
|
||||
|
||||
@property (readonly) BOOL updateInProgress;
|
||||
|
||||
@property (readonly) BOOL installationInProgress;
|
||||
|
||||
@end
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -320,6 +322,14 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
*/
|
||||
- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Returns whether to allow Sparkle to show a modal alert window.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
\param alert The modal alert that proposes to be shown.
|
||||
*/
|
||||
- (BOOL)updater:(SUUpdater *)updater mayShowModalAlert:(NSAlert *)alert;
|
||||
|
||||
/*!
|
||||
Called before an updater shows a modal alert window,
|
||||
to give the host the opportunity to hide attached windows that may get in the way.
|
||||
@@ -363,4 +373,33 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
|
||||
@end
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// SUUpdater Delegate: DevMate Interaction
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// NOTE!!! Implemented delegate methods have higher priority than values saved in user preferences
|
||||
static NSString * const SUUpdaterChecksForBetaUpdatesPrefKey = @"SUUpdaterChecksForBetaUpdates"; // bool value
|
||||
static NSString * const SUUpdaterIsInTestModePrefKey = @"SUUpdaterIsInTestMode"; // bool value
|
||||
|
||||
@protocol SUUpdaterDelegate_DevMateInteraction <SUUpdaterDelegate>
|
||||
@optional
|
||||
|
||||
/*!
|
||||
Calls right before updates checking request to look for beta ones on DevMate.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
\return YES if need also check beta updates, NO otherwise.
|
||||
*/
|
||||
- (BOOL)updaterShouldCheckForBetaUpdates:(SUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Calls right before updates checking request to look for updates in test mode on DevMate.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
\return YES if need to check updates that are in test mode, NO otherwise.
|
||||
*/
|
||||
- (BOOL)isUpdaterInTestMode:(SUUpdater *)updater;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
Vendored
+78
-10
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SUUpdater.h"
|
||||
#import "SUUpdater_Private.h"
|
||||
|
||||
#import "SUHost.h"
|
||||
#import "SUUpdatePermissionPrompt.h"
|
||||
@@ -122,13 +123,10 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
-(void)checkIfConfiguredProperly {
|
||||
BOOL hasPublicDSAKey = [self.host publicDSAKey] != nil;
|
||||
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned];
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:self.host.bundlePath];
|
||||
NSURL *feedURL = [self feedURL];
|
||||
BOOL servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
|
||||
if (!isMainBundle && !hasPublicDSAKey) {
|
||||
[self showAlertText:@"Insecure update error!"
|
||||
informativeText:@"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information."];
|
||||
} else if (isMainBundle && !(hasPublicDSAKey || hostIsCodeSigned)) {
|
||||
if (!hasPublicDSAKey && !hostIsCodeSigned) {
|
||||
[self showAlertText:@"Insecure update error!"
|
||||
informativeText:@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information."];
|
||||
} else if (isMainBundle && !hasPublicDSAKey && !servingOverHttps) {
|
||||
@@ -203,8 +201,13 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
|
||||
- (void)updateDriverDidFinish:(NSNotification *)note
|
||||
{
|
||||
if ([note object] == self.driver && [self.driver finished])
|
||||
if ([note object] == self.driver && (nil == self.driver || [self.driver finished]))
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(updaterDidEndUpdateProcess:)])
|
||||
{
|
||||
[(id<SUPrivateUpdaterDelegate>)self.delegate updaterDidEndUpdateProcess:self];
|
||||
}
|
||||
|
||||
self.driver = nil;
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
@@ -318,7 +321,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
- (IBAction)checkForUpdates:(id)__unused sender
|
||||
{
|
||||
if (self.driver && [self.driver isInterruptible]) {
|
||||
[self.driver abortUpdate];
|
||||
[self.driver abortUpdate:SUUpdateAbortInterrupred];
|
||||
}
|
||||
|
||||
[self checkForUpdatesWithDriver:[[SUUserInitiatedUpdateDriver alloc] initWithUpdater:self]];
|
||||
@@ -332,7 +335,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
- (void)installUpdatesIfAvailable
|
||||
{
|
||||
if (self.driver && [self.driver isInterruptible]) {
|
||||
[self.driver abortUpdate];
|
||||
[self.driver abortUpdate:SUUpdateAbortInterrupred];
|
||||
}
|
||||
|
||||
SUUIBasedUpdateDriver *theUpdateDriver = [[SUUserInitiatedUpdateDriver alloc] initWithUpdater:self];
|
||||
@@ -345,6 +348,11 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if ([self updateInProgress]) { return; }
|
||||
if (self.checkTimer) { [self.checkTimer invalidate]; self.checkTimer = nil; } // Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(updaterWillStartUpdateProcess:)])
|
||||
{
|
||||
[(id<SUPrivateUpdaterDelegate>)self.delegate updaterWillStartUpdateProcess:self];
|
||||
}
|
||||
|
||||
[self willChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
[self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
@@ -370,7 +378,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if (theFeedURL) // Use a NIL URL to cancel quietly.
|
||||
[self.driver checkForUpdatesAtURL:theFeedURL host:self.host];
|
||||
else
|
||||
[self.driver abortUpdate];
|
||||
[self.driver abortUpdate:SUUpdateAbortGotError];
|
||||
}
|
||||
|
||||
- (void)registerAsObserver
|
||||
@@ -469,7 +477,14 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
// A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds).
|
||||
NSString *appcastString = [self.host objectForKey:SUFeedURLKey];
|
||||
if ([self.delegate respondsToSelector:@selector(feedURLStringForUpdater:)])
|
||||
{
|
||||
appcastString = [self.delegate feedURLStringForUpdater:self];
|
||||
}
|
||||
if (0 == appcastString.length)
|
||||
{
|
||||
appcastString = [NSString stringWithFormat:@"https://updates.devmate.com/%@.xml", self.hostBundle.bundleIdentifier];
|
||||
}
|
||||
|
||||
if (!appcastString) // Can't find an appcast string!
|
||||
[NSException raise:@"SUNoFeedURL" format:@"You must specify the URL of the appcast as the %@ key in either the Info.plist or the user defaults!", SUFeedURLKey];
|
||||
NSCharacterSet *quoteSet = [NSCharacterSet characterSetWithCharactersInString:@"\"\'"]; // Some feed publishers add quotes; strip 'em.
|
||||
@@ -517,7 +532,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
|
||||
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
|
||||
|
||||
NSArray *parameters = @[];
|
||||
NSArray *parameters = [self devmateFeedParameters];
|
||||
if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
|
||||
}
|
||||
@@ -585,6 +600,59 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
return self.driver && ([self.driver finished] == NO);
|
||||
}
|
||||
|
||||
- (BOOL)installationInProgress
|
||||
{
|
||||
BOOL result = NO;
|
||||
@try
|
||||
{
|
||||
NSConnection *connection = [NSConnection connectionWithRegisteredName:[NSString stringWithFormat:@"Sparkle-%@", self.host.bundle.bundleIdentifier] host:nil];
|
||||
if (connection != nil)
|
||||
{
|
||||
NSDistantObject *proxyBundle = [connection rootProxy];
|
||||
result = proxyBundle != nil;
|
||||
}
|
||||
}
|
||||
@catch (NSException *)
|
||||
{
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (SUBasicUpdateDriver *)basicDriver
|
||||
{
|
||||
return [self.driver isKindOfClass:[SUBasicUpdateDriver class]] ? (SUBasicUpdateDriver *)self.driver : nil;
|
||||
}
|
||||
|
||||
- (NSBundle *)hostBundle { return [self.host bundle]; }
|
||||
|
||||
#pragma mark - DevMate Interaction
|
||||
|
||||
- (NSArray *)devmateFeedParameters
|
||||
{
|
||||
NSMutableArray *parameters = [NSMutableArray array];
|
||||
|
||||
BOOL isInTestMode = [self.host boolForUserDefaultsKey:SUUpdaterIsInTestModePrefKey];
|
||||
if ([self.delegate respondsToSelector:@selector(isUpdaterInTestMode:)])
|
||||
{
|
||||
isInTestMode = [(id<SUUpdaterDelegate_DevMateInteraction>)self.delegate isUpdaterInTestMode:self];
|
||||
}
|
||||
if (isInTestMode)
|
||||
{
|
||||
[parameters addObject:@{ @"key" : @"test", @"value" : @"1"}];
|
||||
}
|
||||
|
||||
BOOL shouldCheckBeta = [self.host boolForUserDefaultsKey:SUUpdaterChecksForBetaUpdatesPrefKey];
|
||||
if ([self.delegate respondsToSelector:@selector(updaterShouldCheckForBetaUpdates:)])
|
||||
{
|
||||
shouldCheckBeta = [(id<SUUpdaterDelegate_DevMateInteraction>)self.delegate updaterShouldCheckForBetaUpdates:self];
|
||||
}
|
||||
if (shouldCheckBeta)
|
||||
{
|
||||
[parameters addObject:@{ @"key" : @"beta", @"value" : @"1"}];
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// SUUpdaterProxy.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 10/1/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SUUpdater.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
// This is a proxy for DM_SUUpdater class used in DevMateSparkle_lib target.
|
||||
// In cases when developer uses this lib in it's own project but forgot to change
|
||||
// updater object class inside XIB file from SUUpdater to DM_SUUpdater updating process won't be broken.
|
||||
|
||||
static NSString *sOriginalSUUpdaterClass = @"SUUpdater";
|
||||
|
||||
@interface SUUpdaterLoader : NSObject
|
||||
@end
|
||||
|
||||
@implementation SUUpdaterLoader
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
if (Nil == NSClassFromString(sOriginalSUUpdaterClass))
|
||||
{
|
||||
// Custom Sparkle.framework is absent
|
||||
// Add own SUUpdater proxy class
|
||||
Class SUUpdaterClass = objc_allocateClassPair([NSObject class], [sOriginalSUUpdaterClass UTF8String], 0);
|
||||
if (Nil != SUUpdaterClass)
|
||||
{
|
||||
objc_registerClassPair(SUUpdaterClass);
|
||||
}
|
||||
Class SUUpdaterMetaclass = objc_getMetaClass(class_getName(SUUpdaterClass));
|
||||
|
||||
Class LoaderClass = [self class];
|
||||
Class LoaderMetaclass = objc_getMetaClass(class_getName(LoaderClass));
|
||||
|
||||
BOOL success = SUUpdaterClass != Nil && SUUpdaterMetaclass != Nil;
|
||||
void *runtimeMethods[][3] = {
|
||||
{ (__bridge void *)SUUpdaterClass, (__bridge void *)LoaderClass, @selector(init) },
|
||||
{ (__bridge void *)SUUpdaterClass, (__bridge void *)LoaderClass, @selector(initForBundle:) },
|
||||
{ (__bridge void *)SUUpdaterMetaclass, (__bridge void *)LoaderMetaclass, @selector(sharedUpdater) },
|
||||
{ (__bridge void *)SUUpdaterMetaclass, (__bridge void *)LoaderMetaclass, @selector(updaterForBundle:) },
|
||||
};
|
||||
size_t methodsCount = sizeof(runtimeMethods) / sizeof(runtimeMethods[0]);
|
||||
for (size_t i = 0; success && i < methodsCount; ++i)
|
||||
{
|
||||
Class changeClass = (__bridge Class)runtimeMethods[i][0];
|
||||
Class prototypeClass = (__bridge Class)runtimeMethods[i][1];
|
||||
SEL selector = runtimeMethods[i][2];
|
||||
|
||||
IMP implementation = class_getMethodImplementation(prototypeClass, selector);
|
||||
const char *types = method_getTypeEncoding(class_getInstanceMethod(prototypeClass, selector));
|
||||
|
||||
success = class_addMethod(changeClass, selector, implementation, types);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
objc_disposeClassPair(SUUpdaterClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Public creation methods
|
||||
|
||||
- (id)init
|
||||
{
|
||||
return (id)[[SUUpdaterWorking alloc] init];
|
||||
}
|
||||
|
||||
- (id)initForBundle:(NSBundle *)bundle
|
||||
{
|
||||
return (id)[[SUUpdaterWorking alloc] initForBundle:bundle];
|
||||
}
|
||||
|
||||
+ (SUUpdater *)sharedUpdater
|
||||
{
|
||||
return [SUUpdaterWorking sharedUpdater];
|
||||
}
|
||||
|
||||
+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle
|
||||
{
|
||||
return [SUUpdaterWorking updaterForBundle:bundle];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// SUUpdaterQueue.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 7/31/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUExport.h"
|
||||
|
||||
@class SUUpdater;
|
||||
|
||||
SU_EXPORT @interface SUUpdaterQueue : NSObject
|
||||
|
||||
- (void)addUpdater:(SUUpdater *)updater;
|
||||
- (void)removeUpdater:(SUUpdater *)updater;
|
||||
|
||||
- (void)checkForUpdates;
|
||||
- (void)checkForUpdatesInBackground;
|
||||
|
||||
@property (readonly) BOOL updateInProgress;
|
||||
|
||||
@end
|
||||
Vendored
+431
@@ -0,0 +1,431 @@
|
||||
//
|
||||
// SUUpdaterQueue.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Dmytro Tretiakov on 7/31/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SUUpdaterQueue.h"
|
||||
#import "SUUpdater.h"
|
||||
#import "SUUpdater_Private.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
#import "SUUserInitiatedUpdateDriver.h"
|
||||
|
||||
@interface SUDelegateProxy : NSProxy <SUPrivateUpdaterDelegate>
|
||||
|
||||
@property (nonatomic, assign) id realDelegate;
|
||||
@property (nonatomic, assign) SUUpdaterQueue *updaterQueue;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUDelegateProxy
|
||||
|
||||
@synthesize realDelegate;
|
||||
@synthesize updaterQueue;
|
||||
|
||||
+ (BOOL)shouldRedirectToUpdaterQueue:(SEL)aSelector
|
||||
{
|
||||
if (nil == aSelector)
|
||||
return NO;
|
||||
|
||||
static NSSet *sSelectorsToRedirect = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sSelectorsToRedirect = [[NSSet alloc] initWithObjects:
|
||||
NSStringFromSelector(@selector(updaterWillStartUpdateProcess:)),
|
||||
NSStringFromSelector(@selector(updaterDidEndUpdateProcess:)),
|
||||
NSStringFromSelector(@selector(updaterMayCheckForUpdates:)),
|
||||
NSStringFromSelector(@selector(updater:mayShowModalAlert:)),
|
||||
nil];
|
||||
});
|
||||
|
||||
return [sSelectorsToRedirect containsObject:NSStringFromSelector(aSelector)];
|
||||
}
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector
|
||||
{
|
||||
NSMethodSignature *signature = [self.realDelegate methodSignatureForSelector:selector];
|
||||
if (!signature)
|
||||
{
|
||||
signature = [self.updaterQueue methodSignatureForSelector:selector];
|
||||
}
|
||||
if (!signature)
|
||||
{
|
||||
signature = [super methodSignatureForSelector:selector];
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector
|
||||
{
|
||||
BOOL result = NO;
|
||||
|
||||
if ([SUDelegateProxy shouldRedirectToUpdaterQueue:aSelector])
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [self.realDelegate respondsToSelector:aSelector];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
if ([SUDelegateProxy shouldRedirectToUpdaterQueue:[anInvocation selector]])
|
||||
{
|
||||
[anInvocation invokeWithTarget:self.updaterQueue];
|
||||
}
|
||||
else if ([self.realDelegate respondsToSelector:anInvocation.selector])
|
||||
{
|
||||
[anInvocation invokeWithTarget:self.realDelegate];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isKindOfClass:(Class)aClass
|
||||
{
|
||||
if (self.realDelegate)
|
||||
return [self.realDelegate isKindOfClass:aClass];
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface SUUpdaterQueue ()
|
||||
{
|
||||
NSMutableArray *_updaters;
|
||||
NSMutableDictionary *_delegatesMap;
|
||||
}
|
||||
|
||||
@property (atomic, retain) NSMutableArray *updaters;
|
||||
@property (atomic, retain) NSMutableDictionary *delegatesMap;
|
||||
@property (atomic, retain) SUUpdater *currentUpdater;
|
||||
@property (atomic, assign) dispatch_semaphore_t currentUpdaterSema;
|
||||
@property (nonatomic, retain) NSObject *semaphoreSynchronizer;
|
||||
@property (atomic, assign) BOOL shouldContinueCheck;
|
||||
@property (nonatomic, retain) NSMutableArray *resultUIDrivers;
|
||||
|
||||
@property (atomic, assign, getter=isProcessingUpdatersCheck) BOOL processingUpdatersCheck;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUUpdaterQueue
|
||||
|
||||
@synthesize updaters;
|
||||
@synthesize delegatesMap;
|
||||
@synthesize currentUpdater;
|
||||
@synthesize currentUpdaterSema;
|
||||
@synthesize semaphoreSynchronizer;
|
||||
@synthesize shouldContinueCheck;
|
||||
@synthesize resultUIDrivers;
|
||||
@synthesize processingUpdatersCheck;
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
self.semaphoreSynchronizer = [[NSObject alloc] init];
|
||||
self.updaters = [NSMutableArray array];
|
||||
self.delegatesMap = [NSMutableDictionary dictionary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
for (SUUpdater *updater in [self.updaters copy])
|
||||
{
|
||||
[self removeUpdater:updater];
|
||||
}
|
||||
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (!self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
dispatch_release(self.currentUpdaterSema);
|
||||
self.currentUpdaterSema = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString __unused *)keyPath ofObject:(id)object change:(NSDictionary __unused *)change context:(void __unused *)context
|
||||
{
|
||||
if ([object isKindOfClass:[SUUpdater class]])
|
||||
{
|
||||
[self updateUpdaterDelegate:object];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateUpdaterDelegate:(SUUpdater *)updater
|
||||
{
|
||||
if ([SUDelegateProxy class] == [updater.delegate class] && self == [(SUDelegateProxy *)updater.delegate updaterQueue])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@synchronized (self.delegatesMap)
|
||||
{
|
||||
id realDelegate = updater.delegate;
|
||||
SUDelegateProxy *proxy = [SUDelegateProxy alloc];
|
||||
proxy.realDelegate = realDelegate;
|
||||
proxy.updaterQueue = self;
|
||||
updater.delegate = proxy;
|
||||
|
||||
NSString *updaterKey = [self mapKeyForUpdater:updater];
|
||||
self.delegatesMap[updaterKey] = proxy;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)mapKeyForUpdater:(SUUpdater *)updater
|
||||
{
|
||||
return [NSString stringWithFormat:@"%p", updater];
|
||||
}
|
||||
|
||||
- (id)realDelegateForUpdater:(SUUpdater *)updater
|
||||
{
|
||||
if (nil == updater)
|
||||
return nil;
|
||||
|
||||
id delegate = nil;
|
||||
@synchronized (self.delegatesMap)
|
||||
{
|
||||
NSString *updaterKey = [self mapKeyForUpdater:updater];
|
||||
delegate = self.delegatesMap[updaterKey];
|
||||
}
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)addUpdater:(SUUpdater *)updater
|
||||
{
|
||||
if (nil == updater)
|
||||
return;
|
||||
|
||||
if ([updater updateInProgress])
|
||||
{
|
||||
NSLog(@"Could not add updater while it's in progress");
|
||||
return;
|
||||
}
|
||||
|
||||
@synchronized (self.updaters)
|
||||
{
|
||||
if (![self.updaters containsObject:updater])
|
||||
{
|
||||
[self updateUpdaterDelegate:updater];
|
||||
[updater addObserver:self forKeyPath:@"delegate" options:NSKeyValueObservingOptionNew context:NULL];
|
||||
[self.updaters addObject:updater];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeUpdater:(SUUpdater *)updater
|
||||
{
|
||||
if (nil == updater)
|
||||
return;
|
||||
|
||||
if (updater == self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
NSLog(@"Could not remove updater while it's in progress.");
|
||||
return;
|
||||
}
|
||||
|
||||
@synchronized (self.updaters)
|
||||
{
|
||||
if ([self.updaters containsObject:updater])
|
||||
{
|
||||
[updater removeObserver:self forKeyPath:@"delegate"];
|
||||
id realDelegate = nil;
|
||||
NSString *updaterKey = [self mapKeyForUpdater:updater];
|
||||
|
||||
@synchronized (self.delegatesMap)
|
||||
{
|
||||
realDelegate = [self.delegatesMap[updaterKey] realDelegate];
|
||||
[self.delegatesMap removeObjectForKey:updaterKey];
|
||||
}
|
||||
|
||||
[updater setDelegate:realDelegate];
|
||||
[self.updaters removeObject:updater];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)updateInProgress
|
||||
{
|
||||
return self.processingUpdatersCheck;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)performCheckForUpdates:(NSString *)selectorName
|
||||
{
|
||||
if (self.isProcessingUpdatersCheck)
|
||||
return;
|
||||
|
||||
self.processingUpdatersCheck = YES;
|
||||
|
||||
NSUInteger index = 0;
|
||||
self.shouldContinueCheck = YES;
|
||||
self.resultUIDrivers = [NSMutableArray array];
|
||||
do
|
||||
{
|
||||
// in case if some of queued updaters is already in process
|
||||
if (self.currentUpdater && self.currentUpdaterSema)
|
||||
{
|
||||
dispatch_semaphore_wait(self.currentUpdaterSema, DISPATCH_TIME_FOREVER);
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
dispatch_release(self.currentUpdaterSema);
|
||||
self.currentUpdaterSema = nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.shouldContinueCheck)
|
||||
break;
|
||||
|
||||
@synchronized (self.updaters)
|
||||
{
|
||||
self.currentUpdater = index < self.updaters.count ? self.updaters[index] : nil;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (nil == self.currentUpdater)
|
||||
break;
|
||||
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (nil == self.currentUpdaterSema)
|
||||
self.currentUpdaterSema = dispatch_semaphore_create(0);
|
||||
}
|
||||
[self.currentUpdater performSelectorOnMainThread:NSSelectorFromString(selectorName)
|
||||
withObject:nil
|
||||
waitUntilDone:YES];
|
||||
}
|
||||
while (YES);
|
||||
|
||||
if (SUUpdateAbortDidNotFind == [self.resultUIDrivers.lastObject abortReason])
|
||||
{
|
||||
SUBasicUpdateDriver *driver = nil;
|
||||
if (self.resultUIDrivers.count > 1)
|
||||
{
|
||||
SUUpdater *mainUpdater = [SUUpdater sharedUpdater];
|
||||
driver = [[SUUserInitiatedUpdateDriver alloc] initWithUpdater:mainUpdater];
|
||||
driver.host = mainUpdater.host;
|
||||
}
|
||||
else
|
||||
{
|
||||
driver = self.resultUIDrivers.lastObject;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wselector"
|
||||
[driver performSelectorOnMainThread:@selector(didNotFindUpdate) withObject:nil waitUntilDone:YES];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
self.resultUIDrivers = nil;
|
||||
|
||||
self.processingUpdatersCheck = NO;
|
||||
}
|
||||
|
||||
- (void)checkForUpdates
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wselector"
|
||||
[self performSelectorInBackground:@selector(performCheckForUpdates:)
|
||||
withObject:NSStringFromSelector(@selector(checkForUpdates:))];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesInBackground
|
||||
{
|
||||
[self performSelectorInBackground:@selector(performCheckForUpdates:)
|
||||
withObject:NSStringFromSelector(@selector(checkForUpdatesInBackground))];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)updaterWillStartUpdateProcess:(SUUpdater *)updater
|
||||
{
|
||||
if ((nil != updater && nil == self.currentUpdater) ||
|
||||
(self.currentUpdater == updater))
|
||||
{
|
||||
self.currentUpdater = updater;
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (nil == self.currentUpdaterSema)
|
||||
self.currentUpdaterSema = dispatch_semaphore_create(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updaterDidEndUpdateProcess:(SUUpdater *)updater
|
||||
{
|
||||
if (self.currentUpdater == updater)
|
||||
{
|
||||
self.currentUpdater = nil;
|
||||
@synchronized (self.semaphoreSynchronizer)
|
||||
{
|
||||
if (self.currentUpdaterSema)
|
||||
dispatch_semaphore_signal(self.currentUpdaterSema);
|
||||
}
|
||||
|
||||
SUBasicUpdateDriver *driver = updater.basicDriver;
|
||||
do
|
||||
{
|
||||
if (!driver.shouldShowUI)
|
||||
break;
|
||||
|
||||
if (SUUpdateAbortGotError == driver.abortReason)
|
||||
{
|
||||
self.resultUIDrivers = nil;
|
||||
self.shouldContinueCheck = NO;
|
||||
break;
|
||||
}
|
||||
|
||||
[self.resultUIDrivers addObject:driver];
|
||||
}
|
||||
while (NO);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)updater
|
||||
{
|
||||
BOOL result = NO;
|
||||
if (updater != nil && updater == self.currentUpdater)
|
||||
{
|
||||
id realDelegate = ([SUDelegateProxy class] == [updater.delegate class]) ? [(SUDelegateProxy *)updater.delegate realDelegate] : updater.delegate;
|
||||
result = ![realDelegate respondsToSelector:_cmd] || [realDelegate updaterMayCheckForUpdates:updater];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (BOOL)updater:(SUUpdater *)updater mayShowModalAlert:(NSAlert *)alertToShow
|
||||
{
|
||||
BOOL result = YES;
|
||||
|
||||
if (updater != nil && updater == self.currentUpdater && self.shouldContinueCheck)
|
||||
{
|
||||
if (SUUpdateAbortGotError != updater.basicDriver.abortReason)
|
||||
result = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
id realDelegate = ([SUDelegateProxy class] == [updater.delegate class]) ? [(SUDelegateProxy *)updater.delegate realDelegate] : updater.delegate;
|
||||
result = ![realDelegate respondsToSelector:_cmd] || [realDelegate updater:updater mayShowModalAlert:alertToShow];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+12
@@ -8,8 +8,20 @@
|
||||
|
||||
#import "SUUpdater.h"
|
||||
|
||||
@class SUBasicUpdateDriver, SUHost;
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
|
||||
@property (readonly) BOOL mayUpdateAndRestart;
|
||||
@property (readonly) SUBasicUpdateDriver *basicDriver;
|
||||
@property (readonly) SUHost *host;
|
||||
|
||||
@end
|
||||
|
||||
@protocol SUPrivateUpdaterDelegate <SUUpdaterDelegate>
|
||||
@optional
|
||||
|
||||
- (void)updaterWillStartUpdateProcess:(SUUpdater *)updater;
|
||||
- (void)updaterDidEndUpdateProcess:(SUUpdater *)updater;
|
||||
|
||||
@end
|
||||
+3
-3
@@ -59,7 +59,7 @@
|
||||
{
|
||||
if (self.isCanceled)
|
||||
{
|
||||
[self abortUpdate];
|
||||
[self abortUpdate:SUUpdateAbortCanceledByUser];
|
||||
return;
|
||||
}
|
||||
[self closeCheckingWindow];
|
||||
@@ -72,10 +72,10 @@
|
||||
[super abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
- (void)abortUpdate:(SUUpdateAbortReason)reason
|
||||
{
|
||||
[self closeCheckingWindow];
|
||||
[super abortUpdate];
|
||||
[super abortUpdate:reason];
|
||||
}
|
||||
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
|
||||
|
||||
Vendored
+1
@@ -21,5 +21,6 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUVersionDisplayProtocol.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SUUpdaterQueue.h"
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,13 @@
|
||||
#import "SUFileManager.h"
|
||||
#import "SUTestWebServer.h"
|
||||
|
||||
#define MACROSTRING(x) #x
|
||||
#define NSSTRING_MACRO(x) @MACROSTRING(x)
|
||||
|
||||
#ifndef CODE_SIGN_IDENTITY
|
||||
#define CODE_SIGN_IDENTITY
|
||||
#endif
|
||||
|
||||
@interface SUTestApplicationDelegate ()
|
||||
|
||||
@property (nonatomic) SUUpdateSettingsWindowController *updateSettingsWindowController;
|
||||
@@ -24,6 +31,7 @@
|
||||
@synthesize webServer = _webServer;
|
||||
|
||||
static NSString * const UPDATED_VERSION = @"2.0";
|
||||
static NSString * const CODE_SIGN_ID = NSSTRING_MACRO(CODE_SIGN_IDENTITY);
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification * __unused)notification
|
||||
{
|
||||
@@ -93,6 +101,17 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
BOOL wroteInfoFile = [infoDictionary writeToURL:infoURL atomically:NO];
|
||||
assert(wroteInfoFile);
|
||||
|
||||
if ([CODE_SIGN_ID length])
|
||||
{
|
||||
NSTask *codesignTask = [[NSTask alloc] init];
|
||||
codesignTask.launchPath = @"/usr/bin/codesign";
|
||||
codesignTask.arguments = @[@"-s", CODE_SIGN_ID, @"-fv", destinationBundleURL.path];
|
||||
[codesignTask launch];
|
||||
[codesignTask waitUntilExit];
|
||||
|
||||
assert(codesignTask.terminationStatus == 0);
|
||||
}
|
||||
|
||||
// Change current working directory so web server knows where to list files
|
||||
NSString *serverDirectoryPath = serverDirectoryURL.path;
|
||||
assert(serverDirectoryPath != nil);
|
||||
|
||||
+4
-2
@@ -9,15 +9,17 @@
|
||||
#ifndef NTSYNCHRONOUSTASK_H
|
||||
#define NTSYNCHRONOUSTASK_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NTSynchronousTask : NSObject
|
||||
@property (readonly, strong) NSData *output;
|
||||
@property (readonly) int result;
|
||||
|
||||
// pass nil for directory if not needed
|
||||
// returns the result
|
||||
+(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData;
|
||||
+ (int)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output:(NSData**)outData;
|
||||
|
||||
+(NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
|
||||
Reference in new issue
Block a user