Compare commits

...
1513 Commits
Author SHA1 Message Date
Kornel 0900d09ab3 Run swiftlint 2020-06-10 12:19:02 +01:00
Rajiv Shah 1755a3da05 Silence two warnings 2020-06-10 12:17:38 +01:00
Rajiv Shah bb56b5b259 Run SwifLint autocorrect 2020-06-10 12:15:34 +01:00
Rajiv Shah 5df208336a Copy SwiftLint config from master 2020-06-10 12:15:34 +01:00
Jordan Rose 50f754c21d Don't treat a download prevalidation failure as a regular validation failure
You have to remember to invoke prevalidation anyway, so it doesn't
gain much for post-validation to check whether prevalidation failed.

Also, remove a no-longer correct comment from the corresponding
header.
2020-06-10 12:14:30 +01:00
Jordan Rose 8455216a58 Don't complain about pre-validated package installs
That's the normal way packages get installed in 2.x.
2020-06-10 12:14:30 +01:00
Jordan Rose 524761c50f Remove -[SUPublicKeys isEqualToKey:]
It's been broken since 2018, and we suspect no one's using it anyway.
2020-06-10 12:14:30 +01:00
Jordan Rose 626ccc79c6 Update missing key messages to refer to EdDSA rather than DSA 2020-06-10 12:14:30 +01:00
Jordan Rose a9ba760d6e Rename generate_appcast briding header to match standard naming 2020-06-10 12:14:30 +01:00
Jordan Rose 9561b365af Update signing self-check to look for EdDSA (like 14f1d352 on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 723e5d11be Statically link libed25519.a everywhere that needs it. 2020-06-10 12:14:30 +01:00
Jordan Rose 19ef31b681 Use EdDSA keys in test app (like 9c4729ed on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 50d321a1a9 Now that we're close enough to 1.x, steal its implementation of SUSignatureVerifier.m and SUUpdateValidator.m wholesale. 2020-06-10 12:14:30 +01:00
Jordan Rose 55e0dc508c Rename -[SUSignatureVerifier verifyStream:signatures:] to -verifyDSASignatureOfStream:signatures: (like b9150d2 on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose f6f4ac6925 Make SecKeyRef as needed (like 1006326 on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 2ace19e72b Read SUPublicEDKey from plist (like 68856e0 in 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose cb12461be1 Separate prevalidation out of constructor (like 92e00ba on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose e7c828b332 Rename SUDSAVerifier to SUSignatureVerifier (like 98ea3e3 on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 5dbc53a8b8 Adopt SUPublicKeys (like c094a38 on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 5dc407ddc5 Switch the signature verifier to use SUSignatures (like 6df898f on 1.x) 2020-06-10 12:14:30 +01:00
Jordan Rose 261f5dc797 Push SUSignature through SUAppcastItem (like 8ad1f57 on 1.x) 2020-06-10 12:14:30 +01:00
Tony Arnold 25d394acda Update the code signing verifier tests to match what is on master 2020-06-10 12:14:30 +01:00
Tony Arnold 401cd5f628 Add Xcode group for the command line tools
# Conflicts:
#	Sparkle.xcodeproj/project.pbxproj
2020-06-10 12:14:30 +01:00
Tony Arnold ddc8fac6c6 Add sign_update command line tool
This code has been ported directly from `master`.

Co-authored-by: Kornel Lesiński <github@pornel.net>

# Conflicts:
#	Sparkle.xcodeproj/project.pbxproj
2020-06-10 12:14:30 +01:00
Tony Arnold da573aa9ab Add generate_keys command line tool
This code has been ported directly from `master`.

Co-authored-by: Kornel Lesiński <github@pornel.net>

# Conflicts:
#	Sparkle.xcodeproj/project.pbxproj
2020-06-10 12:14:30 +01:00
Tony Arnold 8b40e22432 Update generate_appcast command line tool to support ed25519 signatures
This code has been ported directly from `master`.

Co-authored-by: Kornel Lesiński <github@pornel.net>

# Conflicts:
#	Sparkle.xcodeproj/project.pbxproj
2020-06-10 12:14:30 +01:00
Tony Arnold 93a8aca7fd Add ed25519 as a static library to the project
# Conflicts:
#	Sparkle.xcodeproj/project.pbxproj
2020-06-10 12:14:30 +01:00
Tony Arnold 63aa96a076 Look up the path for the System Applications directory, as it is not a single directory on macOS Catalina 2020-06-10 12:14:29 +01:00
Kornel 7b13157dce Merge pull request #1598 from rajivshah3/fix/2.x/ci
2.x: Fix CI tests
2020-05-27 11:44:59 +01:00
Rajiv Shah aa9e05958d Fix SUCodeSigningVerifierTest on macOS 10.15
Pre-installed apps, such as Calculator, are now installed under the System folder
2020-05-26 17:36:42 -04:00
Rajiv Shah 58fff9732e Copy new Travis CI config from master 2020-05-26 17:31:02 -04:00
Kornel 9c8fef56e3 Merge pull request #1592 from R4N/fullscreen-alert-fix-v2 2020-05-15 20:39:17 +01:00
Micah Moore 0e0b87afd4 Sets UpdateAlert and UpdatePermissionPrompt window's fullscreen collectionBehavior to NSWindowCollectionBehaviorFullScreenAuxiliary to allow them to present on top of the Main App's window if it's fullscreen. 2020-05-15 14:15:11 -04:00
Kornel b8f87f1702 Merge pull request #1584 from ksuther/fix-warnings 2020-05-05 14:14:33 +01:00
Kent Sutherland 32db72a2fc Fix format warning 2020-05-04 19:03:07 -05:00
Kent Sutherland f83f29193b Remove __attribute__((noreturn)) since these methods no longer abort 2020-05-04 19:02:56 -05:00
Kent Sutherland 93cff25e6f Remove @import from framework headers
Xcode 11.4 turns on -Watimport-in-framework-header by default which causes this to warn
2020-05-04 19:02:41 -05:00
Kornel f886459367 Merge pull request #1567 from panicinc/merge/app-translocation
Adding support for detecting App Translocation and showing an error
2020-03-27 14:33:41 +00:00
Logan Collins 54e663085b Adding support for detecting App Translocation and showing an error, originally from #1392. 2020-03-26 14:58:59 -07:00
Kornel 80627a4946 Merge pull request #1566 from bdkjones/2.x
Better Appcast Errors
2020-03-26 12:20:41 +00:00
Bryan Jones ba8dd4d010 Better Appcast Errors
Removes extra layer of UserInfo dictionary, exposing underlying errors to implementors.
2020-03-25 23:21:05 -07:00
Kornel 5270fe0f51 Merge pull request #1557 from martinsp/fix-2.x-build
Fixes `make release` for 2.x
2020-03-07 01:21:10 +00:00
Martins Polakovs 03ab0b72a6 Fixes make release 2020-03-06 22:22:55 +02:00
Kornel 931f7855f7 Merge pull request #1554 from philippec/fix-build-2.x
Fixed build issue
2020-02-21 10:35:35 +00:00
Philippe Casgrain a10a99ce1a Fixed build issue
Added missing semi-colon that prevented a `make release` build.
2020-02-20 22:59:44 -05:00
Kornel a9209b94b7 Merge pull request #1545 from bdkjones/2.x
Remove most production-reachable instances of abort().
2020-02-06 10:01:37 +00:00
Kornel Lesiński d2ac8bc61e Bump version
Fixes #1547
2020-02-06 09:53:23 +00:00
Bryan Jones e5e4c6c2e1 Remove most production-reachable instances of abort(). 2020-02-05 23:25:07 -08:00
Kornel a045f1a50b Merge pull request #1524 from jakob/issue-1505
Sparkle 2.x: Delay startup of updater
2019-12-15 17:05:27 +00:00
Jakob 771b193924 Use self to avoid warning 2019-12-14 22:53:56 +01:00
Jakob 0cd3aa0d9d SUUpdater: Delay updater startup
This should allow configuring the updater in willFinishLaunching:
Should fix #1505
2019-12-14 22:33:48 +01:00
Kornel c694980a94 Merge pull request #1522 from jakob/update-readme-2.x
Update README for Sparkle 2.x
2019-12-14 16:50:37 +00:00
Jakob 7c413a3da2 Make link clickable 2019-12-14 16:48:27 +01:00
Jakob b08e339a50 Add link to issue #1523 2019-12-14 16:46:54 +01:00
Jakob 91b6716f85 README: Update current status and add next steps 2019-12-14 16:19:48 +01:00
Jakob d7d567d5e2 README: Change title to "Sparkle 2.x Beta" 2019-12-14 16:08:49 +01:00
Jakob 4a82eb3d69 README: Fix link to issues 2019-12-14 16:01:40 +01:00
Martin Jan Köhler d9cce796cb Let SPUUpdaterDelegate handle errors currently suppressed (#1494)
* Let SPUUpdaterDelegate handle errors which are suppressed when calling the user driver
2019-10-31 00:30:00 +00:00
Kornel 67819be18a Merge pull request #1479 from ksuther/ui-separation-and-xpc
Added bsdiff as an explicit dependency to targets
2019-10-02 17:03:12 +01:00
Kent Sutherland 03d2ddc005 Added bsdiff as an explicit dependency to BinaryDelta and Sparkle Unit Tests targets 2019-10-01 20:06:27 -05:00
Kornel 1d6266e978 Merge pull request #1477 from ksuther/ui-separation-and-xpc
ui-separation-and-xpc branch fixes
2019-09-29 23:11:25 +01:00
Kent Sutherland 5de92bad8f Add bsdiff as an explicit dependency to Autoupdater to avoid errors if implicit dependencies is disabled 2019-09-29 00:14:49 -04:00
Kent Sutherland 3ad6b2b75b Add explicit casts to silence Xcode 11 warnings 2019-09-29 00:12:55 -04:00
Kornel 14871e5ee9 Merge pull request #1451 from mangerlahn/bugfix/cleanup-downloder-on-cancel
#1449 Fix ongoing download after the update has been cancelled
2019-08-08 22:24:59 +01:00
Max Langer f42aac7797 #1449 Fix ongoing download after the update has been cancelled 2019-08-07 23:43:46 +02:00
Kornel 3f978e865d Merge pull request #1430 from martinjbaker/patch-1
fixed incorrect syntax
2019-06-29 13:59:10 +01:00
martinjbaker c65fad6b53 fixed incorrect syntax
missing quotes on sparkle:installationType examples
2019-06-29 10:03:13 +01:00
Kornel 6fa1302ecb Merge pull request #1425 from DivineDominion/patch-1
Make XPC service prefix "org.sparkle-project" customizable
2019-06-26 20:50:52 +01:00
Christian Tietze 9980a0f911 replace org.sparkle-project with XPC_SERVICE_BUNDLE_ID_PREFIX 2019-06-26 09:25:15 +02:00
Kornel 696f1f7bf1 Merge pull request #1422 from tonyarnold/feature/bring-forward-bsdiff-static-library
Package bsdiff as a static library
2019-06-17 23:55:44 +01:00
Tony Arnold 9e4f395c97 Add Xcode 10’s workspace checks property list to the project 2019-06-16 21:31:16 +10:00
Tony Arnold e4020faae0 Rename “Third Party” Xcode group to “Vendor” to match underlying folder name 2019-06-16 19:50:25 +10:00
Tony Arnold 210a8fb165 Separate the bsdiff sources into a new static library, and use it in targets 2019-06-16 19:44:03 +10:00
Tony Arnold 3569b46d35 Fix localization region deprecation warnings 2019-05-20 11:22:39 +01:00
Kornel 2f9c721719 Merge pull request #1393 from FlixelPhotos/ui-separation-and-xpc
Update codesign script and INSTALL doc
2019-04-18 20:33:58 +01:00
Karl Moskowski 47b35a737a Update INSTALL document:
- updated codesign script
- hardened runtime and notarization
- testing notes
2019-04-18 08:48:47 -04:00
Karl Moskowski 6975392ed3 Upate the codesign script (since it’s for more than just XPCs)
#1319
2019-04-18 08:20:20 -04:00
Kornel 36f4955740 Merge pull request #1391 from michelf/hardened
Updated XPC codesigning to enable hardened runtime.
2019-04-16 19:34:46 +01:00
Martins Spilners 894f9dd683 Fix header imports (#1390)
Allows building Distribution scheme with Xcode 10.2
2019-04-16 16:49:23 +01:00
Michel Fortin dc819460a9 Updated XPC codesigning to enable hardened runtime. 2019-02-14 22:16:51 -05:00
Kornel b0fe9aa09a Merge pull request #1357 from danielpunkass/fix-framework-import-warnings
Update imports to use framework-style imports consistently
2019-02-04 23:14:41 +00:00
Daniel Jalkut ee64dc7574 Update imports to use framework-style imports to avoid warnings when CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES. Add CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to xcconfig file to protect against any changes that would introduce such warnings for clients who have the waring enabled. 2019-02-04 13:39:48 -05:00
Kornel b1c3b313f5 Merge pull request #1332 from ksuther/downloader-finishTasksAndInvalidate
Use finishTasksAndInvalidate instead of invalidateAndCancel in SPUDownloader
2018-12-14 19:18:04 +00:00
Kent Sutherland 01bc8628da Use finishTasksAndInvalidate instead of invalidateAndCancel
-cleanup is only called when the task has finished, so it's safe to do this.
This silences a spurious warning logged by NSURLSession (or somewhere else internal):

Task <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://example.com/appcast.xml, NSErrorFailingURLKey=https://example.com/appcast.xml, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDownloadTask <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1>, NSLocalizedDescription=cancelled} [-999]
2018-12-14 12:49:20 -06:00
Daniel Jalkut 2e1596c673 A recent merge with master caused the CLANG_WARN_COMMA warning to be enabled, which generates warnings in this ui-separation-and-xpc only file. I thought it would be safest to use #pragma clang diagnostic ignore to quiet the warnings without changing the source file in this file. (#1314) 2018-11-14 17:26:10 +00:00
Kornel 0a13dfab4a Workaround for Security.framework not supporting better keys 2018-11-13 13:39:32 +00:00
Daniel Jalkut 96eb45efdc Quiet a warning about a missing @synthesize for observingAppearance property. (#1312) 2018-11-11 15:42:30 +01:00
Kornel 1784fc1a72 Merge remote-tracking branch 'origin/ui-separation-and-xpc' into ui-separation-and-xpc
* origin/ui-separation-and-xpc:
  Fix unit tests (#1311)
2018-11-11 14:23:42 +00:00
Kornel 832902cea7 Merge tag '1.20.0' into ui-separation-and-xpc
* tag '1.20.0': (28 commits)
  Bump
  Fix binary delta creation on network drives
  New Spanish localisation
  Fix compilation issues on Xcode 10 with new build system
  Bump
  Updated readme to indicate that the 10.11 SDK is required to compile Xcode 7 was released with 10.11, the reference to the 10.8 SDK is out of date.
  Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings.
  Updated Finnish language resources
  Remove executable bit on distributed source files.
  Fix potential hang with dispatch_sync to main thread
  Deliver SPUDownloaderSession delegate messages on the main queue
  add tips for user to install doxygen
  add delegate callbacks for fininshed download and extraction related events
  Restored legacy CLI for backward compatibility
  Fixed index out of bounds
  More complex argument parsing to support both inputs
  Function to load the private key directly from the keychain
  Minor naming improvement
  Bump
  Explain why auth is requested
  ...
2018-11-11 14:21:37 +00:00
Kornel 2121a7d9f2 Merge tag '1.19.0' into ui-separation-and-xpc
* tag '1.19.0': (44 commits)
  Ensure cocoapods is installed before performing the release “sanity check” (#860)
  Silence ‘This block declaration is not a prototype’ Xcode warning
  Silence ‘decodeObjectOfClass:forKey: is only available on macOS 10.8’ Xcode warnings, similar to commit ea94969188
  10.7 compatibility
  Avoid invalid use of main thread
  Update wording of read-only error
  Improve 'read-only' error message (#1192)
  "all" target
  Hidden verbose flag
  Outdated comment
  Amend to avoid gender issue
  Changelog
  Bump
  move Xcode 9.2 automatic changes from project to xcconfig files
  Bring project up to Xcode 9.2 settings
  silence 10.9 availability and other warnings and use modules when available
  Ensure UI is changed only on the main thread
  nil checks
  Fix typo in expectation description
  Finish tests for persistent download
  ...
2018-11-11 14:18:07 +00:00
Daniel Jalkut ad0ea07252 Fix unit tests (#1311)
* Quiet warnings from Swift compiler: "Using '!' here is deprecated and will be removed in a future release"

* Ignore diagnostics that yield 'messaging unqualified id' warnings when calling XCTAssertNotEqualObjects. I have filed a bug with Apple, Radar #45968630, requesting that they quiet the warning internally to the macro implementation.

* When setting the access time on a directory and its contents, set the access time on the directory last so that it will be guaranteed to match the expected value. There is a side-effect of calling getFileSystemRepresentation that it sets the access time of its container folder, presumably because of an implementatiton detail of how Foundation builds up the path. Note there is another problem here that the order of items from NSDirectoryEnumerator is undefined, so some of the interior items of a directory will undoubtedly end up getting slightly varying access times set upon them. However, for the purposes of Sparkle's use of this method to "keep things alive" in /tmp, I don't think there is an issue. This fix addresses a failing unit test testUpdateFileAccessTime, which was failing because of very slight differences in access time created by the problem described.
2018-11-11 13:10:12 +01:00
Kornel 45d27cc5d0 Safety-check around observing appearance
#1307
2018-11-09 16:55:51 +01:00
Kornel 34e96171f3 Merge pull request #1306 from teologov/ui-separation-and-xpc-fix-make-release
Fix make release script.
2018-11-09 15:39:42 +00:00
Andrey Teologov b3fa1fc904 fixed make-release-package.sh failure 2018-11-09 08:20:30 +02:00
Kornel 3cb3eb55ec Merge pull request #1304 from danielpunkass/improved-install-instructions
Improved install instructions
2018-11-07 22:51:45 +00:00
Kornel bcb943a093 Merge pull request #1305 from danielpunkass/app-extension-safe-api
Define APPLICATION_EXTENSION_API_ONLY = NO
2018-11-07 22:50:22 +00:00
Daniel Jalkut be29f66ddd Define APPLICATION_EXTENSION_API_ONLY = NO. As long as we don't ourselves depend upon any Frameworks that are incompatible with Application Extensions, then we should allow frameworks that require compatibility to be able to link with us. 2018-11-07 17:38:37 -05:00
Daniel Jalkut 2f6587f5a6 Add a note in Usage to indicate additional configuration is required for Sandboxed apps. 2018-11-04 12:53:41 -05:00
Daniel Jalkut 01bacb9647 Another backwards-coded Markdown link. 2018-11-04 12:51:08 -05:00
Daniel Jalkut 75b7066a6e Add two other XPC services that seems to be required by most if not all sandboxed apps. I am not 100% sure I understand the role yet of these but as an instructional document this gets at the requirements in a way that is better than nothing. 2018-11-04 12:16:13 -05:00
Daniel Jalkut 5bf8730c6b I had the Markdown link backwards. 2018-11-04 12:11:36 -05:00
Daniel Jalkut 05393a8223 Trying to fix links 2018-11-04 12:10:50 -05:00
Daniel Jalkut 8f65c07a1a Remove links to the zorgiepoo issues database because zorgiepoo indicated surprise about people still coming there, and because issues are being tracked in the main repository's issues. 2018-11-04 12:07:53 -05:00
Daniel Jalkut fbbb44bf73 Add links to the INSTALL document to make it easier to access. 2018-11-02 15:38:08 -04:00
Daniel Jalkut 9b960233ca Taking a stab at rewriting some of the instructional content to be more clearly understood by folks just getting familiar with the XPC version of the project. Removed the 'Requirements' section because it's out of date with the README and doesn't need to be listed redundantly. 2018-11-02 13:34:06 -04:00
Daniel Jalkut 9e67ef244b Change to Markdown style headings. 2018-11-02 13:12:48 -04:00
Daniel Jalkut 43b5382daf Rename INSTALL to INSTALL.markdown so it will present as a readable file on GitHub. 2018-11-02 13:09:57 -04:00
Kornel dbcdd76da2 Merge pull request #1294 from michelf/ui-separation-and-xpc
releaseNotesView must be strong if we attach an observer to it
2018-10-09 08:57:09 +01:00
Michel Fortin b9328cc466 releaseNotesView must be strong if since we're attaching an observer to it. 2018-10-08 15:25:20 -04:00
Kornel 8ba29aa40d Merge pull request #1293 from ksuther/effectiveAppearance-observation
Only observe effectiveAppearance on 10.14 or later
2018-10-08 18:59:23 +01:00
Kent Sutherland 467325bc21 Only observe effectiveAppearance on 10.14 or later
Observing WebView is crashing on 10.12 when SUUpdateAlert gets released even though removeObserver is called in dealloc
2018-10-08 11:10:53 -05:00
Kornel 7e351b52c7 Merge pull request #1288 from michelf/ui-separation-and-xpc
Dark Mode Release Notes Complement
2018-09-15 18:56:27 +01:00
Michel Fortin 20d5b4e003 Setting darkBackgroundView to nil when adapting for light mode so it gets recreated later if we re-enter dark mode. 2018-09-15 09:59:47 -04:00
Michel Fortin 077e2b155f Avoid checking appearance by name, use bestMatchFromAppearancesWithNames for future-proofing. 2018-09-15 09:47:37 -04:00
Michel Fortin 3ed5f3875b React to effective appearance changing. 2018-09-15 09:45:54 -04:00
Kornel 34fe3b52ff Merge pull request #1281 from michelf/ui-separation-and-xpc-prompt-fr
Fixing cut text in prompt window (French)
2018-08-27 10:36:25 +01:00
Michel Fortin 6daa5e152b Adjusting French text above the system profile table view so it fits. 2018-08-26 19:04:21 -04:00
Michel Fortin e6d9a01316 The "include anonymous system profile" checkbox is not wide enough for its French content. 2018-08-26 18:51:38 -04:00
Kornel 502378553e Merge pull request #1280 from michelf/ui-separation-and-xpc-darkmode
Showing release notes with dark appearance according to the system theme
2018-08-26 23:13:29 +01:00
Michel Fortin 64eb13672d Showing release notes with dark appearance according to the system theme.
This is done by applying a user stylesheet, making the background of the WebView transparent, and using a NSBox to display the dynamic dark background color. The appearance of the release notes will unfortunately not adapt if the theme is changed while the release notes window is open.
2018-08-26 11:51:10 -04:00
Kornel e40628a78f Merge pull request #1273 from rob-patchett/ui-separation-and-xpc
Adds an option to turn off hideOnDeactivate in SPUStandardUserDriver for foreground apps
2018-07-25 14:11:56 +01:00
Robert Patchett a8528a256b Add an option to turn off hideOnDeactivate in SPUStandardUserDriver for forground apps 2018-07-25 14:46:37 +02:00
Kornel e1d4b19ce7 Bump 2018-07-17 16:37:50 +01:00
sagecook 360c2ce7a9 Fix binary delta creation on network drives
Closes  #1156
2018-07-17 16:33:58 +01:00
Kornel f9740292d4 Merge pull request #1261 from kenohori/master
New Spanish localisation
2018-06-28 12:55:05 +02:00
Ken Arroyo Ohori 558be04121 New Spanish localisation 2018-06-27 21:22:56 -05:00
Kornel b426426905 Merge pull request #1257 from LeoNatan/master
Fix compilation issues on Xcode 10 with new build system
2018-06-20 16:04:39 +01:00
Leo Natan 75835a5874 Fix compilation issues on Xcode 10 with new build system 2018-06-20 15:29:50 +03:00
Kornel 50c12d1c2b Bump 2018-06-19 22:36:19 +01:00
Kornel cc94d66994 Merge pull request #1252 from ksuther/ui-separation-and-xpc
Silence Xcode 10 "Messaging unqualified id" warnings by specifying types (XPC branch)
2018-06-14 23:26:09 +03:00
Kent Sutherland 4bcaee7213 Updated readme to indicate Xcode 7 or later is required. 2018-06-14 21:22:39 +02:00
Kent Sutherland d574574345 Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10.
Removed __has_feature(objc_generics) check and use generisc to help silence the warnings.
2018-06-14 21:22:38 +02:00
Kornel e452b7f6ba Merge pull request #1251 from ksuther/objc-messaging-id-fixes
Silence Xcode 10 "Messaging unqualified id" warnings by specifying types
2018-06-14 21:56:05 +03:00
Kent Sutherland 3034eca85b Updated readme to indicate that the 10.11 SDK is required to compile
Xcode 7 was released with 10.11, the reference to the 10.8 SDK is out of date.
2018-06-14 20:31:58 +02:00
Kent Sutherland 9ae41fe4ab Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10.
Removed __has_feature(objc_generics) check and use generisc to help silence the warnings.
2018-06-14 20:31:20 +02:00
Kornel 7d931e22d7 Merge pull request #1249 from JasonLPollack/update-finnish
Updated Finnish language resources
2018-06-14 18:57:56 +03:00
Jason Pollack b303ee312b Updated Finnish language resources 2018-06-14 10:05:31 -04:00
Kornel d19c98a877 Merge pull request #1245 from grahammiln/master
Remove executable bit on distributed source files.
2018-06-04 12:32:30 +01:00
Graham Miln 7a4caad5fe Remove executable bit on distributed source files. 2018-06-04 08:27:05 +02:00
Kornel 89ce79488c Merge pull request #1238 from aonez/aone-ui-separation-and-xpc
Download process string updated to match master
2018-05-28 11:17:02 +01:00
aone b3ecc89f11 Download process string updated to match master 2018-05-28 10:09:05 +02:00
Kornel 8f546c93f4 Merge pull request #1237 from ProsoftEngineering/spudownloadersession-main
#1236: SPUDownloaderSession main thread
2018-05-25 22:04:08 +01:00
Brian Bergstrand 1c4bcda012 Fix potential hang with dispatch_sync to main thread 2018-05-25 14:32:57 -05:00
Brian Bergstrand a18282ec79 Deliver SPUDownloaderSession delegate messages on the main queue
This is the behavior of SPDownloaderDeprecated.

Github #1236
2018-05-25 14:32:57 -05:00
Kornel 8a8ce49a23 Merge pull request #1235 from sunwenli/sunwenli
add tips for user to install doxygen
2018-05-25 12:22:32 +01:00
sunwenli 2561af8270 add tips for user to install doxygen 2018-05-25 17:12:11 +08:00
Kornel 035ad6a277 Merge pull request #1234 from horcs/add-delegate-callback-to-track-update-events
delegate callbacks for fininshed download and extraction related events
2018-05-22 17:08:25 +01:00
Csaba Horony 9cbae0edb6 add delegate callbacks for fininshed download and extraction related events 2018-05-22 10:07:50 +02:00
Kornel 3bbf84e332 Merge pull request #1230 from tamasprezi/private-key-from-keychain
Support for getting the private key from keychain for signing deltas
2018-05-13 23:22:14 +01:00
Tamás Lustyik a582d46096 Restored legacy CLI for backward compatibility 2018-05-13 21:33:03 +02:00
Tamás Lustyik 3f3ace055d Fixed index out of bounds 2018-05-13 17:28:29 +02:00
Tamás Lustyik 886e4b2c81 More complex argument parsing to support both inputs 2018-05-13 16:28:05 +02:00
Tamás Lustyik a418d8fe64 Function to load the private key directly from the keychain 2018-05-13 16:04:48 +02:00
Tamás Lustyik b48e80aa27 Minor naming improvement 2018-05-13 15:50:46 +02:00
Kornel a19dfb2be0 Bump 2018-04-29 13:36:22 +01:00
Kornel 7394593743 Explain why auth is requested
It can't be SULog, because it's not linked in tool using SUFileManager
2018-04-29 13:34:28 +01:00
Kornel 4973c0143f Whitespace 2018-04-29 13:34:06 +01:00
Kornel c171f381d4 Merge pull request #1222 from zyves72/master
French translation for critical update
2018-04-26 14:39:02 +01:00
zyves72 dde4a0aae2 Add files via upload
Translation
2018-04-26 14:53:59 +02:00
Kornel d5a1ba44ff Don't check for updates if Do Not Disturb is on 2018-04-24 04:20:51 +01:00
Kornel 0d03b4006d Merge pull request #1216 from mallexxx/master
Fix closeCheckingWindow called from background thread
2018-04-20 16:33:12 +01:00
Alexey Martemyanov 25993d0776 Fix closeCheckingWindow called from background thread 2018-04-20 22:22:16 +07:00
Kornel 276707b3da Merge pull request #1212 from sunuslee/master
expose CodesigningVerifier, add codesign info api
2018-04-17 17:51:24 +01:00
Kornel 23e88737ec Merge pull request #1211 from horcs/hungarian-localization
Hungarian localization
2018-04-16 20:54:34 +01:00
Csaba Horony d400a53ebd add missing hungarian translation 2018-04-16 13:40:34 +02:00
sunuslee f39b07fd59 expose CodesigningVerifier, add codesign info api
Signed-off-by: sunuslee <sunuslee@gmail.com>
2018-04-16 10:08:31 +08:00
Csaba Horony 5bc8f3e535 Hungarian localization 2018-04-13 10:56:17 +02:00
Csaba Horony 503a292084 added localization files for Hungarian translation 2018-04-13 10:55:50 +02:00
Karl Moskowski d60b16f633 Ensure cocoapods is installed before performing the release “sanity check” (#860) 2018-04-06 01:35:34 +01:00
Kornel de3e73b589 Merge pull request #1201 from DaveWoodCom/master
Silence some Xcode warnings
2018-03-26 12:32:08 +01:00
Dave Wood ad863775db Silence ‘This block declaration is not a prototype’ Xcode warning 2018-03-25 23:05:37 -04:00
Dave Wood 79511c982a Silence ‘decodeObjectOfClass:forKey: is only available on macOS 10.8’ Xcode warnings, similar to commit ea94969188 2018-03-25 23:05:25 -04:00
Kornel 189ed9d315 Merge pull request #1172 from nivekkagicom/fix_warnings
silence 10.9 availability and other warnings and use modules when available
2018-03-19 20:11:27 +00:00
Kornel ea94969188 10.7 compatibility 2018-03-18 13:52:13 +00:00
Kornel 57731f44d7 Avoid invalid use of main thread
Fixes #1189
2018-03-18 13:41:08 +00:00
Kornel 2a0514c93b Update wording of read-only error 2018-03-18 13:37:46 +00:00
Adrian Thomas 467e1495c0 Improve 'read-only' error message (#1192)
* Improver read-only error message German

Updated the "read-only volume" error to reflect the real-world scenarios users run into.
It's almost never a CD, it's nearly always running from ~/Downloads or the .dmg if you still ship your app that way.
2018-03-18 13:34:19 +00:00
Kornel Lesiński 8ac254951a "all" target 2018-03-18 13:27:56 +00:00
Kornel c83c9221f7 Hidden verbose flag 2018-03-18 13:27:45 +00:00
Kornel b46315df9c Outdated comment 2018-03-18 13:27:43 +00:00
Kornel 67320fcb80 Merge pull request #1184 from ksuther/downloadSession-leak
Fixed SPUDownloader leak
2018-02-15 23:07:30 -08:00
Kent Sutherland 3bf3096369 Fixed SPUDownloader getting leaked because the NSURLSession wasn't being invalidated 2018-02-15 22:52:20 -06:00
Kornel 6cd66a4db9 Merge pull request #1183 from charlieMonroe/patch-1
Fixing build error when some enclosing folder contains a space.
2018-02-15 09:15:03 -08:00
charlieMonroe 3fd5e2315b Fixing build error when some enclosing folder contains a space.
I personally have my projects on iCloud Drive which contains a space in the path (`~/Library/Mobile Documents/...`) and the build fails running these two scripts.
2018-02-15 09:53:55 +01:00
Kornel 9c505dee2f Merge pull request #1181 from vitu/master
Amend to avoid gender issue
2018-02-02 17:22:50 +00:00
BR Lingo 2ed7402367 Amend to avoid gender issue
Amend to avoid gender issue

Victor committed
a01979c
1 changed file
Instead of addressing the user, which might cause gender issues, string has been adapted to include “app” (masculine, in accordance with Apple's terminology).

Would translate back as “The app is up-to-date!”
2018-02-02 10:51:47 -05:00
Kornel 3afa47b092 Changelog 2018-01-29 23:03:33 +00:00
Kornel 874d6bce36 Bump 2018-01-29 22:55:32 +00:00
B. Kevin Hardman 51a335b3fd move Xcode 9.2 automatic changes from project to xcconfig files 2018-01-18 11:19:50 -05:00
B. Kevin Hardman 578bb9ecb8 Bring project up to Xcode 9.2 settings 2018-01-18 08:02:18 -05:00
B. Kevin Hardman 76e8838eb3 silence 10.9 availability and other warnings and use modules when available 2018-01-18 07:37:26 -05:00
Kornel 0a101b7902 Merge pull request #1167 from sparkle-project/mainthread
Ensure UI is changed only on the main thread
2018-01-09 00:18:36 +00:00
Kornel 0093e2f1c9 Merge pull request #1170 from kolpanic/ui-separation-and-xpc
Check if cocoapods is installed
2018-01-04 18:18:08 +00:00
Karl Moskowski 17fc6dbe89 Ensure cocoapods is installed before performing the release “sanity check” (#860) 2018-01-04 09:03:59 -05:00
Kornel 865dd2e187 Ensure UI is changed only on the main thread 2017-12-29 19:27:56 +00:00
Kornel 083bd9b453 nil checks 2017-12-29 19:26:56 +00:00
Kornel b48bc4dcac Merge pull request #1165 from Deadpikle/feature/spudownloader
[WIP] Port SPUDownloader to 1.x w/NSURLSession & NSURLDownload
2017-12-29 17:47:45 +00:00
Deadpikle bb6203f40a Fix typo in expectation description 2017-12-28 22:41:22 -05:00
Deadpikle 25204a66e0 Finish tests for persistent download 2017-12-28 22:35:27 -05:00
Deadpikle c886947f55 Set NSOperationQueue op count to 1 2017-12-28 22:34:43 -05:00
Deadpikle f0460033ba Remove commented out code 2017-12-28 21:58:42 -05:00
Deadpikle 1a71456ed9 Slight refactor of temp download test 2017-12-28 21:50:46 -05:00
Deadpikle e7cdbfc45e Add tests for temp SPUDownloader dl 2017-12-28 21:40:31 -05:00
Deadpikle 8b5c8b5cdf Fix SUAppcast tests 2017-12-28 15:52:47 -05:00
Deadpikle a7af48f0d1 Refactor cache clearing & errors to super 2017-12-24 09:38:04 -05:00
Deadpikle 03e28780d9 Fix AppKitPrevention not being included 2017-12-21 09:35:06 -05:00
Deadpikle 5b1c76db26 Fix a few header comments 2017-12-20 13:22:47 -05:00
Deadpikle 703e611eb5 Remove a bunch of warnings 2017-12-20 13:01:44 -05:00
Deadpikle 6ee88124ad SUAppcast now uses SPUDownloader 2017-12-20 12:58:45 -05:00
Deadpikle 1cc5f230a5 Check OS version before creating downloader 2017-12-20 12:40:48 -05:00
Deadpikle 429f950434 Only send back error if non-nil 2017-12-20 12:40:37 -05:00
Deadpikle 7df50ccfd3 Download path should be full path 2017-12-20 12:25:42 -05:00
Deadpikle 9c301bfbf3 Drivers now use SPUDownloader 2017-12-20 12:11:49 -05:00
Deadpikle 8a0474d644 Continue refactor of downloader to two classes 2017-12-20 11:43:13 -05:00
Deadpikle dc85d63861 Refactor download NSURLSession to a child class 2017-12-20 11:14:02 -05:00
Deadpikle dc8e8b775a Remove unnecessary delegate name in header 2017-12-20 11:13:41 -05:00
Deadpikle ecb608bb40 Bring 2.0 files for SPUDownloader to 1.x 2017-12-20 10:48:51 -05:00
Kornel ad506261ee Merge pull request #1162 from ksuther/synthesize-warning
Fixed an auto-synthesis warning
2017-12-10 19:14:09 +00:00
Kent Sutherland 1e31d849f5 Fixed an auto-synthesis warning 2017-12-10 13:02:48 -06:00
Kornel e30d1b9f68 Merge pull request #1161 from ksuther/sign-with-hyphen
Run codesign when signing identity is a hyphen
2017-12-08 17:51:27 +00:00
Kent Sutherland 3ec3d6f2af Run codesign when signing identity is set to "-"
This creates an adhoc signature rather than not signing
2017-12-08 11:42:58 -06:00
Kornel abb6e28a9f Merge pull request #1160 from ksuther/shell-script-fixes
Shell script fixes
2017-12-08 01:09:50 +00:00
Kent Sutherland f42ceec378 Check for a signing identity of "-" when building Sparkle Test App 2017-12-07 19:07:02 -06:00
Kent Sutherland 4565467287 Shell script fixes (warnings flagged by shellcheck)
Don't call codesign in set-agent-signing if the identity is "-"
2017-12-07 17:32:28 -06:00
Kornel 8b47c5db71 Fixed target variable 2017-12-06 17:46:00 +00:00
Kornel c3e546d7f8 Merge pull request #1154 from 1024jp/updateJapanese
Update Japanese localization
2017-11-25 13:50:32 +00:00
1024jp 2477a92b0f Update Japanese localization 2017-11-25 15:34:15 +09:00
Kornel 7f0bc6a244 Merge pull request #1141 from stefanhp/patch-1
Update Sparkle.strings
2017-10-21 22:28:44 +01:00
Stefan Paychère 68f62e5955 Update Sparkle.strings
Translation of "Description text for SUUpdateAlert when the update informational with no download."
2017-10-21 20:29:51 +02:00
Kornel 0cb0b2f2c7 Update for newer OpenSSL 2017-10-10 12:26:01 +01:00
Kornel b590722aad Merge pull request #1135 from jkbullard/fix-frequent-polling
Fix #1061 & #835: Sparkle clients polling too frequently
2017-10-05 15:43:24 +01:00
Jonathan Bullard 10f831fce8 Move [NSDate date] to be after willChangeValueForKey
Per comment by Pornel
2017-10-05 09:36:31 -04:00
Jonathan Bullard a2ecdd2744 Fix #1061 & #835: Sparkle clients polling too frequently
The SULastCheckTimeKey preference (a/k/a "default"), which is stored
in ~/Library/Preferences/….plist, was used to store the date of the
last update check.

That causes a problem if the storage is read-only (for example, if the
.plist file is “locked” (has the uchg or schg flag set) or if the
SULastCheckTimeKey key "exists in a domain that precedes the
application domain the search list"). The date would never be modified,
and the old date would cause a new update check to be queued at the end
of an update check. If application or bundle was up-to-date, or the
user had chosen to skip the update that was available, this would cause
update checks to happen as often as the computer and network would
allow, many times each second.

The new code uses an instance variable to store the value. The variable
is initially loaded from the “SULastCheckTimeKey” preference, and each
time the variable is modified its new value is stored to that
preference. However, the variable, not the preference, is used when
calculating whether enough time has passed since the last update check
to warrant another check. The variable will always (after the first
update check) have the "correct" value, and update checks will not be
done more frequently than desired.
2017-10-05 08:57:04 -04:00
Kornel 30ab76da03 Merge pull request #1134 from ProsoftEngineering/NSURLSession
Replace NSURLDownload with NSURLSession
2017-10-04 20:38:23 +01:00
Brian Bergstrand a3cc5f8b5d Replace NSURLDownload with NSURLSessionDownloadTask 2017-10-04 12:52:47 -05:00
Brian Bergstrand 218315ffce Bump min OS version for NSURLSession requirement 2017-10-04 12:49:35 -05:00
Kornel ec7f55d173 Handle SecTransformExecute errors
Fixes #1129
2017-09-27 18:45:52 +02:00
Kornel 648f8c960d Merge pull request #1128 from ksuther/ui-separation-and-xpc
Merged master into ui-separation-and-xpc
2017-09-19 19:36:10 +01:00
Kent Sutherland 4c27d7bf73 Merge branch 'master' into ui-separation-and-xpc 2017-09-18 22:39:17 -05:00
Kornel ddfc4089d2 Merge pull request #1126 from ksuther/touchbar-warnings
Silence Touch Bar availability warnings on Xcode 9
2017-09-18 23:06:08 +01:00
Kornel d41c8b3e60 Merge pull request #1127 from ksuther/xcode9-warning
Silence Xcode 9 warning
2017-09-18 23:05:31 +01:00
Kent Sutherland 5aea901ab6 Silence Xcode 9 warning 2017-09-18 12:21:57 -05:00
Kent Sutherland 80c34526e8 Silence Touch Bar availability warnings on Xcode 9 by using API_AVAILABLE.
Disable gnu-zero-variadic-macro-arguments to prevent warnings from use of API_AVAILABLE.
2017-09-18 12:17:58 -05:00
Kornel 0c3994c571 Merge pull request #1124 from dfuhrmann/xcode-7-macOS-10.11-compatibility
Restore Xcode 7 and macOS 10.11 SDK compatibility
2017-09-11 14:19:31 +01:00
David Fuhrmann fbda90ad64 Sparkle: Convert all xib files to Xcode 7 format
Only this format can be opened with Xcode 7. The previously used
Xcode 8 format only opens and compiles with Xcode 8.
2017-09-11 11:24:10 +02:00
David Fuhrmann 40750b6f24 Sparkle: Add 10.11 SDK compatibility for touch bar declarations
Those annotations are not available in 10.11 SDK yet.
2017-09-11 11:23:48 +02:00
David Fuhrmann a7ba0bea6e Sparkle: Add backwards compatibility with 10.11 SDK for logging
10.11 SDK does not contain the os_log API yet. Code is modified
in such a way that it compiles with older SDKs, and falls back
to the old implementation even if it runs on 10.12.
2017-09-11 11:22:27 +02:00
Kornel 08f19f0330 Merge pull request #1120 from ksuther/fix-scheduled-includesSkippedUpdates
Fix for Skip This Updates button not working in XPC branch
2017-08-16 23:43:00 +01:00
Kent Sutherland 618fd6e85a includesSkippedUpdates was set to YES in SPUScheduledUpdateDriver
This was causing the Skip This Version button to not work when a background update check ran.
This was introduced in 47f08be1a.
2017-08-16 12:17:01 -04:00
Kornel 7b3c3b7e58 Merge remote-tracking branch 'origin/master' into ui-separation-and-xpc
* origin/master: (21 commits)
  Bump
  Update Xcode version for Travis CI
  Fix for the timing issue of termination detection.
  Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115)
  Better error message
  Warning
  Update to Xcode 9/Swift 4
  Revert "Ensure UI code always runs on the main thread"
  Update German localization with some terminology changes
  Update German localization for informal style
  Update Dutch localization for informal style
  Update Dutch localization with some style changes
  Include bin files in CocoaPods installation
  Simplified check
  Rename OSX macOS
  [BasicUpdateDriver] - extend hostSupportsItem method to also check the sparkle:os attribute from the enclosure element to decide if an update item is valid for the host
  [AppcastItem] - parse and save the sparkle:os attribute of the enclosure element and add isOsxUpdate method to item class
  Updated Japanese translation to reflect change on 55be13c
  Updated translation to reflect change on “Update error message to mention temp folders rather than optical drives”.
  Changelog
  ...
2017-08-14 13:38:16 +01:00
Kornel 558cfd2153 Bump 2017-08-14 13:19:03 +01:00
Kornel 94074e2bdc Merge pull request #1111 from sparkle-project/swift4
Update to Xcode 9/Swift 4
2017-08-14 13:02:21 +01:00
Kornel 56065fcf95 Merge pull request #1119 from 1024jp/patch-1
Update Xcode version for Travis CI
2017-08-14 12:46:30 +01:00
1024jp f24189e848 Update Xcode version for Travis CI 2017-08-14 18:05:49 +09:00
Kornel 65b12a2be1 Merge pull request #1116 from fujisoft/patch-3
Workaround for timing issue of termination detection.

Not sure if that is correct.
2017-08-11 19:03:05 +01:00
Kornel f27416c97c Merge pull request #1117 from mentalfaculty/studies
Added a timer invalidation in a asynchronous callback.
2017-08-10 13:45:18 +01:00
Drew McCormack ab942fa9b7 Added a timer invalidation in a asynchronous callback.
The scheduleNextUpdateCheckFiringImmediately: method includes an asynchronous callback. It invalidates the timer before invoking the method with the callback (retrieveNextUpdateCheckInterval:), but doesn’t not invalidate again inside the callback block.

The problem with this is that it is possible the timer is started during the delay. In release versions of an app, crashes have been seen due to an assertion that the NSTimer be nil when scheduling.

The proposed fix is to invalidate the timer in the callback, ensuring the NSTimer is nil before scheduling.
2017-08-10 10:19:01 +02:00
fujisoft 900de556a8 Fix for the timing issue of termination detection. 2017-08-08 11:12:47 +09:00
App Tyrant 7c8ff2b969 Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115)
* Added updaterDidRelaunchApplication: delegate method.

* Removed isUpdaterRelaunching property.

* Revert SUHost.
2017-08-08 00:21:51 +01:00
Kornel 43b4472d3c Better error message 2017-08-01 15:55:25 +01:00
Kornel 260170f372 Warning 2017-08-01 15:54:52 +01:00
Kornel ea85fc6442 Update to Xcode 9/Swift 4 2017-07-27 16:42:44 +01:00
Kornel a52604a264 Revert "Ensure UI code always runs on the main thread"
This reverts commit 423ee5a9d6.
2017-07-20 13:20:20 +01:00
Kornel 39d6c616b0 Merge pull request #1051 from sparkle-project/mainalert
Ensure UI code always runs on the main thread
2017-07-16 21:03:20 +01:00
Kornel 043ad0464a Merge pull request #1098 from Eitot/dutch
Update Dutch localization for informal style and changed terminology
2017-06-24 22:19:09 +01:00
Kornel d99339cf08 Merge pull request #1097 from Eitot/german
Update German localization for informal style and changed terminology
2017-06-24 22:11:16 +01:00
Eitot c541f95036 Update German localization with some terminology changes
Apple uses the term "Update" instead of "Aktualisierung" and
"laden" instead of "herunterladen".
2017-06-23 10:00:05 +02:00
Eitot e678ffb3ca Update German localization for informal style
This is the style in Apple's localizations in macOS Sierra.
Also makes some slight changes to wording.
2017-06-23 09:59:48 +02:00
Eitot 070ea362a2 Update Dutch localization for informal style
This is the style in Apple's localizations in macOS Sierra.
2017-06-23 09:57:55 +02:00
Eitot c4db636d0b Update Dutch localization with some style changes
This reflects Apple's localizations a bit better.
2017-06-23 09:57:49 +02:00
Kornel 7e9f05865a Merge pull request #1094 from keith/ks/cocoapods-bin
Include bin files in CocoaPods installation
2017-06-19 10:24:38 +01:00
Keith Smiley 3c14c950ef Include bin files in CocoaPods installation
This updates the podspec to include the bin scripts in Pods directory
when using CocoaPods. This way users don't also have to download the
Sparkle repo out of band to sign releases.
2017-06-18 20:33:24 -07:00
Kornel c3c2e51a08 Merge pull request #1091 from ksuther/remove-unused-function
Remove unused escapeURLComponent
2017-06-10 23:38:38 +01:00
Kent Sutherland d11eb126a1 Remove unused escapeURLComponent 2017-06-10 17:29:07 -05:00
Kornel fa7235c54e Merge pull request #1090 from ksuther/init-for-spustandardupdatercontroller
Added initWithUpdaterDelegate:userDriverDelegate: to SPUStandardUpdaterController
2017-06-09 23:32:00 +01:00
Kent Sutherland ed1e6031b6 Added initWithUpdaterDelegate:userDriverDelegate: to SPUStandardUpdaterController 2017-06-09 12:26:18 -05:00
Kornel 4438b69b50 Simplified check 2017-06-07 23:56:45 +01:00
Kornel 6d0c734c26 Rename OSX macOS 2017-06-07 23:55:34 +01:00
Kornel e8805e0563 Merge pull request #1089 from Memphiz/add_osx_attribute
Add support for the sparkle:os attribute in the enclosure tag
2017-06-07 23:51:10 +01:00
Memphiz 193036b2c4 [BasicUpdateDriver] - extend hostSupportsItem method to also check the sparkle:os attribute from the enclosure element to decide if an update item is valid for the host 2017-06-07 22:11:08 +02:00
Memphiz 33bf6732ea [AppcastItem] - parse and save the sparkle:os attribute of the enclosure element and add isOsxUpdate method to item class 2017-06-07 22:10:56 +02:00
Kornel e94fb63ff0 Merge pull request #1087 from 1024jp/japanese
Updated Japanese translation to reflect change on 55be13c
2017-06-04 15:12:32 +01:00
Kornel 84e5925578 Merge pull request #1086 from vitu/master
Updated translation to reflect change on 55be13c
2017-06-04 15:11:51 +01:00
1024jp bb83e9a0da Updated Japanese translation to reflect change on 55be13c 2017-06-04 10:55:45 +09:00
Victor 26d4d75c36 Updated translation to reflect change on “Update error message to mention temp folders rather than optical drives”. 2017-06-03 20:23:14 -04:00
Kornel fe5737f0b6 Changelog 2017-06-02 12:21:08 +01:00
Kornel 7fc20434b9 Merge remote-tracking branch 'origin/master' into ui-separation-and-xpc
* origin/master:
  Don't assume that the progress block exists (the parameter is nullable)
  Prepend app name to Autoupdate.app name
  Error message tweak
  Update error message to mention temp folders rather than optical drives
  1.18.0
  Log more errors
  Unify handling of aborted updates
2017-06-02 12:07:36 +01:00
Kornel ac49a3b5b6 Merge pull request #1081 from sparkle-project/autoname
Prepend app name to Autoupdate.app name
2017-06-02 12:01:22 +01:00
Kornel cbeaeb29ec Merge pull request #1084 from ksuther/nil-progress-block
Don't assume that the progress block exists (the parameter is nullable)
2017-06-02 04:14:22 +01:00
Kent Sutherland d0a6c699da Don't assume that the progress block exists (the parameter is nullable) 2017-06-01 16:55:52 -05:00
Kornel 84b7e5e22f Prepend app name to Autoupdate.app name 2017-05-27 11:38:19 +01:00
Kornel 61774b3f7d Error message tweak 2017-05-27 11:37:06 +01:00
Kornel 55be13ca6f Update error message to mention temp folders rather than optical drives
Finder is required to remove quarantine from downloaded apps
2017-05-20 17:09:56 +01:00
Kornel fc48e5e4df 1.18.0 2017-05-18 21:54:56 +01:00
Kornel bfada07a2c Log more errors 2017-05-18 21:48:51 +01:00
Kornel 4f965660f3 Merge pull request #1072 from sparkle-project/autoerror
Unify handling of aborted updates
2017-05-03 16:51:06 +01:00
Kornel a2764158d6 Unify handling of aborted updates 2017-05-03 12:34:28 +01:00
Kornel 415b4fe164 Merge commit '60727bffa53ebfbfaf701575904847827bc1656a' into ui-separation-and-xpc
* commit '60727bffa53ebfbfaf701575904847827bc1656a':
  Log key read failure
  Formatting
  Escape + as well
  Escape profile URLs better
  Special case for .tar.gz extension
  Inline release notes if they don't look like a standalone HTML document
  Simplify release notes link check
  Feed formatting
2017-04-24 18:10:35 +01:00
Kornel 60727bffa5 Log key read failure 2017-04-24 18:05:13 +01:00
Kornel 715163fe0d Formatting 2017-04-24 18:05:13 +01:00
Kornel 629c42d62d Merge pull request #1050 from sparkle-project/genapp
generate_appcast improvements
2017-04-14 21:28:07 +02:00
Kornel 3e45211bbe Escape + as well 2017-03-31 15:15:22 +01:00
Kornel 89acca1318 Escape profile URLs better
Fixes #1059
2017-03-31 11:08:03 +01:00
Kornel Lesiński 2d30762570 Merge remote-tracking branch 'origin/master' into ui-separation-and-xpc
* origin/master: (39 commits)
  %s is deliberate in this format string
  Unused
  Make generate_appcast available as a shared scheme
  Shush Xcode
  Link straight to docs from the readme
  ignore .html files when scanning for archives
  Missing strings translation.
  Updated swift
  Warn against abusing installUpdatesIfAvailable
  when generating the appcast, if an .html file exists of the same name as the archive, then it will be linked in as the releaseNotesLink
  Revert "Fix pt_BR translations"
  Revert "Fix pt_BR translations (#1039)"
  Fix Japanse localization
  Add more info to auth tool run failure
  Fix pt_BR translations (#1039)
  Fix pt_BR translations
  Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs.
  added `sparkle:shortVersionString` to the enclosure, #1032
  Changelog
  percent encode the filename used in the delta url
  ...
2017-03-24 12:14:05 +00:00
Kornel Lesiński 4bc2e6e891 %s is deliberate in this format string
Fixes #1053
2017-03-24 12:00:12 +00:00
Kornel Lesiński 405c9fd9a1 Unused 2017-03-24 12:00:12 +00:00
Kornel 9232316b19 Merge pull request #1052 from sparkle-project/scheme
Make generate_appcast available as a shared scheme
2017-03-24 11:05:33 +00:00
Kornel Lesiński 0569c73391 Make generate_appcast available as a shared scheme
#1049
2017-03-17 09:27:00 +00:00
Kornel Lesiński 423ee5a9d6 Ensure UI code always runs on the main thread 2017-03-15 21:31:11 +00:00
Kornel Lesiński ac042821d8 Special case for .tar.gz extension 2017-03-15 18:42:08 +00:00
Kornel Lesiński 36139c57bc Shush Xcode 2017-03-15 18:42:08 +00:00
Kornel Lesiński 662e84400a Inline release notes if they don't look like a standalone HTML document 2017-03-15 18:42:08 +00:00
Kornel Lesiński b6b5c6d927 Link straight to docs from the readme 2017-03-15 18:42:08 +00:00
Kornel Lesiński 1683d2de34 Simplify release notes link check 2017-03-15 18:42:08 +00:00
Kornel Lesiński 615a08bc32 Feed formatting 2017-03-15 18:42:08 +00:00
Kornel c7bf998913 Merge pull request #1016 from sparkle-project/installprogress
Report installation progress from Installer
2017-03-12 14:39:43 +00:00
Kornel 1dd9d93090 Merge pull request #1046 from digitalmoksha/master
generate_appcast: if an .html file exists of the same name, create the releaseNotesLink
2017-03-11 11:31:58 +00:00
Brett Walker ac8c37096e ignore .html files when scanning for archives 2017-03-11 12:09:53 +01:00
Kornel c86e825a5f Merge pull request #1048 from vitu/master
Missing strings translation.
2017-03-09 17:03:57 +00:00
vitu 40a777f5d9 Missing strings translation. 2017-03-09 11:58:52 -05:00
Kornel Lesiński 3098afc90b Updated swift 2017-03-09 13:32:05 +00:00
Kornel Lesiński 3809da20bf Warn against abusing installUpdatesIfAvailable 2017-03-09 13:13:29 +00:00
Brett Walker c623480f72 when generating the appcast, if an .html file exists of the same name as
the archive, then it will be linked in as the releaseNotesLink
2017-03-08 10:57:59 +01:00
Kornel Lesiński 72ee4aa2c6 Revert "Fix pt_BR translations"
This reverts commit 83195a802e.
2017-03-08 00:36:46 +00:00
Kornel Lesiński e160f994b4 Revert "Fix pt_BR translations (#1039)"
This reverts commit 3b04c45ee9.
2017-03-08 00:36:40 +00:00
Kornel e7810c970b Merge pull request #1044 from 1024jp/fixJapanese
Fix Japanse localization
2017-03-01 10:39:35 +00:00
1024jp 0a94a6ce88 Fix Japanse localization
Generalize message to user as the previous setence was more like "Anonymous system profile information is used to help **our company** plan future development work."
2017-02-28 13:54:47 +09:00
Kornel Lesiński e54748ac87 Add more info to auth tool run failure 2017-02-26 18:03:42 +00:00
fujisoft 3b04c45ee9 Fix pt_BR translations (#1039)
* Fix pt_BR translations
2017-02-20 10:22:15 +00:00
Kornel 792e13a067 Merge pull request #1038 from fujisoft/patch-1
Fix pt_BR translations
2017-02-19 16:09:37 +00:00
fujisoft 83195a802e Fix pt_BR translations
"Translation Error Correction"
It must have a faithful consistency to the translation terminologies of Apple Inc.
2017-02-20 00:50:36 +09:00
Kornel 46d2a6aeab Merge pull request #1036 from gnachman/preventAccidentalInstalls
Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs.
2017-02-16 17:21:55 +00:00
George Nachman 40347c0d43 Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. 2017-02-13 19:41:02 -08:00
Kornel e1f67cf8db Merge pull request #1034 from digitalmoksha/master
added `sparkle:shortVersionString` to the enclosure, #1032
2017-02-10 21:39:00 +00:00
Brett Walker 5210e1d3ac added sparkle:shortVersionString to the enclosure, #1032 2017-02-10 16:53:30 +01:00
Kornel Lesiński f43c83688d Changelog 2017-02-09 00:04:10 +00:00
Kornel 83709f4b30 Merge pull request #1028 from digitalmoksha/master
percent encode the filename used in the delta url, for #995
2017-02-08 22:27:17 +00:00
Brett Walker c0d4640508 percent encode the filename used in the delta url 2017-02-08 22:40:37 +01:00
Kornel c6fb841868 Merge pull request #1026 from zorgiepoo/coupling-ci
Detect and fail if any two-way dependencies exist in the project
2017-02-06 16:22:59 +00:00
Zorg 9a07c5125e Detect and fail if any two-way dependencies exist in the project
While this may or may not be perfect, this should improve code quality by preventing new code that is introduced that creates tight coupling. This test is performed when make test is executed.

I avoided retrieving objc_dep in a way that make test would require an internet connection. I also added the executable bit to the objc_dep script, and a source.txt file indicating where the source came from.
2017-02-06 08:27:10 -05:00
Kornel fb6fe6d6da Merge pull request #1025 from vitu/master
Terminology consistency update.
2017-02-06 10:22:21 +00:00
BR Lingo 9318b9f896 Update Sparkle.strings
Terminology consistency update.
2017-02-06 01:18:26 -05:00
BR Lingo d27c12f1fc Update Sparkle.strings
Terminology consistency update.
2017-02-06 01:15:22 -05:00
Kornel 016dad176e Merge pull request #1024 from vslavik/faster-noop-builds
Don't touch Info.plist unless git version changes
2017-02-05 21:31:45 +00:00
Václav Slavík 1f98f9eb36 Don't touch Info.plist unless git version changes
PlistBuddy always touches its output file, even if the value written is
identical to the value already there. In such case, Xcode sees
Info.plist as modified, therefore sees the entire target as modified and
re-runs potentially expensive operations like copying frameworks or
signing.

Avoid unnecessary build operations by checking the previous
CFBundleShortVersionString if Info.plist already exists and only
updating it if necessary.
2017-02-05 18:29:22 +01:00
Kornel 6e51231966 Merge pull request #1021 from zorgiepoo/copyright
Add my name to LICENSE
2017-02-02 08:54:51 +00:00
Zorg dc1d83e904 Add my name to LICENSE 2017-02-01 23:56:17 -05:00
Kornel Lesiński 9d966e68f0 Merge remote-tracking branch 'origin/1.16.x'
* origin/1.16.x:
  Fix #1020
2017-01-28 12:15:28 +00:00
Kornel Lesiński 03abfe2739 Fix #1020 2017-01-28 12:10:03 +00:00
Kornel Lesiński 155816b609 Formatting 2017-01-28 12:07:10 +00:00
Kornel 313352fe26 Merge pull request #1018 from sparkle-project/filesystemnormalization
fileSystemRepresentation normalization
2017-01-28 12:06:32 +00:00
Kornel Lesiński 67b1e08a45 Delta minor version fix 2017-01-28 11:31:08 +00:00
Kornel Lesiński 21214e8623 Simplify minor delta version down to int
+ minor version bump
2017-01-28 11:08:53 +00:00
Kornel Lesiński ed16c5c2a0 Use the same fileSystemRepresentation function for both parts of the path 2017-01-27 18:37:35 +00:00
Kornel Lesiński 0a869e87bf Make normalizedInstallationPathForHost also normalize Unicode 2017-01-27 18:34:56 +00:00
Kornel Lesiński 14c543ccb3 Test with non-ASCII names 2017-01-27 18:17:05 +00:00
Kornel Lesiński 0fd0331464 Typo 2017-01-27 18:04:43 +00:00
Kornel Lesiński 0cba214f07 1.17.0 2017-01-24 14:07:32 +00:00
Kornel Lesiński 2a644672ca Report installer progress 2017-01-24 13:46:21 +00:00
Kornel Lesiński 81e71844d6 Report plain install progress 2017-01-24 13:46:01 +00:00
Kornel Lesiński e4821e0454 Ability to report installation progress 2017-01-24 13:45:50 +00:00
Kornel a97538f931 Merge pull request #1014 from zorgiepoo/fix-unarchive-temp-removal
Don't remove the temporary unarchive directory in unit tests
2017-01-23 09:48:22 +00:00
Zorg c61767f501 Don't remove the temporary unarchive directory in unit tests
This should fix a potential bug where the unit tests try to unarchive a file that does not exist.
2017-01-22 22:02:45 -05:00
Kornel Lesiński c0d45952a9 Removed unimportant changelog entry 2017-01-23 01:21:31 +00:00
Kornel Lesiński 06629310e2 Updated changelog 2017-01-22 18:40:39 +00:00
Zorg a4eefe6725 Move SPUUpdateDriver.h up in the Xcode project 2017-01-20 22:09:41 -05:00
Zorg 934f9e2c32 Add some documentation to internal SPUUpdateDriver 2017-01-20 22:09:19 -05:00
Zorg 446df27354 Document why the user driver API was designed the way it was 2017-01-20 21:00:05 -05:00
Zorg b24ea83d0f Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-20 20:50:28 -05:00
Kornel 7e99561d9c Merge pull request #1010 from zorgiepoo/termination-autoupdate
Termination autoupdate
2017-01-20 13:56:05 +00:00
Zorg 5c71eebf59 Remove nonsense logging I had for debugging purposes 2017-01-19 23:28:56 -05:00
Zorg 5368dbfb41 Merge branch '1.17.x' into termination-autoupdate 2017-01-19 23:22:27 -05:00
Zorg 0e978e3faf Add kqueue based termination listener
Note this termination listener is not polling or timer based and will work on processes that aren't GUI applications.
2017-01-19 23:21:26 -05:00
Zorg aaac6cd594 Document TerminationListener a bit 2017-01-19 23:14:08 -05:00
Zorg a000e3b311 Handle listening for termination of already-dead processes
Before our TerminationListener didn't handle a process that has already been terminated. In my fork this is unlikely to be an actual issue but in master, the application can very well be dead before the termination listener initiates.
2017-01-19 23:11:20 -05:00
Zorg dc02d2d614 Merge branch 'master' into ui-separation-and-xpc 2017-01-18 19:55:39 -05:00
Kornel f9dfa3dd9d Merge pull request #1006 from sparkle-project/subsystem
Use app-independent subsystem identifier
2017-01-18 22:33:22 +00:00
Kornel Lesiński c104c1b27e Fix facility identifier 2017-01-18 22:31:03 +00:00
Kornel Lesiński 7e7c97a09f Use app-independent subsystem identifier 2017-01-18 19:01:45 +00:00
Kornel a75ad96719 Merge pull request #1005 from Bi11/touchbar
Update button outlets for all xib files
2017-01-18 12:32:03 +00:00
Bi11 22f5d1f0f8 Update button outlets for all xib 2017-01-18 15:45:00 +08:00
Zorg 7a1e396530 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-17 19:13:30 -05:00
Kornel b9753cbd81 Merge pull request #1003 from Bi11/touchbar
Add forward declaration for Xcode7
2017-01-17 22:53:21 +00:00
Bi11 548ae6e2b6 Change SDK checking macro to match existing code base 2017-01-18 05:34:37 +08:00
Bi11 db7f4acc83 Add forward declaration for Xcode7 2017-01-18 05:06:09 +08:00
Zorg dfaed624ae Merge branch 'master' into ui-separation-and-xpc 2017-01-17 15:58:02 -05:00
Bi11 942d70d3aa Suppress partial availability warning on line level 2017-01-18 04:53:37 +08:00
Kornel Lesiński 2ccac610f6 Added declaration for Xcode 7 2017-01-17 20:38:22 +00:00
Kornel Lesiński 7a0d402a01 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Explain why I'm not relying on the compiler to throw linkage errors
  Add AppKitPrevention header to reduce redundancy.
  Add AppKit prevention guards to modules that shouldn't import it
  Add Obj-C generics where applicable
  Adds test cases for "sparkle:criticalUpdate" tag. (#999)
2017-01-17 19:39:48 +00:00
Kornel Lesiński d070bca0b0 Sort project file 2017-01-17 19:38:02 +00:00
Kornel 682f8f32c6 Merge pull request #1002 from Bi11/touchbar
Add touch bar build support for Xcode 8.0 and earlier
2017-01-17 19:36:28 +00:00
Bi11 56db200f06 Add touch bar build support for Xcode 8.0 and earlier 2017-01-18 01:44:16 +08:00
Kornel 34179edd6d Merge pull request #1001 from zorgiepoo/appkit-prevention
Add AppKit prevention guards to modules that shouldn't import it
2017-01-17 13:09:38 +00:00
Zorg 530f3a4a63 Explain why I'm not relying on the compiler to throw linkage errors 2017-01-17 07:17:14 -05:00
Zorg 135d05b8b8 Add AppKitPrevention header to reduce redundancy.
Note this header should be included last in implementation files, which is why I added extra padding.
2017-01-17 07:08:29 -05:00
Zorg c56694382e Add AppKit prevention guards to modules that shouldn't import it 2017-01-16 21:17:25 -05:00
Zorg 9dd4d46bb9 Merge branch 'master' into ui-separation-and-xpc 2017-01-16 20:08:56 -05:00
Kornel a39023e95b Merge pull request #1000 from zorgiepoo/generics
Add Obj-C generics where applicable
2017-01-17 00:58:20 +00:00
Zorg 282f0ae58e Add Obj-C generics where applicable
In headers that are exported, we test to see if generic support is available.
2017-01-16 18:09:04 -05:00
Kornel Lesiński 55e1a24431 Formatting 2017-01-16 22:25:37 +00:00
Kornel Lesiński 9fa0519811 Comments 2017-01-16 22:07:55 +00:00
Zorg 0c7db7f24d Remove ask for updater permission changes from Read Me
This no longer differs from master's current behavior.
2017-01-16 16:23:00 -05:00
Zorg a34102a140 Revert back to asking for updater permission on 2nd launch
I don't think I have a great justification anymore for waiting more than 'x' hours. This may just be an artifact when I was initially architecting Sparkle so that the entire framework could be stuffed into an XPC service.
2017-01-16 16:20:36 -05:00
Zorg 0b32116f65 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-16 15:17:16 -05:00
Kornel ecc72f834d Merge pull request #987 from Bi11/touchbar
Add Touch Bar Support
2017-01-16 12:12:47 +00:00
Zorg fdebf50f81 Merge branch 'master' into ui-separation-and-xpc 2017-01-15 20:21:49 -05:00
Thomas Tempelmann c1488b0515 Adds test cases for "sparkle:criticalUpdate" tag. (#999)
* Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift).

* Tests the "criticalUpdate" appcast tag, using the proper XCTest swift class. I haven't tested this, though, due to the lack of the needed Xcode version.

* Test case for Appcast now checks all 4 items for the correct "criticalUpdate" state.

* Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift). (reverted from commit 3ce1c9790b)
2017-01-16 00:02:32 +00:00
Bi11 aa29a754e6 Merge branch '1.17.x' into touchbar 2017-01-13 21:30:09 +08:00
Bi11 65bd11df8a Use NSView’s designated initializer 2017-01-13 20:33:41 +08:00
Zorg 62c9a8c785 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-12 21:50:14 -05:00
Zorg 6a4f1e6340 Merge branch 'master' into ui-separation-and-xpc 2017-01-12 21:13:24 -05:00
Zorg d980fe8783 Merge branch 'master' into ui-separation-and-xpc 2017-01-12 21:12:50 -05:00
Kornel Lesiński 397eb8a379 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Proper fix for #995
2017-01-13 01:03:21 +00:00
Kornel Lesiński 27c560b7d5 Proper fix for #995 2017-01-13 01:02:55 +00:00
Kornel Lesiński 5121d74ad9 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Fix URL/path confusion
  Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis
2017-01-13 00:45:50 +00:00
Kornel Lesiński fbb040926e Fix URL/path confusion
Fixes #995
2017-01-13 00:44:41 +00:00
Bi11 e2426784ac Add constrains to set touch bar buttons width equally 2017-01-13 01:35:09 +08:00
Bi11 118c72e61c Add touch bar button group view to replace NSGroupTouchBarItem 2017-01-13 01:22:33 +08:00
Bi11 6f11c1ce02 Set up touch bar in each window controller 2017-01-12 03:44:01 +08:00
Bi11 d5f4c312ee Keep consistent coding style 2017-01-11 23:11:02 +08:00
Kornel 9b3753f5d7 Merge pull request #990 from sparkle-project/bgnet
Tell OS when networking happens without UI
2017-01-11 04:45:24 +00:00
Zorg 5cff3cd543 Change network service type to background where appropriate 2017-01-10 18:42:33 -05:00
Bi11 5dda7462c1 Merge sparkle-project/master into touchbar 2017-01-11 02:20:28 +08:00
Bi11 c059dc8ae8 remove hardcoded array capacity 2017-01-11 02:07:48 +08:00
Bi11 6ca4b05cad Change touch bar identifier prefix to sparkle bundle identifier 2017-01-11 01:57:16 +08:00
Bi11 d95f420360 Set touch bar default button directly instead of changing its keyEquivalent 2017-01-11 00:44:15 +08:00
Bi11 7ae0e71b02 Fix compile issue with older SDK < 10.12.2 2017-01-11 00:42:03 +08:00
Kornel 548908628f Merge pull request #991 from zorgiepoo/upgrade-ci
Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis
2017-01-10 13:07:39 +00:00
Zorg d40bdb615a Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis 2017-01-10 06:40:35 -05:00
Bi11 b16d881808 Fix default button on touch bar 2017-01-10 18:44:48 +08:00
Kornel Lesiński 392cb65716 Tell OS when networking happens without UI 2017-01-10 02:37:00 +00:00
Bi11 6e01dd272f Use outlets instead of iterating through subviews 2017-01-10 08:34:25 +08:00
Bi11 762d527463 Merge branch 1.17.x into touchbar 2017-01-10 07:43:35 +08:00
Bi11 07599c2ffd Bind enabled and title for touch bar buttons by default 2017-01-10 07:34:52 +08:00
Bi11 f795802d60 Use NSTouchBarDelegate to avoid subclassing NSTouchBar 2017-01-10 07:22:44 +08:00
Zorg 866fbfe4fd Remove bullet points in ReadMe that are less relevant now
Either they're merged in master now or are in the process of being merged soon.
2017-01-09 00:02:32 -05:00
Zorg c543edf6f6 Update graph of sparkle image 2017-01-08 23:56:31 -05:00
Zorg 930346d24b Remove unused header that must have been added from master 2017-01-08 23:54:20 -05:00
Zorg 55b586f4dc Split resumable updates type into downloadable and info update types 2017-01-08 23:42:25 -05:00
Zorg 4c01a69870 Rename SPUDownloadedUpdate -> SPUResumableUpdate
A resumable update isn't necessarily a downloaded update now, due to informational only updates.
2017-01-08 23:12:23 -05:00
Kornel 073ce22015 Merge pull request #988 from zorgiepoo/host-info-dict
Re-read SUHost Info dictionary when necessary
2017-01-08 21:38:28 +00:00
Zorg 7ef468e8ea Use -[SUHost objectForInfoDictionaryKey:] in couple more places 2017-01-08 15:47:44 -05:00
Zorg fc9b2b38fa Make SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle
When we retrieve the "CFBundleIconFile" key from the Info dictionary, we should rely on SUHost's method of obtaining that value now.
2017-01-08 15:36:30 -05:00
Zorg 604d3f578a Use -[SUHost objectForInfoDictionaryKey:] in couple more places 2017-01-08 09:23:15 -05:00
Kornel 717921cfa1 Merge pull request #977 from sparkle-project/skipcrit
Disable skip button if update is critical
2017-01-08 11:44:09 +00:00
Kornel e621622c8b Merge pull request #983 from zorgiepoo/logging
Upgrade SULog to use logging APIs that Apple provides built in
2017-01-08 11:43:44 +00:00
Bi11 6902b80ab6 Fix UITests multiple matches issue introduced in touch bar 2017-01-08 15:23:26 +08:00
Bi11 d44a122a21 Add Touch Bar support 2017-01-08 15:17:47 +08:00
Zorg 0b6b6fe4ca Improve -[SUHost objectForInfoDictionaryKey:]
We use the cached host bundle if the host bundle is equal to the main bundle.
Otherwise we read in the latest Info dictionary every time.

The cached case is the most common case. The odd case (updating other bundles) is less common. Thus we have better performance for the common case, and we retain correct code in both cases.

Also we invoke our own implementation of -objectForInfoDictionaryKey: rather than NSBundle's implementation in a few places.
2017-01-07 23:52:56 -05:00
Zorg 005a9a069e Merge branch 'master' into ui-separation-and-xpc 2017-01-07 23:26:57 -05:00
Zorg 2bb5ce4318 Make SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle
When we retrieve the "CFBundleIconFile" key from the Info dictionary, we should rely on SUHost's method of obtaining that value now.
2017-01-07 22:55:13 -05:00
Zorg b645005689 Improve -[SUHost objectForInfoDictionaryKey:]
We use the cached host bundle if the host bundle is equal to the main bundle.
Otherwise we read in the latest Info dictionary every time.

The cached case is the most common case. The odd case (updating other bundles) is less common. Thus we have better performance for the common case, and we retain correct code in both cases.
2017-01-07 22:32:08 -05:00
Kornel f43b9f7f02 Merge pull request #982 from sparkle-project/genapp
Workaround for bugs in NSXMLDocument prefix handling
2017-01-07 22:07:56 +00:00
Kornel Lesiński eafbb2cfad Copy debug symbols for generate_appcast 2017-01-07 21:57:39 +00:00
Kornel 5c408f5019 Merge pull request #984 from zorgiepoo/appcast-nonnil
The SUAppcast * is not going to be nil here; fixes analyzer warning
2017-01-07 17:43:46 +00:00
Zorg 9d35c819fd The SUAppcast * is not going to be nil here; fixes analyzer warning 2017-01-07 11:26:53 -05:00
Zorg 3b2ea83c6f Fix latest analyzer warnings 2017-01-07 11:22:13 -05:00
Zorg 874ec099b9 Merge branch 'master' into ui-separation-and-xpc 2017-01-07 11:13:40 -05:00
Zorg b9d113924e Upgrade SULog to use logging APIs that Apple provides built in
With this change, we ensure distinct per-app, per-process logging.
Note that the global file ~/Library/Logs/SparkleUpdateLog.log is no longer written into.

On 10.12 and above, SULog uses the os_log APIs. You may want to use log(1) to view logs in addition to Console.app. See the WWDC video on the new logging API and how the Console app has changed.

On older systems, this uses ASL (Apple System Log).

We don't want to reinvent logging, or rely on 3rd party libraries, thus we use what the system provides to us.

Two logging levels were added: Default and Error. The code documents their intended purpose. Now when you call SULog you must make a decision which level to use rather than rely on an implicit level.
2017-01-07 11:02:11 -05:00
Zorg 23011345cb Add SUOperatingSystem.m to generate_appcast since SULog now needs it 2017-01-06 22:29:03 -05:00
Zorg f04c73445e Document logging levels 2017-01-06 12:59:01 -05:00
Kornel Lesiński ee80a66896 Don't try to preserve namespace prefixes, because Apple's serializer is buggy
filed as rdar 29901669
2017-01-06 16:29:29 +00:00
Kornel Lesiński 187ae4fe57 Verify that the XML is serialized properly 2017-01-06 16:29:29 +00:00
Kornel Lesiński ca4d51561e Silence too-verbose delta 2017-01-06 16:29:29 +00:00
Kornel Lesiński 915c2047bf Fix accuracy of error message 2017-01-06 16:29:29 +00:00
Kornel f172cd32a8 Merge pull request #980 from sparkle-project/features
Updated README
2017-01-06 10:31:49 +00:00
Zorg 36fd5a8bbd Add some comments to SULog.h/m 2017-01-05 23:19:28 -05:00
Zorg 31cfbbccd9 Change around SULog.m #include's 2017-01-05 23:15:59 -05:00
Zorg af0a88dab3 Remove private _SULogDisableStandardErrorStream() function
When using ASL, don't log to stderr if a terminal is attached. This behavior closely matches os_log()
2017-01-05 23:09:58 -05:00
Zorg e1a4ad9371 Add level parameter to SULog()
Current levels are: default and error
2017-01-05 22:51:36 -05:00
Zorg 36e7cf263c Use os_log API for errors instead of ASL if it's available 2017-01-05 21:23:16 -05:00
Kornel Lesiński 8481035fb9 No server-side logic is a plus 2017-01-05 22:50:26 +00:00
Kornel Lesiński 7238c2aeb6 Updated README 2017-01-05 22:35:20 +00:00
Kornel Lesiński d9d62299be Disable Skip if the update is critical
Fixes #976
2017-01-04 15:23:47 +00:00
Kornel Lesiński 478bbf303b XIB churn 2017-01-04 15:23:47 +00:00
Kornel Lesiński ee16e5ae55 1.16.0a2 2017-01-04 13:59:17 +00:00
Zorg 19df2867af Merge branch 'master' into ui-separation-and-xpc 2017-01-03 22:19:21 -05:00
Kornel d50e823b3d Merge pull request #972 from sparkle-project/misc
Misc
2017-01-04 00:07:29 +00:00
Kornel 4636588e76 Merge pull request #973 from sparkle-project/nothrowaway
Resume pending automatic update when possible
2017-01-04 00:07:10 +00:00
Kornel Lesiński 2be4dc11a0 Resume pending automatic update when possible
Fixes #970
2017-01-03 17:44:40 +00:00
Kornel Lesiński 6181c9276a Close alert on abort 2017-01-03 17:42:18 +00:00
Kornel Lesiński 49845d8246 Re-init alert when called again
A lazy way to bring it to front
2017-01-03 17:42:18 +00:00
Kornel Lesiński 8fa136c0a3 Invalidate timer when auto-update window is shown
In case it's shown manually, not by the timer
2017-01-03 17:42:18 +00:00
Kornel Lesiński dc1151a5ff Null warning 2017-01-03 16:13:15 +00:00
Zorg 5ce1d7b3dc Merge branch 'master' into ui-separation-and-xpc 2017-01-02 18:12:01 -05:00
Zorg dca2114934 Add user driver method to show informational only updates
This will increase the chance of a user driver implementing being able to show informational only updates. Also it's better to use a new method rather than re-use another existing one inappropriately.
2017-01-02 18:00:17 -05:00
Kornel a920ecc197 Merge pull request #964 from zorgiepoo/guided-default
Make guided package installs the default for updating packages
2017-01-02 20:40:39 +00:00
Zorg c25f127188 Merge branch 'master' into ui-separation-and-xpc 2017-01-01 22:45:28 -05:00
Zorg 2001328032 Add user driver docs & handling for showing informational updates
Perhaps I should add another method to the user driver for showing informational updates in the near future.
2017-01-01 22:22:07 -05:00
Zorg 9d354e5606 Improve title text of update alert for normal & informational updates 2017-01-01 21:38:39 -05:00
Zorg ad43a6d0c9 Informational only updates shouldn't be presented as downloadable 2017-01-01 21:38:08 -05:00
Zorg 0bb3ab51b3 Handle informational only updates from the automatic update driver
The automatic update driver defers the informational only update & aborts, allowing a scheduled UI driver to resume it. The automatic update driver aborts before the point an update would normally be downloaded.
2017-01-01 21:22:02 -05:00
Kornel Lesiński 271d504f6d Expose magic numbers 2017-01-01 14:14:25 +00:00
Kornel Lesiński 9c0ccd4a57 Put latest version first to make wildcard filename matching easier 2017-01-01 14:14:25 +00:00
Kornel 266be254d2 Merge pull request #967 from zorgiepoo/length-fallback
Fallback to the appcast's length value if HTTP doesn't give us one
2017-01-01 15:12:44 +01:00
Kornel efe93c492f Merge pull request #968 from Bi11/info-only
Hide automatic updates checkbox for information only updates
2016-12-31 19:45:46 +01:00
Kornel 74b09ad904 Merge pull request #966 from zorgiepoo/update-podspec-file
Update pod spec file so that `make release` works
2016-12-31 19:44:05 +01:00
Kornel b9012aa8dc Merge pull request #965 from zorgiepoo/unarchiver-test-no-ivar
Remove instance variables from SUUnarchiverTest.swift
2016-12-31 19:43:05 +01:00
Kornel ae41185267 Merge pull request #963 from zorgiepoo/remove-old-app
Remove the old app/bundle instead of moving it to the trash
2016-12-31 18:29:08 +01:00
Bi11 6634ed7d69 Hide automatic updates checkbox for information only updates 2016-12-31 23:37:53 +08:00
Zorg 799ebdcf7d Fallback to the appcast's length value if HTTP doesn't give us one 2016-12-29 14:08:14 -05:00
Zorg 27a24a5413 Make sure downloader progress doesn't exceed expected max progress 2016-12-29 11:46:17 -05:00
Zorg d911db7357 Update pod spec file so that make release works 2016-12-29 11:15:22 -05:00
Zorg e3f68b70bf Prefer using HTTP expected content length over appcast item length
Also use (u)int64_t instead of NS(U)Integer
2016-12-29 11:11:05 -05:00
Zorg d2e1987ce3 Remove instance variables from SUUnarchiverTest.swift
I have been receiving unarchiver test errors lately (after the unarchiver blocks changes) somewhat rarely (it's very hard to reproduce) when running all the tests locally. Thus, hoping this change may make a difference.
2016-12-28 23:44:31 -05:00
Zorg 2d1688c063 Make guided package installs the default for updating packages
Interactive package installs now need to be opted into (foo.sparkle_interactive.pkg or foo.sparkle_interactive.mpkg)

The website documentation may need to be updated later, and this should be noted as an important point in the change log.
2016-12-28 23:15:22 -05:00
Zorg b56910f455 Remove the old app/bundle instead of moving it to the trash
Fixes #827
2016-12-28 22:01:00 -05:00
Zorg a82f5acdd6 Sort the project file using webkit's script:
https://github.com/WebKit/webkit/blob/master/Tools/Scripts/sort-Xcode-project-file

This may help with mergability a bit.
2016-12-28 21:28:16 -05:00
Zorg e463ed4bcb Merge branch 'master' into ui-separation-and-xpc 2016-12-28 21:19:40 -05:00
Zorg 52397d616f Download response may not return expected length for a smaller part 2016-12-28 12:54:05 -05:00
Zorg 47b1c8a9a2 Expected content length from http header should not be accumulated 2016-12-28 12:39:18 -05:00
Zorg 6d69b1215d Prevalidation is mostly merged into master now 2016-12-27 17:51:33 -05:00
Zorg 7609068886 Sync unit test configuration files to be similar to master branch 2016-12-27 17:47:47 -05:00
Kornel Lesiński a3e96581b4 We're not testing with old Xcode, so we can't promise that compatibility 2016-12-27 22:44:01 +01:00
Zorg f7d9e44ab6 Xcode fixing its project file again 2016-12-27 15:41:21 -05:00
Zorg ab64d8d19f Merge branch 'master' into ui-separation-and-xpc 2016-12-27 15:38:13 -05:00
Zorg 76013ba66c Merge branch 'master' into ui-separation-and-xpc 2016-12-27 15:32:56 -05:00
Kornel Lesiński 94423a10c9 Sorted project file 2016-12-27 21:25:52 +01:00
Kornel Lesiński b14c00136e Changelog 2016-12-27 21:23:15 +01:00
Kornel ebf8d2105b Merge pull request #953 from zorgiepoo/gen-appcast-xcconfig
Add xcconfig file for generate_appcast target
2016-12-27 20:53:53 +01:00
Zorg 14ac885ea0 Add ConfigGenerateAppcastDebug.xcconfig 2016-12-27 11:13:32 -05:00
Zorg 355e239df9 Add xcconfig file for generate_appcast target
Also remove swift configurations from Common config files, and change swift optimization from fast to whole module.
2016-12-27 11:01:25 -05:00
Zorg cba7f51132 Merge branch 'master' into ui-separation-and-xpc 2016-12-27 10:29:33 -05:00
Zorg e3a467b126 Rename update permission prompt & nib to use SU prefix 2016-12-27 10:06:41 -05:00
Kornel Lesiński e7ae7d5330 Version bump 2016-12-27 15:32:43 +01:00
Kornel daaadf1c44 Merge pull request #946 from sparkle-project/appcast
Tool to generate appcasts automatically
2016-12-27 15:31:30 +01:00
Zorg 9fa601c08f Remove old SUAutomaticUpdateAlert strings 2016-12-27 09:03:56 -05:00
Kornel 87064c9304 Merge pull request #952 from zorgiepoo/small-changes
Small changes
2016-12-27 14:21:33 +01:00
Zorg 0af392f808 Remove SUWindowController.m because it wasn't really being used 2016-12-26 22:51:55 -05:00
Zorg fb8ad9f75d Enhance SUUpdatePermissionPrompt by using a reply block
Also add SUUpdatePermissionResponse class which matches the response class from my fork.
2016-12-26 22:42:58 -05:00
Zorg b4210a85b9 Add and use normal initializer for SUStandardVersionComparator 2016-12-26 21:23:30 -05:00
Zorg 29ef0150b5 Use [NSApplication sharedApplication] instead to match master 2016-12-26 21:07:21 -05:00
Zorg 65c0c1e7fe Move code from SPUInstallerValidation.m to SUUpdateValidator.m 2016-12-26 21:01:47 -05:00
Zorg b482f55e46 Merge branch 'master' into ui-separation-and-xpc 2016-12-26 19:30:28 -05:00
Zorg 36ed896d0f Rename SPUInstallerProtocol -> SUInstallerProtocol, remove -cleanup
This is to prepare for the next merge from master.
2016-12-26 19:12:02 -05:00
Kornel 091986b12f Merge pull request #951 from zorgiepoo/installer-protocol
Decouple and simplify installation code using protocols
2016-12-27 00:48:57 +01:00
Zorg 1ecb620986 Decouple and simplify installation code using protocols
This also fixes a bug where the status window would stay visible during interactive (non-guided) package installations.
2016-12-26 17:59:32 -05:00
Zorg fd533f937e Don't pass version comparator to SUInstaller 2016-12-26 13:03:20 -05:00
Zorg d362caac98 Rename applicationPath to bundlePath in SUPlainInstaller
This is less confusing. I also documented the SUPlainInstaller initializer method.
2016-12-26 12:58:26 -05:00
Zorg cc77f11e22 Use self instead of [self class] to refer to class method 2016-12-26 11:17:27 -05:00
Zorg 55bc22b1ae Merge branch 'master' into ui-separation-and-xpc 2016-12-26 11:04:56 -05:00
Zorg 66e5460208 Remove some specific deprecated markings in SUUpdaterDelegate.h
The entire protocol is deprecated anyway.
2016-12-26 10:43:21 -05:00
Zorg bd6df5b707 Add nullability annotations to SUUpdaterDelegate.h 2016-12-26 10:35:28 -05:00
Kornel 21f3c8a157 Merge pull request #950 from zorgiepoo/updater-delegation
Updater delegation
2016-12-26 15:44:58 +01:00
Zorg 468bcb9640 Remove typecasting self.updater to id 2016-12-26 09:20:52 -05:00
Kornel Lesiński d38b29c858 Use more precise version for deltas to avoid filename clashes 2016-12-26 14:32:26 +01:00
Kornel Lesiński e2b9fc7ffd Fix path 2016-12-26 14:26:03 +01:00
Zorg f016cd8086 Add nullability annotations to SUUpdaterDelegate.h 2016-12-25 18:45:49 -05:00
Zorg 796967cf24 Allow delegate methods that return an object to return nil
Returning nil from these delegate methods is equivalent to not implementing the delegate method. The caller should be able to make this kind of decision when implementing an optional delegate method.
2016-12-25 18:41:38 -05:00
Zorg 578e78876c Separate SUUpdater delegate methods into different file
Also create SUUpdaterPrivate protocol to expose as little as possible to the internal update drivers. Ideally this would be minimized and not even exist at all, but I don't want to make the architectural and potential backwards-incompatible changes required to do that.
2016-12-25 18:25:42 -05:00
Zorg f656bf5068 Clarify where this delegate method exists 2016-12-24 21:42:54 -05:00
Zorg 2a612f450e Merge branch 'master' into ui-separation-and-xpc 2016-12-24 21:34:49 -05:00
Zorg 853a0ecd82 Use SU prefix for ApplicationInfo and BundleIcon classes
This is to hopefully make merging recent changes from master easier.
2016-12-24 21:19:20 -05:00
Kornel 2f438186d6 Merge pull request #949 from zorgiepoo/decouple-host
Decrease responsibility of SUHost and move code into other components
2016-12-24 14:22:56 +01:00
Zorg 2c1820f2a9 Decrease responsibility of SUHost and move code into other components 2016-12-23 22:21:19 -05:00
Zorg 1943d971fc Remove SUParameterAssert.h since I removed it in master 2016-12-23 19:17:17 -05:00
Zorg 8aada73941 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 19:14:27 -05:00
Kornel a30eff3680 Merge pull request #947 from zorgiepoo/remove-deps
Remove Sparkle.pch and many file #includes
2016-12-24 00:06:56 +01:00
Zorg 1a09baf0ed Remove Sparkle.pch and many file #includes
This eliminates many dependencies that don't need to exist.
2016-12-23 16:13:35 -05:00
Zorg ae35c09624 Fix update validation code from recent merge for pkg updates 2016-12-23 14:58:31 -05:00
Zorg fe79d29665 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 14:50:54 -05:00
Zorg 553168ba51 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 14:44:32 -05:00
Kornel Lesiński a1095ff29c Null fix 2016-12-23 20:00:45 +01:00
Kornel Lesiński 51b3931485 Simpler suffix check 2016-12-23 19:59:48 +01:00
Kornel Lesiński 1e3f5482d0 Additional files 2016-12-23 19:26:30 +01:00
Kornel Lesiński 0a45be54c4 Appcast helper tool 2016-12-23 19:22:13 +01:00
Kornel b5bc2a7374 Merge pull request #940 from sparkle-project/nulz
Nulz
2016-12-23 18:56:57 +01:00
Kornel 3666b89add Merge pull request #933 from sparkle-project/statevars
Minor tweaks
2016-12-23 18:56:06 +01:00
Kornel 23f9e747c1 Merge pull request #942 from zorgiepoo/unarchiver-protocol
Unarchiver protocol
2016-12-23 18:54:25 +01:00
Kornel Lesiński c77895066a Appropriate deployment target for test app xib 2016-12-23 17:01:16 +01:00
Kornel Lesiński c98017dbe2 Fixed binary delta tool 2016-12-23 16:33:12 +01:00
Kornel Lesiński 657e3d47d0 Removed unnecessary nullability 2016-12-23 16:25:09 +01:00
Kornel 4d34e4358a Merge pull request #943 from zorgiepoo/improve-tests
Improve tests
2016-12-22 23:32:19 +01:00
Zorg 6fcd6beb84 Fix UI tests from not working when update alert automatically shows 2016-12-22 12:18:31 -05:00
Zorg 98b3a9828a Use localhost instead of 0.0.0.0. Latter doesn't work when offline. 2016-12-22 12:17:45 -05:00
Zorg 2c1e996fab Update comments 2016-12-22 09:36:37 -05:00
Zorg 137b73af4e Fix subclass compatibility and update schedule unarchiving behavior 2016-12-21 16:39:33 -05:00
Zorg dd1bda5066 Some error reason is better than no reason 2016-12-21 16:14:25 -05:00
Zorg 7bc7a90a09 Fix UI update scheduler not prompting for install & relaunch 2016-12-21 15:59:13 -05:00
Zorg 91d13c7239 Merge branch 'master' into unarchiver-protocol 2016-12-21 15:53:41 -05:00
Zorg fd6ba1820a Merge branch 'master' into unarchiver-protocol 2016-12-21 15:39:38 -05:00
Kornel fb61777024 Merge pull request #941 from sparkle-project/unarch
Error handling test + fix
2016-12-21 19:18:23 +01:00
Kornel Lesiński 2519eb573f Test unarchiving failure 2016-12-21 18:06:22 +01:00
Kornel Lesiński 8a3338b078 Extracted function 2016-12-21 18:06:22 +01:00
Kornel Lesiński b03ae0d765 Moved assert 2016-12-21 18:06:19 +01:00
Kornel Lesiński 97c652e3b0 Fixed method name 2016-12-21 17:42:38 +01:00
Kornel 301af71228 Merge pull request #938 from sparkle-project/unarch
Unarchiving blocks
2016-12-21 17:07:19 +01:00
Zorg 60d4f05743 Add SUUnarchiverProtocol & remove runtime registration of unarchivers 2016-12-21 11:07:03 -05:00
Kornel Lesiński 464972126c Unwrap early 2016-12-21 16:44:04 +01:00
Kornel Lesiński c1392bc190 Nullability 2016-12-21 16:44:04 +01:00
Kornel Lesiński 921aed0fae Temp vars 2016-12-21 16:44:04 +01:00
Kornel Lesiński 59d90e0bb1 Basic binary delta progress 2016-12-21 15:23:41 +01:00
Kornel Lesiński e3fb6bb1a8 Report DMG extraction progress 2016-12-21 15:23:41 +01:00
Kornel Lesiński 8103f5fd43 Replaced progress delegate with a block 2016-12-21 15:23:40 +01:00
Kornel Lesiński 70f5681797 Use completion block for unarchiving 2016-12-21 15:22:59 +01:00
Kornel Lesiński 5ee02e954e Renamed callbacks 2016-12-21 15:22:59 +01:00
Kornel Lesiński 23b2b49663 Ability to report specific unarchiving error 2016-12-21 15:22:59 +01:00
Kornel Lesiński 311ed493b4 Unused 2016-12-21 15:22:59 +01:00
Kornel Lesiński 9d8b3c0c36 DRY async dispatch of unarchiver notifications 2016-12-21 15:22:59 +01:00
Kornel Lesiński f3f268388b Nullability declarations 2016-12-21 15:22:57 +01:00
Zorg b28fd2410d Mark SPUInstallerValidation and SUUpdateValidator as daemon-safe 2016-12-20 22:00:54 -05:00
Zorg 35ef590f2b Update graph of sparkle image in documentation 2016-12-20 21:50:21 -05:00
Zorg 574c0f63ca Add documentation files to Xcode project group 2016-12-20 21:48:06 -05:00
Zorg b6b554e830 Appcast instance cannot be nil here. 2016-12-20 20:54:35 -05:00
Zorg d5e54005ce Fix static analyzer warning by marking method return type as nullable 2016-12-20 20:47:59 -05:00
Zorg 09da99f4cf Merge branch 'master' into ui-separation-and-xpc 2016-12-20 20:23:07 -05:00
Mayur Pawashe 07b9b71f8f Merge pull request #2 from ksuther/ui-separation-and-xpc
Fixed retain cycle between SPUBasicUpdateDriver and SUAppcastDriver
2016-12-19 11:40:19 -05:00
Kornel 8d0effe327 Merge pull request #934 from sparkle-project/msg
Less alarming error message
2016-12-17 23:51:34 +01:00
Kent Sutherland 70af94624d Fixed retain cycle between SPUBasicUpdateDriver and SUAppcastDriver 2016-12-15 15:56:36 -06:00
Kornel Lesiński 19455099ff Formatting 2016-12-10 16:15:02 +00:00
Kornel Lesiński 6e754d7e4f Use return instead of state variable 2016-12-10 16:15:02 +00:00
Kornel Lesiński ab6fa76303 Xcode 8 now 2016-12-10 12:04:26 +00:00
Kornel Lesiński 93fc4b0151 Highlight Sierra compat 2016-12-10 12:03:58 +00:00
Kornel Lesiński 021950a5b2 Less alarming error message 2016-12-10 11:59:47 +00:00
Zorg 9ea4cf1bf6 Merge branch 'master' into ui-separation-and-xpc 2016-12-04 17:05:01 -05:00
Kornel 2ff0da4f15 Merge pull request #881 from zorgiepoo/separate-validation
Separate validation
2016-12-04 13:35:07 +00:00
Kornel Lesiński 945968a0ef Reminder 2016-12-04 12:19:25 +00:00
Kornel Lesiński 1e4f126f7e Podspec version bump 2016-12-04 12:18:11 +00:00
Kornel Lesiński f47115d81f Version bump 2016-12-04 12:14:24 +00:00
Kornel Lesiński 49781561f3 Cocoapods fudge 2016-12-04 12:10:27 +00:00
Zorg fee1b0c126 Mention ABI compatibility specifically 2016-12-03 22:41:43 -05:00
Zorg 2c9d44a341 Improve documentation wording for setFeedURL: 2016-12-03 22:23:48 -05:00
Zorg 9392e3260a Comment style changes 2016-12-03 22:19:13 -05:00
Zorg eb78f61f41 Annotate that -[SPUUpdater setFeedURL:] can take nil as a value 2016-12-03 22:15:08 -05:00
Zorg a6abd1c206 Specify nonatomic in SPUUpdater and SUUpdater where applicable. 2016-12-03 22:00:12 -05:00
Zorg 7b0d0d8909 Merge branch 'master' into ui-separation-and-xpc 2016-12-03 21:50:33 -05:00
Zorg 1587dd1dc3 Refactor pre & post update validation into its own class 2016-12-03 15:37:00 -05:00
Zorg c0b9eaaa0e s/requiresValidationBeforUnarchiving/unsafeIfArchiveIsNotValidated/ 2016-12-03 11:06:10 -05:00
Kornel 91ac90ffcf Merge pull request #928 from sparkle-project/script
Fix #926
2016-12-03 00:05:09 +00:00
Kornel Lesiński 8375922755 Fix #926 2016-12-02 21:10:37 +00:00
Kornel 9dec304f64 Merge pull request #919 from sparkle-project/tag
Don't append hash to versions of builds with a tag
2016-12-01 20:16:43 +00:00
Kornel 8acd915b7b Merge branch 'master' into tag 2016-11-12 23:44:03 +00:00
Kornel Lesiński eb36100388 Allow 2.x 2016-11-12 17:14:56 +00:00
Kornel Lesiński fb22a01a08 Don't append hash to versions of builds with a tag 2016-11-12 14:22:42 +00:00
Zorg 9a32766aeb Merge branch 'master' into separate-validation 2016-11-11 23:35:28 -05:00
Zorg 7783e9f704 Merge branch 'master' into ui-separation-and-xpc 2016-11-11 19:28:02 -05:00
Kornel fc468771c1 Merge pull request #916 from zorgiepoo/swift-xcconfig
Move swift and other build settings into xcconfig files
2016-11-11 23:09:15 +00:00
Zorg 8106aa8700 Merge branch 'master' into ui-separation-and-xpc 2016-11-10 15:57:25 -05:00
Zorg 42dbf94738 Move swift and other build settings into xcconfig files 2016-11-10 15:51:30 -05:00
Kornel 86a0ca3883 Merge pull request #914 from sparkle-project/appiconname
Rename Sparkle.icns to be consistent with ASSETCATALOG_COMPILER_APPICON_NAME
2016-11-09 22:46:27 +00:00
Kornel Lesiński ddb53f330d Rename Sparkle.icns to be consistent with ASSETCATALOG_COMPILER_APPICON_NAME 2016-11-09 21:45:03 +00:00
Zorg efd39a31e9 Remove Makefile-icon 2016-11-03 16:11:59 -04:00
Zorg f46d4b7c4d Mark startUpdater method as being invoked on main thread only 2016-11-03 15:29:25 -04:00
Zorg 5a7462e5b9 Remove the optimized Sparkle.icns that was merged from master
This branch doesn't have Sparkle bundle an icon in the first place.
2016-11-03 15:22:48 -04:00
Zorg 8e7cb0ac79 Merge branch 'master' into ui-separation-and-xpc 2016-11-01 19:46:30 -04:00
Kornel 9dbaae64f1 Merge pull request #908 from sparkle-project/icon
Use optimized icon for Autoupdate.app
2016-11-01 22:56:27 +00:00
Kornel Lesiński d2f4687333 Specify requirements 2016-11-01 21:52:23 +00:00
Zorg c72efdfb34 Merge branch 'master' into ui-separation-and-xpc 2016-10-31 21:49:00 -04:00
Kornel Lesiński 143045d673 Use optimized icon for Autoupdate.app
#803
2016-11-01 00:44:54 +00:00
Kornel d67351cb62 Merge pull request #906 from vslavik/stable-byte-counts
Fix flickering download progress status text
2016-10-31 13:06:40 +00:00
Václav Slavík 07d2897250 Fix flickering download progress status text
Fix status text during download (e.g. "10MB of 22MB") so that it no
longer distractingly jumps around and flickers. This was caused by two
things:

1. Flicker on macOS >= 10.8 due to the use of NSByteCountFormatter's
   default mode which isn't optimized for stable display and is not
   suitable for rapidly updated values.

2. Smaller movements of text on macOS >= 10.11 due to the use of San
   Francisco font's default variant, where digits don't have fixed
   width.

Fixed by using monospacedDigitSystemFontOfSize for the text field and
enabling NSByteCountFormatter's zeroPadsFractionDigits mode.
2016-10-31 11:13:15 +01:00
Jake Petroules 625c942561 Update references to MaxCDN to StackPath
The latter acquired the former and requested this change.
2016-10-04 17:56:44 -07:00
Zorg e2adfd2617 No need to have debug warning in SUUpdater when one is in SPUUpdater
This came from a recent merge.
2016-09-17 09:17:51 -04:00
Zorg 2d4568671c Remove unused 'Invalidate Connection' menu item in Test App 2016-09-16 23:16:32 -04:00
Zorg 6b452b2861 Move swift build settings to xcconfig files 2016-09-16 15:22:19 -04:00
Zorg 163158cacf Merge branch 'master' into ui-separation-and-xpc 2016-09-16 15:08:04 -04:00
Kornel bb299d075b Merge pull request #884 from sparkle-project/xcode8
Xcode8
2016-09-16 11:02:53 +01:00
Kornel 73229f84f7 Merge pull request #889 from zorgiepoo/swift3
Swift 3
2016-09-16 11:02:10 +01:00
Zorg 8152516b7f Remove coveralls
Coveralls hasn't worked properly in months since Swift code started being used, and it's causing a build failure at the moment.
2016-09-14 23:14:41 -04:00
Zorg 96baf2b2ce Update travis to use Xcode 8 2016-09-14 23:05:45 -04:00
Zorg ed5dca3423 Update unit tests to Swift 3 2016-09-14 23:05:05 -04:00
Kornel 3a5c620b60 Merge pull request #886 from zorgiepoo/debug-warning
Warn a developer if they're using a debug version of Sparkle
2016-09-06 17:03:40 +01:00
Zorg a0ced6018d Update ReadMe 2016-09-05 13:58:59 -04:00
Zorg f36e7a46cd Merge branch 'master' into ui-separation-and-xpc
Updating some documentation
2016-09-05 13:48:25 -04:00
Kornel 23ae527b96 Merge pull request #885 from zorgiepoo/docs
Add more documentation to SUUpdater.h
2016-09-05 11:50:00 +01:00
Zorg fd4ff8a6e7 Merge branch 'master' into ui-separation-and-xpc 2016-09-04 23:52:40 -04:00
Zorg 1a5cf6e48f Add @import Foundation handling for SPUStatusCompletionResults.h 2016-09-04 23:49:41 -04:00
Zorg 17277b1f77 Merge updater delegate installer interaction allowed methods 2016-09-04 22:57:59 -04:00
Zorg 2268f96759 Add more documentation to SUUpdater.h 2016-09-04 22:11:29 -04:00
Zorg 898e063b4f Remove unnecessary 'return;' 2016-09-04 18:38:08 -04:00
Zorg e8f88bf0f1 Merge branch 'master' into separate-validation 2016-09-04 18:37:14 -04:00
Zorg 30d4a5eb5c Merge code sign test changes from master 2016-09-04 18:23:23 -04:00
Zorg def9a599a3 More SU -> SPU renaming
Some of these class names conflicted with the official branch even though they are almost nothing like code-wise now.
2016-09-04 18:21:41 -04:00
Kornel Lesiński a3407a2dbf Xcode 8 config 2016-09-04 17:04:54 +01:00
Kornel Lesiński 88933a1e65 Unused 2016-09-04 17:04:54 +01:00
Kornel Lesiński c3d8e4bbc5 Changelog 2016-09-04 17:02:56 +01:00
Kornel f70c2a15b1 Merge pull request #883 from sparkle-project/nulfix
Test nullability
2016-09-04 16:50:36 +01:00
Kornel Lesiński 4eb518de7e Test nullability 2016-09-04 16:07:11 +01:00
Zorg 5b2ce958bd Merge branch 'master' into separate-validation 2016-09-03 23:27:16 -04:00
Zorg 32373e8185 Use -[NSURL checkResourceIsReachableAndReturnError:] in tests
This avoids nullability warnings when converting NSURL -> NSString path
2016-09-03 22:56:38 -04:00
Zorg 213bedfa37 Merge branch 'master' into ui-separation-and-xpc 2016-09-03 22:50:25 -04:00
Kornel 077c64419f Merge pull request #882 from sparkle-project/bundleurl
Use bundle URLs
2016-09-03 17:09:14 +01:00
Kornel Lesiński 1195d4b5d2 Fixed test 2016-09-03 16:14:02 +01:00
Kornel Lesiński c7a7704f3b Switch test to NSURL 2016-09-02 19:08:42 +01:00
Kornel Lesiński 64af6d04c2 Use bundle URLs instead of paths to avoid creation of temp bundle objects 2016-09-02 18:53:23 +01:00
Kornel 0af27ea783 Merge pull request #877 from zorgiepoo/host-independent-signing
Improve Host Signing Verification
2016-09-02 18:31:37 +01:00
Kornel Lesiński c36413ce46 CoC 2016-09-02 12:43:37 +01:00
Kornel Lesiński 13b9081873 Readme text refresh 2016-09-02 12:33:48 +01:00
Kornel Lesiński 3dccca8044 Coveralls badge is a year out of date 2016-09-02 12:31:50 +01:00
Zorg e28c62244a Re-show download status if we attempt a 2nd download
This fixes a bug where the status would stay at "Extracting update" after validation from the 1st delta patch failed, and it continued on to a full download.
2016-09-01 23:19:58 -04:00
Zorg fec76fee12 Validate binary delta patches before unarchiving
Also keep package and bundle validation separate.
2016-09-01 23:14:26 -04:00
Zorg d3ebffb267 Update header documentation for SPUUpdater/SPUUpdaterDelegate 2016-08-30 00:33:03 -04:00
Zorg b911b8c540 Use @import module syntax in exported headers if available
This will decrease compiler warnings to module-based projects that include Sparkle.
2016-08-29 23:59:10 -04:00
Zorg cc38a3d7a6 Pass user initiated flag when update is found to the user driver
This is better than the hack in the previous commit. Also, a user driver may very well want to act differently in showing UI if the user initiated the update check.
2016-08-29 00:31:29 -04:00
Zorg f9a2c7a450 Let user driver know if resume update checks are user initiated 2016-08-29 00:04:23 -04:00
Zorg f5a79ecc79 Merge branch 'master' into ui-separation-and-xpc 2016-08-28 09:42:05 -04:00
Kornel ed3eab64d2 Merge pull request #878 from zorgiepoo/automatic-writability
Improve host writability check by testing ownership/group changes
2016-08-28 14:10:02 +01:00
Zorg 64bf8d02e2 Remove note about removing mdimport since it's been merged in master 2016-08-28 00:11:07 -04:00
Zorg 325059484f Only log missing 'length' warning once per all appcast item instances 2016-08-27 23:58:01 -04:00
Zorg 56cd205880 Merge branch 'master' into ui-separation-and-xpc 2016-08-27 22:46:14 -04:00
Kornel ee257c4070 Merge pull request #876 from zorgiepoo/delta-spotlight-import
Update mdimporter modification dates after delta extractions
2016-08-28 02:34:49 +01:00
Zorg bfec7a82c0 Improve host writability check by testing ownership/group changes 2016-08-27 21:09:51 -04:00
Zorg 4cd472abe6 Update comment on why kSecCSCheckNestedCode is not used 2016-08-27 19:16:48 -04:00
Zorg 39268a13e5 Add unit tests for Apple code signature matching 2016-08-27 19:06:58 -04:00
Zorg 4864dfb5aa Update signing verifier to take any host and s/application/bundle/ 2016-08-27 18:07:40 -04:00
Zorg 71125e3d16 Add unit test for updating spotlight mdimporter bundles 2016-08-27 17:03:54 -04:00
Zorg 779d16e5a7 Update spotlight bundles after delta extraction; don't use mdimport 2016-08-27 15:27:11 -04:00
Mayur Pawashe 021c1a7803 Merge pull request #1 from michelf/ui-separation-and-xpc
Fixing memory leak transferring dictionary to ARC
2016-08-27 14:17:58 -04:00
Zorg 4d13c54d4c Merge branch 'master' into ui-separation-and-xpc 2016-08-27 13:54:20 -04:00
Kornel Lesiński ee2e7fb46b Version bump 2016-08-27 17:01:33 +01:00
Zorg 7c49f722a8 Merge branch 'master' into ui-separation-and-xpc 2016-08-27 11:34:42 -04:00
Kornel d350cf33e0 Merge pull request #865 from denniss/bug-864_missing-abort-update
[BUG-864] Call abort update after updater cannot find valid update
2016-08-27 16:21:03 +01:00
Michel Fortin 5f255c4865 Fixing memory leak where transferring of property dictionary to ARC. 2016-08-27 11:20:34 -04:00
Kornel Lesiński 20be93e96b Version bump 2016-08-27 16:13:05 +01:00
Kornel Lesiński 668e258cff Updated CHANGELOG 2016-08-27 16:12:02 +01:00
Kornel 20f90f1544 Merge pull request #873 from zorgiepoo/dsa-existence
Dsa existence
2016-08-27 16:05:26 +01:00
Kornel 6dbb0d9988 Merge pull request #874 from zorgiepoo/dmg-remove-vendor
Remove NTSynchronousTask
2016-08-27 16:04:58 +01:00
Zorg fb2aea0d86 Fix normalization relaunch path setting and improve relaunching code
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=1 now works properly again. In the progress agent, we don't use the path sent from the installer unless the normalized setting is enabled.
2016-08-27 10:40:38 -04:00
Zorg f700c96e47 Read stdout to end before waiting for task to end to prevent deadlock 2016-08-27 09:27:06 -04:00
Zorg 626d2c96f5 Show the public DSA file key that doesn't exist in the insecure alert 2016-08-27 09:11:08 -04:00
Kornel 5db4e1505b Merge pull request #872 from zorgiepoo/menuvalidation
Menu item validation
2016-08-27 10:42:25 +01:00
Zorg 251feb7e07 Rename registerRelaunchBundlePath to registerApplicationBundlePath 2016-08-27 02:24:37 -04:00
Zorg 115686cd07 Change dmg and test verifying code by removing NTSynchronousTask 2016-08-27 01:09:24 -04:00
Zorg e2fc8b4258 Prevent public DSA key -> no public DSA key downgrade
This may prevent developers from making accidental downgrades.
2016-08-27 00:32:01 -04:00
Zorg 99f34299f1 Show alert if no pub key exists, but SUPublicDSAKeyFileKey exists 2016-08-27 00:07:11 -04:00
Zorg fdf79bc3a6 Enable check for updates menu item if update driver is interruptible 2016-08-26 23:07:13 -04:00
Zorg eb810c7d8f Implement menu item validation in Test Applications window controller 2016-08-26 23:03:08 -04:00
Zorg 38af7cd8cd Export -validateMenuItem: as a method in SUUpdater.h for public use 2016-08-26 23:01:30 -04:00
Zorg 6f337aa6f3 Remove outdated comment about command key being held down in test app 2016-08-26 22:32:49 -04:00
Zorg 9b4aaef3dd Update documentation on -[SPUUserDriver dismissUpdateInstallation] 2016-08-26 18:58:59 -04:00
Zorg 2548057da8 Clarify why installer has handling for timeouts 2016-08-26 18:46:25 -04:00
Zorg fb5c577dad Update comment to reflect what occurs after sending stage 2 request 2016-08-26 18:35:52 -04:00
Zorg db642a0700 Fix relaunching if multiple instances of app were running
We leave the "application was alive and needs to terminate logic" to the progress agent rather than to the installer too.
2016-08-26 18:23:42 -04:00
Zorg 328a445b5c Clarify that the agent tool shouldn't monitor processes' death 2016-08-26 18:01:44 -04:00
Zorg fbad9e466f Update installation document to include termination, SU->SPU changes 2016-08-26 01:47:57 -04:00
Zorg 44b70bb16c Remove SPUApplicationIcon and merge it into SPUApplicationInfo
Every component that needed SPUApplicationIcon also needed SPUApplicationInfo
2016-08-26 01:08:06 -04:00
Zorg 46a75cde97 Terminate application in the progress agent instead of user driver
This allows us to remove SPUUserDriverUIComponent and remove a bunch of logic in the user driver regarding termination. The user drivers generally don't need to know about the application bundle anymore, and strictly now only show UI events.

This has another advantage of the agent being able to quit multiple instances of an application even if the application to update is sandboxed.

We enforce the logic that an application can only be relaunched if it was running initially.
2016-08-25 23:46:42 -04:00
Zorg 27ea7ca2f5 Implement new allow installer interaction methods in sparkle-cli 2016-08-21 18:58:11 -04:00
Zorg b8d1ac45c3 Clarify that interaction also allows installer UI to show up 2016-08-21 18:46:03 -04:00
Zorg b1fa9efa24 Distinguish initiated vs scheduled updates for allowing interaction 2016-08-21 15:58:33 -04:00
Zorg 6a8680464b Pass installer interaction flag to drivers and use delegate once 2016-08-21 15:14:47 -04:00
Zorg 55d58a2203 Add SparkleCore to make-release-package.sh 2016-08-21 11:24:09 -04:00
Zorg f62f7fa1b8 Add localization scripts to SparkleCore 2016-08-21 02:33:19 -04:00
Zorg 5f0f964c65 Merge branch 'sparkle-core' into ui-separation-and-xpc 2016-08-21 02:17:42 -04:00
Zorg f9c87d76db Fix SparkleCore build issues in Release configuration
We don't import SPUUserDriverUIComponent in SparkleCore because it is an exported class a part of Sparkle framework, which causes issues.

Instead, we import SPUApplicationInfo which is not exported from Sparkle.
2016-08-21 02:07:04 -04:00
Zorg 2ca76bef1c Update comment about how cache path method should not in SUHost 2016-08-20 22:00:35 -04:00
Zorg 53cc1cf1ce Add localization scripts from the Framework to the Progress app 2016-08-20 21:51:42 -04:00
Zorg 3547cb1239 Create SparkleCore target that only includes Core related files
Some build issues still need to be resolved.
2016-08-20 21:44:16 -04:00
Zorg e27c5437ab Resume the XPC connections after setting up invalidation handlers 2016-08-20 19:07:10 -04:00
Zorg 47f08be1a0 Don't check or download updates if updater isn't allowed interaction
This only affects updater delegates that return NO from -updaterShouldAllowInstallerInteraction:

This improves the user experience in sparkle-cli where now the checking can be aborted before even downloading the update feed, if it knows ahead of time that installation will fail.
2016-08-20 18:56:01 -04:00
Zorg 7dd066d894 Add SPUDownloadData as compile source to Downloader service 2016-08-20 13:01:51 -04:00
Zorg e2eb9f2af1 Update INSTALL 2016-08-20 12:58:12 -04:00
Zorg 47cdd37238 Rename PersistentDownload -> Downloader 2016-08-20 12:54:13 -04:00
Zorg eb53b58e2b Remove TemporaryDownloader XPC Service
Temporary downloads now use the Persistent Downloader code
2016-08-20 12:14:31 -04:00
Zorg e476ca2cf0 Handle both temporary and persistent downloads in our Downloader
I will aim to remove the TemporaryDownloader target and rename PersistentDownloader to just Downloader.
2016-08-20 11:26:49 -04:00
Zorg 9ac76d6253 Replace -cleanupWithCompletion: with just a -cleanup
SUPersistentDownloader doesn't implement -dealloc anymore so there shouldn't be issues
2016-08-20 09:46:42 -04:00
Zorg ab44d58d0e Don't invoke -cleanup in SUTemporaryDownloader's dealloc
The file will be cleaned up eventually anyway and I don't want to risk something happening when the connection dies.
2016-08-18 19:47:32 -04:00
Zorg b11794b518 Add XPC service documentation section to practices 2016-08-16 20:05:28 -04:00
Zorg 4b962725a5 Document installation resumability behavior for -checkForUpdatesInBackground 2016-08-16 19:52:14 -04:00
Zorg 4bbd3d6c29 Re-order methods in SPUUpdater, put more interesting ones up top 2016-08-16 19:48:03 -04:00
Zorg 1d3e5753d3 -automaticallyDownloadsUpdates should take account if developer disables automatic updates
This behavior is more consistent with the official branch.
2016-08-16 19:43:56 -04:00
Zorg 35ec3caf55 Add documentation to undocumented properties in SPUUpdater 2016-08-16 19:18:46 -04:00
Zorg b92b7948f0 More SU -> SPU changes in the comments 2016-08-16 19:07:16 -04:00
Zorg 69eb10edba Document SPUUserDriver cannot have optional methods 2016-08-16 19:05:05 -04:00
Zorg a6a2da7a69 Add silent termination method to user driver
This is triggered if the update is automatically downloaded and the installer is started in the background, and the updater's delegate decides to handle silent installation and installs the update invoking its immediate installation block. In this scenario, this fixes an issue where the application may not be terminated silently.
2016-08-16 18:59:13 -04:00
Zorg c9a11a262d Spell Compatibility properly 2016-08-16 00:45:45 -04:00
Zorg 05e22348ca Add check to make sure update bundle is signed if no DSA key is provided
This is not a security check. This is just to save a developer from shooting themselves in the foot.
The security checks are done in the installer.
2016-08-16 00:28:29 -04:00
Zorg 6f1b13954b Add authentication before terminating app / launching installer to changes 2016-08-15 21:12:06 -04:00
Zorg 97e769bab0 Update installation docs on handling symlinks 2016-08-15 19:42:56 -04:00
Dennis Suratna 09889d01b1 [BUG-864] Call abort update after updater cannot find valid update 2016-08-15 14:36:41 -07:00
Zorg 4bbce0a25f Re-add temporary read-write exception for use defaults
Switching between a sandboxed and non-sandboxed app with regards to user defaults has some bugs with saving user defaults.
Confirmed by an Apple engineer.
2016-08-15 01:36:48 -04:00
Zorg 5a743ac366 Clarify documentation for applicationBundle in SPUStandardUserDriver 2016-08-15 00:33:29 -04:00
Zorg 1282e42031 Defend against possible symbolic link attack 2016-08-14 23:07:44 -04:00
Zorg 423d288290 Add some defense and comment about relaunching the new app 2016-08-14 21:48:16 -04:00
Zorg 9e183b4e85 Add comment why relaunch path is passed again 2016-08-14 21:17:34 -04:00
Zorg 3132d19afc Add note about no-DSA deprecation 2016-08-14 20:14:34 -04:00
Zorg 2cc3b4c349 Add security note for JoinExistingSession XPC service key 2016-08-14 19:04:21 -04:00
Zorg e6c529e0ee Update README and add documentation, screenshots to reflect this fork. 2016-08-14 18:22:45 -04:00
Zorg 010f642922 Add AppKit prevention guard 2016-08-14 18:14:48 -04:00
Zorg 55e906ba3e Show or dismiss installation progress after sending termination request
Whether we show or dismiss progress depends on whether the current application (from the user driver) is being terminated or not.
2016-08-14 14:32:44 -04:00
Zorg bbfcd564d2 Detect if shift key is held down ASAP when launching test app 2016-08-14 13:44:10 -04:00
Zorg 57325c7507 Add update permission request and response classes
We now pass these to and from the user driver.
2016-08-14 12:51:37 -04:00
Zorg 3f7c3933e7 Fix order of delegation events by dispatching async to main queue
This synchronizes more with the user driver handling events.
2016-08-14 00:55:17 -04:00
Zorg e972e9072c Remove unnecessary import 2016-08-13 23:20:16 -04:00
Zorg 6321329282 Comment why NSWorkspace launchApplicationAtURL: method isn't used 2016-08-13 21:50:45 -04:00
Zorg 73f49ce573 Remove userDriver and delegate properties from SPUUpdater
Until I find a good reason to have them there, they should not be publicly available.
I actually found a couple bugs from code that was accidently referencing them.
2016-08-13 21:32:31 -04:00
Zorg 32d9fd6526 Add flag for custom feed URL to sparkle-cli
This may be useful if user defaults can't be relied on for the feed URL.
For example, if an app is sandboxed, its user defaults may differ from the defaults sparkle-cli looks up.
2016-08-13 20:55:11 -04:00
Zorg 4ec5652a0d Add callbacks for scheduled updates occurring after a delay and being idled
I think I used to have this when the remote XPC callbacks were in the user driver and I removed them at some point.
These callbacks are now part of the SPUUpdaterDelegate and the logic is simpler now than before.
The command line utility makes use of these callbacks.
2016-08-13 20:35:14 -04:00
Zorg eb319ee1b7 Add documentation for prescheduled update actions 2016-08-13 19:37:20 -04:00
Zorg e21d4f1d32 Add sparkle-cli to release build configuration 2016-08-13 19:36:51 -04:00
Zorg d7ddfd2c6b Update installation documentation regarding permission for changing owner/group 2016-08-13 18:24:15 -04:00
Zorg b5ace2d037 Save the NSDate into user defaults for first launch instead of the interval
This is more consistent with how the last update check logic works.
I changed the value of SUTimeIntervalAtFirstLaunchKey for backwards compatibility purposes.
2016-08-13 18:03:16 -04:00
Zorg 3d7f48e03d Merge branch 'master' into ui-separation-and-xpc 2016-08-13 16:56:55 -04:00
Zorg e1397a7098 Copy localizations to installer progress app
Maybe one day only the localizations that are needed can be copied
2016-08-13 16:45:08 -04:00
Zorg ad10096156 Quit all running instances of an application 2016-08-13 15:02:24 -04:00
Zorg af7952b773 Hold down shift instead of command to use popup titlebar user driver 2016-08-13 14:33:09 -04:00
Zorg d9946273a7 Clarify when applicationBundle != hostBundle 2016-08-13 13:08:39 -04:00
Zorg 29d790c63c Pass application bundle into SPUUpdater instead of relying on delegate method 2016-08-13 12:57:26 -04:00
Zorg 26107994f4 Fix typo 2016-08-13 12:14:23 -04:00
Zorg f83d749a39 Not necessarily true, also there's external updaters to worry about 2016-08-13 12:13:27 -04:00
Zorg ad14421b24 Pass relaunch path to standard user driver from SUUpdater 2016-08-13 11:55:50 -04:00
Zorg 5114cd9d83 Distinguish between application and host bundle in user drivers 2016-08-13 11:21:15 -04:00
Zorg cdc329d2c3 Remove SPUUselessUserDriver and just pass nil 2016-08-13 10:57:00 -04:00
Zorg 8eb61afe53 Use SPUUserDriverUIComponent for command line user driver 2016-08-13 10:49:45 -04:00
Zorg b8ccc5d079 Fix compiler error 2016-08-13 10:35:38 -04:00
Zorg fa2e857b4e Add more AppKit prevention guards 2016-08-13 10:35:01 -04:00
Zorg d8ce7cb48b Add external releasenote support to popup titlebar user driver 2016-08-13 10:23:54 -04:00
Zorg 6dddbcc353 Add acknowledgement handler to installation did finish 2016-08-13 09:50:19 -04:00
Zorg f65f4beda8 Fix download progress for popup title user driver 2016-08-13 09:30:40 -04:00
Zorg 3c2875602e Add SPUUserDriverUIComponent and don't export SPUApplicationInfo 2016-08-13 09:19:48 -04:00
Zorg 1a94956f71 Rename userDriver to standardUserDriver for its delegate callbacks 2016-08-13 09:08:32 -04:00
Zorg 92b94343f4 Remove delegate property from SPUStandardUserDriverProtocol
Also remove delegate from user driver core component and popup titlebar user driver.
2016-08-13 09:00:51 -04:00
Zorg b58773cb5e Allow popup titlebar user driver to update other bundles 2016-08-13 08:49:47 -04:00
Zorg 6fb7b4a18b Use popup title user driver when holding down command at launch 2016-08-13 08:39:55 -04:00
Zorg f514861871 Add clarification why SPUStandardUserDriverProtocol doesn't adopt SUUserDriver 2016-08-13 01:37:37 -04:00
Zorg 73c659a2fe Update SPUStandardUpdaterController docs 2016-08-13 01:28:00 -04:00
Zorg a0bc1b19c8 Update some old "SUStandardUserDriver" references 2016-08-13 01:22:34 -04:00
Zorg 8e5554880d Move SUUpdaterDelegate.h to Deprecated group 2016-08-12 23:21:45 -04:00
Zorg d1c2faf7e5 Fixing some old SUUpdater references 2016-08-12 23:18:53 -04:00
Zorg 85914936d7 Add infinite recursion note for -feedURL 2016-08-12 23:06:10 -04:00
Zorg d0d39bc623 For installUpdatesIfAvailable stub, do background update check instead of initiated 2016-08-12 23:04:40 -04:00
Zorg f18d410c6a Add SPUUpdaterDelegate and deprecate SUUpdaterDelegate 2016-08-12 23:02:23 -04:00
Zorg 878c30d17c More SU -> SPU renaming for status completion results 2016-08-12 20:45:24 -04:00
Zorg f5afdc1cd8 Group download data, text encoding name, and MIME type into one class 2016-08-12 20:26:56 -04:00
Zorg bce9c083c1 Remove temporary read-write user preference exception for test app
Note cfprefsd processes may have to be killed or computer may have to be rebooted for user defaults to be read again for the test application.
2016-08-12 19:43:51 -04:00
Zorg 93c23e938f TestAppHelper doesn't do much, so doesn't need RunLoopType as NSRunLoop 2016-08-12 19:03:19 -04:00
Zorg a523621b71 Remove support for remotely using user driver from updater
Although it is interesting to separate the user driver and update scheduler in different processes, this has yet to prove useful. Further, this management should not exist in the user driver protocol since the protocol would be doing double duty. If this separation is useful in the future, it should be separated into another driver altogether. Note that it is also hard to write correct code that separates the user driver and updater. Removing this code should greatly reduce maintenance costs.
2016-08-12 18:48:54 -04:00
Zorg 86668d852b Remove LSBackgroundOnly from Progress Agent app
LSUIElement should only be used if the app can show UI
2016-08-12 16:58:50 -04:00
Zorg 62bbf73ab4 Remove "SUUpdater" reference 2016-08-12 16:52:38 -04:00
Zorg 1a0e169e7f Improve displaying release notes in sparkle-cli (safer & less code) 2016-08-11 20:58:53 -04:00
Zorg a51edf3dad Remove adopted protocol from protocols used for XPC
This is because XPC decoders on older systems may not traverse adopted protocols
2016-08-11 20:58:19 -04:00
Zorg f7d1cab4a0 Make sure we have a valid IANA charset name 2016-08-10 22:44:34 -04:00
Zorg 65d78d5129 Pass text encoding and MIME type to user driver for release notes
This fixes issues where the user driver may not be displaying release notes properly because it doesn't know what kind of data was downloaded (eg: html vs plain text).
2016-08-10 22:11:19 -04:00
Zorg 085724322f Use id type for updater 2016-08-10 21:44:12 -04:00
Zorg 69db74bc36 Resolve symlinks when finding a matching running application path
This fixes issues where Sparkle may think an application has already terminated when placed in a directory that has symlinks (such as /tmp/)
2016-08-10 20:29:10 -04:00
Zorg 11cbecbeaa Test changing ownership/group to determine if authorization is needed
This will work correctly in scenarios where the app to update is in a temporary location for instance.
2016-08-10 20:05:20 -04:00
Kornel 5f2ebb8edf Merge pull request #862 from moubry/master
Remove <link> from SampleAppCast.xml
2016-08-10 23:37:09 +01:00
Zorg 31d6d40112 s/SUStandardUpdaterController/SPUStandardUpdaterController/ 2016-08-10 18:22:41 -04:00
Zorg ba93d9056e Make configuration and valid feed URL checks safer
Instead of potential abort()'ing, we abort the update driver with a supplied error.
2016-08-10 18:16:01 -04:00
Sean Moubry ac4ef7d9a0 Remove <link> from SampleAppCast.xml
Sparkle doesn’t use the channel’s link element. This resolves issue:
https://github.com/sparkle-project/Sparkle/issues/861.
2016-08-10 17:11:48 -05:00
Zorg 9dca6fd27b Specifying invalid DSA key in the info.plist is now a config error 2016-08-09 23:35:27 -04:00
Kornel cc7c0ae052 Merge pull request #858 from catnapgames/patch-1
Make sign_update work when Bash is not the default
2016-08-09 16:34:51 +01:00
Tomas Andrle b8dc5b3f3d Make sign_update work when Bash is not the default
This script fails when Bash is not the default shell. This fixes it and allows the script to run on a default Ubuntu system, for example.
2016-08-09 14:52:26 +02:00
Zorg 2b65860293 Fix nullability warning 2016-08-06 21:01:15 -04:00
Zorg 766dd50aeb More SU -> SPU prefix changing 2016-08-06 21:00:14 -04:00
Zorg bdd2b7571b Mark SPUUpdater with nullability annotations 2016-08-06 20:47:30 -04:00
Zorg f2713138b9 s/SUUpdater/SPUUpdater/ 2016-08-06 20:30:58 -04:00
Zorg e53539b19e Don't deprecate +defaultComparator, although discourage it and use alloc/init 2016-08-06 11:18:00 -04:00
Zorg b676e3761a Add comments for the delegator property of SPUUpdater 2016-08-06 11:04:19 -04:00
Zorg a303859f10 Add deprecation notice to interactive package installer 2016-08-06 10:57:53 -04:00
Zorg bf0aa81546 Add deprecation notice from nib instantiated SUUpdater 2016-08-06 10:54:53 -04:00
Zorg eae8ccb2e7 Don't think SPUApplicationInfo should be exported 2016-08-06 10:52:29 -04:00
Zorg fdd6707f5b Add SU_EXPORT to user driver classes that should be public, I think 2016-08-06 10:49:32 -04:00
Zorg e3dd0d5ce5 Use class name rather than hardcoding it 2016-08-06 10:44:12 -04:00
Zorg 42a9a34be4 Add logging notice and some more explanation for not supporting -installUpdatesIfAvailable (yet) 2016-08-06 10:28:52 -04:00
Zorg 1663a822c8 Allow but deprecate serving download without DSA signature
This allows for a better transitioning period. In the future, this should be removed.
2016-08-06 10:20:36 -04:00
Zorg 6bfdd18d9e Ignore deprecation warnings in SUUpdater.m 2016-08-05 22:26:38 -04:00
Zorg b8d51539d7 Make SUUpdater.h a public header in the framework 2016-08-05 22:16:48 -04:00
Zorg e726dd01e4 Add incomplete -installUpdatesIfAvailable stub for now 2016-08-05 21:59:12 -04:00
Zorg 4ed6d40af8 Update deprecation documentation 2016-08-05 21:49:25 -04:00
Zorg 6e35a1b84d Add deprecation notice 2016-08-05 21:24:14 -04:00
Zorg 86e026588b Handle deprecated updater will install on quit callback
I may have to reconsider the design of this API in general.
2016-08-05 21:18:08 -04:00
Zorg ca36d9963e Remove -updaterIsRequestingQuit: delegate callback and use user driver instead
This way we remove delegate responsibility duplication and this should make backwards compatibility easier
2016-08-05 19:39:12 -04:00
Zorg c9f673cda8 Use SPU prefix in many places 2016-08-05 19:10:21 -04:00
Zorg f5444228c5 Re-add +defaultComparator on SUStandardVersionComparator
Have it be deprecated however. Maybe I can change my mind here later.
2016-08-04 00:15:04 -04:00
Zorg 4f285d2245 Rename SUUpdater -> SPUUpdater & add SUUpdater for backwards compatibility
New classes will soon be prefixed with "SPU"
I still need to look into adding a compatibility layer for -updater:willInstallUpdateOnQuit:immediateInstallationInvocation: and possibly deprecating no-DSA instead of outright rejecting it.
2016-08-03 23:30:55 -04:00
Zorg c811db1e67 Remove Release-HTTP build configuration 2016-08-01 22:17:20 -04:00
Zorg 5dfe4ce71b Set up ATS exceptions for Test App in release mode
Now the test app works properly when building it in release.
2016-08-01 22:02:18 -04:00
Zorg 1a3466ba04 Don't use TestAppHelper or code sign update in release 2016-08-01 22:01:30 -04:00
Kornel 43e96f7ee8 Merge pull request #847 from sparkle-project/relaunch
Better error message when relaunch tool bundle is not found.
2016-08-01 19:15:18 +01:00
Zorg 52fd21e119 Reload NSBundle cache on its info plist dictionary
We reload the info dictionary before we start off an update driver. This is so that we have the latest up to date information for the bundle.
2016-07-31 20:38:48 -04:00
Zorg 411c0ac8bd Only pass host bundle identifier to probe methods 2016-07-31 20:32:21 -04:00
Zorg 682a47f4fa Update INSTALL file 2016-07-30 22:35:59 -04:00
Zorg b8df5d3023 Merge branch 'master' into ui-separation-and-xpc 2016-07-30 22:18:29 -04:00
Zorg a7e03c7f9b Add note about when installer ignores agent/updater invalidation 2016-07-30 20:46:46 -04:00
Zorg 607399f1e6 Comment on why agent is connecting to installer instead of vise versa 2016-07-30 20:41:03 -04:00
Zorg cc9f4d92af Update validation documentation 2016-07-30 18:05:57 -04:00
Zorg 5ad5598a19 Make sure update directory != nil during cleanup 2016-07-30 17:49:37 -04:00
Zorg 1ca233eadf Validate the update before extraction whenever possible
If we download a package type installation or a delta update, we should validate the update before trying to unarchive it.

We can't do this with ordinary updates because we handle changing of DSA keys for that particular case.
2016-07-30 17:36:22 -04:00
Zorg 2fc57ce288 Move installation validation to separate class 2016-07-30 16:03:52 -04:00
Zorg d42ac08bf2 Split connection agent counter into two separate variables 2016-07-30 15:38:09 -04:00
Zorg 97ce687b86 Update installation documentation 2016-07-30 14:20:20 -04:00
Zorg 23e027d02f Have progress agent terminate after relaunching, not after stopping progress 2016-07-30 14:18:39 -04:00
Zorg 8c564fef1f Remove +[SUFileManager defaultManager] and use alloc/init 2016-07-30 10:39:17 -04:00
Zorg 069f78579c Remove commented code 2016-07-30 01:23:03 -04:00
Zorg ea1b04391f Improve cache storage handling of files
We first create a directory with respect to the app's bundle ID being updated, sparkle's bundle ID, and a directory inside for a specific purpose. Then we remove all old directories inside there, and create a new unique temporary directory.

This is to avoid conflicts with eg: multiple updaters running against each other around the same time, or files for one function interfering with files from another purpose, while still having a way to clean up old files.
2016-07-30 01:00:14 -04:00
Zorg 32584ab228 Make content length RSS attribute optional but highly recommended 2016-07-29 21:17:16 -04:00
Zorg 5852ecf0e7 Improve handling of disallowing update interaction
When resuming updates, if interaction is disallowed, we can't continue on with interactive package installation
2016-07-29 20:21:53 -04:00
Zorg 0d0258a87f Rename un/nonguided package to interactive package, and guided to normal 2016-07-29 00:22:52 -04:00
Zorg 097710e27a Update sparkle-cli help usage and interactive flag 2016-07-29 00:16:24 -04:00
Zorg b967c2f13f Disallow interaction for interactive package installers if updater rejects it 2016-07-29 00:15:55 -04:00
Zorg 322ee026ea Fix installer tests 2016-07-28 23:28:44 -04:00
Zorg e2da47b7c7 Improve handling of storing files in cache
Create distinct subdirectories in our cache directory so files for different purposes won't conflict.

For the installer, move the download archive to the installer's cache location. If the installer is running as root, this moves it to a place only root can access I believe. This is also to prevent other functionality from touching these files.
2016-07-28 22:54:28 -04:00
Zorg 32bf570b4c Add some comments to installation process 2016-07-28 20:27:12 -04:00
Zorg bd352c7db5 Take out lot of unnecessary installation code now 2016-07-27 23:11:59 -04:00
Zorg 626e506cae Update codesign_xpc script to sign auxiliary executables too 2016-07-27 21:50:25 -04:00
Zorg cb6fd34448 Add signing for progress agent in the launcher XPC service
This is only for debug builds. Release products aren't signed. This allows the updater agent app to be placed in the installer launcher service's MacOS directory, which is more convenient for developers to sign.
2016-07-27 21:08:32 -04:00
Zorg 3be36d8f22 Don't pass installer/agent path to launcher XPC service
The InstallerLauncher code now tries to locate these tools inside Contents/MacOS/ or inside the Resources directory. The installer launcher XPC service now has a copy of the tools included in its bundle.

This may seem like wasting space but it enables eg, the XPC service not trusting a sandboxed application. A developer could always remove the tools from the Sparkle framework if necessary (we can't because the XPC services are optional..)

Using the XPC service allows the developer to sign the installer executable (Autoupdate.app). The agent app can be moved and signed into the MacOS executables directory as well. We don't do that automatically because Xcode's tooling doesn't play nice with attempting that, although that could be looked at later.
2016-07-27 19:57:46 -04:00
Zorg 8ab7bd6edb Rename XPC services to use reverse DNS style 2016-07-27 00:40:04 -04:00
Zorg 5ceeb3dfd3 Remove "incoming connection" log 2016-07-27 00:04:34 -04:00
Zorg 2191a2b6ed Improve termination & cleanup for progress agent & installer 2016-07-26 23:57:48 -04:00
Zorg 2eccc3a1db Remove unused header 2016-07-26 23:39:49 -04:00
Zorg c445a3f1e4 Remove linking to unused system frameworks 2016-07-26 21:10:22 -04:00
Zorg 6fc5dfb8e7 Simplify release quarantine method 2016-07-26 21:05:42 -04:00
Zorg 929705d6dd Update installer unit test 2016-07-26 21:05:25 -04:00
Zorg 9e1664b42e This function shouldn't be concerned about symlinks
Besides, the path passed into this function in our code comes from a NSBundle
2016-07-26 20:50:23 -04:00
Zorg 260235b2a0 Break retain cycles rather than using weak ref for connection handlers 2016-07-26 20:42:15 -04:00
Zorg 646ed6f3c4 Improve logic for allowing installer interaction
We now distinguish between the updater delegate allowing interaction and the update driver allowing interaction. We also remove an interaction allowed flag from the AppInstaller, letting shouldShowUI flag suffice.
2016-07-26 20:00:56 -04:00
Zorg f9e2609fa1 Update is no longer cancelable after installation begins 2016-07-26 19:25:49 -04:00
Zorg 0ca688073b Disable root support & checking
Assume that the updater will be run as a logged in user.
The command line driver and progress app aren't completely root safe anyway, and running the progress app under a different user could be quite awkward from root
2016-07-26 19:16:38 -04:00
Zorg 9f4e44f919 Don't move old app to Trash
Several reasons:
* The user may not look at the trash anyway, and it would bloat their HD space
* Other sofware updaters don't move old versions to the trash either. Can confuse the user or not be seemly transparent experience.
* Moving app to trash will not work if user has to authenticate anyway
* Unclear how long and expensive this operation *could* take in all scenarios
* App replacements in Apple's new file system can be atomic-safe, but that may only be the case if the old app is no longer needed

Cons:
* Few tech savvy users may not be able to restore an app without re-downloading it. This would still be rarely done even amongst them.
2016-07-25 19:11:20 -04:00
Zorg eac55846a8 Avoid copying the installer to a temporary location 2016-07-25 17:13:18 -04:00
Zorg 70cc3ea360 Remove unused mach service 2016-07-25 00:14:13 -04:00
Zorg fe62ad0468 Merge branch 'xpc-remove-auth' into ui-separation-and-xpc 2016-07-25 00:12:45 -04:00
Zorg 7d16e223c3 Remove stray AuthorizationRef reference 2016-07-25 00:05:42 -04:00
Zorg 150f10ed05 Update Installer unit test 2016-07-24 23:55:21 -04:00
Zorg 0cb59a1b02 Update user driver documentation 2016-07-24 23:44:37 -04:00
Zorg 1384b5a80f Allow tagging installation type in appcast item enclosure
This is now necessary for package type installations so we can know whether or not we should authenticate ahead of time.

Of course, we also verify that the download contains the type of installation we expect (because the appcast is not very trusted).
2016-07-24 23:35:47 -04:00
Zorg 35801a22f2 Remove stray Autoupdate group folder reference 2016-07-24 21:51:54 -04:00
Zorg ec69aa07a3 Add JoinExistingSession to TestAppHelper too 2016-07-24 21:47:12 -04:00
Zorg d8196e1c5d s/cancelled/canceled/ 2016-07-24 20:17:09 -04:00
Zorg da8065f67e Put preventive measures for aborting update more than once.
This resolves issues with canceling not taking complete effect.
2016-07-24 20:13:06 -04:00
Zorg 8d93513813 Don't need SUAuthorizationEnvironment anymore 2016-07-24 19:28:56 -04:00
Zorg 1d3776d5c7 Show app icon in the prompt for authorization 2016-07-24 19:23:56 -04:00
Zorg e5643e2990 Improve authorization prompt handling
We now present a better worded dialog (X wants to update. Please type your password to allow this. OK/Cancel)
We still need to set the icon for the dialog window.

I also fixed some issues with canceling the dialog still throwing an error.
2016-07-24 17:05:26 -04:00
Zorg c95b337b09 Don't need SUSubmitInstaller.h/m anymore 2016-07-24 15:37:33 -04:00
Zorg 25a52439a1 Remove stray reference to SUAuthorizationEnvironment 2016-07-24 15:09:52 -04:00
Zorg e2a51347b9 Differentiate between resuming an installing update & a downloaded one 2016-07-24 14:37:21 -04:00
Zorg ec7766022d Add callback for showing downloaded updates that haven't started 2016-07-24 14:24:04 -04:00
Zorg 5c0ee2d74a Rename did finish downloaading callbacks to did start extracting 2016-07-24 13:29:03 -04:00
Zorg 48938d0e78 Clear downloaded update if delta extraction fails 2016-07-24 13:13:17 -04:00
Zorg a1d43997d9 With JoinExistingSession, the agent doesn't need to submit the intaller ever 2016-07-24 13:03:39 -04:00
Zorg 7d4690ed17 Add JoinExistingSession key to InstallerLauncher service
This is necessary for older OS versions (10.8 & 10.9), otherwise authorization interaction will not be allowed
2016-07-24 11:10:20 -04:00
Zorg 21ad358772 Add JoinExistingSession key to InstallerLauncher service
This is necessary for older OS versions (10.8 & 10.9), otherwise authorization interaction will not be allowed
2016-07-24 11:06:37 -04:00
Zorg ad950beab6 Include SUStatusInfoProtocol methods in SUInstallerStatusProtocol to fix 10.8 compatiblity issues 2016-07-23 23:57:20 -04:00
Zorg d98fe465b5 Allow installer authorization by default
Fixes accidental bug during refactor where authorization wouldn't even be attempted
2016-07-23 23:54:08 -04:00
Zorg 3200029157 Include adopted protocol methods in SUInstallerStatusProtocol
This is because of compatibility issues with 10.8
2016-07-23 23:31:00 -04:00
Zorg 41ee168f2c Change try again error to authorize later error 2016-07-23 14:49:19 -04:00
Zorg c2db46f656 Add error codes to log messages 2016-07-23 14:46:35 -04:00
Zorg 350aeb1c81 Change how errors are passed & clear download after installer starts 2016-07-23 13:50:14 -04:00
Zorg 345ed3b60e Add resuming downloaded updates without starting the installer automatically
This allows automatically downloading updates, and having them prompt up later, so the user can perform authorization later for starting up the installer
2016-07-23 09:08:29 -04:00
Kornel dbff23ea9d Merge pull request #851 from sorccu/patch-1
Add Carthage/Build to .gitignore
2016-07-22 13:02:36 +01:00
Simo Kinnunen ed97e6cb75 Add Carthage/Build to .gitignore
With Carthage, if Sparkle is included as a Git submodule (e.g. with the --use-submodules option), the main module's .gitignore can't reach all the way inside the submodule to ignore the added Carthage/Build symlink, and Git keeps complaining about untracked changes in the submodule forever, which is very annoying. To avoid that issue, ignore here in Sparkle instead.
2016-07-22 18:26:15 +09:00
Kornel Lesiński 492664c611 Clarify comment 2016-07-21 20:01:22 +01:00
Kornel Lesiński fdf07644d0 Better error message when relaunch tool bundle is not found. 2016-07-19 16:06:03 +01:00
Zorg b014737e83 Group appcast update item, download name, and temp directory into one class 2016-07-18 23:25:44 -04:00
Zorg 3244bf7f14 Move installer status info service to progress agent 2016-07-18 21:14:33 -04:00
Zorg 50594dda57 Move execute package out from SUFileManager 2016-07-18 19:48:25 -04:00
Zorg dd02cb2509 Change Autoupdate target from app to command line tool 2016-07-18 18:46:12 -04:00
Zorg 66e3083e0c Initial work on removing AuthorizationExecuteWithPrivileges
I need to at least look at:
* Automatic downloaded / silent updates
* Running updates as root user from beginning
* Status info query service
* Add guided flag in the appcast
2016-07-18 17:40:35 -04:00
Zorg 6b5f014946 Release self if we fail to set up termination callback 2016-07-17 10:54:15 -04:00
Zorg 849d265900 Use kqueues to determine if a process identifier terminates
This way we don't have to rely on AppKit for watching when the target process dies
2016-07-16 21:58:41 -04:00
Zorg 59af8ae0ba Remove old reachability related code/comments 2016-07-16 17:21:57 -04:00
Zorg f7f9ac4c6d Terminate the running application matching the bundle rather than ourselves
This allows the standard user driver to properly be used remotely
2016-07-16 16:59:54 -04:00
Zorg 3939fcfb82 Update Installation documentation 2016-07-16 16:34:01 -04:00
Zorg e0109e2fd5 Have executable path be inside arguments array 2016-07-16 13:09:08 -04:00
Zorg da185de61b Rationalize which domain we submit jobs under 2016-07-16 13:04:10 -04:00
Zorg e00d303c08 Don't log that we're terminating the app
This way if installation takes a long time, it may not look like it is because of termination.
2016-07-16 12:11:52 -04:00
Zorg c37fc24389 Rename AutoUpdate to Installer for service name functions 2016-07-16 08:58:34 -04:00
Zorg a962c8fa8f Make sure Mach service names are shorter than 64 characters
NSXPCConnection has this length restriction on 10.8 and possibly later versions of macOS
2016-07-16 08:30:37 -04:00
Zorg ea6625024c Improve detecting if the updater is still alive
Rather than just testing if our connection is still alive (which is deceiving), we make a ping/pong request and see if we get a response back.
2016-07-15 16:48:26 -04:00
Zorg 64d740a761 Don't log SMJobRemove() job not found error
Also rationalize why we aren't first checking if the job already exists
2016-07-13 22:55:20 -04:00
Zorg 2c3996a522 Add timeouts if the installer or updater don't respond back in timely matter
This is only for creating the initial connection
2016-07-13 22:28:36 -04:00
Zorg 97eb25b27f Supply the base URL when loading external release notes
This fixes an issue where relative external references could not be loaded from the release notes.
Note this just affects apps that have a 'com.apple.security.network.client' entitlement or apps that aren't sandboxed.
2016-07-13 18:00:06 -04:00
Zorg e171824a74 Merge branch 'master' into ui-separation-and-xpc 2016-07-13 00:28:14 -04:00
Zorg a65a7346cf Fix 10.8 bug by re-declaring method in Installer connection protocol
Even though the method is declared in the super protocol type, the XPC decoder on older systems (i.e, 10.8) doesn't parse methods there.
2016-07-12 23:25:27 -04:00
Zorg 7092c19652 Remove accidental SparkleInstallerConnection copy in framework 2016-07-12 21:19:28 -04:00
Zorg 69b4b9e81b Fix installer progress app not terminating properly
This is done by canceling apple termination events, and by exit'ing later
2016-07-12 20:43:53 -04:00
Zorg 8563a40cd2 Use XPC for IPC to the installer instead of CFMessagePort
We now use XPC for communication between Sparkle.framework and Autoupdate.
Autoupdate is now ran as a launchd agaent/daemon. (Most of the time, it acts as an agent).

Using XPC can only be done from non-sandboxed processes, so a connection and status service had to be created.

Currently, the GUI progress tool doesn't work properly, but everything else should be behaving like before.
2016-07-12 19:59:24 -04:00
Zorg 80bc8353ed Handle defer installation when resuming updates in sparkle-cli 2016-07-12 19:50:00 -04:00
Kornel 092feba9f9 Merge pull request #836 from zorgiepoo/remove-reachability
Don't use reachability as a preflight check
2016-07-08 10:27:13 +01:00
Zorg 91c813b6ab Don't use reachability as a preflight check
This removes the reachability code that we have for background scheduled updates.
Apple (and others) don't recommend using reachability to test if a network connection is online.

See:
http://stackoverflow.com/questions/7178330/what-is-the-advantage-of-using-reachability
https://www.mikeash.com/pyblog/friday-qa-2013-06-14-reachability.html (just the comments)
Apple 2012/2011 WWDC videos on networking

Also, our current reachability code is rather illogical:

* reachabilityResult is always NO
* isNetworkReachable is always YES
* flags is ignored
* horrible use of dispatch_sync & putFeedURLIntoDictionary is terrifying
* NSException handling shouldn't be done

Removing this code which wasn't even coded properly, and which would still be misusing the reachability API anyway, also leads to removing some multithreading races and simpler logic :)
2016-07-06 22:38:49 -04:00
Kornel 1ced9c428a Merge pull request #834 from zorgiepoo/dsa-key-comment
DSA security check comment
2016-07-05 14:44:11 +01:00
Zorg 16de00d81d If the old & new DSA keys are the same, then DSA validation must pass for security 2016-07-04 23:43:05 -04:00
Zorg 7d1c0aa83b Merge branch 'master' into ui-separation-and-xpc 2016-07-04 23:29:09 -04:00
Zorg 1b5b4972c9 Document -grantAuthorizationPrivilegesWithError: 2016-07-04 21:33:51 -04:00
Zorg ddb4262b7b Rename and document -updateAccessTimeOfItemAtRootURL:error: 2016-07-04 21:25:54 -04:00
Zorg 599c3fb3c1 Add unit test for updating access dates 2016-07-04 21:10:49 -04:00
Zorg b8bb06fb2f Change step # references to section names now 2016-07-04 19:56:23 -04:00
Zorg 63febfd9cd Updating installation docs into sections rather than bulleted points
Also make some other changes with choice of wording
2016-07-04 19:51:40 -04:00
Zorg b4f7a28aa3 Add updater delegate immediate installation handler to installation docs 2016-07-03 20:18:21 -04:00
Zorg 998a349617 Add updater delegate method for installing & relaunching new update 2016-07-03 18:44:11 -04:00
Zorg 9881476008 Update updater delegate documentation 2016-07-03 14:22:22 -04:00
Zorg 340633fd79 Comment more on why launching Autoupdate with LaunchServices is necessary 2016-07-03 11:54:28 -04:00
Zorg a615703883 Suppress const void* to void* warning for context info 2016-07-03 00:42:42 -04:00
Zorg e4d6e268e2 Stage 2 installation seems to be handled fine 2016-07-03 00:24:38 -04:00
Zorg e32d0dbc1a This validation warning note isn't a real concern for now 2016-07-02 23:32:56 -04:00
Zorg ef4af6b4a8 Marking main parameters as unused 2016-07-02 23:31:05 -04:00
Zorg 8de5c5cfa2 Update installation data documentation 2016-07-02 23:30:36 -04:00
Zorg 54408ca1a9 Fix bug where updater ignored 3rd stage installation failures
Only prevalent if the updater lives in a different process than the app being updated
2016-07-02 23:23:57 -04:00
Zorg 4240138818 The installer shells out to authorization 2016-07-02 19:29:53 -04:00
Zorg 39f7915492 Non-guided pkg installers show progress already 2016-07-02 19:28:35 -04:00
Zorg 23a07127d0 Add installation documentation detailing IPC 2016-07-02 19:26:33 -04:00
Zorg 641f3b0d47 Update mdimporter bundles during delta extraction
During delta extraction, these bundles may not be updated appropriately, so we should just be safe and update them ourselves
2016-07-01 21:23:51 -04:00
Zorg a7aad3b16a Use the authorization environment when requesting for auth
This probably went missing accidently when I did a merge
2016-07-01 20:13:39 -04:00
Zorg a6ccd4cfa9 Avoid unguided package installers if we may be running as root 2016-06-30 22:14:19 -04:00
Zorg b982e9460c Handle package installer (non-guided) errors 2016-06-29 00:09:22 -04:00
Zorg a09aa0b33f Package installs should be guided by default. Opt out for non-guided. 2016-06-29 00:09:08 -04:00
Zorg 9acfe7f180 Don't pass allowsAutomaticUpdates to user driver
Let the user driver read from updater settings to know if automatic updates are allowed
2016-06-28 00:28:21 -04:00
Zorg 30f346a967 Fix normal & resumable update handlers for popup titlebar user driver 2016-06-27 23:57:34 -04:00
Zorg 9a528d912a Fix PopUp Titlebar user driver not showing embedded release notes 2016-06-27 23:57:12 -04:00
Zorg c117837785 Add resumable update handler & fix normal update handler in sparkle-cli 2016-06-27 23:29:45 -04:00
Zorg 34ce18c44f Add private function for disabling stderr logging
This is useful for releasing sparkle-cli
2016-06-27 23:15:51 -04:00
Zorg e919c13f55 Always log output to stderr (for now...) 2016-06-27 00:02:37 -04:00
Zorg a3a6e3b3b7 Separate showing downloadable update from resumable update in user driver 2016-06-27 00:00:20 -04:00
Jake Petroules 3f637c9674 Sanity check that the Podspec version matches the Sparkle version. 2016-06-26 15:03:48 -07:00
Zorg 23a3ad4b05 Remove pch files, don't use older __nullable/__nonnull attributes 2016-06-25 10:18:12 -04:00
Kornel 4a4dc3629f Merge pull request #828 from zorgiepoo/fileop-compile-error
Fix SUFileOperationConstants not found in Test App under Release
2016-06-25 11:45:10 +01:00
Zorg dc5298ce54 Make method for finding running appliction to reduce duped code 2016-06-24 23:42:31 -04:00
Zorg 6437e0448a Warn a developer if they're using a debug version of Sparkle
Due to different values for min/default update check intervals, production apps should not use a debug version of Sparkle
2016-06-24 20:13:17 -04:00
Zorg c77cd49036 Fix SUFileOperationConstants not found in Test App under Release 2016-06-24 19:55:40 -04:00
Zorg 1aedf2f9ed Remove duplicated Sparkle Cache directory code 2016-06-23 23:31:18 -04:00
Kornel 9d7e4d676d Merge pull request #823 from nivekkagicom/master
update Sparkle framework headers to use modules if modules are available
2016-06-23 17:41:44 +01:00
Kornel 1aa0ee8152 Merge pull request #825 from jerrykrinock/xcode8
Changes for Xcode 8
2016-06-23 17:38:47 +01:00
Kornel Lesiński 9944f2496c Comment 2016-06-23 17:24:16 +01:00
Zorg 1392190d47 Make sure SULog delivers messages synchronously 2016-06-21 19:04:01 -04:00
Zorg b1606648cf Use isValidVersion: method in SUHost that already exists 2016-06-20 23:35:17 -04:00
Zorg 4d379f3e0a Add copying SparkleLocalMessagePort to release package script 2016-06-20 00:21:11 -04:00
Zorg da39e841f9 Fix build errors for fileop 2016-06-20 00:17:46 -04:00
Zorg 7e54e94472 Remove build settings I didn't configure
Maybe these happened during a bad merge.
2016-06-20 00:12:00 -04:00
Zorg 6cca0673c5 Change SURemoteMessagePort protocol to SURemoteMessagePortProtocol 2016-06-19 23:52:46 -04:00
Jerry Krinock 33907ec4ed • In SUUpdater.m, use SULocalizedString macro instead of NSLocalizedString.
• In SUOperatingSystem.m, assert instead of test for nil URL.
2016-06-17 22:24:43 -07:00
Jerry Krinock 7892e41b27 Fix for warning in in SUAppcast.m now tests for nil instead of using setValue:forKey: 2016-06-17 20:23:32 -07:00
Jerry Krinock 53983d9452 The following changes were made to clear warnings from static analyzer in Xcode 8:
• In ConfigCommon.xcconfig, removed references to CLANG_WARN_OBJC_RECEIVER_WEAK and -Wno-receiver-is-weak, because apparently these had been deprecated and are now no longer recognized.
• In SUAppcast.m, changed to method which can accept nil.
• In SUOperatingSystem.h, added a check for nil which probably never happens.
• In SUUpdateAlert.m, swapped receiver with parameter in -isEqualToString, 3 places, so that nonnull parameter could never be nil.
• In SUUpdater.m, added NSLocalizedString() wrappers around 8 recently-added (in the last few years, I think) user-facing warning strings.
2016-06-17 14:42:44 -07:00
Zorg 6a4b96580a Info only updates shouldn't require enclosure length 2016-06-16 23:27:39 -04:00
Zorg a780894d14 Fix appcast unit tests 2016-06-16 23:23:43 -04:00
Zorg af7c7cea2b Merge branch 'master' into ui-separation-and-xpc 2016-06-16 22:46:26 -04:00
Zorg 29d32eaaa0 Disable automatic termination when using SULocalMessagePort 2016-06-16 22:38:11 -04:00
B. Kevin Hardman f3a151d473 update Sparkle framework headers to use modules if modules are available 2016-06-16 12:16:31 -04:00
Zorg 061e99995f Add XPC service for local message port
This should work under 10.12 (beta) environment now when sandboxed.
2016-06-15 21:44:24 -04:00
Jake Petroules bb624ffa59 Replace OS X with macOS or more generic terminology. 2016-06-15 13:46:19 -07:00
Jake Petroules 2963f788e1 Fix version number in Doxyfile. 2016-06-15 13:43:40 -07:00
Zorg 911f2150f9 Don't think update driver should be interruptible anymore 2016-06-11 23:52:05 -04:00
Zorg adba3bd945 Don't allow SUUpdater to be kept alive by cycle resets 2016-06-11 23:31:24 -04:00
Zorg 71b91734e5 Merge branch 'master' into ui-separation-and-xpc 2016-06-11 21:07:57 -04:00
Kornel 9017962ab9 Merge pull request #818 from zorgiepoo/auth-wait-fileop
Improve Authorization Usage (Take 2)
2016-06-11 00:24:22 +01:00
Zorg dd0805c05b No need to log the underlying error
This is already logged when logging the main error
2016-06-10 16:13:18 -04:00
Zorg e4c3c29a85 Fix SUFileOperationConstants link errors in BinaryDelta 2016-06-09 07:59:46 -04:00
Zorg f70c7429ba Merge branch 'auth-wait-fileop' into ui-separation-and-xpc 2016-06-08 23:44:05 -04:00
Zorg be1e86174a Wait for the appropriate process when authorizing file operations
This changes the way we authorize & execute commands, and how we wait for their completion. In order to obtain the correct child to wait (instead of another one terminating intermediately), we use a wrapper tool (fileop) to output its pid onto the communication pipe that we read from the other end.
2016-06-08 21:49:58 -04:00
Zorg 207390a2c1 Retrieve child pid by using fcntl() 2016-06-06 23:11:38 -04:00
Zorg 86d5d49111 Comment why AuthorizationExecuteWithPrivileges() is still being used 2016-06-04 18:02:21 -04:00
Zorg b2cb1bd531 Wait for all children processes to stop
This fixes installation failing when we check for the wrong child and don't let the installer finish. However, this code now ignores the status from the child. I might see if there's a better way around fixing that..
2016-06-04 17:38:21 -04:00
Zorg f36397e89c Handle EINTR for wait() and don't store / back up ECHILD handler 2016-06-04 13:31:57 -04:00
Zorg 623f535883 We can do guided installation silently if we're root 2016-06-03 23:16:21 -04:00
Zorg 070686b488 Use NS_ASSUME_NONNULL macros 2016-05-29 20:21:14 -04:00
Zorg 4482e2b736 Fix unsigned cast warning 2016-05-29 20:20:42 -04:00
Zorg c80ddf99f8 Declare constants for SUAppcastItem.m 2016-05-29 17:42:34 -04:00
Zorg 45aaba9ee9 Use ivars in SUAppcastItem initializers to make code smaller 2016-05-29 17:29:13 -04:00
Zorg 53c4abaf9e Remove providing custom installer progress app
I don't think this feature would be used much, and I don't want to deal with additional maintainability. As it is, the progress app should show up in rare cases.
2016-05-29 17:01:38 -04:00
Zorg d44ef6bb75 Installer progress: change the dock icon to the bundle being updated
This way we don't have to include an icon for the installer progress app. There is a minor issue where the dock icon changes back before termination. However, this app should show up in rare cases in the first place, so I still think this is a good trade off.

For most applications, it makes more sense to use the app's icon than Sparkle's. That and we can save some disk space usage.
2016-05-29 16:39:46 -04:00
Zorg 355d6eddbf Rely more on content length from appcast item than from downloader
The rationale is that the downloader may be giving us an expected length for a block of data rather than the whole
2016-05-29 14:25:21 -04:00
Zorg f62285ff3b Use Appcast's content length when downloader doesn't retrieve an expected length 2016-05-29 13:17:56 -04:00
Zorg 80267f22b5 Test if we are root for guided silent installs 2016-05-29 11:28:38 -04:00
Zorg da145b2100 Log terminating target application in sparkle-cli 2016-05-29 11:28:11 -04:00
Zorg 0fb951bd4c NSURLQuarantinePropertiesKey isn't used anywhere 2016-05-29 10:53:45 -04:00
Zorg b4f1f67ddb Prevent using wrong combination of flags 2016-05-28 23:15:54 -04:00
Zorg a113ce49bd Add interactive option to sparkle-cli
This allows installation by requesting the user to enter a password when elevated privileges are necessary. This only works if the application is alive before installation begins.
2016-05-28 23:04:43 -04:00
Zorg ec0889ef83 Redirect stdout/stderr when unmounting dmg 2016-05-28 17:06:41 -04:00
Zorg 1046cb4217 Don't attempt 3rd installation stage if 2nd failed 2016-05-28 12:05:00 -04:00
Zorg f210fddb30 Add error for being unable to install the update silently 2016-05-28 11:50:46 -04:00
Zorg 0cf1aee693 Add -updaterShouldDownloadReleaseNotes: delegate method 2016-05-28 10:13:18 -04:00
Zorg 7bfccc3898 Fix nullability warning 2016-05-28 09:49:51 -04:00
Zorg 87903c0d97 Fix unit tests from not compiling
SUFileManager fileManager method had to be renamed to satisfy Swift
2016-05-27 22:23:04 -04:00
Zorg 7df7222fe4 Merge branch 'master' into ui-separation-and-xpc 2016-05-27 16:30:13 -04:00
Zorg 348426e501 Make cancelling authorization prompt graceful
An error dialog no longer shows up when the user cancels an authorization request
2016-05-27 15:56:26 -04:00
Zorg bcb3f669ba Fix couple of nullability warnings 2016-05-27 14:26:13 -04:00
Zorg 1438dd6140 Rename SUUnarchiver protocol to SUUnarchiverProtocol for less confusion 2016-05-27 14:14:22 -04:00
Zorg 64a7624744 Add authorization environment when using file manager
If the file manager is used for authorization, we can now supply an authorization environment.

This allows us to specify a customized prompt message and an icon to use in the authorization dialog window. We no longer need to include an icon for Autoupdate app.

We now also see if we can get authorization rights access right away, rather than lazily when executing a tool.
2016-05-27 12:36:44 -04:00
Zorg d182b28d09 Rename AppcastDownloader service to TemporaryDownloader 2016-05-26 18:27:15 -04:00
Zorg c5026976ee Rename UpdateDownloader service to PersistentDownloader 2016-05-26 18:10:07 -04:00
Kornel 8b56fba39b Merge pull request #814 from DivineDominion/master
add Carthage & CocoaPods compatibility indicators to README
2016-05-26 11:06:42 +01:00
Christian Tietze db232a263b add CocoaPods indicator 2016-05-26 10:44:15 +02:00
Christian Tietze 4d952e9961 add Carthage indicator 2016-05-26 10:43:29 +02:00
Kornel Lesiński 64fd27d918 Fix 10.7 compat in new code 2016-05-22 23:09:23 +01:00
Kornel Lesiński 666e86b0bb Merge remote-tracking branch 'origin/master' into nsparse
* origin/master: (31 commits)
  Fix indentation with bspatch.c
  Fix warnings for bsdiff.c
  Improve error handling on readfile()
  Don't forget to free the buffer on failure
  Don't exit the program on failure for bsdiff.c
  Don't exit the program on failure for bspatch.c
  Use FILE* functions in bspatch.c
  Use FILE* (fopen/fread/etc) functions for bsdiff.c
  Fix warnings for bspatch
  Don't hide warnings for bsdiff/bspatch
  Reorganize checks for clarity
  Update changelog
  Update screenshot with new logo.
  Remove Sparkle.png. This does not appear to be used anywhere anymore.
  Set correct DPI for all images (72 for @1x, 144 for @2x).
  Assign newly added icon images in asset catalog (#801) (#804)
  Update app icon for Autoupdate.app (#347)
  Updated sponsored by text and links (#800)
  Upgrade warning to alert for signing update over HTTP with no DSA key
  Clear update caches directory before downloading new update
  ...
2016-05-22 23:09:08 +01:00
Kornel 601b4a7a7f Merge pull request #811 from zorgiepoo/bsdiff-fixes
bsdiff fixes
2016-05-22 22:31:12 +01:00
Zorg c9cb670761 Improve codesign_xpc script by taking files instead of a directory 2016-05-21 19:55:37 -04:00
Zorg cd135d9b10 Add log to see if remote message service gets interrupted 2016-05-21 00:07:36 -04:00
Zorg 1084071810 Enable automatic termination if creating CFMessagePort fails 2016-05-20 23:58:31 -04:00
Zorg dd0230e6c2 Use ASL_LEVEL_ERR instead of "3" 2016-05-20 21:57:47 -04:00
Zorg d463db5742 Protect RemoteMessagePort service terminating prematurely 2016-05-20 18:28:07 -04:00
Zorg e3795194d6 Set completion handler to nil when download fails 2016-05-20 18:26:53 -04:00
Zorg cb5cf9aa69 self can't be nil here 2016-05-20 16:35:09 -04:00
Zorg 0a53d51d89 Don't send NSURLResponse objects over XPC or to the user driver
This class doesn't support NSSecureCoding in OS X 10.8, so this fixes a crash there.
2016-05-19 21:52:50 -04:00
Zorg 4a0837a500 Add wrapper class over NSURLRequest that implements NSSecureCoding
This fixes a crash on OS X 10.8 where NSURLRequest didn't implement secure coding there
2016-05-19 21:21:50 -04:00
Zorg 83fe6adcba Make sure XPC versions are synced with the framework version 2016-05-19 19:29:47 -04:00
Zorg 7c06ceb7e4 Set version info for XPC services 2016-05-18 22:28:02 -04:00
Zorg 4661fee388 Deal with byte order when sending installation progress 2016-05-18 20:08:01 -04:00
Zorg 1a952227a7 Replace assert(false/NO) with abort() 2016-05-18 19:15:01 -04:00
Zorg eec2eca0c2 Document SULog and its intended use case 2016-05-18 19:04:41 -04:00
Zorg a8dd49acad On second thought, stick to using NSLog for DEBUG warning 2016-05-18 19:03:13 -04:00
Zorg 3826b35bc2 Explain why NSLog is being used here. 2016-05-18 18:53:30 -04:00
Zorg 4ba3673dfd Use SULog over NSLog in a couple of places now 2016-05-18 18:52:25 -04:00
Zorg 72d63f3992 Print friendly error messages in sparkle-cli 2016-05-18 18:51:47 -04:00
Zorg 346f996942 Re-write logging functionality
1. Use Apple's logging system (ASL) - don't invent our own inefficient mechanism.
2. Logging is not dependent on a global file that any process and thread using Sparkle can write to now, which could also be cleared at any point before.
3. Don't write to stderr on non-debug builds. This is ideal for sparkle-cli utility.
2016-05-18 18:48:01 -04:00
Zorg 3b05179ccf Don't litter status messages with SULog
We should just stick to logging errors
2016-05-18 18:01:02 -04:00
Zorg 1316707136 Fix indentation with bspatch.c 2016-05-16 22:30:48 -04:00
Zorg e485baf8b8 Fix warnings for bsdiff.c 2016-05-16 22:20:35 -04:00
Zorg d71fe4a17d Improve error handling on readfile() 2016-05-16 22:05:53 -04:00
Zorg f990f5fcfc Don't forget to free the buffer on failure 2016-05-16 22:05:43 -04:00
Zorg 07ac154e2e Don't exit the program on failure for bsdiff.c 2016-05-16 22:05:29 -04:00
Zorg 48eb25fbf3 Don't exit the program on failure for bspatch.c
We call warn type functions instead of err ones now and do some cleanup
2016-05-16 22:05:19 -04:00
Zorg 914bf9e333 Use FILE* functions in bspatch.c 2016-05-16 22:04:44 -04:00
Zorg 271b7a1daf Use FILE* (fopen/fread/etc) functions for bsdiff.c
This way we don't have to handle EINTR
2016-05-16 22:01:41 -04:00
Zorg c11c660f22 Fix warnings for bspatch 2016-05-16 21:58:32 -04:00
Zorg 0e2fe68399 Don't hide warnings for bsdiff/bspatch 2016-05-16 21:57:19 -04:00
Zorg 159c16fc12 Improve error handling on readfile() 2016-05-16 19:25:39 -04:00
Zorg 71330366d8 Don't forget to free the buffer on failure 2016-05-16 19:22:34 -04:00
Zorg a1b6cbb5e2 Don't exit the program on failure for bsdiff.c 2016-05-16 19:15:57 -04:00
Zorg e1af0264de Don't exit the program on failure for bspatch.c
We call warn type functions instead of err ones now and do some cleanup
2016-05-16 19:02:00 -04:00
Zorg 7056ccb321 Use FILE* functions in bspatch.c 2016-05-16 18:21:52 -04:00
Zorg 77ad42aab6 Use FILE* (fopen/fread/etc) functions for bsdiff.c
This way we don't have to handle EINTR
2016-05-16 10:57:42 -04:00
Zorg fa36cb300b Add exception handling to secure coding archivers/unarchivers 2016-05-14 23:27:59 -04:00
Zorg 8b19b0e1b4 Adding todo to implement showing linked release notes from popup user driver 2016-05-14 21:57:41 -04:00
Zorg fbb9fbf535 Add showing release notes from sparkle-cli 2016-05-14 21:56:35 -04:00
Zorg 1446acf519 Add methods onto user driver show showing linked release notes
These release notes are downloaded while showing that the new update is found
2016-05-14 21:45:25 -04:00
Zorg 95416e4f65 Add SUURLDownload specifically for downloading temporary files 2016-05-13 22:11:47 -04:00
Kornel 852965d824 Merge pull request #807 from sparkle-project/seccheck
Simpler conditions for security config check
2016-05-12 23:19:08 +01:00
Kornel Lesiński e2c60be805 Reorganize checks for clarity 2016-05-12 15:19:57 +01:00
Kornel Lesiński 71e15f4b1d Update changelog 2016-05-10 13:32:27 +01:00
Zorg d21c4c4785 s/appcastData/data/ - this shouldn't be appcast specific 2016-05-08 16:25:56 -04:00
Zorg 70582639ee Remove completion block from SUUpdateDownloaderProtocol
Only use the delegate now for communication via this protocol.
This cleans up some inconsistency.
2016-05-08 16:24:16 -04:00
Zorg 033f59e643 Comment on why these delegate methods are being implemented 2016-05-06 19:36:46 -04:00
Zorg c9c1de30e4 Don't implement failedToDownloadUpdate delegate
It's not necessary and won't be invoked before user driver shows the error.
2016-05-06 19:35:13 -04:00
Zorg 9d1e707577 Add probing for updates to sparkle-cli 2016-05-06 19:22:15 -04:00
Zorg bc43e9186f Download cleanup should be before aborting 2016-05-06 19:20:17 -04:00
Zorg 4a2dd657b2 Remove Supporting Files group for sparkle-cli 2016-05-02 02:00:00 -04:00
Zorg 0df9bd6760 Merge branch 'master' into ui-separation-and-xpc 2016-05-02 01:22:58 -04:00
Zorg c2f4be611b Add usage description & options to sparkle-cli 2016-05-01 22:14:49 -04:00
Zorg 702a1dffc0 Add the old and a new postpone relaunch hook to the install driver 2016-05-01 18:23:45 -04:00
Zorg 704518278c Set installer driver's update item when resuming an update 2016-05-01 17:56:42 -04:00
Zorg 738490af07 Fix not showing that updates can be checked before permission request 2016-05-01 17:09:44 -04:00
Zorg 4b75564b5f Remove has launched before check box from Test App
We don't export an API for configuring this in SUUpdater.
Messing with the user defaults is not ideal, and we don't use hasLaunchedBefore anymore

For testing this, the user defaults should just be removed manually, and the test app should be relaunched.
This option never used to work for me that well before anyway.
2016-05-01 16:54:17 -04:00
Zorg 305e33945f Change update permission prompt to prompt after a few hours
The old behavior used to be to prompt on second launch.
However, applications can be re-launched in a short amount of time, and Sparkle can be loaded multiple times during a single app launch.
So prompting after a certain amount of time after first launch works better.
2016-05-01 16:21:22 -04:00
Zorg 350eba452c s/SUUpdatePermissionPromptResult/SUUpdatePermission/ && s/shouldSendProfile/sendProfile/ 2016-05-01 14:54:17 -04:00
Zorg 1356024b25 Add --grant-automatic-checks and --send-profile flags
If an update permission request comes up, this alows us to make a decision.

Also I renamed the defer and checknow flags to defer-install and check-immediately
2016-05-01 14:33:13 -04:00
Zorg 235e93f0c1 Dismiss update installation before aborting update
This fixes bug where the idle status update is invoked before the install is dismissed.
2016-05-01 13:51:57 -04:00
Zorg 7d8d5d1f46 Adjust error message for automatic updates being disabled 2016-05-01 13:51:39 -04:00
Zorg 004da55780 Add error message if bundle paths are invalid/inaccessible 2016-05-01 12:03:50 -04:00
Zorg c0a148f5ff Post relaunch notification only if we are relaunching 2016-05-01 11:54:23 -04:00
Zorg 981f67e8b1 Only trigger update delegate error abort when there's an error 2016-05-01 11:21:04 -04:00
Zorg a4157e5989 Add checknow flag to check for updates immediately
What is new is that we can now disable checking for updates immediately.
sparkle-cli is not intended to be run for a long time, so if the next update check is not soon, we exit.
A client can now launch sparkle-cli without having to necessarily check for updates, so that they don't check for updates too soon.
2016-05-01 02:46:22 -04:00
Zorg 9bea84b29e Fix unit tests from not compiling 2016-05-01 01:10:35 -04:00
Zorg d632dcb72f Add a verbose mode to command line driver 2016-05-01 01:06:38 -04:00
Zorg 11c79b7b2a Add command line argument parsing to sparkle-cli
Also add defer installation option, which will not terminate the application right away.
Rename "relaunch" option as "application" instead.
2016-05-01 00:39:28 -04:00
Zorg 83bb5354dc Use NSRunLoop instead of NSApplication
Don't use AppKit where we don't have to, especially for command line tools
2016-04-30 23:02:21 -04:00
Zorg 15483815ff Pass path to relaunch to sparkle-cli
We also now listen on termination for the app that we are going to re-launch,
rather than the bundle we are updating.
2016-04-30 22:52:04 -04:00
Jake Petroules 8a4e4aea2c Update screenshot with new logo. 2016-04-30 17:47:37 -07:00
Jake Petroules 8fea6670c2 Remove Sparkle.png. This does not appear to be used anywhere anymore. 2016-04-30 17:27:26 -07:00
Jake Petroules 19fcca11f0 Set correct DPI for all images (72 for @1x, 144 for @2x). 2016-04-30 17:24:02 -07:00
1024jp fd082a93d4 Assign newly added icon images in asset catalog (#801) (#804) 2016-04-30 17:20:51 -07:00
Zorg d9952b8f22 Merge branch 'master' into ui-separation-and-xpc 2016-04-30 14:11:44 -04:00
Zorg ef134d9245 Allow updater to be ran as root & inherit privileges
The installer can now inherit privileges from the updater, which inherits
privileges from the process that spawns the updater. As such, we can now
run the updater & installer as root, and no authorization dialog can prompt up.

The installer now must abort or install if the target app has terminated.
Zombie processes will no longer stay around.

Because the root user has no trash directory, we ignore logging the error if it was not found.
We also avoid invoking mdimport which fails as root on the installed app.
mdimport may have been used before for updating mdimporter files, however, it should be the developer's
responsibility to ensure their mdimporter files have an updated date stamp, which will work if a user updates an app manually.
Other than that, we already touch the app to register it with LaunchServices, so that should suffice.
2016-04-30 12:26:36 -04:00
Zorg 65e2bac89e Improve finding live target app in command line driver 2016-04-30 12:26:25 -04:00
Kornel b9e8830f60 Merge pull request #801 from 1024jp/appIcon
Update app icon for Autoupdate.app (#347)
2016-04-30 13:40:04 +01:00
1024jp 8576eb7cad Update app icon for Autoupdate.app (#347) 2016-04-30 18:42:17 +09:00
Zorg fdee19ec69 Add installation did finish event. This is not complete.
For sparkle-cli and out-of-process updaters, I added a did finish installing event.

I also have logic dealing with whether an update can be silently installed or not.

I made closing status windows before app termination a reponsibility for the user driver now, not
the installer drivers.

I improved checking for updates before starting the updater, if Sparle didn't ask the user for permission yet.

Currently, Autoupdate can persist in the background even when the app is terminated,
if we don't have sufficient privilleges to install right away for example, or if an update isn't silent.
After much thinking, I need to ditch this strategy because:

1. An app can be manually replaced and so the installer would have to monitor that
2. We leave a zombie process running
2016-04-29 00:37:21 -04:00
Justin Dorfman cf4c02f1b0 Updated sponsored by text and links (#800)
We are migrating the Bandwidth Hog brand with MaxCDN.
2016-04-28 19:51:32 -07:00
Kornel 8e57ca9284 Merge pull request #798 from zorgiepoo/http-no-dsa-alert
Upgrade warning to alert for signing update over HTTP with no DSA key
2016-04-20 22:56:02 +01:00
Zorg 7183d9ebc5 Merge branch 'master' into ui-separation-and-xpc 2016-04-20 00:05:45 -04:00
Zorg 2c64d98ec8 Mention that OS X 10.8 is required 2016-04-19 23:31:43 -04:00
Zorg 0b640d5d20 Fix bug where updated app can think a new update has already been downloaded
This is fixed by invalidating the local port connection from Autoupdate right before launching the new update
2016-04-19 20:55:36 -04:00
Kornel 3c2f24c340 Merge pull request #797 from zorgiepoo/download-cleanup
Download cleanup
2016-04-19 10:16:48 +01:00
Kornel 7a9ff3de48 Merge pull request #780 from zorgiepoo/fix-tests
Fix issues with unit tests
2016-04-19 10:11:35 +01:00
Zorg a3d4d9fac4 Upgrade warning to alert for signing update over HTTP with no DSA key 2016-04-19 02:59:33 -04:00
Zorg a937fa0a17 Clear update caches directory before downloading new update
This aims to make it impossible to have download data accumulate inside the caches directory.
We still try to deal with if an intermediate file is created at the path we want.

appCachePath method was also moved away from SUHost into SUBasicUpdateDriver which is the only class that needs it.
This method also has very little to do with host bundles.

appCachePath is also called less when checking for the existence of intermediate file paths.

Lastly, we now create a directory whose name is the sparkle bundle ID instead of just "Sparkle"
This is to improve potential name collision issues.
2016-04-19 02:39:00 -04:00
Zorg 99be33d83b Move Test App server directory data into subdirectory inside Caches
We want to wipe the caches directory we create for the test app data on launch,
and want to make sure no other data is being inserted into the same directory.
Before, Sparkle was inserting data into the same directory when downloading an update.
2016-04-19 02:31:02 -04:00
Zorg 8a8cef7dce Add INSTALL file and add XPC services to Distribution target 2016-04-18 21:23:09 -04:00
Zorg 47d8ed8f05 Removing this codesign script because we're not including XPC services in the framework 2016-04-17 23:27:26 -04:00
Zorg 4ea4ece4fd Add XPC service dependencies to Test App 2016-04-17 23:13:27 -04:00
Zorg 3b892524a6 Rewrite ATS check by distinguishing if Sparkle is in XPC service or not
If it's not in a XPC service, then the main bundle decides the rules.
2016-04-17 23:01:20 -04:00
Zorg 2a89393853 Take XPC services out of the framework & make them optional
I'm hoping this will ease some of the build configuration issues I've been running into.
Apps (eg: unsigned, not-sandboxed) don't need to (although they still can) use the XPC services.
Sandboxed apps naturally should use the XPC services. Although, you can for example, choose not to use the
downloader services if the host app already entitlements to allow network connections.

If you use the downloader services, you must configure ATS exceptions in them. And if you use those services,
you probably want to sign them with the required entitlements.

If you don't use the services, Sparkle will fall back on almost-identical code executed within the framework instead.

There may be other reasons to use the services or not other than for sandboxing, like fault tolerance.
Lastly, XPC services work within an application namespace. They are discoverable as long as they're in the app.
That's why we can have an app incorporate the services and let the framework use them.
2016-04-17 21:24:11 -04:00
Zorg 31dc457676 Do some Xcode XPC service cleaning
Rename the XPC service products so that they start with 'Sparkle'
Make the bundle IDs of the services a part of the build configuration, so we can pass it to the preprocessor.
2016-04-17 18:44:06 -04:00
Zorg 22e32a2304 Add codesign script and disable more signing for release modes
We have a custom codesign-after-copy script because Xcode's code sign on copy feature is bad when it
comes to frameworks including signable tools. In release build configurations, nothing we build uses
an ad-hoc code signature. This is logical because ad-hoc signatures are only meant to be used for testing purposes.
2016-04-17 03:20:57 -04:00
Zorg b9f2a24660 Only use ad-hoc signing for Debug type builds and testing
We shouldn't sign Sparkle for Release builds after all..
2016-04-17 00:26:09 -04:00
Zorg a1fa7b1fa3 Make a script file for our ats-exception run script 2016-04-17 00:00:17 -04:00
Zorg 78f2453f2b Don't ad-hoc sign Sparkle
Only the XPC services need to be ad-hoc signed (else Xcode gets cranky),
or targets with entitlements like our Test Application.

Distributing ad-hoc binaries can be mixed with distributing unsigned apps,
and ad-hoc is no worse than unsigned when it comes to distributing, so we're all good.
2016-04-16 23:04:36 -04:00
Zorg d96fd93edf Start the updater in TestAppHelper 2016-04-16 21:48:02 -04:00
Zorg 786d3d4bb6 Remove support for updating without DSA signing
Updating without DSA signing the download is simply not secure.
Before, we were keen on allowing no DSA signing as long as https is used.
However, under the separate process security model, the installer can't know or trust
if the download came over from https. We could move downloading into the installer, but
the installer may run with full privileges one day in the future, and this would
complicate the installer & updater interaction. Furthermore, this could disallow us from being able
to silently download the update in the future if the installer runs at full privileges.

An upside is that the validation and configuration checking code is simpler to read through now.

Even if we could validate that an update came over https, it is still not as secure as people may like to believe.
For example, a hijacked server can choose to manipulate the download (within restrictions), even if it's signed by a developer ID, but not with our DSA support.

Changing of DSA keys and Apple code signing identities is still allowed as long as one of these pairs match and are valid.
Hence requiring DSA signing is also safer when it comes to losing one of your keys. It's only a bit less convenient.
2016-04-16 18:04:47 -04:00
Zorg 88f4557bdd Sign with DSA "and/or" code sign 2016-04-16 17:53:16 -04:00
Zorg 39bc068b89 Move Sparkle debug warning into +load
Also use NSLog here instead of SULog because we don't want to start the logger early on
2016-04-16 17:53:16 -04:00
Zorg e767f6a4c6 Add release build configuration that allows arbitrary HTTP loads
In debug mode we always build with arbitrary http loads, but in release mode we
only want to build sparkle-cli and SparkleTestApp with arbitrary http loads.

An ATS error was added back if arbitrary HTTP loads are not allowed and if the feed URL is http://

The "distribution" target/scheme is now not very up to date because it builds everything under Release configuration.
2016-04-16 17:52:03 -04:00
Zorg 13993aea67 Defaulting NSAllowsArbitraryLoads to NO in XPC info.plist's 2016-04-16 10:21:42 -04:00
Zorg 5eef1d1243 Remove empty configuration files
If specific config files are needed for debug, release, and coverage, they can always be added later.
Right now, they just take up useless space.
2016-04-16 10:15:28 -04:00
Zorg 98f07419aa Remove ATS exception from TestApplication
The XPC services (under debug mode) now handle this.
2016-04-16 01:56:50 -04:00
Zorg 7a0ee291f9 ATS cannot be reliably checked against anymore
An app can contain a XPC service with restricted entitlements and own ATS exceptions.
Indeed, Sparkle now is a framework that embeds two XPC services that include download entitlements.
If ATS is disabled, it'd have to be disabled in those services, not within the root of the application.

So we can't keep this detection because it will generate false positives. And it's not really our responsibility anyway.
2016-04-16 01:52:29 -04:00
Zorg 63e100ae0d Instead of checking for main bundle, check for app bundle
We really want to differentiate between apps and prefpanes/plug-ins.
Using the main bundle is not at all a reliable indicator because an updater could target
any kind of bundle anywhere.
2016-04-16 01:48:54 -04:00
Zorg 291bef326b Require the updater to be started, separate from initializing
This new method also takes an error object as output, which means we can now
read a bundle in Sparkle without having to abort. If a check for updates action is invoked
before the updater has been started, it becomes a pending scheduled operation.
2016-04-15 23:36:12 -04:00
Zorg bab33b66cb Making minor improvements to property/synthesize names 2016-04-12 23:56:24 -04:00
Kornel 0132377a2a Merge pull request #795 from zorgiepoo/check-parent-writability
Check the bundle's parent directory for writability too
2016-04-13 00:02:55 +01:00
Kornel 7fdedad68e Merge pull request #794 from zorgiepoo/fix-symlinks
Don't follow symbolic links for file operations
2016-04-12 15:58:29 +01:00
Zorg ad0868ab4f Only use performedStage1Installation property on main thread
Should resolve any thread-safe worries
2016-04-11 21:54:29 -04:00
Zorg 18e666ac3a Don't make a permission prompt decision
We shouldn't change the user defaults on behalf of another application. This may require more thinking..
2016-04-11 09:03:25 -04:00
Zorg acaa021583 Merge branch 'master' into ui-separation-and-xpc 2016-04-11 03:25:00 -04:00
Zorg aa7c46ba4f Check the bundle's parent directory for writability too
This is to decide if we should allow automatic downloading & installing of updates or not.
2016-04-11 03:15:36 -04:00
Zorg d263bf4fd0 Don't follow symbolic links for file operations
This fixes issues with updating modification/access time, and changing owner/group
where symbolic links used to be followed. Symbolic link tests are included.
2016-04-11 03:05:53 -04:00
Zorg c105154ba8 Only recursively update access time, not modification time of updates 2016-04-11 02:01:58 -04:00
Zorg d4466d1448 Add Installer Progress depedency to Sparkle.framework 2016-04-11 01:31:32 -04:00
Zorg ee8fed0c2a Remove Sparkle target depedency from BinaryDelta
This shouldn't be needed.
2016-04-11 01:30:10 -04:00
Zorg e1b13f9c67 Add sparkle-cli tool that can update any arbitrary app
I added an application target but it's really intended to be used as a command line tool. The reason being was that it was the easiest way to bundle the Sparkle framework, I've found.

Note this doesn't work perfectly yet, but it's a good start. Trying to update anything that's not Sparkle based will crash for instance. And it will use the installer progress tool which may be undesirable.
2016-04-11 01:29:08 -04:00
Zorg d5f1dcc7c3 Use futimes() when updating mod times recursively 2016-04-11 00:18:32 -04:00
Zorg 88f5d9a6d9 Fix SUAppcastItem's delta updates failing to securely unarchive 2016-04-11 00:09:51 -04:00
Zorg 163a64f3fe Fix unit tests using SUCodeSigningVerifier due to previous commit 2016-04-10 19:43:30 -04:00
Zorg 15c9ae65e7 We support bundles, not applications, in the general sense 2016-04-10 19:41:58 -04:00
Zorg 1151d66337 Remove customized application icon for installer progress
This created more complexity than it was worth and leads to subpar user experience because the user can see the icon switch back to the generic one when the updater terminates. So we now bundle the icon in the install progress tool. If a developer wants to use a custom icon, they can provide their own customized tool.
2016-04-10 19:25:31 -04:00
Zorg 8eb0bc1921 Messed up on argument order here 2016-04-10 17:13:00 -04:00
Zorg 2b84e83ba4 Add customization point to installer progress tool & desired icon 2016-04-10 15:57:47 -04:00
Zorg 5fdc438fa6 Refactor InstallerProgress tool into separate classes 2016-04-10 14:46:05 -04:00
Zorg 7015303726 Pass around download name rather than download path
We know that the download sits in the update directory
2016-04-10 13:51:32 -04:00
Zorg 296154d467 Check the parent directory for writability too 2016-04-10 09:07:00 -04:00
Zorg cd108ef47c Allow automatically downloading updates, but alerting the user immediately
Following cases where after an update has been automatically downloaded, Sparkle may alert the user right away:
1) Critical updates
2) Insufficient write access to install without being root
3) Package type installations

In addition to alerting the user right away, if they dismiss the update, the schedule timer will be on regular intervals. We also no longer need to care about writability in the updater, only just in the installer.
2016-04-10 02:32:54 -04:00
Zorg 5a0ee5d56a Don't follow symbolic links for file operations
This fixes issues with updating modification/access time, and changing owner/group
where symbolic links used to be followed. Tests are included.
2016-04-09 22:33:17 -04:00
Zorg 20e8ea8603 Fix tests that use SUStandardVersionComparator 2016-04-09 21:22:22 -04:00
Zorg e1a9e98d8b Fix implicit type conversion warnings 2016-04-09 18:48:19 -04:00
Zorg 39f82edcf6 Remove standard version comparator singleton
There's no reason for this to be a singleton instance, and the singleton pattern is not even implemented right
2016-04-09 18:13:00 -04:00
Zorg 8d5f1edf39 Remove duplicated header 2016-04-09 18:06:41 -04:00
Zorg beacf49158 Improve authorization handling
Duplicated code from SUFileManager and SUGuidedPackageInstaller has been removed.

SUPlainInstaller now tests if it needs authorization rather than by trying to touch the old app.

SUGuidedPackageInstaller now tries to grab authorization during stage 2 of the installation.
2016-04-09 18:00:47 -04:00
Zorg b3b12dc4be Remove unused variable warning 2016-04-09 16:31:28 -04:00
Zorg bb3a2e299e Don't show installer progress if installer already displays progress 2016-04-09 15:29:18 -04:00
Zorg 33bd47cd1f Fix deprecated API warning for -[NSData initWithBase64Encoding:] 2016-04-09 14:55:55 -04:00
Zorg 61ed9920b4 Use NSURL's checkResourceIsReachableAndReturnError: instead of FSRef's
Fixes deprecated API warning in DMG unarchiver code
2016-04-09 14:44:32 -04:00
Zorg f528f6b2ba Fix warnings for bspatch 2016-04-09 14:36:16 -04:00
Zorg 5f253e8c64 Fix not showing download update initiation when applying delta update fails 2016-04-09 13:43:47 -04:00
Zorg 00cdab1766 s/updateInProgress/canCheckForUpdates/ 2016-04-09 13:22:48 -04:00
Zorg e14077ee9a s/SUUpdaterController/SUStandardUpdaterController/ 2016-04-09 13:21:29 -04:00
Zorg e5b5952287 Avoid probing the installer multiple times 2016-04-09 12:53:49 -04:00
Zorg c80015bf99 Move invoking showCanCheckForUpdates: outside of this completion 2016-04-09 12:35:23 -04:00
Zorg 1bb301e82a Change updateInProgress to canCheckForUpdates
This more accurately reflects its intended purpose. From the beginning,
the user cannot check for updates until the updater is ready;
however this doesn't mean that the update is in progress.
2016-04-09 11:39:02 -04:00
Zorg 933504263a Use Autoupdate's icon for installer progress tool 2016-04-09 01:05:11 -04:00
Zorg 233fa268b5 Add tool for showing installer progress
This tool is only launched if a certain amount of time has passed,
and if we're allowed to show UI
2016-04-09 00:36:09 -04:00
Zorg c178e34d8f Remove unused headers from SUStatusController 2016-04-07 23:07:27 -04:00
Kornel bdb3dd8c36 Merge pull request #790 from zorgiepoo/no-auth-cleanup
Don't bring up an authorized dialog during cleanup
2016-04-04 14:41:25 +01:00
Zorg c8ff1c0453 Don't bring up an authorized dialog during cleanup
If permissions are abnormal during cleanup or somewhere along the lines, it may be
possible to bring up authorization dialog that is not really needed. Prevent this from happening.

We would want to restrict authorization from being possible anyway when not needed.
2016-04-04 01:54:02 -04:00
Zorg 97a8568491 Add service for remote message port
This allows the updater to communicate to the installer without an additional entitlement
2016-04-04 01:18:15 -04:00
Zorg c4800182a2 Simplify testing for writable permissions to host path
Before there was always lag when checking for updates the first time.
This helps improve consistency.
2016-04-03 21:30:59 -04:00
Zorg b22d2c2568 Make menu item validation work in the test app 2016-04-03 20:06:56 -04:00
Zorg 44a61b830e Move debug warning up in initializer because it spawns really often.. 2016-04-03 20:04:56 -04:00
Zorg 6dedd8309f Handle multiple live remote port connections better
This also should fix a bug where sometimes an update could not be resumed
2016-04-03 19:56:29 -04:00
Zorg 32c687ed79 Make SURemoteMessagePort operations asynchronous 2016-04-03 17:05:56 -04:00
Zorg d7cca8a594 Check if runningApplication is nil for errors.. 2016-04-02 12:17:54 -04:00
Zorg 116c8ea8b7 Supply NSWorkspaceLaunchNewInstance when launching AutoUpdate
I don't think it actually matters since we are launching a copy we created, but
sounds like the right thing to do anyway.
2016-04-02 12:12:48 -04:00
Kornel bb40663d37 Merge pull request #789 from Eitot/patch
Remove SUEnableAutomaticChecksKeyOld and SUCheckAtStartup constants
2016-04-02 12:18:45 +01:00
Zorg 38a69cee5b Launch AutoUpdate via LaunchServices again.
I was being stupid for trying to launch the executable rather than the app.
2016-04-02 05:34:31 -04:00
Zorg a3a2310952 Fix Appcast unit tests 2016-04-02 02:14:54 -04:00
Zorg e03607a2d6 Only use SUFileManager in debug mode for the test app
This way we don't have to export it in release mode
2016-04-02 00:10:20 -04:00
Zorg 51e1e1c646 More care to handling invalidation logic 2016-04-01 23:58:32 -04:00
Zorg d5cd64159c Handle error handling for update downloader connection 2016-04-01 23:45:59 -04:00
Zorg 0b19d8d7fd Add error handling cleanup to Appcast Downloader connection 2016-04-01 23:22:52 -04:00
Zorg 92e5c30c0d Move SUUnarchiver.h from private to project 2016-04-01 22:51:10 -04:00
Zorg 9b1d441194 Add warning that Sparkle shouldn't be used when built in Debug
This is for several reasons: ATS, very short default update timer intervals, ...
2016-04-01 22:45:46 -04:00
Zorg e74a397152 Add downloader XPC services for sandboxed apps
ATS exceptions now need to be included in the appcast & update downloader services - *shrugs*.
I've a run script configured to disable ATS for release builds.
2016-04-01 22:41:12 -04:00
Zorg 9525b156a2 Export classes that we are using publicly so release build compiles 2016-04-01 22:36:42 -04:00
Zorg e7f85bb40f Add testing writability as part of SUInstallerLauncher
This is necessary for detecting if automatic updates are possible in a sandboxed environment
2016-04-01 18:56:20 -04:00
Eitot b8588543cf Remove SUEnableAutomaticChecksKeyOld and SUCheckAtStartup constants 2016-04-02 00:07:20 +02:00
Zorg 5c08e0a1d1 Add InstallerLauncher XPC Service
This allows Sparkle to be used as-is in a sandboxed application,
without needing to place Sparkle into its own XPC service.

Currently the main app may need to set a global mach service lookup exception
and a client download exception, however this can be fixed by creating a couple more
services. Testing for disk writability will need be done in a service too.
2016-04-01 17:54:12 -04:00
Zorg ee77bf59d5 IB is not smart enough to parse Nullable attribute 2016-04-01 17:41:28 -04:00
Zorg 009de37415 Remove references to status controller from AutoUpdate 2016-04-01 15:17:18 -04:00
Zorg e0e93e3edf Remove old periodic timer code 2016-04-01 15:15:11 -04:00
Zorg 60fcbe4f88 Call -fileManagerByPreservingAuthorizationRights during cleanup
Since cleanup may be invoked after 2nd stage failed for example.
2016-04-01 15:12:50 -04:00
Zorg c9f66cdeff Don't bring up an authorized dialog during cleanup
If permissions are abnormal during cleanup or somewhere along the lines, it may be
possible to bring up authorization dialog that is not really needed. Prevent this from happening.

We would want to restrict authorization from being possible anyway when not needed.
2016-04-01 15:06:47 -04:00
Zorg 32edf6cc5d Add temporary hack for bringing up authorization dialog right away if needed later 2016-04-01 14:11:30 -04:00
Zorg 941ae6481f Read the allowsUI flag again for performing installation work
Also some code cleanup. In the future, we may want to figure out authorization
before extraction even occurs.
2016-04-01 13:55:34 -04:00
Zorg e0b3a128b0 Revert 3 stage installation..
Just do all installation in 3rd stage at the moment and reconsider this idea..
Doing any work prior to finishing the installation that requires keeping files in
a temporary directory for potentially a long time turns not to probably not be a great idea.
Unfortunately I don't think trying to keep the files up to date every some interval is a _great_ idea.
I will need to rethink this some more.
2016-03-31 00:53:01 -04:00
Zorg 9e6f376285 Add periodic timer for preventing temporary file cleanup
This is inevitable if we stick to a three stage installation.
The other direction to consider is to defer most installation until after the app terminated,
although that may have disadvantages of its own.

One important addition is touching the new app recursively before moving it in a temp directory.
This is important because archives can preserve modification & access times, but we don't want that.
2016-03-29 01:15:39 -04:00
Zorg 5c624eccbe Fix issues with unit tests 2016-03-27 22:58:41 -04:00
Zorg e792798294 Forgot to invoke download receive response/progress user driver callbacks 2016-03-27 22:29:23 -04:00
Zorg 08696841c2 Fix bug where generic error dialog was shown when no update was found 2016-03-27 21:57:06 -04:00
Zorg 0b94f56f7f Rename some user driver delegate methods 2016-03-27 19:03:28 -04:00
Zorg d12121a265 Add SUUpdaterSettings class, allowing to read default settings.
This is convenient if the updater and app live in separate processes.
No need to use XPC to find out what certain settings are, and it may take too long to find out that way.
2016-03-27 18:44:36 -04:00
Zorg 9bb87b2018 Move installationPath out from SUHost
It's not too relevant to SUHost, and mostly relevant to the installer.
Plus its output can depend on whether a certain file exists on the system.
2016-03-27 17:54:38 -04:00
Zorg 6de75413e8 Don't show user initiated progress when resuming an update
Retrieving the data to resume an update happens very quickly.
2016-03-27 16:36:24 -04:00
Zorg b27255468a Update cycle should only be reset if update is not in progress 2016-03-27 16:11:17 -04:00
Zorg b0963583ba Remove unused header 2016-03-27 16:03:55 -04:00
Zorg 46387097c1 These resets are not necessary 2016-03-27 16:03:23 -04:00
Zorg c58eaa205e Remove -[SUUpdater updateInProgress]
This method is not used anymore internally. Outside, the user driver should
be used instead.
2016-03-27 15:56:17 -04:00
Zorg ac0aaddefa Use -resetUpdateCycleAfterShortDelay internally but don't expose it publicly 2016-03-27 15:51:52 -04:00
Zorg 528c6f25ed Remove user defaults observing in standard updater controller
If these settings are changed, they should be changed through SUUpdater, honestly.
Morever, this user defaults code retains the controller.
2016-03-27 15:46:40 -04:00
Zorg a8252cbe20 This is supposed to be main bundle actually 2016-03-27 14:51:36 -04:00
Zorg 7fc6896170 Move automatic updates property from SUHost into SUUpdater
SUHost cannot properly detect if automatic updates are allowed due to write permissions,
thus it should not be a property of SUHost at all.
2016-03-27 13:33:28 -04:00
Zorg 9c7d41dd90 Updating SUUserDriver docs 2016-03-27 00:08:01 -04:00
Zorg eddf611ede Decryption password should now be supported 2016-03-26 23:46:27 -04:00
Zorg 8184838835 Explain reasoning on re-assigning updateItem here 2016-03-26 23:16:17 -04:00
Zorg 301f3bf4e3 Move appCachePath out of SUHost for process independence
The behavior depends on what kind of process is invoking is, which is no good.
2016-03-26 22:54:08 -04:00
Zorg fb32c8e18a Fix unarchiving unit tests 2016-03-26 02:20:34 -04:00
Zorg 8e4498adaf Refactor unarchivers to use protocols and less dynamism/global state
Before there were implicit dependencies and unarchivers were globally registered as their classes were loaded.
This flexibilty is unnecessary and comes with a safety (eg: forgetting to link in a class) and harder to read cost
2016-03-26 01:54:15 -04:00
Zorg 9d6f196111 Dismiss user initiated update check progress after appcast is loaded
Fixes bug where the update check progress window could still be visible after the appcast loaded successfully
2016-03-26 00:12:28 -04:00
Zorg 06c2f47024 Make delta updates & multiple download attempts work. 2016-03-25 23:58:05 -04:00
Zorg 1e9292acf4 Merge branch 'master' into ui-separation-and-xpc 2016-03-23 22:37:11 -04:00
Kornel cc332de4d1 Merge pull request #786 from zorgiepoo/fix-warnings
Fix warnings
2016-03-23 09:32:50 +00:00
Zorg d6b1c7de54 Fix another place where I accidently swapped key & object value 2016-03-22 23:51:20 -04:00
Zorg 3a3f46f2c1 Fix one place where I accidently swapped key & object value 2016-03-22 22:52:40 -04:00
Zorg 1ae0999082 Fix nullability warnings 2016-03-22 22:08:14 -04:00
Zorg c265e3f7bf Fix warnings caused by -Wpartial-availability
Most of this is removing Obj-C subscripting usage
Some bits are adding pragma ignores to places where we are careful to not use the API at runtime on older OS's

Note that for NSMutableDictionary:
x[y] = z is not the same as [x setObject:z forKey:y]

In particular, z can be nil for subscripting (removing the element if it exists) where it cannot for setObject:forKey:
Personally I like the non-subscripting semantics better. Most cases we were using this we were checking if the object was non-nil anyway
2016-03-22 22:07:49 -04:00
Zorg 5d1d2291a0 Don't see why handledResumeInstallationToStage2 is needed actually 2016-03-21 21:17:18 -04:00
Zorg 65a6d41147 Merge branch 'master' into ui-separation-and-xpc 2016-03-21 01:12:34 -04:00
Zorg 4042068c82 Fix Appcast unit tests 2016-03-21 01:09:25 -04:00
Zorg a3c950f480 Remove unused function 2016-03-21 00:57:31 -04:00
Zorg a1d08a354d Add updater resumability, merge automatic & regular update prompts
Resumability works by asking the installer for its progress and for the appcast item we've given it before.

If an automatic silent download occurs, we abort it after the installer tool finishes with its basic steps.
Then, a user initiated or scheduled check can resume the update. The scheduled check fires during a longer-than-normal
span since usually the user can install by quitting the app, unless the app has been alive for a very long time.
One exception to this is when the update is marked critical; in that case, the scheduled check is fired immediately after
an automatic update download. Subsequent attempts will be fired using a normal update check interval.

Todo: delta updates probably don't work when they fail and fallback to a regular update
2016-03-21 00:46:34 -04:00
Zorg 615f71474b Fix retain cycle by making these references weak 2016-03-20 13:16:36 -04:00
Zorg 4e8a39267d Fix memory corruption issue when copying CFDataRef bytes
Copy the bytes manually using -[NSData dataWithBytes:length:]
If we use -[NSData copy] instead, we may be using already freed memory
(according to ASAN), which is no good. This may be because the bytes aren't
deep copied.

Also add some @autoreleasepool wrappers because why not.
2016-03-19 22:06:33 -04:00
Kornel 2faf8ccdd2 Merge pull request #783 from sebcode/l10n-fixes
Fix german l10n.
2016-03-20 00:45:14 +00:00
Zorg 56a75bd4b6 Fix update scheduling not always firing 2016-03-19 15:25:44 -04:00
Sebastian Volland 2f724659a7 Fix german l10n.
Update german translation.
Update german version of SUAutomaticUpdateAlert.xib (Button widths).
Update CheckLocalizations.swift for Swift 2.
2016-03-19 18:40:41 +01:00
Zorg 87275b23c8 Refactor update drivers
This removes subclassing usage making the code harder to follow.
Todo: handle resuming an update already waiting to be installed,
adding impatience timer for automatic update scheduling
2016-03-19 12:09:11 -04:00
Kornel Lesiński 8cca51d08b Merge remote-tracking branch 'origin/master' into nsparse 2016-03-14 12:32:15 +00:00
Kornel Lesiński c9fa1142c9 Formatting/comments 2016-03-14 12:22:35 +00:00
Kornel 445cc55794 Merge pull request #781 from zorgiepoo/subscripting
Don't use subscripting where it may potentially be risky on 10.7
2016-03-14 12:16:43 +00:00
Zorg 013e60204d Don't use subscripting where it may potentially be risky on 10.7 2016-03-13 23:40:23 -04:00
Zorg b8fecf1f36 Fix issues with unit tests
I added public DSA file, automatic update checking, disabled system profiling
in the unit test's info.plist so that SUUpdater won't complain that DSA is missing,
and it won't prompt for update permission the first time.

I also made SUUpdater use the correct bundle in SUUpdaterTest
2016-03-13 22:27:57 -04:00
Zorg 1e645e8bd7 Remove resources/source files Autoupdate doesn't use anymore 2016-03-13 19:50:28 -04:00
Zorg d44094a692 Fix installer tests and add comment about running them 2016-03-13 19:32:58 -04:00
Zorg cb0b7c8cfe Remove all termination logic from the user driver
Autoupdate is now responsible for all of this. The user driver implementation is shorter and less complex now.
2016-03-13 19:18:51 -04:00
Zorg af126d9c82 Update automatic update driver to reflect AutoUpdate changes 2016-03-13 18:56:02 -04:00
Zorg f918368c72 Change SUCancelUpdateInstallation to SUDismissUpdateInstallation
Since this is not really canceling the installation anymore.
2016-03-13 16:52:25 -04:00
Zorg 85517dd0dd Don't think I need to handle this 2016-03-13 16:19:28 -04:00
Zorg d78f487596 Remove tempDir deletion warning 2016-03-13 16:17:51 -04:00
Zorg e7fdfb9dc9 Don't handle out of order messages 2016-03-13 16:17:24 -04:00
Zorg 64c17df1e6 Improve TerminationListener by observing NSRunningApplication instance
Listening for app termination doesn't require polling anymore.
2016-03-13 14:26:12 -04:00
Zorg f82a698937 Handle installer cleanup occur after any stage 2016-03-13 13:39:28 -04:00
Zorg b10202769f Documenting the SUInstaller protocol 2016-03-13 13:27:53 -04:00
Zorg 194c0ed63a Split installation into more stages.
We now have a stage where authorization is allowed (when the user intiates a relaunch).
This stage occurs before the user application is terminated (if the operation succeeds).

An install attempt will always be made after the validation is finished now. However, if the
user doesn't explicitly relaunch the app, we don't bug the user about auth prompts which means
updates can fail in this kind of scenario.
2016-03-13 13:09:36 -04:00
Zorg 72d3634f32 Merge branch 'master' into ui-separation-and-xpc 2016-03-12 20:07:39 -05:00
Zorg 25ab5a1870 Move SUUpdater references out of update drivers
This decreases coupling for the updater and updater drivers.

We still pass in the updater because we need it for invoking the updater delegate's methods,
but we now use type 'id' instead of SUUpdater* because we don't want to invoke anything on the object.
Furthermore, we never #import SUUpdater, only forward class declarations.
2016-03-12 19:57:28 -05:00
Zorg f4869e584c Improve grammar 2016-03-12 18:28:08 -05:00
Zorg 079f1e33bc Guard against more than 1 initialization more strongly 2016-03-12 18:26:54 -05:00
Zorg 84ad85c253 Don't use main bundle in SUStandardUpdaterController 2016-03-12 18:24:29 -05:00
Zorg 6753c788f8 Fix issues with unit tests
I added public DSA file, automatic update checking, disabled system profiling
in the unit test's info.plist so that SUUpdater won't complain that DSA is missing,
and it won't prompt for update permission the first time.
2016-03-12 18:21:07 -05:00
Zorg 4dcef32eb4 Fix unit tests from not building/passing.
UI tests will fail right now due to the current custom UI I'm using.
2016-03-12 16:44:52 -05:00
Zorg 38abfca4b0 Remove more unused #imports 2016-03-12 16:12:33 -05:00
Zorg 46256b297b Do not pass the user driver in delegate methods
This is bad for a number of reasons.

1. Our SUUserDriver protocol wasn't quite the right protocol to pass in.
2. This made the UI/Core components to hold a depedency to the user driver, when it
really was not used for anything other than passing to the delegate. We can now
remove this bidirectional depedency between the components and the user driver.
3. This encourages that the client can handle multiple user drivers within the same class,
which encourages complexity. If they were able to set the delegate, they should have a reference
to the user driver.

Indeed, SUUpdater, SUUpdaterDelegate, and the update drivers all have the same problem.
An unfortunate design decision..
2016-03-12 15:53:00 -05:00
Zorg 2a277c24b5 Put SUInstaller protocol into its own file 2016-03-12 14:43:27 -05:00
Zorg 25b451b4c2 Remove unused #imports 2016-03-12 14:43:11 -05:00
Zorg cee120065f Split installation work into stages
This is to minimize the amount of time the app is left terminated.
App restarts should always be near instantaneous.

More work needs to be done to make authenticated installs more friendly,
and not making installs abortable after validation is done.
2016-03-12 13:25:07 -05:00
Kornel b319fb50f9 Merge pull request #756 from zorgiepoo/best-update-by-version
Best Update by Version & Date Removal
2016-03-12 15:39:38 +00:00
Kornel Lesiński 698e737b56 CocoaPods 2016-03-12 01:16:51 +00:00
Kornel Lesiński 0be862708f Merge tag '1.14.0'
* tag '1.14.0':
  v1.14.0
  Fixed crash on 10.7 - subscript operator not available https://github.com/sparkle-project/Sparkle/issues/776 related
2016-03-11 09:20:21 +00:00
Kornel Lesiński 1c8d54166b v1.14.0 2016-03-11 09:11:12 +00:00
kleuter 77511c8f19 Fixed crash on 10.7 - subscript operator not available https://github.com/sparkle-project/Sparkle/issues/776 related 2016-03-11 09:07:42 +00:00
Zorg 59bbcfadb0 Initial work on separating the updater & installer
The installer (Autoupdate.app) is now responsible for extracting & verifying the update.
It talks to the updater via mach ports. We can't afford to use a XPC service due to
lack of perfoming privileged tasks.
2016-03-10 01:49:59 -05:00
Kornel d9a3afb869 Merge pull request #778 from kleuter/master
Fixed crash on 10.7 - subscript operator not available https://github.com/sparkle-project/Sparkle/issues/776 related
2016-03-09 16:44:12 +00:00
kleuter 34a78d59fc Fixed crash on 10.7 - subscript operator not available https://github.com/sparkle-project/Sparkle/issues/776 related 2016-03-09 12:07:51 +01:00
Kornel Lesiński b95008e248 Merge branch '1.14.x'
* 1.14.x:
  One more attr fix
2016-03-09 00:34:10 +00:00
Kornel Lesiński 317423ae78 One more attr fix
#776
2016-03-09 00:33:59 +00:00
Kornel Lesiński 27cb8e66fe Merge branch '1.14.x'
* 1.14.x:
  More workarounds for OS X 10.7
2016-03-09 00:10:14 +00:00
Kornel Lesiński 28e8a1fdaf More workarounds for OS X 10.7
#776
2016-03-09 00:09:04 +00:00
Kornel Lesiński f43c284f14 Merge tag '1.14.0'
* tag '1.14.0':
  Fix #776
2016-03-08 23:43:46 +00:00
Kornel Lesiński cd3d7d9f98 Fix #776 2016-03-08 23:24:26 +00:00
Zorg 73a0f10010 I don't see installerForHost:error: used anywhere
We can also demote relaunchPath from being an ivar
2016-03-08 00:22:57 -05:00
Zorg 6f30ae2093 Remove passing duplicated host path 2016-03-08 00:16:03 -05:00
Zorg 7ea2d0f9cf Separating Autoupdate into separate files 2016-03-08 00:00:00 -05:00
Zorg 57f0bc4245 Make download validation function take a SUHost 2016-03-07 23:24:35 -05:00
Zorg cf3674b2d7 Exit on failure here 2016-03-07 23:15:40 -05:00
Zorg 00368011c8 Add delegate outlets to SUStandardUpdaterController
This adds delegate outlets to the updater and to the user driver, so a
developer can hook either of them up. Note we now initialize the updater and
user driver after being awoken from the nib.

We also took this chance to make the delegates to the updater and user driver read only.
This means that the delegates have to be available on initialization, which is good because
changing delegates or setting delegates too late (and missing messages) is bad.
2016-03-06 23:38:17 -05:00
Zorg 1e92d403ec Improve SUUpdater docs 2016-03-05 17:33:27 -05:00
Zorg f2b9ae97c2 Merge branch 'master' into ui-separation-and-xpc 2016-03-05 15:06:25 -05:00
Zorg 96f016a790 Add acknowledgement handlers to no update found / errors
This way, if the errors are not presented modally, they won't be dismissed
until we tell the updater we are finished acknowledging them
2016-03-05 14:42:17 -05:00
Zorg 337f39e8b9 Just log an error instead of changing update button
Because the update installation will be aborted soon anyway..
2016-03-05 13:33:32 -05:00
Zorg 53719cc8b7 Fix termination being delayed when connection is invalidated 2016-03-05 13:12:52 -05:00
Zorg 5dca54d904 Add custom user driver in the test app 2016-03-05 12:59:11 -05:00
Zorg 30cb984341 Split SUStandardUserDriver into re-usable components 2016-03-05 00:17:41 -05:00
Zorg 43942bcbad Remove UITests-Info.plist being copied to UI Tests bundle 2016-03-04 20:13:02 -05:00
Zorg ed72d25eaa Re-sign the altered/new test app
For sandbox testing, we really have to use ad-hoc signing.
Which means we have to sign the "new" app after we alter its info.plist file,
so that our code signing verifier doesn't (rightfully) complain
2016-03-04 20:05:33 -05:00
Zorg db4e8a9946 s/SUUpdaterController/SUStandardUpdaterController.m/ 2016-03-04 19:25:25 -05:00
Zorg 0338cd443a This should not be wrapped in an exception 2016-03-04 19:19:28 -05:00
Zorg f2e485df87 Add proper remote updater idling support
Meaning that we don't send a message or re-establish the XPC connection
immediately when something goes wrong
2016-03-04 19:00:47 -05:00
Zorg 58f4e97f9c Note about being dispatched on main queue 2016-03-03 22:31:49 -05:00
Zorg af8e195cd9 Handle app termination better with regards to automatic updates
We should terminate even if the update aborts.

We should also terminate even if the connection is invalidated or interrupted, if we've
already been told to quit
2016-03-03 22:28:38 -05:00
Zorg 2e44a5ecc5 Reverting code signing since our verifier doesn't look ad-hoc signatures 2016-03-03 22:12:55 -05:00
Zorg 6c9cbbb389 Set deployment target to 10.8 2016-03-03 20:02:01 -05:00
Zorg 045de30926 Clean up last bit of warnings 2016-03-03 19:59:16 -05:00
Zorg 62fa723564 Use ad-hoc code signing for test app so Xcode won't complain 2016-03-03 19:55:40 -05:00
Zorg cc5826d2f1 Add SUStandardUserDriverDelegate.h 2016-03-03 19:45:52 -05:00
Zorg a652ab952e Add documentation to dismissUpdateInstallation for SUStandardUserDriver 2016-03-03 19:40:25 -05:00
Zorg ada2688b86 Set up invalidation and interruption XPC handlers 2016-03-03 19:20:01 -05:00
Zorg f5a9cf14de s/SUSparkleUserDriver/SUStandardUserDriver/ 2016-03-03 18:29:15 -05:00
Zorg 5f572854d2 Improve docs on showing update is found, plus some formatting 2016-03-03 18:08:34 -05:00
Zorg 8a42975dc2 Add test application code for Sparkle over XPC 2016-03-03 03:03:56 -05:00
Zorg ed00162faa Fix project header imports 2016-03-02 01:44:03 -05:00
Zorg 65f16e7e8c Make delegate methods optional 2016-03-02 01:43:51 -05:00
Zorg 1b9d93f739 Add initForBundle: back just so we can raise an exception 2016-03-02 01:22:54 -05:00
Zorg 9ee8a6d314 Wrap initializer with standard if self != nil check 2016-03-02 01:15:10 -05:00
Zorg b58eeeabb5 Add docs to SUUpdater initializer 2016-03-02 01:13:33 -05:00
Zorg 5eb715f1f3 Added docs to sparkle's user driver
Also split SUSparkleUserDriverDelegate into two protocols, since it
just makes sense.
2016-03-02 00:53:28 -05:00
Zorg 4a2c3dd922 Update docs on SUUpdaterController 2016-03-01 23:18:44 -05:00
Zorg ad26fe9627 Use -[SUSparkleUserDriver updateInProgress] instead
If a developer doesn't want to use SUUpdateController, it'll be
clear to them how to implement the menu item validation
2016-03-01 23:15:08 -05:00
Zorg 772c6b7d3f Just add Sparkle user driver reference to SUUpdaterController 2016-03-01 23:03:05 -05:00
Zorg 8b0eae8ef4 Revert deferring startUpdateCycle in SUUpdater init
I decided it was less evil to allow SUUpdater to defer cycling and have
a mutable delegate, than it was for SUUpdateController to have a nullable SUUpdater
that could be instantiated an arbitrary time later

I have also changed the delay from 0 to 1, on the safer side.
2016-03-01 22:46:15 -05:00
Zorg 1da4ee961c Add delegate as parameter to SUUpdater's initializer 2016-03-01 22:22:05 -05:00
Zorg efac2acf57 Change SUUpdaterDelegate to be weak reference 2016-03-01 21:51:02 -05:00
Zorg 077b0c7bc9 Separate out UI bits from SUSparkleUserDriver delegate protocol 2016-03-01 21:40:13 -05:00
Zorg f5bc152f1c No longer true 2016-03-01 21:25:40 -05:00
Zorg ba4bbbb99a Rename UserUpdaterDriver -> UserDriver
This ends up to be more natural to me.
2016-03-01 21:24:50 -05:00
Zorg d3a09cc68a Move custom version displayer away from SUUpdater delegate
This is a UI related protocol and thus should be part of the user updater driver,
not a part of the core updater.
2016-03-01 21:09:28 -05:00
Zorg dafdcf21b6 Add more nullability specifiers 2016-03-01 20:15:45 -05:00
Zorg 1b46ecf663 Improve SUUpdaterController docs and add nullability specifiers 2016-03-01 20:08:21 -05:00
Zorg dd3c698f3e Add documentation to SUUpdaterController 2016-03-01 19:48:56 -05:00
Zorg 30c2ba125b Remove IBOutlet attribute for SUUpdater delegate 2016-03-01 19:37:39 -05:00
Zorg f26811b439 Document resetUpdateCycleAfterShortDelay and updateInProgress 2016-03-01 19:19:01 -05:00
Zorg 7dd3e02546 Clarify why automatic update driver doesn't listen for system power off 2016-03-01 19:11:07 -05:00
Zorg 0c41fafb47 Add more doc notes to SUUserUpdaterDriver.h 2016-03-01 18:53:37 -05:00
Zorg 3362ea174a Remove SUAutomaticInstallationChoice since it was duplicated definitions 2016-03-01 02:50:44 -05:00
Zorg cea47960dd Fix filename in comments 2016-03-01 02:37:24 -05:00
Zorg 721ccdc5d9 Adding documentation comments to SUUserUpdaterDriver 2016-03-01 02:36:42 -05:00
Zorg 49c10c8cb5 Move Sparkle's user updater driver delegate protocol out of SUUserUpdaterDriver 2016-03-01 00:16:59 -05:00
Zorg 0a6db8ef7a I can verify this later 2016-03-01 00:02:34 -05:00
Zorg cf31592e4a Ignore deprecated warnings for calling alert modal methods on updater delegate 2016-02-29 23:47:44 -05:00
Zorg 097784db95 Cancel update cycle and abort updates in SUUpdater's dealloc 2016-02-29 23:41:39 -05:00
Zorg b6fe5ea289 Move permission checking of allowing automatic updates to SUUpdater
SUHost can be called from any process with different privilege levels,
so it can't determine if the user can install to the app bundle without issue
2016-02-29 22:48:27 -05:00
Kornel 864044e44e Merge pull request #772 from zorgiepoo/fix-codesigning-tests
Fix code signing verifier tests when ran locally
2016-03-01 00:39:49 +00:00
Kornel Lesiński 48f18d000c Support XML namespace prefixes when parsing appcasts
Fixes #771
2016-03-01 00:37:52 +00:00
Zorg d0adc0af39 Fix code signing verifier tests when ran locally
The tests sometimes fail for me when copying these files over,
because they already may exist. I guess they're not torn down properly.
2016-02-29 18:30:36 -05:00
Zorg f7b6a70979 These two classes are not referenced here anymore 2016-02-29 18:27:33 -05:00
Kornel Lesiński 64d95bb36f Error code for download errors
Fixes #770
2016-02-29 13:39:08 +00:00
Zorg 7c16419a6d SUUpdatePermissionPromptResult is a core/non-UI class 2016-02-29 08:38:28 -05:00
Zorg 253f544bbe Remove old localized byte count code 2016-02-29 08:28:54 -05:00
Zorg 16b9d47cbe SUHost can go back to non-public header
Although I don't know if this should be the final decision on that matter.
If users create their own user drivers, will they want SUHost?
2016-02-29 03:04:36 -05:00
Zorg d3ed152e1a Let SUSparkleUserUpdaterDriver take a NSBundle instead of SUHost
This way we don't have to expose SUHost to public anymore, I think
2016-02-29 03:00:12 -05:00
Zorg 5e87fe6daa Let delegate tell us if it's responsible for signaling termination 2016-02-29 02:53:50 -05:00
Zorg 34cf472834 Import Foundation in SUStatusCompletionResults.h 2016-02-29 02:29:22 -05:00
Zorg 1278a34d3b Move SUUserUpdaterDriverDelegate into its own source file 2016-02-29 02:28:51 -05:00
Zorg 1aa6f88819 Move status completion results into a new header 2016-02-29 02:23:15 -05:00
Zorg 829a88be58 Remove references to IOKit 2016-02-29 01:48:01 -05:00
Zorg 4a26c395d8 Add no-AppKit guards against all "core" files
Also move system shut off handling to the user driver.
Observing system shut off is difficult without AppKit, and
a client may want to observe for varying types of events.
I suppose this is consistent with application termination
notifications though.
2016-02-29 01:42:16 -05:00
Zorg 02ee6f9c15 Fix bad typo :\ 2016-02-28 22:53:57 -05:00
Zorg 6c1aa38ac9 Mm.. I don't think so. 2016-02-28 22:16:51 -05:00
Zorg 45e6951552 User updater driver is now aware about updates being in progress or not 2016-02-28 22:10:58 -05:00
Zorg 8c769ca9cd Raising exception if -[SUUpdater init] is called 2016-02-28 21:28:46 -05:00
Zorg 2e28d47d48 Add some docs on SUUpdateController 2016-02-28 21:21:40 -05:00
Zorg 21b49d41a2 Make sure updater is not nil for menu validation 2016-02-28 21:15:43 -05:00
Zorg 8325c9a4d9 Remove duplicated referenced classes in test app and framework 2016-02-28 21:05:23 -05:00
Zorg 6ade2f270b Don't see why this method should be very generic 2016-02-28 21:01:49 -05:00
Zorg 15b4d1adf3 Add a "Updater NIB" object for standard sparkle UI
I may consider  extending SUUpdater instead of another controller..
2016-02-28 20:18:06 -05:00
Zorg 7f494f13be Fix not observing driver finishing notifications 2016-02-28 20:16:47 -05:00
Zorg 34ad4cfd6b Add note about has launched before logic needing improvement 2016-02-28 18:03:38 -05:00
Zorg cba11cac2d Don't need to forward declare these methods 2016-02-28 17:50:00 -05:00
Zorg 3725d1e14d We don't need to delay update cycle from SUUpdater anymore 2016-02-28 17:48:47 -05:00
Zorg cfd462002c Let AutoUpdater relaunch itself through LaunchServices
This solves several problems:
1) we can't spawn a task reliably from a XPC process
2) we don't want to link to AppKit from SUBasicUpdateDriver
3) spawning a task to invoke open utility is poor with bad inputs
2016-02-28 17:46:29 -05:00
Zorg caf5e01643 Merge branch 'best-update-by-version' into ui-separation-core 2016-02-28 15:52:00 -05:00
Zorg 196bb64483 Be extra careful the updater is passed as a weak reference 2016-02-28 15:40:33 -05:00
Zorg 30abbb238a Fix AutoUpdate activation issues
Forcing the app to activate after we show the status window in AutoUpdate seems to work better
2016-02-28 15:34:11 -05:00
Zorg dccce32beb Temporary fix for running the test application 2016-02-28 15:18:09 -05:00
Zorg 680484f7c2 SUWindowController can be removed; it doesn't do anything 2016-02-28 15:09:09 -05:00
Zorg 030725ff2d Replace Cocoa imports with Foundation in unit tests 2016-02-28 14:52:39 -05:00
Zorg cd83dd3769 Removing NTSynchronousTask for good 2016-02-28 14:45:16 -05:00
Zorg f88eec8105 Remove NTSynchronousTask from SUCodeSigningVerifierTest 2016-02-28 14:11:54 -05:00
Zorg c6df59c7b0 Fix code signing verifier tests for me 2016-02-28 14:06:05 -05:00
Zorg 876c7af538 Move finding active host pid into Autoupdate
Also use 'open' instead of NSWorkspace to remove our dependency on AppKit
2016-02-28 13:38:51 -05:00
Zorg 513d7f39a1 Use SUFileManager to move the temp item to the trash 2016-02-28 12:27:53 -05:00
Zorg 3e64da75b6 Replace Cocoa import with Foundation wherever possible 2016-02-28 11:59:27 -05:00
Zorg 6041d68db6 Add note about .pch usually being a bad idea 2016-02-28 11:41:09 -05:00
Zorg d216f30f47 More secure coding implementation forgot to remove 2016-02-28 11:37:35 -05:00
Zorg 8af18843ef Move AppKit functionality from SUHost to SUApplicationInfo
These operations also make incorrect assumptions when called from out of process,
so it makes sense to separate them out. Furthermore, SUHost can now only depend on
Foundation
2016-02-28 11:36:11 -05:00
Zorg 2a13d62838 Forgot to remove this secure coding implmentation 2016-02-28 11:09:48 -05:00
Zorg 1fc1d3598a No need for SUSystemProfiler singleton, and SUHost doesn't need to know about it 2016-02-28 11:09:11 -05:00
Zorg 0d7b0037a1 Remove unneeded deps from SUHost 2016-02-28 10:51:31 -05:00
Zorg 4a3f0ad984 Pass the SUHost into the driver's constructor 2016-02-28 02:00:57 -05:00
Zorg f630188255 Remove/modernize a bunch of cruft
Yeah, this isn't backwards compatible with older code that uses Sparkle

Few notes:
* Mostly everything from *.pch has been moved out for saner dependency tracking
* 10.7 compatibility has been removed out so I don't import Cocoa when I don't have to
* sharedUpdaters/SUUpdater singletons has been removed out so updaters can actually be deallocated properly
 (and since singletons are generally horrible idea anyway)
* SUUpdater doesn't have UI/cocoa/bindings/menu validation code. Its new initializer method takes a user driver
 (perhaps in the future I'll create another class that "binds" the UI and core)
2016-02-28 01:39:15 -05:00
Zorg b5a1826a47 finishTermination property is no longer used 2016-02-27 21:47:27 -05:00
Zorg 717f741977 Simplify sending termination signal from the user driver 2016-02-27 21:13:26 -05:00
Zorg 3d2958326c Looks like standard Foundation classes (NSNumber, NSString) are safe 2016-02-27 20:30:18 -05:00
Zorg 3bf91e795e Move delegate protocol to SUUserUpdaterDriver protocol 2016-02-27 19:59:39 -05:00
Zorg cdea8015d3 Merge branch 'master' into ui-separation 2016-02-27 19:41:27 -05:00
Zorg bea00a99e8 Update SULoggerUpdateDriver example 2016-02-27 19:40:09 -05:00
Zorg 0e7eba5ae9 Add note about not dispatching to main queue again 2016-02-27 19:31:53 -05:00
Kornel a52cbc38a1 Merge pull request #769 from zorgiepoo/update-last-check-date
Update last update check date when the update driver finishes
2016-02-28 00:04:45 +00:00
Zorg 530a90cb73 Update last update check date when the update driver finishes
This fixes the issue where if an update alert is present for a long time,
and the user dismisses it, they may be prompted with another update alert
immediately after.
2016-02-27 18:39:18 -05:00
Zorg aee0b6f7d8 Allow user driver's delegate to handle initiating update checks
In a XPC environment, a delegate may handle update checks by sending a message
to the XPC process that tells it to reset the sparkle updater's check cycle.
If the user driver delegate can do this, the XPC process will not need to wait
for a reply, allowing the system to kill the XPC process when it becomes idle.
2016-02-27 17:54:19 -05:00
Zorg dec088b9ad Dispatch reply blocks to main queue 2016-02-27 16:41:05 -05:00
Zorg fbfcbbdf2d Move check update timer into the user driver
In an XPC environment, XPC processes may be killed if they are considered idle.
Thus, we must do the update checking in the user driver.
2016-02-27 16:28:25 -05:00
Zorg 3230fd982b Change SUUserUpdaterDriver so that every reply block must get a response
These changes are to make XPC environment more friendly. Every reply block must
get a response and is not optional to respond to. For example we can no longer have
a reply block that is just "cancelUpdate()"; it must now take an option whether
we are done now or if we want to cancel, and the receiver should now be aware
when canceling doesn't make sense (i.e, if update already aborted). Furthermore,
a reply block must get exactly *one* response.
2016-02-27 14:00:28 -05:00
Zorg b6d1726d77 Cleanup showing update alerts and use weak references 2016-02-26 20:28:35 -05:00
Zorg 582381a5df Add note about permission dialog being modal 2016-02-26 20:06:11 -05:00
Zorg beae77136b Preserve & deprecate SUUpdater show modal alert methdods
Just to keep backwards compatibility as an option
2016-02-23 22:29:25 -05:00
Zorg e20ecce343 Make sure delegate responds to methods 2016-02-23 21:58:58 -05:00
Zorg 14f56c519b Move modal alert delegation to user updater driver 2016-02-23 21:56:14 -05:00
Zorg cd66b1013a Modal alert methods no longer needed for SUSparkleUserUpdaterDriver 2016-02-22 23:27:23 -05:00
Zorg a6d6e31b2c Remove asking user updater driver if it's showing alerts modally
non-void/synchronous calls over XPC don't work properly, and
these methods don't seem very proper architecture wise anyway.
A proper solution will be needed for notifying the delegate of modal alerts
2016-02-22 23:21:27 -05:00
Zorg 308cfe36cf Don't assume the host is our original application for code signing verification
Tested to make sure this the verification didn't break
2016-02-22 22:50:37 -05:00
Zorg b6e558d82e Timeout if target app takes too long to terminate
This makes the AutoUpdate app less trusting for the target app
2016-02-21 23:42:03 -05:00
Zorg a9df54eb98 Replace critical Sparkle error alerts with raised exceptions
Alert UI does not belong here. And since these are critical errors,
they should not be recoverable (i.e, user can't just hit 'OK')
2016-02-21 17:30:45 -05:00
Zorg f00978c87b Move -dismissUpdateInstallation call into basic update driver 2016-02-21 16:57:54 -05:00
Zorg 0e97f0b4b6 Handle app termination in the user driver
If an automatic update needs to be applied at termination,
the app delegate will need to hold responsibility of delaying
termination until Sparkle is ready to relaunch
2016-02-21 13:24:54 -05:00
Zorg 5a60ddaf8c activeUpdateAlert needs to be a strong reference 2016-02-21 00:48:49 -05:00
Zorg c3824b4c20 Making dismissUpdateInstallation independent of installation type
Also clean up warnings/temporary comments
2016-02-21 00:26:51 -05:00
Zorg 6b5a3547e7 Cleaning up SUUserUpdateDriver protocol 2016-02-20 23:52:24 -05:00
Zorg 1ebb150a1b Null out applicationWillTerminate block reference 2016-02-20 21:44:30 -05:00
Zorg 80bdd318ba Condense manual vs automatic update alert code 2016-02-20 21:36:16 -05:00
Kornel 168c769eb0 Merge pull request #764 from nriley/icon-scaling
Scale app icon up if needed in Software Update window (#763)
2016-02-21 01:11:45 +00:00
Zorg 1fad56c4c3 Add user driver methods for automatic updating
Note that the protocol API for the user updater driver can still be improved.

applicationWillTerminate: is done from the user driver because that's the only way that will
function across different processes.
2016-02-20 19:39:48 -05:00
Nicholas Riley 5b3577c14c Scale app icon up if needed in Software Update window (#763) 2016-02-20 13:56:28 -05:00
Zorg 835f4ac5b5 Forgot to remove -openInfoURLForAppcastItem: from previous commit 2016-02-19 21:07:48 -05:00
Zorg e6ac015dde Remove opening info URL from being an update alert choice
This option is really "do something in user driver & remind me later"
2016-02-19 21:00:54 -05:00
Zorg 6acbf0010a Merge branch 'master' into ui-separation 2016-02-19 19:56:43 -05:00
Zorg 0bb5de196a Remove initializer taking SUHost from SUUserUpdaterDriver 2016-02-19 17:27:44 -05:00
Zorg b9c664687d Take delta updates in account and add tests for them 2016-02-19 12:43:41 -05:00
Zorg 2a3e88bf96 Test the dateString field 2016-02-19 11:45:54 -05:00
Zorg 004ac3f9ae Test the best chosen appcast item 2016-02-19 11:26:35 -05:00
Zorg 8a04cc726f Appcast items are no longer sorted; reflect that in unit tests 2016-02-19 10:19:00 -05:00
Zorg 9f2604b888 Merge branch 'master' into best-update-by-version 2016-02-19 10:17:27 -05:00
Kornel 0171ab2d84 Merge pull request #761 from zorgiepoo/automatic-update-termination
Fix Installation process being initiated twice
2016-02-19 14:52:25 +00:00
Zorg c3ffd7f739 Don't register for termination notifications more than once. Fixes #757
These notifications are already added by -unarchiverDidFinish: which is
always invoked before -showUpdateAlert
2016-02-19 09:38:42 -05:00
Zorg 625f229a65 Don't terminate the app if we're already terminating 2016-02-18 00:40:14 -05:00
Zorg 674b2238b8 Make Sparkle look for the highest compatible version
Sparkle's past behavior was sorting appcast items by published dates and
picking the first compatible item. However, it makes more sense to pick
the compatible item with the highest version (see issue #31).

The NSDate instance creation & sorting has also been removed from the code.
The methods we were using to parse the string into a NSDate have been deprecated,
and are strongly discouraged. Namely, all methods taking an arbitrary/natural string
have been nuked signaling they were probably a really bad idea. Furthermore, the
date code we had created a NSCalendarDate which has been long deprecated.

So we just don't handle date parsing. Even if there is a proper format for the pubDate,
It is an extra burden on the developer to insert a conforming date.
And we shouldn't want to rely on a potentially error-prone input field.
2016-02-17 00:04:07 -05:00
Zorg 48e0febf1a Add NSSecureCoding to SUUpdatePermissionPromptResult 2016-02-15 00:18:01 -05:00
Zorg 480feff34f Update postponing code is not as bad as I thought 2016-02-15 00:08:07 -05:00
Zorg 1cfbffa74c Making Sparkle more XPC friendly
We support NSSecureCoding for SUAppcastItem and SUHost

Callbacks from XPC <-> Host app now async to main GCD queue.
This is needed for everything to be thread safe.

Todo: NSDate parsing sucks and is temporarily disabled.
In particular, we're using deprecated methods to read the dates,
which don't support NSSecureCoding. The other problem is that the dates are
really useless technically and we shouldn't sort by them.
2016-02-15 00:00:01 -05:00
Zorg a9f1e2d919 Add SUSparkleUserUpdaterDriver.h to Sparkle.h 2016-02-14 21:16:48 -05:00
Zorg 46a2485d9c Created custom user update driver protocol
Everything related to the protocol is intended for showing & dismissing progress,
as well as making UI actions such as canceling, installing, confirming update permissions
2016-02-14 20:57:32 -05:00
Zorg 7ca99547b9 Add note about default icon assumption potentially being off 2016-02-14 13:18:32 -05:00
Zorg 96fb18e0df Launch AutoUpdate via NSWorkspace instead of NSTask
This will allow the app to run normally without being terminated because
a XPC service was terminated
2016-02-14 09:47:16 -05:00
Zorg 2ef497afcd Added delegate methods to all UI bits
This is still incomplete and not perfect yet.

In particular, these delegate methods ought to perhaps be grouped in a separate class.

The UI code that is currently done should be treated the same manner as a custom UI

Relaunching Sparkle should give customization over showing the UI of the autoupdater app
2016-02-13 23:09:01 -05:00
Zorg 0a29626615 Initial work on UI separation
Separated just the permission prompt so far
2016-02-11 23:45:36 -05:00
530 changed files with 26182 additions and 12011 deletions

No files matched your search

+7
View File
@@ -28,6 +28,13 @@ Icon
.Spotlight-V100
.Trashes
# With Carthage, if Sparkle is included as a Git submodule (e.g. with the
# --use-submodules option), the main module's .gitignore can't reach all the
# way inside the submodule to ignore the added Carthage/Build symlink, and Git
# keeps complaining about untracked changes in the submodule forever, which
# is very annoying. To avoid that issue, ignore here in Sparkle instead.
Carthage/Build
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
+3
View File
@@ -0,0 +1,3 @@
[submodule "Vendor/ed25519"]
path = Vendor/ed25519
url = https://github.com/orlp/ed25519
+20
View File
@@ -0,0 +1,20 @@
excluded:
- Vendor
disabled_rules:
- opening_brace
- empty_parentheses_with_trailing_closure
- function_body_length
- line_length
- cyclomatic_complexity
- large_tuple
# Rule-specific config
trailing_comma:
mandatory_comma: true
force_try:
severity: warning
force_cast:
severity: warning
identifier_name:
min_length:
warning: 2
+6 -6
View File
@@ -1,7 +1,7 @@
os: osx
language: objective-c
osx_image: xcode7
before_install:
- brew update
- brew install macmade/tap/xcode-coveralls
script: make ci
after_success: xcode-coveralls --exclude /Applications --exclude Tests --exclude Vendor build/Build/Intermediates/Sparkle.build/Coverage/Sparkle.build/Objects-normal/x86_64
osx_image:
- xcode10.3
- xcode11.4
script:
- set -o pipefail && xcodebuild test -project Sparkle.xcodeproj -scheme Distribution -derivedDataPath build -enableCodeCoverage YES | xcpretty
+34
View File
@@ -0,0 +1,34 @@
//
// AgentConnection.h
// Sparkle
//
// Created by Mayur Pawashe on 7/17/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol AgentConnectionDelegate <NSObject>
- (void)agentConnectionDidInitiate;
- (void)agentConnectionDidInvalidate;
@end
@protocol SPUInstallerAgentProtocol;
@interface AgentConnection : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate;
- (void)startListener;
- (void)invalidate;
@property (nonatomic, readonly, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, readonly) BOOL connected;
@end
NS_ASSUME_NONNULL_END
+108
View File
@@ -0,0 +1,108 @@
//
// AgentConnection.m
// Sparkle
//
// Created by Mayur Pawashe on 7/17/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "AgentConnection.h"
#import "SPUMessageTypes.h"
#import "SPUInstallerAgentProtocol.h"
#import "SUInstallerAgentInitiationProtocol.h"
#include "AppKitPrevention.h"
@interface AgentConnection () <NSXPCListenerDelegate, SUInstallerAgentInitiationProtocol>
@property (nonatomic) NSXPCListener *xpcListener;
@property (nonatomic, nullable) NSXPCConnection *activeConnection;
@property (nonatomic, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, weak) id<AgentConnectionDelegate> delegate;
@property (nonatomic) BOOL connected;
@end
@implementation AgentConnection
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize agent = _agent;
@synthesize delegate = _delegate;
@synthesize connected = _connected;
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate
{
self = [super init];
if (self != nil) {
// Agents should always be the one that connect to daemons due to how mach bootstraps work
// For this reason, we are the ones that are creating a listener, not the agent
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
_delegate = delegate;
}
return self;
}
- (void)startListener
{
[self.xpcListener resume];
}
- (void)invalidate
{
self.delegate = nil;
[self.activeConnection invalidate];
self.activeConnection = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (self.activeConnection != nil) {
[newConnection invalidate];
return NO;
}
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)];
newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
self.activeConnection = newConnection;
__weak AgentConnection *weakSelf = self;
newConnection.interruptionHandler = ^{
[weakSelf.activeConnection invalidate];
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf.delegate agentConnectionDidInvalidate];
});
};
[newConnection resume];
self.agent = newConnection.remoteObjectProxy;
return YES;
}
- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement
{
dispatch_async(dispatch_get_main_queue(), ^{
self.connected = YES;
[self.delegate agentConnectionDidInitiate];
self.delegate = nil;
});
acknowledgement();
}
@end
+20
View File
@@ -0,0 +1,20 @@
//
// AppInstaller.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
@interface AppInstaller : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier;
- (void)start;
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn));
@end
+622
View File
@@ -0,0 +1,622 @@
//
// AppInstaller.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "AppInstaller.h"
#import "TerminationListener.h"
#import "SUInstaller.h"
#import "SUUpdateValidator.h"
#import "SULog.h"
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUStandardVersionComparator.h"
#import "SPUMessageTypes.h"
#import "SPUSecureCoding.h"
#import "SPUInstallationInputData.h"
#import "SUUnarchiver.h"
#import "SUFileManager.h"
#import "SPUInstallationInfo.h"
#import "SUAppcastItem.h"
#import <Sparkle/SUErrors.h>
#import "SUInstallerCommunicationProtocol.h"
#import "AgentConnection.h"
#import "SPUInstallerAgentProtocol.h"
#import "SPUInstallationType.h"
#import "SPULocalCacheDirectory.h"
#include "AppKitPrevention.h"
#define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull
/*!
* Show display progress UI after a delay from starting the final part of the installation.
* This should be long enough so that we don't show progress for very fast installations, but
* short enough so that we don't leave the user wondering why nothing is happening.
*/
static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@interface AppInstaller () <NSXPCListenerDelegate, SUInstallerCommunicationProtocol, AgentConnectionDelegate>
@property (nonatomic) NSXPCListener* xpcListener;
@property (nonatomic) NSXPCConnection *activeConnection;
@property (nonatomic) id<SUInstallerCommunicationProtocol> communicator;
@property (nonatomic) AgentConnection *agentConnection;
@property (nonatomic) BOOL receivedUpdaterPong;
@property (nonatomic, strong) TerminationListener *terminationListener;
@property (nonatomic) SUUpdateValidator *updateValidator;
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
@property (nonatomic) SUHost *host;
@property (nonatomic, copy) NSString *updateDirectoryPath;
@property (nonatomic, copy) NSString *downloadName;
@property (nonatomic, copy) NSString *decryptionPassword;
@property (nonatomic, strong) SUSignatures *signatures;
@property (nonatomic, copy) NSString *relaunchPath;
@property (nonatomic, copy) NSString *installationType;
@property (nonatomic, assign) BOOL shouldRelaunch;
@property (nonatomic, assign) BOOL shouldShowUI;
@property (nonatomic) id<SUInstallerProtocol> installer;
@property (nonatomic) BOOL willCompleteInstallation;
@property (nonatomic) BOOL receivedInstallationData;
@property (nonatomic) BOOL finishedValidation;
@property (nonatomic) BOOL agentInitiatedConnection;
@property (nonatomic) dispatch_queue_t installerQueue;
@property (nonatomic) BOOL performedStage1Installation;
@property (nonatomic) BOOL performedStage2Installation;
@property (nonatomic) BOOL performedStage3Installation;
@end
@implementation AppInstaller
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize communicator = _communicator;
@synthesize agentConnection = _agentConnection;
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
@synthesize terminationListener = _terminationListener;
@synthesize updateValidator = _updateValidator;
@synthesize host = _host;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize signatures = _signatures;
@synthesize relaunchPath = _relaunchPath;
@synthesize installationType = _installationType;
@synthesize shouldRelaunch = _shouldRelaunch;
@synthesize shouldShowUI = _shouldShowUI;
@synthesize installer = _installer;
@synthesize willCompleteInstallation = _willCompleteInstallation;
@synthesize receivedInstallationData = _receivedInstallationData;
@synthesize installerQueue = _installerQueue;
@synthesize performedStage1Installation = _performedStage1Installation;
@synthesize performedStage2Installation = _performedStage2Installation;
@synthesize performedStage3Installation = _performedStage3Installation;
@synthesize finishedValidation = _finishedValidation;
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier
{
if (!(self = [super init])) {
return nil;
}
_hostBundleIdentifier = [hostBundleIdentifier copy];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
_xpcListener.delegate = self;
_agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self];
return self;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (self.activeConnection != nil) {
SULog(SULogLevelDefault, @"Rejecting multiple connections...");
[newConnection invalidate];
return NO;
}
self.activeConnection = newConnection;
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
__weak AppInstaller *weakSelf = self;
newConnection.interruptionHandler = ^{
[weakSelf.activeConnection invalidate];
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
AppInstaller *strongSelf = weakSelf;
if (strongSelf != nil) {
if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) {
SULog(SULogLevelError, @"Invalidation on remote port being called, and installation is not close enough to completion!");
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE];
}
strongSelf.communicator = nil;
strongSelf.activeConnection = nil;
}
});
};
[newConnection resume];
self.communicator = newConnection.remoteObjectProxy;
return YES;
}
- (void)start
{
[self.xpcListener resume];
[self.agentConnection startListener];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self.receivedInstallationData) {
SULog(SULogLevelError, @"Timeout: installation data was never received");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
}
if (!self.agentConnection.connected) {
SULog(SULogLevelError, @"Timeout: agent connection was never initiated");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
}
});
}
- (void)extractAndInstallUpdate
{
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword];
BOOL success = NO;
if (!unarchiver) {
SULog(SULogLevelError, @"Error: No valid unarchiver for %@", archivePath);
success = NO;
} else {
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
// Delta & package updates will require validation before extraction
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or DSA keys
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) {
success = [self.updateValidator validateDownloadPath];
} else {
success = YES;
}
}
if (!success) {
[self unarchiverDidFail];
} else {
[unarchiver
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
if (error != nil) {
[self unarchiverDidFail];
} else {
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath];
if (!validationSuccess) {
SULog(SULogLevelError, @"Error: update validation was a failure");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
} else {
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
self.finishedValidation = YES;
if (self.agentInitiatedConnection) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
}
}
progressBlock:^(double progress) {
if (sizeof(progress) == sizeof(uint64_t)) {
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
[self.communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data];
}
}];
}
}
- (void)unarchiverDidFail
{
// No longer need update validator until next possible extraction (eg: if initial delta update fails)
self.updateValidator = nil;
// Client could try update again with different inputs
// Eg: one common case is if a delta update fails, client may want to fall back to regular update
// We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data,
// but may as well set other fields to nil too
self.updateDirectoryPath = nil;
self.downloadName = nil;
self.decryptionPassword = nil;
self.signatures = nil;
self.relaunchPath = nil;
self.host = nil;
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:[NSData data]];
}
- (void)agentConnectionDidInitiate
{
self.agentInitiatedConnection = YES;
if (self.finishedValidation) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
- (void)agentConnectionDidInvalidate
{
if (!self.finishedValidation || !self.agentInitiatedConnection) {
SULog(SULogLevelError, @"Error: Agent connection invalidated before installation began");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
}
}
- (void)retrieveProcessIdentifierAndStartInstallation
{
// We use the relaunch path for the bundle to listen for termination instead of the host path
// For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates
// Otherwise for an app, the relaunch path and host path should be identical
[self.agentConnection.agent registerApplicationBundlePath:self.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) {
dispatch_async(dispatch_get_main_queue(), ^{
self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier];
[self startInstallation];
});
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.terminationListener == nil) {
SULog(SULogLevelError, @"Timeout error: failed to retreive process identifier from agent");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
}
});
}
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{
if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
dispatch_async(dispatch_get_main_queue(), ^{
// Mark that we have received the installation data
// Do not rely on eg: self.ipdateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
self.receivedInstallationData = YES;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) {
SULog(SULogLevelError, @"Error: Failed to unarchive input installation data");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
NSString *installationType = installationData.installationType;
if (!SPUValidInstallationType(installationType)) {
SULog(SULogLevelError, @"Error: Received invalid installation type: %@", installationType);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath];
NSString *bundleIdentifier = hostBundle.bundleIdentifier;
if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) {
SULog(SULogLevelError, @"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// This will be important later
if (installationData.relaunchPath == nil) {
SULog(SULogLevelError, @"Error: Failed to obtain relaunch path from installation data");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// This installation path is specific to sparkle and the bundle identifier
NSString *rootCacheInstallationPath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"Installation"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootCacheInstallationPath];
NSString *cacheInstallationPath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootCacheInstallationPath];
if (cacheInstallationPath == nil) {
SULog(SULogLevelError, @"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// Move the download archive to somewhere where probably only we will be touching it
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
// When this tool is ran as root, we are moving it into a directory that only root will have access to
NSURL *downloadURL = [[NSURL fileURLWithPath:installationData.updateDirectoryPath] URLByAppendingPathComponent:installationData.downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:installationData.downloadName];
NSError *moveError = nil;
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
SULog(SULogLevelError, @"Error: Failed to move download archive to new location: %@", moveError);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// Make sure the downloaded archive we moved over is a regular file and not a symbolic link placed by an attacker
NSError *attributesError = nil;
NSString *downloadDestinationPath = downloadDestinationURL.path;
if (downloadDestinationPath == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve download archive path from %@", downloadDestinationURL);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
NSDictionary<NSString *, id> *archiveAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:downloadDestinationPath error:&attributesError];
if (archiveAttributes == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve download archive attributes from %@", downloadDestinationPath);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
if (![(NSString *)archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) {
SULog(SULogLevelError, @"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// Carry these properities separately rather than using the SUInstallationInputData object
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
self.installationType = installationType;
self.relaunchPath = installationData.relaunchPath;
self.downloadName = installationData.downloadName;
self.signatures = installationData.signatures;
self.updateDirectoryPath = cacheInstallationPath;
self.host = [[SUHost alloc] initWithBundle:hostBundle];
[self extractAndInstallUpdate];
});
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
if (archivedData != nil) {
[self.agentConnection.agent registerInstallationInfoData:archivedData];
}
}
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
// Because anyone can ask us to resume the installation, it may be wise to think about backwards compatibility here if IPC changes
uint8_t relaunch = *((const uint8_t *)data.bytes);
uint8_t showsUI = *((const uint8_t *)data.bytes + 1);
dispatch_async(dispatch_get_main_queue(), ^{
// This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
self.shouldShowUI = (BOOL)showsUI;
// Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
self.shouldRelaunch = (BOOL)relaunch;
if (self.performedStage1Installation) {
// Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
});
}
});
} else if (identifier == SPUUpdaterAlivePong) {
self.receivedUpdaterPong = YES;
}
}
- (void)startInstallation
{
self.willCompleteInstallation = YES;
self.installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL);
dispatch_async(self.installerQueue, ^{
NSError *installerError = nil;
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
if (installer == nil) {
SULog(SULogLevelError, @"Error: Failed to create installer instance with error: %@", installerError);
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
});
return;
}
NSError *firstStageError = nil;
if (![installer performInitialInstallation:&firstStageError]) {
SULog(SULogLevelError, @"Error: Failed to start installer with error: %@", firstStageError);
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
});
return;
}
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
dispatch_async(dispatch_get_main_queue(), ^{
self.installer = installer;
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
self.performedStage1Installation = YES;
// Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated
[self finishInstallationAfterHostTermination];
});
});
}
- (void)performStage2InstallationIfNeeded
{
if (self.performedStage2Installation) {
return;
}
BOOL performedSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
if (performedSecondStage) {
self.performedStage2Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
// Don't check if the target is already terminated, leave that to the progress agent
// We could be slightly off if there were multiple instances running
[self.agentConnection.agent sendTerminationSignal];
});
} else {
SULog(SULogLevelError, @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently");
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
});
}
}
- (void)finishInstallationAfterHostTermination
{
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
if (!success) {
SULog(SULogLevelError, @"Failed to listen for application termination");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
return;
}
// Show our installer progress UI tool if only after a certain amount of time passes,
// and if our installer is silent (i.e, doesn't show progress on its own)
__block BOOL shouldShowUIProgress = YES;
if (self.shouldShowUI && [self.installer canInstallSilently]) {
// Ask the updater if it is still alive
// If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side
self.receivedUpdaterPong = NO;
[self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Make sure we're still eligible for showing the installer progress
// Also if the updater process is still alive, showing the progress should not be our duty
// if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil,
// this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater
if (shouldShowUIProgress && (!self.receivedUpdaterPong || self.communicator == nil)) {
[self.agentConnection.agent showProgress];
}
});
}
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
if (!self.performedStage2Installation) {
// We failed and we're going to exit shortly
return;
}
// Used later for relaunching
// Compute this now before we set this installer property to nil
NSString *installationPath = [self.installer installationPath];
NSError *thirdStageError = nil;
if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
SULog(SULogLevelError, @"Failed to finalize installation with error: %@", thirdStageError);
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
});
return;
}
self.performedStage3Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
// Make sure to stop our displayed progress before we move onto cleanup & relaunch
// This will also stop the agent from broadcasting the status info service, which we want to do before
// we relaunch the app because the relaunched app could check the service upon launch..
[self.agentConnection.agent stopProgress];
shouldShowUIProgress = NO;
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
if (self.shouldRelaunch) {
NSString *pathToRelaunch = nil;
// If the relaunch path is the same as the host bundle path, use the installation path from the installer which may be normalized
// Otherwise use the requested relaunch path in all other cases
if ([self.relaunchPath.pathComponents isEqualToArray:self.host.bundlePath.pathComponents]) {
pathToRelaunch = installationPath;
} else {
pathToRelaunch = self.relaunchPath;
}
// This will also signal to the agent that it will terminate soon
[self.agentConnection.agent relaunchPath:pathToRelaunch];
}
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
});
});
}];
}
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn))
{
// It's nice to tell the other end we're invalidating
[self.activeConnection invalidate];
self.activeConnection = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
[self.agentConnection invalidate];
self.agentConnection = nil;
if (self.updateDirectoryPath != nil) {
NSError *theError = nil;
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
}
}
exit(status);
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// SPUInstallationInfo.h
// Sparkle
//
// Created by Mayur Pawashe on 4/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem;
@interface SPUInstallationInfo : NSObject <NSSecureCoding>
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
@property (nonatomic, readonly) BOOL canSilentlyInstall;
@end
NS_ASSUME_NONNULL_END
+55
View File
@@ -0,0 +1,55 @@
//
// SPUInstallationInfo.m
// Sparkle
//
// Created by Mayur Pawashe on 4/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUInstallationInfo.h"
#import "SUAppcastItem.h"
#include "AppKitPrevention.h"
static NSString *SUAppcastItemKey = @"SUAppcastItem";
static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
@implementation SPUInstallationInfo
@synthesize appcastItem = _appcastItem;
@synthesize canSilentlyInstall = _canSilentlyInstall;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
{
self = [super init];
if (self != nil) {
_appcastItem = appcastItem;
_canSilentlyInstall = canSilentlyInstall;
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
{
SUAppcastItem *appcastItem = [decoder decodeObjectOfClass:[SUAppcastItem class] forKey:SUAppcastItemKey];
if (appcastItem == nil) {
return nil;
}
BOOL canSilentlyInstall = [decoder decodeBoolForKey:SUCanSilentlyInstallKey];
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
[coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
@end
+37
View File
@@ -0,0 +1,37 @@
//
// SPUInstallationInputData.h
// Sparkle
//
// Created by Mayur Pawashe on 3/24/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
@class SUSignatures;
NS_ASSUME_NONNULL_BEGIN
@interface SPUInstallationInputData : NSObject <NSSecureCoding>
/*
* relaunchPath - path to application bundle to relaunch and listen for termination
* hostBundlePath - path to host bundle to update & replace
* updateDirectoryPath - path to update directory (i.e, temporary directory containing the new update archive)
* downloadName - name of update archive in update directory
* signatures - signatures for the update that came from the appcast item
* decryptionPassword - optional decryption password for dmg archives
*/
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
@property (nonatomic, copy, readonly) NSString *relaunchPath;
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
@property (nonatomic, copy, readonly) NSString *downloadName;
@property (nonatomic, copy, readonly) NSString *installationType;
@property (nonatomic, strong, readonly) SUSignatures *signatures;
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
@end
NS_ASSUME_NONNULL_END
+106
View File
@@ -0,0 +1,106 @@
//
// SPUInstallationInputData.m
// Sparkle
//
// Created by Mayur Pawashe on 3/24/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUInstallationInputData.h"
#import "SPUInstallationType.h"
#import "SUSignatures.h"
#include "AppKitPrevention.h"
static NSString *SURelaunchPathKey = @"SURelaunchPath";
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
static NSString *SUDownloadNameKey = @"SUDownloadName";
static NSString *SUSignaturesKey = @"SUSignatures";
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
static NSString *SUInstallationTypeKey = @"SUInstallationType";
@implementation SPUInstallationInputData
@synthesize relaunchPath = _relaunchPath;
@synthesize hostBundlePath = _hostBundlePath;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize signatures = _signatures;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize installationType = _installationType;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
_relaunchPath = [relaunchPath copy];
_hostBundlePath = [hostBundlePath copy];
_updateDirectoryPath = [updateDirectoryPath copy];
_downloadName = [downloadName copy];
_installationType = [installationType copy];
assert(SPUValidInstallationType(_installationType));
_signatures = signatures;
_decryptionPassword = [decryptionPassword copy];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
{
NSString *relaunchPath = [decoder decodeObjectOfClass:[NSString class] forKey:SURelaunchPathKey];
if (relaunchPath == nil) {
return nil;
}
NSString *hostBundlePath = [decoder decodeObjectOfClass:[NSString class] forKey:SUHostBundlePathKey];
if (hostBundlePath == nil) {
return nil;
}
NSString *updateDirectoryPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUUpdateDirectoryPathKey];
if (updateDirectoryPath == nil) {
return nil;
}
NSString *downloadName = [decoder decodeObjectOfClass:[NSString class] forKey:SUDownloadNameKey];
if (downloadName == nil) {
return nil;
}
NSString *installationType = [decoder decodeObjectOfClass:[NSString class] forKey:SUInstallationTypeKey];
if (!SPUValidInstallationType(installationType)) {
return nil;
}
SUSignatures *signatures = [decoder decodeObjectOfClass:[SUSignatures class] forKey:SUSignaturesKey];
if (signatures == nil) {
return nil;
}
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
[coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
[coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
[coder encodeObject:self.signatures forKey:SUSignaturesKey];
if (self.decryptionPassword != nil) {
[coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
}
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
@end
+48
View File
@@ -0,0 +1,48 @@
//
// SPUMessageTypes.h
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
extern NSString *SPUAppcastItemArchiveKey;
// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
{
SPUInstallerNotStarted = 0,
SPUExtractionStarted = 1,
SPUExtractedArchiveWithProgress = 2,
SPUArchiveExtractionFailed = 3,
SPUValidationStarted = 4,
SPUInstallationStartedStage1 = 5,
SPUInstallationFinishedStage1 = 6,
SPUInstallationFinishedStage2 = 7,
SPUInstallationFinishedStage3 = 8,
SPUUpdaterAlivePing = 9
};
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
{
SPUInstallationData = 0,
SPUSentUpdateAppcastItemData = 1,
SPUResumeInstallationToStage2 = 2,
SPUUpdaterAlivePong = 3
};
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NS_ASSUME_NONNULL_END
+89
View File
@@ -0,0 +1,89 @@
//
// SPUMessageTypes.m
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUMessageTypes.h"
#import "SUHost.h"
#include "AppKitPrevention.h"
NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive";
// Tags added to the bundle identifier which is used as Mach service names
// These should be very short because length restrictions exist on earlier versions of macOS
#define SPARKLE_INSTALLER_TAG @"-spki"
#define SPARKLE_STATUS_TAG @"-spks"
#define SPARKLE_PROGRESS_TAG @"-spkp"
#define SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG @"-spkl"
// macOS 10.8 at least can't handle service names that are 64 characters or longer
// This was fixed some point after 10.8, but I'm not sure if it was fixed in 10.9 or 10.10 or 10.11
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
#define MAX_SERVICE_NAME_LENGTH 63u
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
{
BOOL legal;
switch (newMessageType) {
case SPUInstallerNotStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractionStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractedArchiveWithProgress:
case SPUArchiveExtractionFailed:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUValidationStarted:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUInstallationStartedStage1:
legal = (oldMessageType == SPUValidationStarted);
break;
case SPUInstallationFinishedStage1:
legal = (oldMessageType == SPUInstallationStartedStage1);
break;
case SPUInstallationFinishedStage2:
legal = (oldMessageType == SPUInstallationFinishedStage1);
break;
case SPUInstallationFinishedStage3:
legal = (oldMessageType == SPUInstallationFinishedStage2);
break;
case SPUUpdaterAlivePing:
// Having this state being dependent on other installation states would make the complicate our logic
// So just always allow this type of message
legal = YES;
break;
}
return legal;
}
static NSString *SPUServiceNameWithTag(NSString *tagName, NSString *bundleIdentifier)
{
NSString *serviceName = [bundleIdentifier stringByAppendingString:tagName];
NSUInteger length = MIN(serviceName.length, MAX_SERVICE_NAME_LENGTH);
// If the service name is too long, cut off the beginning rather than cutting off the end
// This should lead to a more unique name
return [serviceName substringFromIndex:serviceName.length - length];
}
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_INSTALLER_TAG, bundleIdentifier);
}
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier);
}
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier);
}
@@ -9,7 +9,9 @@
#ifndef SUBINARYDELTAAPPLY_H
#define SUBINARYDELTAAPPLY_H
#import <Foundation/Foundation.h>
@class NSString;
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, NSError * __autoreleasing *error);
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double), NSError * __autoreleasing *error);
#endif
@@ -15,6 +15,9 @@
#include <stdlib.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
{
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
@@ -25,7 +28,7 @@ static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFil
return success;
}
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, NSError * __autoreleasing *error)
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError *__autoreleasing *error)
{
xar_t x = xar_open([patchFile fileSystemRepresentation], READ);
if (!x) {
@@ -34,69 +37,71 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION;
int minorDiffVersion = 0;
NSString *expectedBeforeHashv1 = nil;
NSString *expectedAfterHashv1 = nil;
NSString *expectedNewBeforeHash = nil;
NSString *expectedNewAfterHash = nil;
progressCallback(0/6.0);
xar_subdoc_t subdoc;
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
const char *value = 0;
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
if (value)
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
if (value)
minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue];
minorDiffVersion = [@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_KEY, &value);
if (value)
expectedNewBeforeHash = @(value);
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_KEY, &value);
if (value)
expectedNewAfterHash = @(value);
// only available in version 1.0
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_OLD_KEY, &value);
if (value)
expectedBeforeHashv1 = @(value);
// only available in version 1.0
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_OLD_KEY, &value);
if (value)
expectedAfterHashv1 = @(value);
}
}
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
}
return NO;
}
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
}
return NO;
}
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
@@ -111,7 +116,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
fprintf(stderr, "Applying version %u.%u patch...\n", majorDiffVersion, minorDiffVersion);
fprintf(stderr, "Verifying source...");
}
progressCallback(1/6.0);
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
if (!beforeHash) {
if (verbose) {
@@ -136,7 +143,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
if (verbose) {
fprintf(stderr, "\nCopying files...");
}
progressCallback(2/6.0);
if (!removeTree(destination)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -146,6 +155,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
progressCallback(3/6.0);
if (!copyTree(source, destination)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -155,7 +167,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
progressCallback(4/6.0);
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
if (verbose) {
@@ -172,10 +186,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
BOOL removedFile = NO;
const char *value;
if (!xar_prop_get(file, DELETE_KEY, &value) ||
(!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
if (!removeTree(destinationFilePath)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -191,7 +204,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
continue;
}
removedFile = YES;
}
@@ -205,13 +218,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n🔨 %s %s", VERBOSE_PATCHED, [path fileSystemRepresentation]);
}
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) ||
(!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
if (verbose) {
fprintf(stderr, "\n");
@@ -221,7 +233,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
if (fileExisted) {
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [path fileSystemRepresentation]);
@@ -232,7 +244,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
} else if (verbose && removedFile) {
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]);
}
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
if (!modifyPermissions(destinationFilePath, mode)) {
@@ -244,7 +256,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [path fileSystemRepresentation], mode);
}
@@ -252,6 +264,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
xar_close(x);
progressCallback(5/6.0);
if (verbose) {
fprintf(stderr, "\nVerifying destination...");
}
@@ -277,6 +291,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
return NO;
}
progressCallback(6/6.0);
if (verbose) {
fprintf(stderr, "\nDone!\n");
}
@@ -57,16 +57,7 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
SUBeigeMajorVersion = 2
};
// Only keep track of the latest minor version for each major version
typedef NS_ENUM(uint16_t, SUBinaryDeltaMinorVersion)
{
SUAzureMinorVersion = 1,
SUBeigeMinorVersion = 1,
};
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
#define FIRST_DELTA_DIFF_MINOR_VERSION ((SUBinaryDeltaMinorVersion)0)
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
extern int compareFiles(const FTSENT **a, const FTSENT **b);
@@ -80,5 +71,5 @@ extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
NSString *temporaryFilename(NSString *base);
NSString *temporaryDirectory(NSString *base);
NSString *stringWithFileSystemRepresentation(const char*);
SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
#endif
@@ -18,6 +18,8 @@
#include <sys/stat.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
int compareFiles(const FTSENT **a, const FTSENT **b)
{
return strcoll((*a)->fts_name, (*b)->fts_name);
@@ -32,19 +34,20 @@ NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
return path;
}
NSString *stringWithFileSystemRepresentation(const char *input) {
NSString *stringWithFileSystemRepresentation(const char *input)
{
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)];
}
SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
{
switch (majorVersion) {
case SUAzureMajorVersion:
return SUAzureMinorVersion;
return 1;
case SUBeigeMajorVersion:
return SUBeigeMinorVersion;
return 2;
}
return (SUBinaryDeltaMinorVersion)0;
return 0;
}
NSString *temporaryFilename(NSString *base)
@@ -73,18 +76,18 @@ NSString *temporaryDirectory(NSString *base)
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
NSMutableData *data = [NSMutableData data];
[data appendBytes:template.fileSystemRepresentation length:strlen(template.fileSystemRepresentation) + 1];
char *buffer = data.mutableBytes;
char *templateResult = mkdtemp(buffer);
if (templateResult == NULL) {
perror("mkdtemp");
return nil;
}
return stringWithFileSystemRepresentation(templateResult);
}
static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t bufferLength)
static void _hashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bufferLength)
{
assert(bufferLength >= 0 && bufferLength <= UINT32_MAX);
CC_SHA1_CTX hashContext;
@@ -93,7 +96,7 @@ static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t buffe
CC_SHA1_Final(hash, &hashContext);
}
static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent)
static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
{
if (ent->fts_info == FTS_SL) {
char linkDestination[MAXPATHLEN + 1];
@@ -116,12 +119,12 @@ static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent)
_hashOfBuffer(hash, NULL, 0);
} else {
void *buffer = mmap(0, (size_t)fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
if (buffer == (void*)-1) {
if (buffer == (void *)-1) {
close(fileDescriptor);
perror("mmap");
return NO;
}
_hashOfBuffer(hash, buffer, fileSize);
munmap(buffer, (size_t)fileSize);
}
@@ -145,12 +148,12 @@ NSData *hashOfFileContents(FTSENT *ent)
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
{
char pathBuffer[PATH_MAX] = {0};
char pathBuffer[PATH_MAX] = { 0 };
if (![path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
return nil;
}
char * const sourcePaths[] = {pathBuffer, 0};
char *const sourcePaths[] = { pathBuffer, 0 };
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
perror("fts_open");
@@ -160,16 +163,19 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
CC_SHA1_CTX hashContext;
CC_SHA1_Init(&hashContext);
// Ensure the path uses filesystem-specific Unicode normalization #1017
NSString *normalizedPath = stringWithFileSystemRepresentation(pathBuffer);
FTSENT *ent = 0;
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
continue;
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
continue;
}
NSString *relativePath = pathRelativeToDirectory(path, stringWithFileSystemRepresentation(ent->fts_path));
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
if (relativePath.length == 0)
continue;
@@ -181,12 +187,12 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
const char *relativePathBytes = [relativePath fileSystemRepresentation];
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
uint16_t mode = ent->fts_statp->st_mode;
uint16_t type = ent->fts_info;
uint16_t permissions = mode & PERMISSION_FLAGS;
CC_SHA1_Update(&hashContext, &type, sizeof(type));
CC_SHA1_Update(&hashContext, &permissions, sizeof(permissions));
}
@@ -221,7 +227,8 @@ BOOL removeTree(NSString *path)
BOOL copyTree(NSString *source, NSString *dest)
{
return [[SUFileManager fileManagerAllowingAuthorization:NO] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
// SUFileManager will be more reliable for copying items especially across network mounts
return [[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
}
BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
@@ -231,12 +238,12 @@ BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
if (!attributes) {
return NO;
}
NSNumber *permissions = attributes[NSFilePosixPermissions];
NSNumber *permissions = [attributes objectForKey:NSFilePosixPermissions];
if (!permissions) {
return NO;
}
mode_t newMode = ([permissions unsignedShortValue] & ~PERMISSION_FLAGS) | desiredPermissions;
int (*changeModeFunc)(const char *, mode_t) = [attributes[NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
int (*changeModeFunc)(const char *, mode_t) = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
if (changeModeFunc([path fileSystemRepresentation], newMode) != 0) {
return NO;
}
File renamed without changes.
@@ -21,6 +21,8 @@
#include <sys/xattr.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
extern int bsdiff(int argc, const char **argv);
@interface CreateBinaryDeltaOperation : NSOperation
@@ -56,7 +58,7 @@ extern int bsdiff(int argc, const char **argv);
- (void)main
{
NSString *temporaryFile = temporaryFilename(@"BinaryDelta");
const char *argv[] = {"/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation]};
const char *argv[] = { "/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation] };
int result = bsdiff(4, argv);
if (!result)
self.resultPath = temporaryFile;
@@ -75,23 +77,35 @@ static NSDictionary *infoForFile(FTSENT *ent)
if (!hash) {
return nil;
}
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
assert(ent->fts_statp != NULL);
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
return @{INFO_HASH_KEY: hash, INFO_TYPE_KEY: @(ent->fts_info), INFO_PERMISSIONS_KEY : @(permissions), INFO_SIZE_KEY: @(size)};
return @{ INFO_HASH_KEY: hash,
INFO_TYPE_KEY: @(ent->fts_info),
INFO_PERMISSIONS_KEY: @(permissions),
INFO_SIZE_KEY: @(size) };
}
static bool isSymLink(const FTSENT *ent)
{
if (ent->fts_info == FTS_SL)
{
return (true);
}
return false;
}
static bool aclExists(const FTSENT *ent)
{
// OS X does not currently support ACLs for symlinks
// macOS does not currently support ACLs for symlinks
if (ent->fts_info == FTS_SL) {
return NO;
}
acl_t acl = acl_get_link_np(ent->fts_path, ACL_TYPE_EXTENDED);
if (acl != NULL) {
acl_entry_t entry;
@@ -109,28 +123,26 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent)
if (listSize == -1) {
return false;
}
char *buffer = malloc((size_t)listSize);
assert(buffer != NULL);
ssize_t sizeBack = listxattr(ent->fts_path, buffer, (size_t)listSize, options);
assert(sizeBack == listSize);
size_t startCharacterIndex = 0;
for (size_t characterIndex = 0; characterIndex < (size_t)listSize; characterIndex++) {
if (buffer[characterIndex] == '\0') {
char *attribute = &buffer[startCharacterIndex];
size_t length = characterIndex - startCharacterIndex;
if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 ||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 ||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) {
if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) {
free(buffer);
return true;
}
startCharacterIndex = characterIndex + 1;
}
}
free(buffer);
return false;
}
@@ -138,7 +150,7 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent)
static NSString *absolutePath(NSString *path)
{
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
return [[url absoluteURL] path];
return [[url absoluteURL] path];
}
static NSString *temporaryPatchFile(NSString *patchFile)
@@ -151,9 +163,9 @@ static NSString *temporaryPatchFile(NSString *patchFile)
#define MIN_FILE_SIZE_FOR_CREATING_DELTA 4096
static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary *newInfo)
static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo)
{
unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
unsigned long long fileSize = [(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) {
return YES;
}
@@ -162,11 +174,11 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary
return YES;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return YES;
}
if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
if ([(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
// this is possible if just the permissions have changed
return YES;
}
@@ -174,13 +186,13 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary
return NO;
}
static BOOL shouldDeleteThenExtract(NSDictionary* originalInfo, NSDictionary *newInfo)
static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *newInfo)
{
if (!originalInfo) {
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return YES;
}
@@ -192,15 +204,15 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
if (!originalInfo) {
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
if (![(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
return NO;
}
return YES;
}
@@ -209,30 +221,30 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
if (!originalInfo) {
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
return NO;
}
return YES;
}
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError * __autoreleasing *error)
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error)
{
assert(source);
assert(destination);
assert(patchFile);
assert(majorVersion >= FIRST_DELTA_DIFF_MAJOR_VERSION && majorVersion <= LATEST_DELTA_DIFF_MAJOR_VERSION);
SUBinaryDeltaMinorVersion minorVersion = latestMinorVersionForMajorVersion(majorVersion);
int minorVersion = latestMinorVersionForMajorVersion(majorVersion);
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
char pathBuffer[PATH_MAX] = {0};
char pathBuffer[PATH_MAX] = { 0 };
if (![source getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to retrieve file system path representation from source %@", source] }];
@@ -240,7 +252,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
char *sourcePaths[] = {pathBuffer, 0};
char *sourcePaths[] = { pathBuffer, 0 };
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
if (error != NULL) {
@@ -251,9 +263,9 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (verbose) {
fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion);
fprintf(stderr, "Processing %s...", [source fileSystemRepresentation]);
fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]);
}
FTSENT *ent = 0;
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
@@ -276,7 +288,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
originalTreeState[key] = info;
if (aclExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -286,7 +298,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (codeSignatureExtendedAttributeExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -298,7 +310,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
}
fts_close(fts);
NSString *beforeHash = hashOfTreeWithVersion(source, majorVersion);
if (!beforeHash) {
@@ -312,13 +324,12 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary];
for (NSString *key in originalTreeState)
{
for (NSString *key in originalTreeState) {
newTreeState[key] = [NSNull null];
}
if (verbose) {
fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]);
fprintf(stderr, "\nProcessing destination, %s...", [destination fileSystemRepresentation]);
}
pathBuffer[0] = 0;
@@ -331,7 +342,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
sourcePaths[0] = pathBuffer;
fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
@@ -341,7 +352,6 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
continue;
@@ -362,15 +372,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
// We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs,
// or in the case of permissions if the patch version is 1
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
// inside an application, and since we don't preserve extended attribitutes anyway
mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!IS_VALID_PERMISSIONS(permissions)) {
mode_t permissions = [(NSNumber*)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
if (verbose) {
fprintf(stderr, "\n");
}
@@ -379,7 +389,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (aclExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -389,7 +399,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (codeSignatureExtendedAttributeExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -399,15 +409,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
NSDictionary *oldInfo = originalTreeState[key];
if ([info isEqual:oldInfo]) {
[newTreeState removeObjectForKey:key];
} else {
newTreeState[key] = info;
if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
if (oldInfo && [(NSNumber *)oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [(NSNumber *)info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
NSArray *parentPathComponents = key.pathComponents;
for (NSString *childPath in originalTreeState) {
@@ -432,12 +442,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (verbose) {
fprintf(stderr, "\nGenerating delta...");
}
NSString *temporaryFile = temporaryPatchFile(patchFile);
if (verbose) {
fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]);
}
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
if (!x) {
if (verbose) {
@@ -448,20 +461,18 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
xar_subdoc_t attributes = xar_subdoc_new(x, BINARY_DELTA_ATTRIBUTES_KEY);
xar_subdoc_prop_set(attributes, MAJOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", majorVersion] UTF8String]);
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
const char *beforeHashKey =
MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey =
MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
@@ -471,21 +482,21 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
// Sort the keys by preferring the ones from the original tree to appear first
// We want to enforce deleting before extracting in the case paths differ only by case
NSArray *keys = [[newTreeState allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSString *key1, NSString *key2) {
NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2];
if (insensitiveCompareResult != NSOrderedSame) {
return insensitiveCompareResult;
}
NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2];
if (insensitiveCompareResult != NSOrderedSame) {
return insensitiveCompareResult;
}
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
}];
for (NSString* key in keys) {
for (NSString *key in keys) {
id value = [newTreeState valueForKey:key];
if ([value isEqual:[NSNull null]]) {
if ([(NSObject *)value isEqual:[NSNull null]]) {
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, DELETE_KEY, "true");
if (verbose) {
fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]);
}
@@ -499,17 +510,17 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (shouldChangePermissions(originalInfo, newInfo)) {
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
}
}
} else {
NSString *path = [destination stringByAppendingPathComponent:key];
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
assert(newFile);
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
xar_prop_set(newFile, DELETE_KEY, "true");
@@ -517,11 +528,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
}
}
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
xar_prop_set(newFile, EXTRACT_KEY, "true");
}
if (verbose) {
if (originalInfo) {
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
@@ -554,19 +565,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
}
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
assert(newFile);
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
unlink([resultPath fileSystemRepresentation]);
if (operation.permissions) {
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [operation.permissions unsignedShortValue]] UTF8String]);
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [[operation relativePath] fileSystemRepresentation], operation.oldPermissions.unsignedShortValue, operation.permissions.unsignedShortValue);
}
@@ -575,13 +586,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_close(x);
unlink([patchFile fileSystemRepresentation]);
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
unlink([temporaryFile fileSystemRepresentation]);
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr removeItemAtPath: patchFile error: NULL];
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
{
if (verbose) {
fprintf(stderr, "Failed to move temporary file, %s, to %s!\n", [temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
}
return NO;
}
if (verbose) {
fprintf(stderr, "\nDone!\n");
}
return YES;
}
@@ -20,6 +20,8 @@
#define VERSION_COMMAND @"version"
#define VERSION_ALTERNATE_COMMAND @"--version"
#include "AppKitPrevention.h"
static void printUsage(NSString *programName)
{
fprintf(stderr, "Usage:\n");
@@ -34,7 +36,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
NSUInteger numberOflagsFound = 0;
NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG];
NSUInteger versionIndex = NSNotFound;
@@ -44,22 +46,22 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
break;
}
}
if (verboseIndex != NSNotFound) {
++numberOflagsFound;
}
if (versionIndex != NSNotFound) {
++numberOflagsFound;
}
if (args.count - numberOflagsFound < 3) {
printUsage(programName);
return NO;
}
BOOL verbose = (verboseIndex != NSNotFound);
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
NSArray *versionComponents = nil;
if (versionField) {
versionComponents = [versionField componentsSeparatedByString:@"="];
@@ -68,17 +70,17 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
return NO;
}
}
SUBinaryDeltaMajorVersion patchVersion =
!versionComponents ?
LATEST_DELTA_DIFF_MAJOR_VERSION :
(SUBinaryDeltaMajorVersion)[[versionComponents[1] componentsSeparatedByString:@"."][0] intValue]; // ignore minor version if provided
if (patchVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
fprintf(stderr, "Version provided (%u) is not valid\n", patchVersion);
return NO;
}
if (patchVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
fprintf(stderr, "This program is too old to create a version %u patch, or the version number provided is invalid\n", patchVersion);
return NO;
@@ -90,31 +92,35 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
[fileArgs addObject:argument];
}
}
if (fileArgs.count != 3) {
printUsage(programName);
return NO;
}
NSString *sourcePath = fileArgs[0];
NSString *destPath = fileArgs[1];
NSString *patchPath = fileArgs[2];
BOOL isDirectory;
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[0] isDirectory:&isDirectory] || !isDirectory) {
if (![[NSFileManager defaultManager] fileExistsAtPath:sourcePath isDirectory:&isDirectory] || !isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: before-tree must be a directory\n");
return NO;
}
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[1] isDirectory:&isDirectory] || !isDirectory) {
if (![[NSFileManager defaultManager] fileExistsAtPath:destPath isDirectory:&isDirectory] || !isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: after-tree must be a directory\n");
return NO;
}
NSError *createDiffError = nil;
if (!createBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], patchVersion, verbose, &createDiffError)) {
if (!createBinaryDelta(sourcePath, destPath, patchPath, patchVersion, verbose, &createDiffError)) {
fprintf(stderr, "%s\n", [createDiffError.localizedDescription UTF8String]);
return NO;
}
return YES;
}
@@ -124,45 +130,45 @@ static BOOL runApplyCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
BOOL verbose = [args containsObject:VERBOSE_FLAG];
if (args.count == 4 && !verbose) {
printUsage(programName);
return NO;
}
NSMutableArray *fileArgs = [NSMutableArray array];
for (NSString *argument in args) {
if (![argument isEqualToString:VERBOSE_FLAG]) {
[fileArgs addObject:argument];
}
}
if (fileArgs.count != 3) {
printUsage(programName);
return NO;
}
BOOL isDirectory;
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[0] isDirectory:&isDirectory] || !isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: before-tree must be a directory\n");
return NO;
}
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[2] isDirectory:&isDirectory] || isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: patch-file must be a file %d\n", isDirectory);
return NO;
}
NSError *applyDiffError = nil;
if (!applyBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], verbose, &applyDiffError)) {
if (!applyBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], verbose, ^(__unused double x){}, &applyDiffError)) {
fprintf(stderr, "%s\n", [applyDiffError.localizedDescription UTF8String]);
return NO;
}
return YES;
}
@@ -172,7 +178,7 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
if (args.count == 0) {
fprintf(stdout, "%u.%u\n", LATEST_DELTA_DIFF_MAJOR_VERSION, latestMinorVersionForMajorVersion(LATEST_DELTA_DIFF_MAJOR_VERSION));
} else {
@@ -182,30 +188,30 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args)
fprintf(stderr, "Unable to open patch %s\n", [patchFile fileSystemRepresentation]);
return NO;
}
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION;
int minorDiffVersion = 0;
xar_subdoc_t subdoc;
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
const char *value = 0;
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
if (value)
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
if (value)
minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue];
minorDiffVersion = [@(value) intValue];
}
}
fprintf(stdout, "%u.%u\n", majorDiffVersion, minorDiffVersion);
}
return YES;
}
@@ -214,7 +220,7 @@ int main(int __unused argc, char __unused *argv[])
@autoreleasepool {
NSArray *args = [[NSProcessInfo processInfo] arguments];
NSString *programName = [args[0] lastPathComponent];
if (args.count < 2) {
printUsage(programName);
return 1;
@@ -222,7 +228,7 @@ int main(int __unused argc, char __unused *argv[])
NSString *command = args[1];
NSArray *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)];
BOOL result;
if ([command isEqualToString:CREATE_COMMAND]) {
result = runCreateCommand(programName, commandArguments);
@@ -234,7 +240,7 @@ int main(int __unused argc, char __unused *argv[])
result = NO;
printUsage(programName);
}
return result ? 0 : 1;
}
}
+25
View File
@@ -0,0 +1,25 @@
//
// SUBinaryDeltaUnarchiver.h
// Sparkle
//
// Created by Mark Rowe on 2009-06-03.
// Copyright 2009 Mark Rowe. All rights reserved.
//
#ifndef SUBINARYDELTAUNARCHIVER_H
#define SUBINARYDELTAUNARCHIVER_H
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
@end
NS_ASSUME_NONNULL_END
#endif
+118
View File
@@ -0,0 +1,118 @@
//
// SUBinaryDeltaUnarchiver.m
// Sparkle
//
// Created by Mark Rowe on 2009-06-03.
// Copyright 2009 Mark Rowe. All rights reserved.
//
#import "SUBinaryDeltaUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SUBinaryDeltaCommon.h"
#import "SUBinaryDeltaApply.h"
#import "SULog.h"
#import "SUFileManager.h"
#include "AppKitPrevention.h"
@interface SUBinaryDeltaUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
@end
@implementation SUBinaryDeltaUnarchiver
@synthesize archivePath = _archivePath;
@synthesize updateHostBundlePath = _updateHostBundlePath;
+ (BOOL)canUnarchivePath:(NSString *)path
{
return [[path pathExtension] isEqualToString:@"delta"];
}
+ (BOOL)mustValidateBeforeExtraction
{
return YES;
}
// According to https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/MDImporters/Concepts/Troubleshooting.html
// We should make sure mdimporter bundles have an up to date time in the event they were delta updated.
// We used to invoke mdimport on the bundle but this is not a very good approach.
// There's no need to do that for non-delta updates and for updates that contain no mdimporters.
// Moreover, updating the timestamp on the mdimporter bundles is what developers have to do anyway when shipping their new update outside of Sparkle
+ (void)updateSpotlightImportersAtBundlePath:(NSString *)targetPath
{
NSURL *targetURL = [NSURL fileURLWithPath:targetPath];
// Only recurse if it's actually a directory. Don't recurse into a
// root-level symbolic link.
NSDictionary *rootAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetPath error:nil];
NSString *rootType = [rootAttributes objectForKey:NSFileType];
if ([rootType isEqualToString:NSFileTypeDirectory]) {
// The NSDirectoryEnumerator will avoid recursing into any contained
// symbolic links, so no further type checks are needed.
NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtURL:targetURL includingPropertiesForKeys:nil options:(NSDirectoryEnumerationOptions)0 errorHandler:nil];
NSMutableArray *filesToUpdate = [[NSMutableArray alloc] init];
for (NSURL *file in directoryEnumerator) {
if ([file.pathExtension isEqualToString:@"mdimporter"]) {
[filesToUpdate addObject:file];
}
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
for (NSURL *file in filesToUpdate) {
NSError *error = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:file error:&error]) {
SULog(SULogLevelError, @"Error: During delta unarchiving, failed to touch %@", error);
}
}
}
}
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath
{
self = [super init];
if (self != nil) {
_archivePath = [archivePath copy];
_updateHostBundlePath = [updateHostBundlePath copy];
}
return self;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@autoreleasepool {
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
[self extractDeltaWithNotifier:notifier];
}
});
}
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
{
NSString *sourcePath = self.updateHostBundlePath;
NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
NSError *applyDiffError = nil;
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
[notifier notifyProgress:progress];
}, &applyDiffError);
if (success) {
[[self class] updateSpotlightImportersAtBundlePath:targetPath];
[notifier notifySuccess];
}
else {
[notifier notifyFailureWithError:applyDiffError];
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end
+20
View File
@@ -0,0 +1,20 @@
//
// SUCodeSigningVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 7/5/12.
//
//
#ifndef SUCODESIGNINGVERIFIER_H
#define SUCODESIGNINGVERIFIER_H
#import <Foundation/Foundation.h>
@interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError **)error;
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
@end
#endif
+185
View File
@@ -0,0 +1,185 @@
//
// SUCodeSigningVerifier.m
// Sparkle
//
// Created by Andy Matuschak on 7/5/12.
//
//
#include <Security/CodeSigning.h>
#include <Security/SecCode.h>
#import "SUCodeSigningVerifier.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError * __autoreleasing *)error
{
OSStatus result;
SecRequirementRef requirement = NULL;
SecStaticCodeRef staticCode = NULL;
SecStaticCodeRef oldCode = NULL;
CFErrorRef cfError = NULL;
if (error) {
*error = nil;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)oldBundleURL, kSecCSDefaultFlags, &oldCode);
if (result == errSecCSUnsigned) {
return NO;
}
result = SecCodeCopyDesignatedRequirement(oldCode, kSecCSDefaultFlags, &requirement);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to copy designated requirement. Code Signing OSStatus code: %d", result);
goto finally;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)newBundleURL, kSecCSDefaultFlags, &staticCode);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static 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
// Aditionally, there are several reasons to stay away from deep verification and to prefer DSA signing the download archive instead.
// See https://github.com/sparkle-project/Sparkle/pull/523#commitcomment-17549302 and https://github.com/sparkle-project/Sparkle/issues/543
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError);
if (cfError) {
NSError *tmpError = CFBridgingRelease(cfError);
if (error) *error = tmpError;
}
if (result != noErr) {
if (result == errSecCSUnsigned) {
SULog(SULogLevelError, @"The host app is signed, but the new version of the app is not signed using Apple Code Signing. Please ensure that the new app is signed and that archiving did not corrupt the signature.");
}
if (result == errSecCSReqFailed) {
CFStringRef requirementString = nil;
if (SecRequirementCopyString(requirement, kSecCSDefaultFlags, &requirementString) == noErr) {
SULog(SULogLevelError, @"Code signature of the new version doesn't match the old version: %@. Please ensure that old and new app is signed using exactly the same certificate.", requirementString);
CFRelease(requirementString);
}
[self logSigningInfoForCode:oldCode label:@"old info"];
[self logSigningInfoForCode:staticCode label:@"new info"];
}
}
finally:
if (oldCode) CFRelease(oldCode);
if (staticCode) CFRelease(staticCode);
if (requirement) CFRelease(requirement);
return (result == noErr);
}
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError *__autoreleasing *)error
{
OSStatus result;
SecStaticCodeRef staticCode = NULL;
CFErrorRef cfError = NULL;
if (error) {
*error = nil;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
// See in -codeSignatureAtBundleURL:matchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not passed
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError);
if (cfError) {
NSError *tmpError = CFBridgingRelease(cfError);
if (error) *error = tmpError;
}
if (result != noErr) {
if (result == errSecCSUnsigned) {
SULog(SULogLevelError, @"Error: The app is not signed using Apple Code Signing. %@", bundleURL);
}
if (result == errSecCSReqFailed) {
[self logSigningInfoForCode:staticCode label:@"new info"];
}
}
finally:
if (staticCode) CFRelease(staticCode);
return (result == noErr);
}
static id valueOrNSNull(id value) {
return value ? value : [NSNull null];
}
+ (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath {
NSDictionary *info = nil;
SecStaticCodeRef code = NULL;
OSStatus result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundlePath, kSecCSDefaultFlags, &code);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
info = [self codeSignatureInfoForCode:code];
finally:
if (code) CFRelease(code);
return info;
}
+ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code {
CFDictionaryRef signingInfo = nil;
const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation);
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
NSDictionary *signingDict = CFBridgingRelease(signingInfo);
NSMutableDictionary *relevantInfo = [NSMutableDictionary dictionary];
for (NSString *key in @[@"format", @"identifier", @"requirements", @"teamid", @"signing-time"]) {
[relevantInfo setObject:valueOrNSNull([signingDict objectForKey:key]) forKey:key];
}
NSDictionary *infoPlist = [signingDict objectForKey:@"info-plist"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:@"CFBundleShortVersionString"]) forKey:@"version"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:(__bridge NSString *)kCFBundleVersionKey]) forKey:@"build"];
return [relevantInfo copy];
}
return nil;
}
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
}
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL
{
OSStatus result;
SecStaticCodeRef staticCode = NULL;
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
if (result == errSecCSUnsigned) {
return NO;
}
SecRequirementRef requirement = NULL;
result = SecCodeCopyDesignatedRequirement(staticCode, kSecCSDefaultFlags, &requirement);
if (staticCode) {
CFRelease(staticCode);
}
if (requirement) {
CFRelease(requirement);
}
if (result == errSecCSUnsigned) {
return NO;
}
return (result == 0);
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SUDiskImageUnarchiver.h
// Sparkle
//
// Created by Andy Matuschak on 6/16/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#ifndef SUDISKIMAGEUNARCHIVER_H
#define SUDISKIMAGEUNARCHIVER_H
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
@end
NS_ASSUME_NONNULL_END
#endif
+207
View File
@@ -0,0 +1,207 @@
//
// SUDiskImageUnarchiver.m
// Sparkle
//
// Created by Andy Matuschak on 6/16/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUDiskImageUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@interface SUDiskImageUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
@end
@implementation SUDiskImageUnarchiver
@synthesize archivePath = _archivePath;
@synthesize decryptionPassword = _decryptionPassword;
+ (BOOL)canUnarchivePath:(NSString *)path
{
return [[path pathExtension] isEqualToString:@"dmg"];
}
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
_archivePath = [archivePath copy];
_decryptionPassword = [decryptionPassword copy];
}
return self;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
[self extractDMGWithNotifier:notifier];
});
}
// Called on a non-main thread.
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier
{
@autoreleasepool {
BOOL mountedSuccessfully = NO;
// get a unique mount point path
NSString *mountPoint = nil;
NSFileManager *manager;
NSError *error;
NSArray *contents;
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.
CFUUIDRef uuid = CFUUIDCreate(NULL);
if (uuid)
{
NSString *uuidString = CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
if (uuidString)
{
mountPoint = [@"/Volumes" stringByAppendingPathComponent:uuidString];
}
CFRelease(uuid);
}
}
// Note: this check does not follow symbolic links, which is what we want
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
NSData *promptData = nil;
promptData = [NSData dataWithBytes:"yes\n" length:4];
NSMutableArray *arguments = [@[@"attach", self.archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"] mutableCopy];
if (self.decryptionPassword) {
NSMutableData *passwordData = [[self.decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
// From the hdiutil docs:
// read a null-terminated passphrase from standard input
//
// Add the null terminator, then the newline
[passwordData appendData:[NSData dataWithBytes:"\0" length:1]];
[passwordData appendData:promptData];
promptData = passwordData;
[arguments addObject:@"-stdinpass"];
}
NSData *output = nil;
NSInteger taskResult = -1;
@try
{
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/hdiutil";
task.currentDirectoryPath = @"/";
task.arguments = arguments;
NSPipe *inputPipe = [NSPipe pipe];
NSPipe *outputPipe = [NSPipe pipe];
task.standardInput = inputPipe;
task.standardOutput = outputPipe;
[task launch];
[notifier notifyProgress:0.125];
[inputPipe.fileHandleForWriting writeData:promptData];
[inputPipe.fileHandleForWriting closeFile];
// Read data to end *before* waiting until the task ends so we don't deadlock if the stdout buffer becomes full if we haven't consumed from it
output = [outputPipe.fileHandleForReading readDataToEndOfFile];
[task waitUntilExit];
taskResult = task.terminationStatus;
}
@catch (NSException *)
{
goto reportError;
}
[notifier notifyProgress:0.5];
if (taskResult != 0)
{
NSString *resultStr = output ? [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding] : nil;
SULog(SULogLevelError, @"hdiutil failed with code: %ld data: <<%@>>", (long)taskResult, resultStr);
goto reportError;
}
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(SULogLevelError, @"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
goto reportError;
}
double itemsCopied = 0;
double totalItems = [contents count];
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;
}
itemsCopied += 1.0;
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
{
goto reportError;
}
}
[notifier notifySuccess];
goto finally;
reportError:
[notifier notifyFailureWithError:error];
finally:
if (mountedSuccessfully) {
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/hdiutil";
task.arguments = @[@"detach", mountPoint, @"-force"];
task.standardOutput = [NSPipe pipe];
task.standardError = [NSPipe pipe];
@try {
[task launch];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
SULog(SULogLevelError, @"Exception: %@", exception);
}
} else {
SULog(SULogLevelError, @"Can't mount DMG %@", self.archivePath);
}
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end
+26
View File
@@ -0,0 +1,26 @@
//
// SUGuidedPackageInstaller.h
// Sparkle
//
// Created by Graham Miln on 14/05/2010.
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
//
/*!
# Sparkle Guided Installations
A guided installation allows Sparkle to download and install a package (pkg) or multi-package (mpkg) without user interaction.
The installer package is installed using macOS's built-in command line installer, `/usr/sbin/installer`. No installation interface is shown to the user.
A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used.
*/
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
@end
+78
View File
@@ -0,0 +1,78 @@
//
// SUGuidedPackageInstaller.m
// Sparkle
//
// Created by Graham Miln on 14/05/2010.
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
//
#import <sys/stat.h>
#import "SUGuidedPackageInstaller.h"
#import <Sparkle/SUErrors.h>
#include "AppKitPrevention.h"
@interface SUGuidedPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *installationPath;
@end
@implementation SUGuidedPackageInstaller
@synthesize packagePath = _packagePath;
@synthesize installationPath = _installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
{
self = [super init];
if (self != nil) {
_packagePath = [packagePath copy];
_installationPath = [installationPath copy];
}
return self;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)__unused error
{
return YES;
}
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError * __autoreleasing *)error
{
// This command *must* be run as root
NSString *installerPath = @"/usr/sbin/installer";
NSTask *task = [[NSTask alloc] init];
task.launchPath = installerPath;
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
task.standardError = [NSPipe pipe];
task.standardOutput = [NSPipe pipe];
BOOL success = YES;
@try {
[task launch];
[task waitUntilExit];
if (task.terminationStatus != EXIT_SUCCESS) {
success = NO;
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }];
}
}
} @catch (NSException *) {
success = NO;
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }];
}
}
return success;
}
- (BOOL)canInstallSilently
{
return YES;
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// SUInstaller.h
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@interface SUInstaller : NSObject
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
@end
NS_ASSUME_NONNULL_END
+186
View File
@@ -0,0 +1,186 @@
//
// SUInstaller.m
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUInstaller.h"
#import "SUPlainInstaller.h"
#import "SUPackageInstaller.h"
#import "SUGuidedPackageInstaller.h"
#import "SUHost.h"
#import "SUConstants.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#import "SPUInstallationType.h"
#include "AppKitPrevention.h"
@implementation SUInstaller
+ (BOOL)isAliasFolderAtPath:(NSString *)path
{
NSNumber *aliasFlag = nil;
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
NSNumber *directoryFlag = nil;
[[NSURL fileURLWithPath:path] getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:nil];
return aliasFlag.boolValue && directoryFlag.boolValue;
}
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
{
NSParameterAssert(inUpdateFolder);
NSParameterAssert(host);
// Search subdirectories for the application
NSString *currentFile,
*newAppDownloadPath = nil,
*bundleFileName = [[host bundlePath] lastPathComponent],
*alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]];
BOOL isPackage = NO;
BOOL isGuided = YES;
NSString *fallbackPackagePath = nil;
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:inUpdateFolder];
NSString *bundleFileNameNoExtension = [bundleFileName stringByDeletingPathExtension];
while ((currentFile = [dirEnum nextObject])) {
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
NSString *currentFilename = [currentFile lastPathComponent];
NSString *currentExtension = [currentFile pathExtension];
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
if ([currentFilename isEqualToString:bundleFileName] ||
[currentFilename isEqualToString:alternateBundleFileName]) // We found one!
{
isPackage = NO;
newAppDownloadPath = currentPath;
break;
} else if ([currentExtension isEqualToString:@"pkg"] ||
[currentExtension isEqualToString:@"mpkg"]) {
if ([currentFilenameNoExtension isEqualToString:bundleFileNameNoExtension]) {
isPackage = YES;
newAppDownloadPath = currentPath;
break;
} else {
// Remember any other non-matching packages we have seen should we need to use one of them as a fallback.
fallbackPackagePath = currentPath;
}
} else {
// Try matching on bundle identifiers in case the user has changed the name of the host app
NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath];
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) {
isPackage = NO;
newAppDownloadPath = currentPath;
break;
}
}
// Some DMGs have symlinks into /Applications! That's no good!
if ([self isAliasFolderAtPath:currentPath])
[dirEnum skipDescendents];
}
// We don't have a valid path. Try to use the fallback package.
if (newAppDownloadPath == nil && fallbackPackagePath != nil) {
isPackage = YES;
newAppDownloadPath = fallbackPackagePath;
}
if (isPackage) {
// Guided (or now "normal") installs used to be opt-in (i.e, Sparkle would detect foo.sparkle_guided.pkg or foo.sparkle_guided.mpkg),
// but to get an interactive (or "unguided") install, the developer now must opt-out of guided installations.
// foo.app -> foo.sparkle_interactive.pkg or foo.sparkle_interactive.mpkg
if ([[[newAppDownloadPath stringByDeletingPathExtension] pathExtension] isEqualToString:@"sparkle_interactive"]) {
isGuided = NO;
}
}
if (isPackagePtr)
*isPackagePtr = isPackage;
if (isGuidedPtr)
*isGuidedPtr = isGuided;
if (!newAppDownloadPath) {
SULog(SULogLevelError, @"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
}
return newAppDownloadPath;
}
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
{
BOOL isPackage = NO;
BOOL isGuided = NO;
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:&isGuided];
if (newDownloadPath == nil) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"Couldn't find an appropriate update in the downloaded package." }];
}
return nil;
}
// Make sure we find the type of installer that we were expecting to find
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
// ahead of time whether or not this installer tool should be ran as root or not
id <SUInstallerProtocol> installer = nil;
if (isPackage && isGuided) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found guided package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeGuidedPackage] }];
}
} else {
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
}
} else if (isPackage) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeInteractivePackage] }];
}
} else {
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
}
} else {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }];
}
} else {
NSString *normalizedInstallationPath = nil;
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
}
// If we have a normalized path, we'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
// Otherwise if there's no normalized path (the more likely case), we'll just use the host bundle's path
NSString *installationPath;
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
installationPath = normalizedInstallationPath;
} else {
installationPath = host.bundlePath;
}
installer = [[SUPlainInstaller alloc] initWithHost:host bundlePath:newDownloadPath installationPath:installationPath];
}
}
return installer;
}
+ (NSString *)normalizedInstallationPathForHost:(SUHost *)host
{
NSBundle *bundle = host.bundle;
assert(bundle != nil);
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
// rather than arbitrary Unicode form from Info.plist - #1017
return [NSString stringWithUTF8String:[normalizedAppPath fileSystemRepresentation]];
}
@end
+35
View File
@@ -0,0 +1,35 @@
//
// SUInstallerProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 3/12/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUInstallerProtocol <NSObject>
// Any installation work can be done prior to user application being terminated and relaunched
// No UI should occur during this stage (i.e, do not show package installer apps, etc..)
// Should be able to be called from non-main thread
- (BOOL)performInitialInstallation:(NSError **)error;
// Any installation work after the user application has has been terminated. This is where the final installation work can be done.
// After this stage is done, the user application may be relaunched.
// Should be able to be called from non-main thread
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
// If this returns NO, then the installation can fail if the user did not directly request for the install to occur.
// Should be thread safe
- (BOOL)canInstallSilently;
// The destination and installation path of the bundle being updated
- (NSString *)installationPath;
@end
NS_ASSUME_NONNULL_END
+19
View File
@@ -0,0 +1,19 @@
//
// SUPackageInstaller.h
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
// This is the deprecated package installation type, aka the "interactive" package installer
// For a more supported package installation, see SUGuidedPackageInstaller
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
@end
+81
View File
@@ -0,0 +1,81 @@
//
// SUPackageInstaller.m
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUPackageInstaller.h"
#import "SUConstants.h"
#import <Sparkle/SUErrors.h>
#import "SULog.h"
#include "AppKitPrevention.h"
@interface SUPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *installationPath;
@end
@implementation SUPackageInstaller
static NSString *SUOpenUtilityPath = @"/usr/bin/open";
@synthesize packagePath = _packagePath;
@synthesize installationPath = _installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
{
self = [super init];
if (self != nil) {
_packagePath = [packagePath copy];
_installationPath = [installationPath copy];
}
return self;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
{
if (![[NSFileManager defaultManager] fileExistsAtPath:SUOpenUtilityPath]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:@{ NSLocalizedDescriptionKey: @"Couldn't find Apple's installer tool!" }];
}
return NO;
}
return YES;
}
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError *__autoreleasing*)error
{
// Run installer using the "open" command to ensure it is launched in front of current application.
// -W = wait until the app has quit.
// -n = Open another instance if already open.
// -b = app bundle identifier
NSArray *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", self.packagePath];
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
@try {
NSTask *installer = [NSTask launchedTaskWithLaunchPath:SUOpenUtilityPath arguments:args];
[installer waitUntilExit];
}
@catch (NSException *exception) {
SULog(SULogLevelError, @"Error: Failed to launch package installer: %@", exception);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Package installer failed to launch." }];
}
return NO;
}
return YES;
}
- (BOOL)canInstallSilently
{
return NO;
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SUPipedUnarchiver.h
// Sparkle
//
// Created by Andy Matuschak on 6/16/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#ifndef SUPIPEDUNARCHIVER_H
#define SUPIPEDUNARCHIVER_H
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath;
@end
NS_ASSUME_NONNULL_END
#endif
+155
View File
@@ -0,0 +1,155 @@
//
// SUPipedUnarchiver.m
// Sparkle
//
// Created by Andy Matuschak on 6/16/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUPipedUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#include "AppKitPrevention.h"
@interface SUPipedUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@end
@implementation SUPipedUnarchiver
@synthesize archivePath = _archivePath;
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
{
NSArray <NSString *> *extractTGZ = @[@"/usr/bin/tar", @"-zxC"];
NSArray <NSString *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"];
NSArray <NSString *> *extractTXZ = extractTGZ;
NSDictionary <NSString *, NSArray<NSString *> *> *extractCommandDictionary =
@{
@".zip" : @[@"/usr/bin/ditto", @"-x",@"-k",@"-"],
@".tar" : @[@"/usr/bin/tar", @"-xC"],
@".tar.gz" : extractTGZ,
@".tgz" : extractTGZ,
@".tar.bz2" : extractTBZ,
@".tbz" : extractTBZ,
@".tar.xz" : extractTXZ,
@".txz" : extractTXZ,
@".tar.lzma" : extractTXZ
};
NSString *lastPathComponent = [path lastPathComponent];
for (NSString *currentType in extractCommandDictionary)
{
if ([lastPathComponent hasSuffix:currentType]) {
return [extractCommandDictionary objectForKey:currentType];
}
}
return nil;
}
+ (BOOL)canUnarchivePath:(NSString *)path
{
return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
}
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
- (instancetype)initWithArchivePath:(NSString *)archivePath
{
self = [super init];
if (self != nil) {
_archivePath = [archivePath copy];
}
return self;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
NSArray <NSString *> *commandAndArguments = [[self class] commandAndArgumentsConformingToTypeOfPath:self.archivePath];
assert(commandAndArguments != nil);
NSString *command = commandAndArguments.firstObject;
assert(command != nil);
NSArray <NSString *> *arguments = [commandAndArguments subarrayWithRange:NSMakeRange(1, commandAndArguments.count - 1)];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
[self extractArchivePipingDataToCommand:command arguments:arguments notifier:notifier];
});
}
// This method abstracts the types that use a command line tool piping data from stdin.
- (void)extractArchivePipingDataToCommand:(NSString *)command arguments:(NSArray*)args notifier:(SUUnarchiverNotifier *)notifier
{
// *** GETS CALLED ON NON-MAIN THREAD!!!
@autoreleasepool {
NSError *error = nil;
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
// Get the file size.
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
if (expectedLength > 0) {
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSTask *task = [[NSTask alloc] init];
[task setStandardInput:[pipe fileHandleForReading]];
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
[task setLaunchPath:command];
[task setArguments:[args arrayByAddingObject:destination]];
[task launch];
NSUInteger bytesRead = 0;
do {
NSData *data = [archiveInput readDataOfLength:256*1024];
NSUInteger len = [data length];
if (!len) {
break;
}
bytesRead += len;
[archiveOutput writeData:data];
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
}
while(bytesRead < expectedLength);
[archiveOutput closeFile];
[task waitUntilExit];
if ([task terminationStatus] == 0) {
if (bytesRead == expectedLength) {
[notifier notifySuccess];
return;
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
}
[notifier notifyFailureWithError:error];
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end
+24
View File
@@ -0,0 +1,24 @@
//
// SUPlainInstaller.h
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
@class SUHost;
@protocol SUVersionComparison;
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
/*!
@param host The current (old) bundle host
@param bundlePath The path to the new bundle that will be installed.
@param installationPath The path the new bundlePath will be installed to.
*/
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath;
@end
+264
View File
@@ -0,0 +1,264 @@
//
// SUPlainInstaller.m
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUPlainInstaller.h"
#import "SUFileManager.h"
#import "SUConstants.h"
#import "SUHost.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#import <Sparkle/SUVersionComparisonProtocol.h>
#import "SUStandardVersionComparator.h"
#include "AppKitPrevention.h"
@interface SUPlainInstaller ()
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, copy, readonly) NSString *bundlePath;
@property (nonatomic, copy, readonly) NSString *installationPath;
@end
@implementation SUPlainInstaller
@synthesize host = _host;
@synthesize bundlePath = _bundlePath;
@synthesize installationPath = _installationPath;
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
{
self = [super init];
if (self != nil) {
_host = host;
_bundlePath = [bundlePath copy];
_installationPath = [installationPath copy];
}
return self;
}
// Returns the bundle version from the specified host that is appropriate to use as a filename, or nil if we're unable to retrieve one
- (NSString *)bundleVersionAppropriateForFilenameFromHost:(SUHost *)host
{
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *trimmedVersion = @"";
if (bundleVersion != nil) {
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
}
return trimmedVersion.length > 0 ? trimmedVersion : nil;
}
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
{
if (installationURL == nil || newURL == nil) {
// this really shouldn't happen but just in case
SULog(SULogLevelError, @"Failed to perform installation because either installation URL (%@) or new URL (%@) is nil", installationURL, newURL);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because the paths to install at and from are not valid" }];
}
return NO;
}
if (progress) {
progress(1/10.0);
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
// Update the access time of our entire application before moving it into a temporary directory
// The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
// before being installed
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:error]) {
SULog(SULogLevelError, @"Failed to recursively update new application's modification time before moving into temporary directory");
return NO;
}
// Create a temporary directory for our new app that resides on our destination's volume
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
if (tempNewDirectoryURL == nil) {
SULog(SULogLevelError, @"Failed to make new temp directory");
return NO;
}
if (progress) {
progress(2/10.0);
}
// Move the new app to our temporary directory
NSString *newURLLastPathComponent = newURL.lastPathComponent;
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:error]) {
SULog(SULogLevelError, @"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(3/10.0);
}
// Release our new app from quarantine
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
// Not big enough of a deal to fail the entire installation
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
}
if (progress) {
progress(4/10.0);
}
NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath];
if (oldURL == nil) {
// this really shouldn't happen but just in case
SULog(SULogLevelError, @"Failed to construct URL from bundle path: %@", host.bundlePath);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because a path could not be constructed for the old installation" }];
}
return NO;
}
// We must leave moving the app to its destination as the final step in installing it, so that
// it's not possible our new app can be left in an incomplete state at the final destination
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:error]) {
// But this is big enough of a deal to fail
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(5/10.0);
}
NSError *touchError = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:&touchError]) {
// Not a fatal error, but a pretty unfortunate one
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
SULog(SULogLevelError, @"Error: %@", touchError);
}
if (progress) {
progress(6/10.0);
}
// Decide on a destination name we should use for the older app when we move it around the file system
NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent;
// Create a temporary directory for our old app that resides on its volume
NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent;
NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil;
if (tempOldDirectoryURL == nil) {
SULog(SULogLevelError, @"Failed to create temporary directory for old app at %@", oldURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(7/10.0);
}
// Move the old app to the temporary directory
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
SULog(SULogLevelError, @"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path);
// Just forget about our updated app on failure
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(8/10.0);
}
// Move the new app to its final destination
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
// Forget about our updated app on failure
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
// Attempt to restore our old app back the way it was on failure
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(9/10.0);
}
// Cleanup
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
if (progress) {
progress(10/10.0);
}
return YES;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
{
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
// Prevent malicious downgrades
// Note that we may not be able to do this for package installations, hence this code being done here
if (!allowDowngrades) {
NSString *hostVersion = [self.host version];
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
if (error != NULL) {
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, updateVersion];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
}
return NO;
}
}
return YES;
}
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error
{
// Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories.
// It must not be possible for our update to sit in temporary directories for a very long time.
return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
}
- (BOOL)canInstallSilently
{
return YES;
}
@end
+32
View File
@@ -0,0 +1,32 @@
//
// SUSignatureVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#ifndef SUDSAVERIFIER_H
#define SUDSAVERIFIER_H
#import <Foundation/Foundation.h>
@class SUSignatures;
@class SUPublicKeys;
@interface SUSignatureVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys;
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pkeys;
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures;
@end
#endif
+217
View File
@@ -0,0 +1,217 @@
//
// SUDSAVerifier.m
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#import "SUSignatureVerifier.h"
#import "SULog.h"
#import "SUSignatures.h"
#include <CommonCrypto/CommonDigest.h>
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
#include "AppKitPrevention.h"
@interface SUSignatureVerifier ()
@property (readonly) SUPublicKeys *pubKeys;
@end
@implementation SUSignatureVerifier {
}
@synthesize pubKeys = _pubKeys;
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys
{
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
if (!verifier) {
return NO;
}
return [verifier verifyFileAtPath:path signatures:signatures];
}
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pubkeys
{
self = [super init];
_pubKeys = pubkeys;
return self;
}
- (SecKeyRef)dsaSecKeyRef {
NSData *data = [self.pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
if (!self || !data.length) {
SULog(SULogLevelError, @"Could not read public DSA key");
return nil;
}
SecExternalFormat format = kSecFormatOpenSSL;
SecExternalItemType itemType = kSecItemTypePublicKey;
CFArrayRef items = NULL;
OSStatus status = SecItemImport((__bridge CFDataRef)data, NULL, &format, &itemType, (SecItemImportExportFlags)0, NULL, NULL, &items);
if (status != errSecSuccess || !items) {
if (items) {
CFRelease(items);
}
SULog(SULogLevelError, @"Public DSA key could not be imported: %d", status);
return nil;
}
SecKeyRef dsaPubKeySecKey = nil;
if (format == kSecFormatOpenSSL && itemType == kSecItemTypePublicKey && CFArrayGetCount(items) == 1) {
// Seems silly, but we can't quiet the warning about dropping CFTypeRef's const qualifier through
// any manner of casting I've tried, including interim explicit cast to void*. The -Wcast-qual
// warning is on by default with -Weverything and apparently became more noisy as of Xcode 7.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
dsaPubKeySecKey = (SecKeyRef)CFRetain(CFArrayGetValueAtIndex(items, 0));
#pragma clang diagnostic pop
}
CFRelease(items);
return dsaPubKeySecKey;
}
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures
{
if (!path || !path.length) {
return NO;
}
if (!signatures) {
SULog(SULogLevelDefault, @"No signatures given to verifyFileAtPath");
return NO;
}
NSData *dsaSignature = signatures.dsaSignature;
NSString *dsaPubKey = self.pubKeys.dsaPubKey;
const unsigned char *edSignature = signatures.ed25519Signature;
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
if (edPubKey && !edSignature) {
SULog(SULogLevelDefault, @"There is no EdDSA signature in the update, but the app is capable of verifying them");
} if (!edPubKey && edSignature) {
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
} else if (edPubKey && edSignature) {
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&error];
if (!data || !data.length) {
SULog(SULogLevelError, @"Failed to load file %@: %@", path, error);
return NO;
}
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
if (!dsaPubKey) {
return YES;
} else {
SULog(SULogLevelDefault, @"This app has a DSA public key, so a DSA signature is required too");
}
} else {
SULog(SULogLevelError, @"EdDSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
if (dsaSignature) {
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
}
return NO;
}
}
if (!dsaSignature) {
SULog(SULogLevelError, @"There is no DSA signature in the update");
} else if (!dsaPubKey) {
SULog(SULogLevelDefault, @"The update has a DSA signature, but it can't be used, because the old app doesn't have a DSA public key");
} else {
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
return [self verifyDSASignatureOfStream:dataInputStream dsaSignature:dsaSignature];
}
return NO;
}
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature
{
if (!stream || !dsaSignature) {
SULog(SULogLevelError, @"Invalid arguments to verifyStream");
return NO;
}
SecKeyRef dsaPubKeySecKey = [self dsaSecKeyRef];
if (!dsaPubKeySecKey) {
return NO;
}
__block SecGroupTransformRef group = SecTransformCreateGroupTransform();
__block SecTransformRef dataReadTransform = NULL;
__block SecTransformRef dataDigestTransform = NULL;
__block SecTransformRef dataVerifyTransform = NULL;
__block CFErrorRef error = NULL;
BOOL (^cleanup)(void) = ^{
if (group) CFRelease(group);
if (dataReadTransform) CFRelease(dataReadTransform);
if (dataDigestTransform) CFRelease(dataDigestTransform);
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
if (error) CFRelease(error);
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
return NO;
};
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
if (!dataReadTransform) {
SULog(SULogLevelError, @"File containing update archive could not be read (failed to create SecTransform for input stream)");
return cleanup();
}
dataDigestTransform = SecDigestTransformCreate(kSecDigestSHA1, CC_SHA1_DIGEST_LENGTH, NULL);
if (!dataDigestTransform) {
return cleanup();
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform || error) {
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
return cleanup();
}
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
if (error) {
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
return cleanup();
}
if (!result.boolValue) {
SULog(SULogLevelError, @"DSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
}
cleanup();
return result.boolValue;
}
@end
+21
View File
@@ -0,0 +1,21 @@
//
// SUStatusInfoProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUStatusInfoProtocol
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply;
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply;
@end
NS_ASSUME_NONNULL_END
+21
View File
@@ -0,0 +1,21 @@
//
// SUUnarchiver.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUUnarchiverProtocol;
@interface SUUnarchiver : NSObject
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
@end
NS_ASSUME_NONNULL_END
+36
View File
@@ -0,0 +1,36 @@
//
// SUUnarchiver.m
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#import "SUUnarchiver.h"
#import "SUUnarchiverProtocol.h"
#import "SUPipedUnarchiver.h"
#import "SUDiskImageUnarchiver.h"
#import "SUBinaryDeltaUnarchiver.h"
#include "AppKitPrevention.h"
@implementation SUUnarchiver
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
{
if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
assert(hostPath != nil);
NSString *nonNullHostPath = hostPath;
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
}
return nil;
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SUUnarchiverNotifier.h
// Sparkle
//
// Created by Mayur Pawashe on 12/21/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SUUnarchiverNotifier : NSObject
- (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
- (void)notifySuccess;
- (void)notifyFailureWithError:(NSError * _Nullable)reason;
- (void)notifyProgress:(double)progress;
@end
NS_ASSUME_NONNULL_END
+68
View File
@@ -0,0 +1,68 @@
//
// SUUnarchiverNotifier.m
// Sparkle
//
// Created by Mayur Pawashe on 12/21/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SUUnarchiverNotifier.h"
#import "SULocalizations.h"
#import <Sparkle/SUErrors.h>
#include "AppKitPrevention.h"
@interface SUUnarchiverNotifier ()
@property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable);
@property (nonatomic, readonly, copy) void (^ _Nullable progressBlock)(double);
@end
@implementation SUUnarchiverNotifier
@synthesize completionBlock = _completionBlock;
@synthesize progressBlock = _progressBlock;
- (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
self = [super init];
if (self != nil) {
_completionBlock = [completionBlock copy];
_progressBlock = [progressBlock copy];
}
return self;
}
- (void)notifySuccess
{
dispatch_async(dispatch_get_main_queue(), ^{
self.completionBlock(nil);
});
}
- (void)notifyFailureWithError:(NSError * _Nullable)reason
{
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) forKey:NSLocalizedDescriptionKey];
if (reason) {
[userInfo setObject:(NSError * _Nonnull)reason forKey:NSUnderlyingErrorKey];
}
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfo];
dispatch_async(dispatch_get_main_queue(), ^{
self.completionBlock(error);
});
}
- (void)notifyProgress:(double)progress
{
if (self.progressBlock != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
self.progressBlock(progress);
});
}
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SUUnarchiverProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 3/26/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUUnarchiverProtocol <NSObject>
+ (BOOL)canUnarchivePath:(NSString *)path;
+ (BOOL)mustValidateBeforeExtraction;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
- (NSString *)description;
@end
NS_ASSUME_NONNULL_END
+26
View File
@@ -0,0 +1,26 @@
//
// StatusInfo.h
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUStatusInfoProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface StatusInfo : NSObject <SUStatusInfoProtocol>
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier;
@property (nonatomic, nullable) NSData *installationInfoData;
- (void)startListener;
- (void)invalidate;
@end
NS_ASSUME_NONNULL_END
+69
View File
@@ -0,0 +1,69 @@
//
// StatusInfo.m
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "StatusInfo.h"
#import "SPUMessageTypes.h"
#include "AppKitPrevention.h"
@interface StatusInfo () <NSXPCListenerDelegate>
@property (nonatomic) NSXPCListener *xpcListener;
@end
@implementation StatusInfo
@synthesize xpcListener = _xpcListener;
@synthesize installationInfoData = _installationInfoData;
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier
{
self = [super init];
if (self != nil) {
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
}
return self;
}
- (void)startListener
{
[self.xpcListener resume];
}
- (void)invalidate
{
[self.xpcListener invalidate];
self.xpcListener = nil;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)];
newConnection.exportedObject = self;
[newConnection resume];
return YES;
}
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable))reply
{
dispatch_async(dispatch_get_main_queue(), ^{
reply(self.installationInfoData);
});
}
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply
{
reply();
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// TerminationListener.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TerminationListener : NSObject
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
@property (nonatomic, readonly) BOOL terminated;
// If the process identifier provided was nil, then the completion block will invoke immediately with a YES success
- (void)startListeningWithCompletion:(void (^)(BOOL success))completionBlock;
@end
NS_ASSUME_NONNULL_END
+131
View File
@@ -0,0 +1,131 @@
//
// TerminationListener.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "TerminationListener.h"
#import "SULog.h"
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include "AppKitPrevention.h"
@interface TerminationListener ()
@property (nonatomic, readonly, nullable) NSNumber *processIdentifier;
@property (nonatomic) BOOL watchedTermination;
@property (nonatomic, copy) void (^completionBlock)(BOOL);
@end
@implementation TerminationListener
@synthesize completionBlock = _completionBlock;
@synthesize processIdentifier = _processIdentifier;
@synthesize watchedTermination = _watchedTermination;
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
{
self = [super init];
if (self != nil) {
_processIdentifier = processIdentifier;
}
return self;
}
- (BOOL)terminated
{
return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
}
- (void)invokeCompletionWithSuccess:(BOOL)success
{
if (self.completionBlock != nil) {
self.completionBlock(success);
self.completionBlock = nil;
}
}
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
{
self.completionBlock = completionBlock;
if (self.processIdentifier == nil) {
[self invokeCompletionWithSuccess:YES];
return;
}
// Use kqueues to determine when the process will terminate
// As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10
// By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it
pid_t processIdentifier = self.processIdentifier.intValue;
int queue = kqueue();
if (queue == -1) {
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
struct kevent changes;
EV_SET(&changes, processIdentifier, EVFILT_PROC, EV_ADD | EV_RECEIPT, NOTE_EXIT, 0, NULL);
if (kevent(queue, &changes, 1, &changes, 1, NULL) == -1) {
SULog(SULogLevelError, @"Failed to invoke kevent() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
// We will assume this terminationListener will never be deallocated
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
CFFileDescriptorContext context = { 0, (void *)CFBridgingRetain(self), NULL, NULL, NULL };
#pragma clang diagnostic pop
CFFileDescriptorRef noteExitKQueueRef = CFFileDescriptorCreate(NULL, queue, true, noteExitKQueueCallback, &context);
if (noteExitKQueueRef == NULL) {
SULog(SULogLevelError, @"Failed to create file descriptor via CFFileDescriptorCreate()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopSourceRef runLoopSource = CFFileDescriptorCreateRunLoopSource(NULL, noteExitKQueueRef, 0);
if (runLoopSource == NULL) {
SULog(SULogLevelError, @"Failed to create runLoopSource via CFFileDescriptorCreateRunLoopSource()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
CFRelease(runLoopSource);
CFFileDescriptorEnableCallBacks(noteExitKQueueRef, kCFFileDescriptorReadCallBack);
// Make sure we didn't set the listener callback to a dead PID
// If we did, we could hang forever. To avoid this, we check if the process has terminated *after* we set up the callback
// If we tried to do this check before setting the callback, we could run into an issue where the process can terminate after our check
// but before setting the callback
if ([self terminated]) {
[self invokeCompletionWithSuccess:YES];
}
}
static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unused callBackTypes, void *info)
{
struct kevent event;
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
TerminationListener *self = CFBridgingRelease(info);
self.watchedTermination = YES;
[self invokeCompletionWithSuccess:YES];
}
@end
+34
View File
@@ -0,0 +1,34 @@
#import <Foundation/Foundation.h>
#import "AppInstaller.h"
#include "AppKitPrevention.h"
int main(int __unused argc, const char __unused *argv[])
{
@autoreleasepool
{
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
if (args.count != 2) {
return EXIT_FAILURE;
}
NSString *hostBundleIdentifier = args[1];
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
[appInstaller start];
// Ignore SIGTERM because we are going to catch it ourselves
signal(SIGTERM, SIG_IGN);
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
dispatch_source_set_event_handler(sigtermSource, ^{
[appInstaller cleanupAndExitWithStatus:SIGTERM];
});
dispatch_resume(sigtermSource);
[[NSRunLoop currentRunLoop] run];
}
return EXIT_SUCCESS;
}
+128 -6
View File
@@ -1,15 +1,137 @@
# 1.14.0
# 1.20.0
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
* Add delegate callbacks for fininshed download and extraction related events (Csaba Horony)
* Don't check for updates if Do Not Disturb is on (Kornel)
* Expose `CodesigningVerifier`, add codesign info API (sunuslee)
* Threading fixes:
* Fix potential hang with `dispatch_sync` to main thread (Brian Bergstrand)
* Fix closeCheckingWindow called from background thread (Alexey Martemyanov)
* Improve 'read-only' error message (#1192) (Adrian Thomas)
* New Spanish localisation (Ken Arroyo Ohori)
* Updated Finnish language resources (Jason Pollack)
* Hungarian localization (Csaba Horony)
* Log more information about authentication requests (Kornel)
* Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings. (Kent Sutherland)
* Fix binary delta creation on network drives (sagecook)
* Fix compilation issues on Xcode 10 with new build system (Leo Natan)
# 1.19.0
* Refactoring of downloader code to avoid deprecated methods (Deadpikle)
* Changes to which methods run on the main thread.
Note: some delegate methods may be called on non-main thread now. (Kornel)
* Update Japanese localization (1024jp)
* Update Sparkle.strings (Stefan Paychère)
* Fix Sparkle clients polling too frequently (Jonathan Bullard)
* Handle SecTransformExecute errors (Kornel)
* Silence Touch Bar availability warnings on Xcode 9 by using API_AVAILABLE. Disable gnu-zero-variadic-macro-arguments to prevent warnings from use of API_AVAILABLE. (Kent Sutherland)
* 10.11 SDK compatibility (David Fuhrmann)
# 1.18.1
* Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115) (App Tyrant)
* Implemented sparkle:os attribute as documented (Memphiz)
* Additional termination detection in case kpoll fails. (fujisoft)
* Included bin files in CocoaPods installation (Keith Smiley)
* Updated Dutch localization (Eitot)
* Updated German localization (Eitot)
* Updated Japanese translation (1024jp)
* Updated Portuguese translation (Victor)
* Updated to Xcode 9/Swift 4
# 1.18.0
* Name of the host app is used in authorization prompt (the `SPARKLE_RELAUNCH_TOOL_NAME` setting is now obsolete)
* More detailed progress bar for package installers (Kornel Lesiński)
* Disabled the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. (George Nachman)
* generate_appcast tool adds release notes if there's an .html file with the same base name as the archive (Brett Walker)
* Added `sparkle:shortVersionString` to the enclosure, #1032 (Brett Walker)
* Fixed Japanese localization (1024jp)
* Fixed escaping of system profile URLs
* Added more logging in various failure cases (Kornel Lesiński)
* Better error message for quarantined apps that can't be updated
# 1.17.0
* Added Touch Bar support (Bi11)
* Upgraded SULog to use logging APIs that Apple provides built-in (Zorg)
* Skip buttons are disabled if the update is marked as critical (Kornel Lesiński)
* Background updates ask OS for lower-priority networking (Kornel Lesiński)
* Refactorings to sync with upcoming 2.0
* Added kqueue based termination listener (Zorg)
* Added AppKit prevention guards to modules that shouldn't import it (Zorg)
* Added Obj-C generics where applicable (Zorg)
* Made SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle (Zorg)
* Improved -[SUHost objectForInfoDictionaryKey:] (Zorg)
* Detect and fail if any two-way dependencies exist in the project (Zorg)
* generate_appcast:
* fixed handling of multiple directories in an archive
* percent encode the filename used in the delta url (Brett Walker)
* Update Sparkle.strings (BR Lingo)
* Improved handling of non-ASCII names in delta archives (Kornel Lesiński)
* Don't touch Info.plist unless git version changes (Václav Slavík)
# 1.16.0
* Guided package installs are now the default for updating packages (Zorg)
- `pkg` installers won't show any UI. If you require the old behavior of showing a full installer window, rename the `*.pkg` file to `*.sparkle_interactive.pkg`
* Previous version of the app is now deleted instead of staying in the trash (Zorg)
* Added `generate_appcast` helper tool (Kornel Lesiński)
* Made manual check resume pending automatic updates instead of starting a new update (Kornel Lesiński)
* Started using `length` value from RSS if HTTP doesn't give one (Zorg)
* Hidden automatic updates checkbox for information only updates (Bi11)
* Added progressbar for DMG and binary delta extraction (Kornel Lesiński)
* Fixed showing of download status if we attempt a 2nd download (Zorg)
* Refactorings to sync with upcoming 2.0
* Decoupled and simplified installation code using protocols (Zorg)
* Added nullability annotations (Zorg)
* Allowed delegate methods that return an object to return nil (Zorg)
* Decreased responsibility of SUHost and moved code into other components (Zorg)
* Removed Sparkle.pch and many file #includes (Zorg)
# 1.15.0
* A new icon! Thanks to 1024jp
* Show alert when an update is sent over insecure HTTP with no DSA key (Zorg)
- If you can't use HTTPS, you must at least sign updates with a DSA key.
* Improved binary delta implementation (Zorg)
* Added improved -validateMenuItem: as a method in SUUpdater.h for public use (Zorg)
* Removed reachability preflight check (Zorg)
* Clear update caches directory before downloading new update (Zorg)
* Check the bundle's parent directory for writability too (Zorg)
* Don't follow symbolic links for file operations (Zorg)
* Don't bring up an authorized dialog during cleanup (Zorg)
* Made Sparkle look for the highest compatible version regardless of timestamps (Zorg)
* Fixed compatibility with 10.7
* Fixed crash on 10.7 - subscript operator not available (kleuter)
* Fixed warnings caused by -Wpartial-availability (Zorg)
* Fixed german l10n. (Sebastian Volland)
* Error code for download errors (Kornel Lesiński)
* Update last update check date when the update driver finishes (Zorg)
* Scale app icon up if needed in Software Update window (Nicholas Riley)
* Don't register for termination notifications more than once (Zorg)
* Don't terminate the app if we're already terminating (Zorg)
* Removed SUEnableAutomaticChecksKeyOld and SUCheckAtStartup constants (Eitot)
* Updated Sparkle framework headers to use modules if modules are available (B. Kevin Hardman)
* Fixed warnings, fixed uses of SULocalizedString (Jerry Krinock)
* Improved signing verifier to take any host and s/application/bundle/ (Zorg)
* Improved Spotlight updates after delta extraction (Zorg)
# 1.14.0 (Mar 11, 2016)
* Disable javascript by default and make it opt-in (Zorg)
* URL-encoding of appcast URLs is preserved (Kornel Lesiński)
* Delegate is asked for fallback updates if delta update fails (Kornel Lesiński)
* Fixed crash on 10.7 - subscript operator not available (kleuter)
* Fixed check of feed URL before delegate had a chance to set it (Kornel Lesiński)
* Re-added support for password-protected dmg images (Andrew K. Boyd)
* Added warning about ATS blocking (Kornel Lesiński)
* Translation fixes for pt-BR. (vitu)
* Add some Japanese lozalized strings (1024jp)
* Made test app available in all languages #695 (LIU Dongyuan / 柳东原)
* Removed a test resource from the framework bundle (Karl Moskowski)
* Czech localizations update (Frantisek Erben)
* Removed a test resource from the framework bundle (Karl Moskowski)
* Test if the updated app is the frontmost one (Zorg)
* UI Tests for the Test Application (Zorg)
@@ -33,7 +155,7 @@ Important security fixes:
- Strong documentation, easier to read code.
* Automatic updates won't be installed if the system is about to shut off (Zorg)
* Deprecated serving over HTTP without DSA (Zorg)
- Note that Apple has deprecated insecure HTTP in OS X 10.11
- Note that Apple has deprecated insecure HTTP in macOS 10.11
* Improved Autoupdate application (Zorg)
* Do all the installation work after the runloop is set up
* TerminationListener only does termination listening now
@@ -131,12 +253,12 @@ Important security fixes:
# 1.8.0 (Jul 26, 2014)
* New SUDSAVerifier based on up-to-date OS X APIs (Zachary Waldowski)
* New SUDSAVerifier based on up-to-date macOS APIs (Zachary Waldowski)
* Detailed error log for failed signature checks (Kornel Lesiński)
* Converted Sparkle to ARC (C.W. Betts)
* Converted ivars to properties. (Jake Petroules)
* Cocoapod support (Xhacker Liu)
* Quarantine removal on OS X 10.10 (C.W. Betts)
* Quarantine removal on macOS 10.10 (C.W. Betts)
* Updated Japanese localization (1024jp)
* Added Greek localization
@@ -157,7 +279,7 @@ Important security fixes:
# 1.7.0
* Dropped support for OS X 10.6. Sparkle now supports 10.7 and newer (including 10.10 Yosemite) on 64-bit Intel Macs (the last 32-bit Mac was released in 2006).
* Dropped support for macOS 10.6. Sparkle now supports 10.7 and newer (including 10.10 Yosemite) on 64-bit Intel Macs (the last 32-bit Mac was released in 2006).
* Removed use of deprecated functions (Zachary Waldowski)
* Switched to modern Obj-C runtime and new literals syntax
* Removed pre-10.7 code. (C.W. Betts)
+74
View File
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at kornel+sparkle@geekhood.net. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,4 @@
// Generate Appcast Debug
#include "CommandLineTool-Shared.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
@@ -0,0 +1,4 @@
// Generate Appcast Release
#include "CommandLineTool-Shared.xcconfig"
#include "ConfigSwiftRelease.xcconfig"
@@ -0,0 +1,6 @@
// Generate Appcast only
#include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
MACOSX_DEPLOYMENT_TARGET = 10.11
@@ -1,2 +0,0 @@
#include "ConfigBinaryDelta.xcconfig"
@@ -1 +0,0 @@
#include "ConfigBinaryDelta.xcconfig"
+19 -11
View File
@@ -2,8 +2,7 @@
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
SPARKLE_APPEND_VERSION_NUMBER = 1
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
// Sparkle usually doesn't allow downgrades as they're usually accidental, but
// if your app has a downgrade function or URL handler, turn this on
@@ -14,29 +13,39 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
// following on to always reset the name back to "MyApp":
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_VERSION_MAJOR = 1
SPARKLE_VERSION_MINOR = 14
SPARKLE_ICON_NAME = AppIcon
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 0
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
ALWAYS_SEARCH_USER_PATHS = NO
ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_PREFIX_HEADER = Sparkle/Sparkle.pch
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
ARCHS = $(ARCHS_STANDARD)
MACOSX_DEPLOYMENT_TARGET = 10.7
// NSURLSession requirements
MACOSX_DEPLOYMENT_TARGET = 10.9
PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\"
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
CLANG_ENABLE_OBJC_ARC = YES
GCC_ENABLE_PASCAL_STRINGS = NO
GCC_NO_COMMON_BLOCKS = YES;
COMBINE_HIDPI_IMAGES = NO;
// Enable warnings
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
@@ -51,8 +60,8 @@ CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
CLANG_WARN_OBJC_RECEIVER_WEAK = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
CLANG_WARN_UNREACHABLE_CODE = YES
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
@@ -80,11 +89,10 @@ GCC_WARN_UNUSED_PARAMETER = YES
GCC_WARN_UNUSED_VARIABLE = YES
// Fixes a strange issue where the compiler thinks references to some enums are ambiguous
CLANG_ENABLE_MODULES[sdk=macosx10.7] = NO
CLANG_ENABLE_MODULES[sdk=macosx10.8] = NO
// These should be removed once the conversion to ARC is complete
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
// Turn on all warnings, then disable a few which are almost impossible to avoid
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-auto-import $(WARNING_CFLAGS_EXTRA)
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments $(WARNING_CFLAGS_EXTRA)
@@ -1,4 +1,13 @@
#include "ConfigCommonDebug.xcconfig"
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = YES
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES
+8 -1
View File
@@ -2,8 +2,15 @@
// Debug only
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = 0
SWIFT_OPTIMIZATION_LEVEL = -Onone
DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
+8 -1
View File
@@ -2,8 +2,15 @@
// Release only
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 0
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = s
SWIFT_OPTIMIZATION_LEVEL = -Ofast
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
+7
View File
@@ -0,0 +1,7 @@
// Downloader
INFOPLIST_FILE = Downloader/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
@@ -0,0 +1,4 @@
// Downloader Debug
#include "ConfigDownloader.xcconfig"
CODE_SIGN_IDENTITY = -
+5 -1
View File
@@ -7,7 +7,11 @@ WRAPPER_EXTENSION = framework
FRAMEWORK_VERSION = A
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
SKIP_INSTALL = YES
DEFINES_MODULE = YES
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
// As long as we don't ourselves depend upon any Frameworks that are incompatible
// with Application Extensions, then we should allow frameworks that require
// compatibility to be able to link with us.
APPLICATION_EXTENSION_API_ONLY = YES
@@ -1,2 +0,0 @@
#include "ConfigFramework.xcconfig"
@@ -0,0 +1,6 @@
// InstallerConnection
INFOPLIST_FILE = InstallerConnection/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_CONNECTION_BUNDLE_ID}
@@ -0,0 +1,5 @@
// InstallerConnection Debug
#include "ConfigInstallerConnection.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -0,0 +1,6 @@
// Installer Launcher
INFOPLIST_FILE = InstallerLauncher/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_LAUNCHER_BUNDLE_ID}
@@ -0,0 +1,4 @@
// Installer Launcher Debug
#include "ConfigInstallerLauncher.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -0,0 +1,6 @@
// Installer Progress only
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
SKIP_INSTALL = YES
CLANG_ENABLE_MODULES = NO
@@ -0,0 +1,6 @@
// InstallerStatus
INFOPLIST_FILE = InstallerStatus/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_STATUS_BUNDLE_ID}
@@ -0,0 +1,5 @@
// InstallerStatus Debug
#include "ConfigInstallerStatus.xcconfig"
CODE_SIGN_IDENTITY = -
-3
View File
@@ -1,8 +1,5 @@
// Relaunch Tool only
INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist
PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME)
SKIP_INSTALL = YES
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
CLANG_ENABLE_MODULES = NO
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
@@ -1 +0,0 @@
#include "ConfigRelaunch.xcconfig"
@@ -1 +0,0 @@
#include "ConfigRelaunch.xcconfig"
@@ -0,0 +1,6 @@
// sparkle command line tool only
INFOPLIST_FILE = sparkle-cli/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.sparkle-cli
PRODUCT_NAME = sparkle
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks/
+2
View File
@@ -0,0 +1,2 @@
SWIFT_VERSION = 4.0
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
+1
View File
@@ -0,0 +1 @@
SWIFT_OPTIMIZATION_LEVEL = -Onone
@@ -0,0 +1 @@
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
+4 -2
View File
@@ -1,7 +1,9 @@
// Test Application only
// Test Application
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
WRAPPER_EXTENSION = app
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME)
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
MACOSX_DEPLOYMENT_TARGET = 10.10
@@ -1,2 +1,4 @@
// Test Application Debug
#include "ConfigTestApp.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -0,0 +1,6 @@
// Test Application Helper
INFOPLIST_FILE = TestAppHelper/Info.plist
WRAPPER_EXTENSION = xpc
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
@@ -0,0 +1,4 @@
// Test Application Helper Debug
#include "ConfigTestAppHelper.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -1 +0,0 @@
#include "ConfigTestApp.xcconfig"
+2
View File
@@ -1,5 +1,7 @@
// UI Test only
#include "ConfigSwift.xcconfig"
INFOPLIST_FILE = UITests/UITests-Info.plist
WRAPPER_EXTENSION = xctest
MACOSX_DEPLOYMENT_TARGET = 10.11
@@ -1,4 +1,5 @@
#include "ConfigUITest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
GCC_GENERATE_TEST_COVERAGE_FILES = NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
@@ -1 +1,2 @@
#include "ConfigUITest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
@@ -1 +1,2 @@
#include "ConfigUITest.xcconfig"
#include "ConfigSwiftRelease.xcconfig"
+2
View File
@@ -1,5 +1,7 @@
// Unit Test only
#include "ConfigSwift.xcconfig"
INFOPLIST_FILE = Tests/SparkleTests-Info.plist
WRAPPER_EXTENSION = xctest
OTHER_CFLAGS = $(inherited) -iframework"$(DEVELOPER_FRAMEWORKS_DIR)" -iframework"$(PLATFORM_DIR)/Developer/Library/Frameworks"
@@ -1,4 +1,5 @@
#include "ConfigUnitTest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
GCC_GENERATE_TEST_COVERAGE_FILES = NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
@@ -1 +1,2 @@
#include "ConfigUnitTest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
@@ -1 +1,2 @@
#include "ConfigUnitTest.xcconfig"
#include "ConfigSwiftRelease.xcconfig"
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "bsdiff-Shared.xcconfig"
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "bsdiff-Shared.xcconfig"
+14
View File
@@ -0,0 +1,14 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
// Deployment
SKIP_INSTALL = YES
// Packaging
EXECUTABLE_PREFIX = lib
PRODUCT_NAME = $(TARGET_NAME)
// Search Paths
ALWAYS_SEARCH_USER_PATHS = NO
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
WARNING_CFLAGS = $(inherited) -Wno-comma
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "ed25519-Shared.xcconfig"
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "ed25519-Shared.xcconfig"
+14
View File
@@ -0,0 +1,14 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
// Deployment
SKIP_INSTALL = YES
// Packaging
EXECUTABLE_PREFIX = lib
PRODUCT_NAME = $(TARGET_NAME)
// Search Paths
ALWAYS_SEARCH_USER_PATHS = NO
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversion
+30 -1
View File
@@ -2,22 +2,51 @@
set -e
if [ "$ACTION" = "" ] ; then
# If using cocoapods, sanity check that the Podspec version matches the Sparkle version
if [ -x "$(command -v pod)" ]; then
spec_version=$(printf "require 'cocoapods'\nspec = %s\nprint spec.version" "$(cat "$SRCROOT/Sparkle.podspec")" | LANG=en_US.UTF-8 ruby)
if [ "$spec_version" != "$CURRENT_PROJECT_VERSION" ] ; then
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
exit 1
fi
fi
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL.markdown" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/generate_appcast" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework" "$CONFIGURATION_BUILD_DIR/staging"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp "$SRCROOT/Downloader/$DOWNLOADER_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
# Only copy dSYMs for Release builds, but don't check for the presence of the actual files
# because missing dSYMs in a release build SHOULD trigger a build failure
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
fi
cd "$CONFIGURATION_BUILD_DIR/staging"
Loaded 100 of 530 files, more files were not shown because too many files have changed in this diff. Show more