Compare commits

...
Author SHA1 Message Date
Zorg 3ad23bdcba Call SUUpdater updaterDidRelaunchApplication: on delegate (1.x stub) 2021-07-12 00:05:14 -07:00
Zorg 7689f9e8af Add API allowing developer do detect if Sparkle relaunched an update
Remove some old objc generic feature checks too.
2021-07-11 23:36:35 -07:00
Mayur Pawashe d9d7e310a5 Pull current date out of appcast filtering and add tests for phased group rollouts (#1889) 2021-07-11 16:47:05 -07:00
Mayur Pawashe 5677ca3f5a Avoid DSA verification if EdDSA verification passes (#1888)
If EdDSA verification passes we don't need to have DSA verification pass, and don't need to require the new update to contain a DSA signature or keys.

Also reject updates if app has EdDSA but no EdDSA signature is provided
2021-07-11 08:59:09 -07:00
Mayur Pawashe 29d4b801fc Reset skipped updates when updates are user initiated and checked (#1887)
Instead of only when a new update is found. This resets skipped updates if the user initiates a new check even if a new update is not found.
2021-07-10 08:52:33 -07:00
Mayur Pawashe 2157f78ffd Provide reason update is not found to updater delegate (#1886) 2021-07-10 08:52:06 -07:00
Mayur Pawashe e5c63b6369 Set $USER and $HOME variables when running guided pkg installers (#1884)
Set $USER and $HOME variables when running guided pkg installers

This allows pre/post install scripts to reference the user's environment correctly. The standard pkg installer GUI preserves these two variables.
2021-07-07 08:31:33 -07:00
Zorg 9f2629c892 Fix false un-initialized warning 2021-07-05 18:20:24 -07:00
Mayur Pawashe b21647bcef Allow delegate to pick no valid items (#1880)
* Allow delegate to pick no valid items

We now allow returning SUAppcastItem.emptyAppcastItem in -bestValidUpdateInAppcast:forUpdater: to indicate no update should be picked.

We preserve returning nil to indicate Sparkle handles the best appcast selection instead.

People have expressed needs for both of these decisions (and deprecated SUUpdater relies on the nil behavior).
2021-07-05 10:01:52 -07:00
Mayur Pawashe ac1bb7036c Make installing major upgrades opt-in (#1881) 2021-07-04 08:58:26 -07:00
Mayur Pawashe eecc4802db Merge pull request #1879 from sparkle-project/channels
Add support for channels
2021-06-28 19:57:58 -07:00
Zorg e0a7304a81 Remove outdated comment 2021-06-27 23:08:50 -07:00
Zorg 78a66c7dda Add channels support to sparkle-cli 2021-06-27 22:40:16 -07:00
Zorg d8f5f58468 Restrict channel names to reasonable set of characters 2021-06-27 22:06:02 -07:00
Zorg e5f1bd5e02 Fix initializing recoveryOption 2021-06-27 22:05:13 -07:00
Zorg c329319b0c Merge branch '2.x' into channels 2021-06-27 15:49:00 -07:00
Mayur Pawashe ad4ec8e3ab Merge pull request #1878 from sparkle-project/sparkle-version-element
Favor sparkle:version and sparkle:shortVersionString elements over enclosure attributes
2021-06-27 15:40:51 -07:00
Zorg 8997bad17e Update error message to lacking version element instead of attribute 2021-06-27 15:19:46 -07:00
Zorg c631a52b48 Re-order where link element is in sample appcast 2021-06-27 15:17:11 -07:00
Zorg dab34b62a0 Merge branch '2.x' into sparkle-version-element 2021-06-27 15:16:12 -07:00
Zorg c968334192 Allow only one channel in appcast feed items 2021-06-27 15:14:37 -07:00
Mayur Pawashe 6639feaafc Merge pull request #1877 from sparkle-project/update-not-found-why
Expose why new update is unavailable
2021-06-27 15:13:49 -07:00
Zorg 29c9b72be6 Refer developers to channels API where appropriate 2021-06-27 01:16:23 -07:00
Zorg 64484507b5 Guard against delegate returning nil channels incorrectly 2021-06-27 00:47:54 -07:00
Zorg bc7e2d4845 Export SUAppcastElementBetaChannel in new exported constants header 2021-06-27 00:40:33 -07:00
Zorg 9bb59b8c00 Add tests for filtering allowed channels and macOS releases 2021-06-27 00:28:09 -07:00
Zorg 267f2b82b1 Do not say no valid update could be found if there were no items
There may not be any applicable items due to sparkle:channels now.
2021-06-26 23:49:45 -07:00
Zorg 5fba1fe046 Add channels support to Sparkle
This allows developers to post updates to specific channels like for beta updates. Updaters only get notifications from channels they're allowed to be on.
2021-06-26 23:18:22 -07:00
Zorg ccd8886bfd Adopt sparkle:version and sparkle:shortVersionString elements
We should recommend using sparkle:version and sparkle:shortVersionString elements inside the appcast item instead of inside the enclosure for consistency.

Delta updates do not need to specify sparkle:version, and can inherit the top level element. This clears up some confusion and reduces duplication (and reduces error proneness / saves me work when testing delta / info-only features).

This is also consistent with informational updates. Regardless whether you want to make an update informational only or not, the sparkle:version stays in the same top-level place.

This is a backwards compatible change. Very old versions of Sparkle (possibly up to a decade or more ago) have supported specifying sparkle:version as a top level item. Winsparkle supports it as well because it's needed for info-only updates.

This is only changing what we recommend / standardize. The attribute variants are still usable.

External tools relying on Sparkle's feed format may have to adapt to this standardization (they have always needed to support info-only updates with a missing enclosure which apps do leverage anyway).

I updated generate_appcast to prefer the element variants and updated the tool so it understands them (this was a bug).
2021-06-26 21:01:39 -07:00
Zorg 1c1b7416ba Add Version History string to localization file 2021-06-26 18:33:00 -07:00
Zorg ed3e331f56 Update SampleAppcast.xml with links to Sparkle's website 2021-06-26 18:21:47 -07:00
Zorg aa867a0cb9 Expose reason why new update is not available to user
When user is on version >= latest appcast feed item, we give them an option to view version history.

When user can't update because of a min/max OS requirement, we give them an option to view product's website.
2021-06-26 18:18:44 -07:00
Zorg 5d27dc6fb3 Expose the reason and latest appcast item when update is not found 2021-06-26 16:06:39 -07:00
Mayur Pawashe fefce16697 Merge pull request #1876 from sparkle-project/refine-standard-updater-controller
Refine standard updater controller
2021-06-26 15:04:27 -07:00
Zorg 28065e7240 Refine SPUStandardUpdaterController API
* Make updater/userDriver properties non-null
* Expose starting the updater and allowing it to be done later instead of at instantiation (so clients in some cases will not need to make their controller declared as an optional)
* Make sender in checkForUpdates: nullable
2021-06-26 12:35:13 -07:00
Zorg d0f43e04d1 Merge branch '2.x' into expose-starting-updater 2021-06-26 11:09:35 -07:00
Mayur Pawashe 746bb1b248 Merge pull request #1862 from sparkle-project/selective-critical
Select critical/informational updates by version & store state in appcast items
2021-06-26 10:51:36 -07:00
Zorg ba5d895e8f Document where to find SPUAppcastItemStateResolver 2021-06-26 10:05:25 -07:00
Zorg 7efa996ba9 Merge branch '2.x' into selective-critical 2021-06-26 10:01:33 -07:00
Mayur Pawashe 2411d7538d Merge pull request #1875 from sparkle-project/fix-analyzer-warnings
Fix analyzer warnings
2021-06-26 09:46:29 -07:00
Zorg 3e1651d1cd Expose starting updater manually on SPUStandardUpdaterController
This allows instantiating SPUStandardUpdaterController right away programmatically, but starting the updater at a later point.
2021-06-26 09:44:41 -07:00
Zorg 4780cfccd5 Reword initializer deprecation messages 2021-06-26 01:36:54 -07:00
Zorg 50df5ed438 Retrieve critical update info even if stateResolver == nil 2021-06-26 01:21:14 -07:00
Zorg 3d8e00eecd Annotate SUAppcastItem initializers as nullable
Also mark -init as unavailable.
2021-06-25 22:26:52 -07:00
Zorg 25e0de5988 Fix analyzer warnings 2021-06-25 22:17:29 -07:00
Zorg 6e3cd6b313 Mark init methods as unavailable 2021-06-21 00:11:06 -07:00
Zorg 31f6f512e1 Export SUAppcastItem designated initializer to PrivateHeaders
Clients can use this header if they need to, but they should first talk to us / explore other avenues.
2021-06-20 23:55:40 -07:00
Zorg 686fd05fce Add tests for informational only updates 2021-06-20 23:11:02 -07:00
Zorg da30373a30 Clarify informationOnlyUpdate description in user driver docs 2021-06-20 23:10:20 -07:00
Zorg 1444561899 Add support for selectively choosing what updates are info-only
Example:
<sparkle:informationalUpdate>
    <sparkle:version>1.5.0</sparkle:version>
    <sparkle:version>1.5.1</sparkle:version>
</sparkle:informationalUpdate>

Means that updating only from versions 1.5.0 and 1.5.1 are shown an informational update (provided there is an info link).

<sparkle:informationalUpdate></sparkle:informationalUpdate>

Means that updating from any version gets an informational update (provided there is an info link).

No presence of this new element falls back to current behavior in Sparkle where an informational update is shown if an enclosure is missing but an info link is provided.
2021-06-20 21:59:05 -07:00
Zorg fb8a0a02c8 Fix typos 2021-06-20 20:42:18 -07:00
Mayur Pawashe 9a3ada03f9 Merge pull request #1872 from sparkle-project/http-headers-releasenotes
Pass http headers and user agent when downloading release notes
2021-06-19 17:28:23 -07:00
Zorg d794a2d803 Merge branch '2.x' into selective-critical 2021-06-18 00:21:53 -07:00
Zorg b1f9bff9a1 Pass http headers and user agent when downloading release notes 2021-06-17 20:29:33 -07:00
Mayur Pawashe c548721e16 Merge pull request #1871 from sparkle-project/restore-removed-initializers
Restore more removed SUAppcastItem initializer methods
2021-06-17 20:13:40 -07:00
Zorg eeb24ed92d Restore more removed SUAppcastItem initializer methods 2021-06-17 19:50:37 -07:00
Mayur Pawashe 66de9697f3 Merge pull request #1868 from sparkle-project/xcode13
Upgrade and fix Xcode 13 warnings
2021-06-17 00:39:31 -07:00
Mayur Pawashe cb1e58e309 Merge pull request #1870 from tonyarnold/restore-suappcastitem-public-init
Restore public initializer for SUAppcastItem
2021-06-17 00:37:04 -07:00
Tony Arnold 24a0485e98 Restore public initializer for SUAppcastItem
Closes #1869
2021-06-16 09:56:19 +10:00
Zorg 29e7ad4495 Merge branch '2.x' into selective-critical 2021-06-12 22:33:21 -07:00
Zorg 961605c6d6 Upgrade macOS and Xcode versions for CI 2021-06-11 22:50:32 -07:00
Zorg 2b8d2a2be7 Set SDKROOT to macosx instead of nothing 2021-06-11 22:42:52 -07:00
Zorg dfdd6ac978 Update last upgrade version of project files 2021-06-11 22:40:57 -07:00
Zorg 52f3337eda Enable parallelizing building of targets
Not doing this is deprecated in Xcode 13.
2021-06-11 22:35:41 -07:00
Zorg defa8e4332 Add Sparkle.framework as dependency to Distribution 2021-06-11 22:34:55 -07:00
Zorg 3636e22cc5 Fix sparkle-cli not linking/embedding Sparkle.framework 2021-06-11 22:26:28 -07:00
Zorg 50ba774bbe Fix -Wcompletion-handler warnings 2021-06-11 22:25:14 -07:00
Mayur Pawashe 432f10f804 Merge pull request #1867 from danielpunkass/xcode13-fix-cgimage
Fix the build with Xcode 13 by explcitly importing ImageIO
2021-06-11 18:49:08 -07:00
Daniel Jalkut 232ce2543e Fix the build with Xcode 13 by explcitly importing ImageIO. Previously it was being implicitly imported along with Foundation. 2021-06-09 14:04:26 -04:00
Mayur Pawashe efe1c8c02e Merge pull request #1866 from sparkle-project/configuration-cleanup
Configuration cleanup
2021-06-07 19:25:23 -07:00
Zorg 1697c7966c Fix unit tests from not building 2021-06-06 20:26:03 -07:00
Zorg 5203518fbd Remove allowing downgrades
Downgrades hasn't worked properly with choosing the best appcast selection in a long long time.
2021-06-06 19:40:58 -07:00
Zorg 9fd2e72913 Fix missing implementation method in sparkle-cli 2021-06-06 19:38:00 -07:00
Zorg ff83896e01 Set app category for InstallerProgress agent tool 2021-06-06 19:36:56 -07:00
Zorg 89ecb88f2b Define DEBUG=0 for release builds 2021-06-06 19:35:15 -07:00
Zorg 4825ac5d62 Remove outdated comments 2021-06-06 19:31:30 -07:00
Zorg e2723717f1 Don't link to AppKit and WebKit explicitly 2021-06-06 19:26:49 -07:00
Zorg b6956a480d Don't include WebKit implementation when not building UI bits 2021-06-06 19:26:25 -07:00
Zorg 7f87d8842e Add missing appkit prevention includes 2021-06-06 19:16:51 -07:00
Zorg cbd1503c06 Add configuration option to not build UI bits 2021-06-06 19:09:19 -07:00
Zorg eda1b4bdaa Remove SparkleCore target and use <> imports
In some cases for shared headers in downloader XPC Service or generate_appcast / sign_update tools, I had to do a little dance for using double quote imports.
2021-06-06 18:38:49 -07:00
Zorg 7861cea66c Merge branch '2.x' into selective-critical 2021-06-01 23:35:03 -07:00
Mayur Pawashe c0691c4606 Merge pull request #1865 from sparkle-project/disable-automatic-downloads-manual-checks
Don't allow setting/toggling automatic updates in update alert when update checks are disabled
2021-06-01 23:33:20 -07:00
Zorg 0063fbda17 Don't allow setting automatic updates when update checks are disabled 2021-06-01 10:19:44 -07:00
Zorg d468757ee1 Revert some unnecessary changes I made 2021-05-31 12:51:09 -07:00
Zorg 1013b2506a Remove #warning 2021-05-31 12:17:43 -07:00
Zorg 1aadf1b351 Remove passing around preventsAutoupdate flag
Also improve user driver documentation slightly.
2021-05-31 11:57:33 -07:00
Zorg 5287453cfd Use dot-syntax naming 2021-05-31 11:41:30 -07:00
Zorg 88f678ebe6 Remove SPUUserUpdateStageInformational 2021-05-31 11:24:32 -07:00
Zorg ee5e98d3dd Rename SPUUpdateState back to SPUUserUpdateState 2021-05-31 11:13:05 -07:00
Zorg 062bfaaa97 Remove old code passing min/max OS tests 2021-05-31 10:59:35 -07:00
Zorg f51bb996e6 Remove critical and major upgrade properties from SPUUpdateState 2021-05-31 10:22:55 -07:00
Zorg 8fb44df0b7 Add unit tests for critical updates 2021-05-31 10:16:04 -07:00
Zorg 8f488c6ffd Fix unit tests 2021-05-31 09:58:09 -07:00
Zorg 63e0b47c98 Don't expose appcast item state publicly 2021-05-31 09:32:00 -07:00
Zorg fabf415999 Resolve appcast item properties from external environment at init 2021-05-31 09:27:21 -07:00
Zorg 0e264dae2f Add comments on critical testing functions 2021-05-31 00:20:11 -07:00
Zorg 60bbb373e2 Add comments on legacy critical update path 2021-05-31 00:17:08 -07:00
Zorg 1cc11d76a2 Fix SPUUpdateState reference 2021-05-31 00:14:55 -07:00
Zorg 90bdd84832 Move SPUUserUpdateChoice into its own header 2021-05-31 00:13:07 -07:00
Zorg b7f9b76dd9 Rename SPUUserUpdateState -> SPUUpdateState 2021-05-31 00:00:38 -07:00
Zorg 253f45b476 Add optional version field to sparkle:criticalUpdate element
This version indicates the version that was first marked critical. So versions below this specified version will treat the update as critical while versions >= the specified version will not.

Also move sparkle:criticalUpdate to root level element instead of it being a tag. The tagged version is now deprecated and doesn't support the version field.
2021-05-30 23:37:38 -07:00
Mayur Pawashe 433e1bf3de Merge pull request #1860 from 1024jp/localizeJa
Add missing Japanese localization strings
2021-05-30 10:08:44 -07:00
Mayur Pawashe bbdebfdbee Merge pull request #1858 from sparkle-project/warnings
Fix all Interface Builder and compiler warnings and require macOS 10.11 (El Capitan)
2021-05-30 09:46:10 -07:00
1024jp 8a62dc06fe Add missing Japanese localization strings
that were added in #1853.
2021-05-30 16:51:23 +09:00
Mayur Pawashe d7c504a254 Merge pull request #1853 from sparkle-project/skip-major-updates
Skip minor updates separately from major upgrades
2021-05-29 23:19:28 -07:00
Zorg 87a4e349ce Remove more legacy pre 10.11 checks 2021-05-29 22:53:25 -07:00
Zorg 549a8ce117 Re-annotate sender as unused 2021-05-29 22:46:51 -07:00
Zorg 91fc440d15 Animate resizing the window when disclosing more info 2021-05-29 14:49:28 -07:00
Zorg 79cd07fc70 Use alerts instead of notifications 2021-05-29 07:52:50 -07:00
Zorg 0cdb0976ef Don't hide skipping button for major upgrades if update is critical 2021-05-29 07:50:30 -07:00
Zorg e0a414909c Re-word skip upgrade title confirmation 2021-05-28 23:56:04 -07:00
Zorg 8e466eecc8 Fix unit tests for skipped updates 2021-05-28 23:28:44 -07:00
Zorg 17eb15e9d3 Simplify skipping major updates
We now only track one major version to skip and one minor version to skip, instead of an array of potentially growing minor/major versions.
2021-05-28 23:11:13 -07:00
Zorg 7d3c7ae78a Add alert confirmation for skipping major upgrades 2021-05-28 17:23:31 -07:00
Zorg a630614dc4 Use "update" still instead of "upgrade" for major updates 2021-05-27 22:26:23 -07:00
Zorg 87ecba77d3 Set LSMinimumSystemVersion for the test app 2021-05-27 21:50:30 -07:00
Zorg 455e63cc59 Remove hard coded 10.11 deployment targets 2021-05-27 21:50:16 -07:00
Zorg 57b39fc1e5 Update and remove 10.9 and 10.10 references 2021-05-27 21:39:24 -07:00
Zorg b2127da6f5 Add missing trailing constraint to Release Notes label 2021-05-27 16:37:44 -07:00
Zorg 8fc1689c26 Remove hidden shouldAskAboutProfile button binding 2021-05-27 16:28:41 -07:00
Zorg 898ac7253a Set code sign identity to adhoc across the project 2021-05-24 01:04:33 -07:00
Zorg f8ef9608dc Fix warning from using -stringByAddingPercentEscapesUsingEncoding: 2021-05-24 00:41:46 -07:00
Zorg d22ef79d9e Remove unused outlets 2021-05-16 15:45:06 -07:00
Zorg 8af1d18764 Update localization files 2021-05-16 15:42:05 -07:00
Zorg a7e090e3ca Revert "Start to move permission prompt localizations away from xib"
This reverts commit e607bf19dc.
2021-05-16 15:35:49 -07:00
Zorg e607bf19dc Start to move permission prompt localizations away from xib 2021-05-16 12:39:22 -07:00
Zorg 7490a91406 Re-adjust leading constraint for anonymous info button 2021-05-16 10:18:27 -07:00
Zorg 9ee2a525d0 Decrease distance between response buttons info view 2021-05-16 10:14:42 -07:00
Zorg 54caf47602 Set leading constraint of more info description to be bit higher 2021-05-16 10:06:56 -07:00
Zorg ed87bcdab6 Use NSStackView for permission prompt window 2021-05-16 10:01:48 -07:00
Zorg ef577fe0c0 Make subview for anonymous system info button 2021-05-15 21:54:06 -07:00
Zorg 7c8defb75e Create separate subviews for permission prompt 2021-05-15 21:41:19 -07:00
Zorg f6d8b506ae Align disclosure button with include anonymous info text 2021-05-15 14:21:17 -07:00
Zorg 3306ccd994 Suppress deprecation warnings for SMJobSubmit functions 2021-05-15 11:58:01 -07:00
Zorg 07aca30e11 Bump deployment target to 10.11 2021-05-15 11:53:08 -07:00
Zorg be75bb38f6 Add auto layout constraints to update permission prompt 2021-05-14 22:52:20 -07:00
Zorg debab803c9 Add auto-layout constraints to status window 2021-05-14 22:28:38 -07:00
Zorg 8dc4e78cb2 Remove unused installationPath variable from normalization changes 2021-05-14 22:09:41 -07:00
Zorg e91ae897e7 Add method to compare two minimum autoupdate versions 2021-05-14 18:28:32 -07:00
Mayur Pawashe 91e71c219c Merge pull request #1854 from sparkle-project/xpc-sha
Validate XPC Service versions
2021-05-10 19:11:57 -07:00
Zorg f56e923043 Validate XPC Services versions in startUpdater: 2021-05-10 01:02:27 -07:00
Zorg 50bec90279 Set fetch-depth to 0 in GitHub Actions CI 2021-05-10 00:26:57 -07:00
Zorg 1f9d76bc13 Retitle install button to "Install Upgrade" for major updates 2021-05-09 23:16:01 -07:00
Zorg 59fbd37bb1 Re-title skip button when update is a major one 2021-05-09 23:03:05 -07:00
Zorg f671b82e50 Test against SPUUserUpdateStageInformational 2021-05-09 22:53:58 -07:00
Zorg 1565db3fec Add secure coding to SPUUserUpdateState 2021-05-09 22:51:50 -07:00
Zorg 25b3d01efa Rename majorUpdate to majorUpgrade 2021-05-09 22:45:40 -07:00
Zorg d193f2e28b Pass majorUpdate information to user driver
We unify the user driver method showing the update to take a generic state object now. The current fields of the state object are its current stage, if it's user initiated, and if the update is a major one.

We also remove deprecated code paths that were complex to support and will otherwise generate in compile errors if people adopt the new API.
2021-05-09 22:42:42 -07:00
Zorg a79f6b2a85 Add documentation to SPUSkippedUpdate 2021-05-09 20:48:32 -07:00
Zorg 0ee12d881d Add and fix unit tests for skipping updates 2021-05-09 19:53:19 -07:00
Zorg 6d6cc2d052 Add support for skipping major and minor updates separately 2021-05-09 19:30:44 -07:00
Mayur Pawashe 039adc1ef2 Merge pull request #1850 from sparkle-project/better-appcast-selection
Better appcast selection
2021-05-03 19:02:20 -07:00
Zorg 62695379d9 Clarify what versions not to filter for 2021-05-02 23:15:01 -07:00
Zorg f82f9eb878 Fix typo 2021-05-02 23:13:58 -07:00
Zorg a1aef4eca0 Fix string localization 2021-05-02 23:12:48 -07:00
Zorg 3d2dc8a7f6 Update documentation for -bestValidUpdateInAppcast:forUpdater:
This method will not be invoked for appcast with zero items. Clients must pick best item and cannot pick "no items."
2021-05-02 23:09:45 -07:00
Zorg 5a3b71b96a Add note about not returning a delta update item in delegate 2021-05-02 22:38:27 -07:00
Zorg 3c9508bd2a Add tests for testing minimum autoupdate version 2021-05-02 22:32:50 -07:00
Zorg 79c1141155 Refactor finding latest appcast item 2021-05-02 21:44:35 -07:00
Zorg ebb822af43 Merge branch '2.x' into better-appcast-selection 2021-05-02 16:06:45 -07:00
Zorg c882da7bc7 Update documentation for -bestValidUpdateInAppcast 2021-05-02 16:06:22 -07:00
Zorg f1be9f72d5 Remove passing includesSkippedUpdates in favor of background flag 2021-05-02 15:59:43 -07:00
Zorg e7441351d7 Make improvements to best appcast selection
* Prefer using the latest update that passes minimumAutoupdateVersion

When an update is not found:
* Find latest appcast item that may fail min/max OS
* Report that user cannot install an update due to unsupported OS
2021-05-02 15:50:03 -07:00
Mayur Pawashe 3cafb688b7 Merge pull request #1849 from sparkle-project/appcast-item-nullability
Add nullability annotations to SUAppcastItem
2021-05-02 13:49:27 -07:00
Zorg d84a79cfc2 Merge branch '2.x' into appcast-item-nullability 2021-05-02 11:29:39 -07:00
Zorg c33ccd5921 Merge branch '2.x' into appcast-item-nullability 2021-05-02 11:17:42 -07:00
Zorg 6ad996338d Add nullability annotations to SUAppcastItem 2021-05-02 10:00:56 -07:00
Mayur Pawashe 46f7898d36 Merge pull request #1844 from sparkle-project/download-driver-appcast
Re-use download driver for downloading appcast & release notes
2021-05-02 09:03:20 -07:00
Mayur Pawashe 85ac073e6d Merge pull request #1846 from sparkle-project/enforce-session-in-progress
Enforce the updater session is in progress
2021-05-02 09:03:04 -07:00
Mayur Pawashe 7c46e8db3e Merge pull request #1848 from sparkle-project/skip-installing-update
Allow skipping/canceling of an update that is currently installing
2021-05-02 09:02:08 -07:00
Zorg fbe48e5738 Allow skipping/canceling of an update that is currently installing 2021-05-01 19:53:01 -07:00
Mayur Pawashe b140c05bad Merge pull request #1843 from sparkle-project/nsunavailable
Add NS_UNAVAILABLE attributes to user driver classes
2021-05-01 17:26:15 -07:00
Mayur Pawashe c79785aad4 Merge pull request #1845 from sparkle-project/version-dash-separator
Port #1504 (dash separators in version strings) to 2.x
2021-05-01 17:25:53 -07:00
Mayur Pawashe 5da8199818 Merge pull request #1847 from sparkle-project/sandbox-errors
Log more sandbox errors
2021-05-01 17:25:35 -07:00
Zorg 79a6bb1318 Disable unused debugging options in test app scheme 2021-05-01 14:48:31 -07:00
Zorg 9b8756d824 Add sandbox log if connection to installer fails 2021-05-01 14:46:34 -07:00
Zorg 712753d812 Add log linking to sandboxed steps if app isn't sandboxed at all 2021-05-01 14:36:45 -07:00
Zorg e8d5c8024c Log error if developer sandboxes installer launcher service 2021-05-01 14:30:21 -07:00
Zorg af245bfe62 Enforce the updater session is in progress
We should enforce update session is in progress before checking for new updates. I've tested checking for updates regularly, in background, and informational updates.

An update check could have been made while the permission request was in flight, which we don't want to happen.
2021-05-01 11:08:18 -07:00
Zorg 9a12dbf62a Port #1504 (dash separators in version strings) to 2.x
On second thought I realized we can support this without doing any date comparison because the code just picks the first item if two are equal.
2021-05-01 10:48:53 -07:00
Zorg 477d0a243f Fix unit tests 2021-04-30 22:21:19 -07:00
Zorg ab294d607d Hide private SUAppcast / SUAppcastItem APIs 2021-04-30 21:40:47 -07:00
Zorg 26c63c1a7b Remove commented out code 2021-04-30 21:28:56 -07:00
Zorg 6adb0c3017 Use download driver for downloading release notes 2021-04-30 21:10:41 -07:00
Zorg 7cb72238fa Use download driver for downloading appcast 2021-04-30 20:37:00 -07:00
Zorg 0eb5a706f8 Add NS_UNAVAILABLE attributes to user driver classes 2021-04-30 18:03:22 -07:00
Mayur Pawashe e179443799 Merge pull request #1836 from jaroslavas/feature/sign-update-file
Add private_key parameter in sign_update
2021-04-26 20:11:57 -07:00
Jaroslav Ozevič c00946ee20 Fixed error message in case sign_update can't find the key in the keychain 2021-04-26 10:07:38 +03:00
Jaroslav Ozevič 12a3da9629 Update sign_update to accept -f <private_key_file> or -s <private_key> parameters 2021-04-26 09:49:50 +03:00
Mayur Pawashe 84cdb0c7e8 Merge pull request #1838 from sparkle-project/fix-delta-updates
Fix delta updates edge cases
2021-04-25 21:39:53 -07:00
Mayur Pawashe 478cc98b90 Merge pull request #1839 from sparkle-project/remove-auth-promt-localization
Remove localizing authorization prompt
2021-04-25 20:26:56 -07:00
Mayur Pawashe bf35926cf3 Merge pull request #1840 from sparkle-project/fix-test-app-responder
Test App: Allow check for updates menu item to be invoked outside of settings
2021-04-25 20:26:15 -07:00
Kornel 8034404cc7 Merge pull request #1835 from 1024jp/localizeJa
Add missing Japanese localization strings
2021-04-26 02:54:37 +01:00
Zorg 411360deb2 Allow check for updates menu item to be invoked outside of settings
Previously check for updates was only in responder chain of the settings window controller. Now it's in responder chain of the entire application.
2021-04-25 15:48:20 -07:00
Zorg d91223a5b6 Remove localizing authorization prompt
The message string gets cached and I don't think this is the proper way to localize the auth dialog (which I think has some other mechanism). So I am removing localization here for now until this can possibly be done properly.
2021-04-25 14:46:42 -07:00
Zorg 063974c553 Simplify logic in -preferredUpdateForRegularAppcastItem method 2021-04-25 14:28:33 -07:00
Mayur Pawashe 97f15943e4 Merge pull request #1837 from sparkle-project/cleanup-download
Clean up downloads better
2021-04-25 14:22:56 -07:00
Zorg 564f0c316a Refactor retrieving regular & delta update items 2021-04-25 13:57:09 -07:00
Zorg 50942909f2 Add comment indicating why we don't pass full downloaded path 2021-04-25 12:24:34 -07:00
Zorg 71557fac85 Include secondary non-delta update to resumable updates 2021-04-25 12:15:44 -07:00
Zorg e51eb32403 Fix bestValidUpdateInAppcast: not handling delta updates correctly
All the top level appcast items are non-delta items. The client needs to give us back a non-delta update item. We then fetch the appropriate delta item ourselves.
2021-04-24 21:42:33 -07:00
Zorg 6d0d1a7aa8 Add comment about clearing download after beginning installation 2021-04-24 19:40:54 -07:00
Zorg c44c164aff Clean up empty / temporary progress agent tool directory immediately 2021-04-24 19:29:10 -07:00
Zorg 1244612946 Clear download from installer when extraction fails
One example of extraction failing is the delta update failing to apply.
2021-04-24 19:11:36 -07:00
Zorg 842d258330 Clean up download directory upon skipping already downloaded update 2021-04-24 19:00:06 -07:00
Jaroslav Ozevič ef7c16bb9d Add private_key parameter in sign_update 2021-04-23 15:09:30 +03:00
1024jp f56f937ad2 Add missing Japanese localization strings
that were added in #1833.
2021-04-21 09:14:07 +09:00
Mayur Pawashe 02b85635c7 Merge pull request #1833 from sparkle-project/missing-localizations
Update missing localizations strings
2021-04-18 19:32:25 -07:00
Zorg ce70a30be5 Don't localize rare/unlikely/specific scenario error strings 2021-04-18 19:00:58 -07:00
Zorg e8f41640dc Comment which localizations are rare/unlikely 2021-04-18 18:54:05 -07:00
Mayur Pawashe 7247803fea Merge pull request #1831 from sparkle-project/deprecate-dismiss-check
Deprecate -dismissUserInitiatedUpdateCheck user driver method
2021-04-18 18:29:39 -07:00
Mayur Pawashe fe8b6b3e2a Merge pull request #1827 from sparkle-project/show-update-focus
Show the present update in focus when checkForUpdates is invoked
2021-04-18 18:29:11 -07:00
Mayur Pawashe f0ff2e3ef0 Merge pull request #1832 from sparkle-project/update-auth-prompt
Update authorization prompt when updating an app
2021-04-18 18:22:30 -07:00
Zorg c7ff8f4bb0 Add Install on Quit localizations from automatic alert from 1.x 2021-04-18 12:11:46 -07:00
Zorg 669c369ce7 Add missing localization strings to Sparkle.strings 2021-04-18 12:06:34 -07:00
Zorg db6ef214ab Update authorization prompt when updating an app
We have a slightly different prompt for an app updating itself vs an app/tool updating another app. Also put prompt in the localization strings.
2021-04-18 11:44:30 -07:00
Zorg ba11897345 Deprecate -dismissUserInitiatedUpdateCheck user driver method
We don't have a dismiss method for every transition state and we don't want to. This should be up to the UI to determine how to transition from one UI state to another UI state.
2021-04-17 22:21:22 -07:00
Zorg cc4c02f467 Add showUpdateInFocus implementation to Test App user driver 2021-04-17 16:36:28 -07:00
Zorg f58cc9e9b5 Merge branch '2.x' into show-update-focus 2021-04-17 16:25:36 -07:00
Mayur Pawashe 8f3e340e47 Merge pull request #1829 from sparkle-project/merge-show-update-methods
Merge show update methods
2021-04-17 16:23:53 -07:00
Mayur Pawashe 547fde293d Merge pull request #1830 from sparkle-project/enforce-only-owner
Don't bring up authorization just because group ID doesn't match
2021-04-17 16:09:40 -07:00
Zorg 302f3f41a3 Clear downloaded update upon skipping
I had this line of code before in the legacy path but forgot to use it.
2021-04-17 16:07:18 -07:00
Zorg af9935540a Don't bring up authorization just because group ID doesn't match 2021-04-17 13:47:00 -07:00
Zorg 188a893174 Rename new state back to not downloaded 2021-04-16 19:07:48 -07:00
Zorg 3309abf936 Remove DEBUG conditional check around deprecated methods 2021-04-16 16:55:48 -07:00
Zorg 1abe5f70db Add comment for legacy path 2021-04-16 16:47:22 -07:00
Zorg ab9ffdb901 Rename SPUUserUpdateStateNotDownloaded to SPUUserUpdateStateNew
Update documentation too.

Fix test app trying to make installable update skippable.
2021-04-16 16:40:33 -07:00
Zorg e64253be0b Merge showUpdateFount: methods into single one
Handling the different variations with different completion blocks is a pain when ultimately clients want to display a mostly unified user interface.
2021-04-16 16:34:01 -07:00
Zorg 8ff356bc7d Update documentation on checkForUpdates 2021-04-16 12:16:34 -07:00
Zorg 3593157e3d Merge branch '2.x' into show-update-focus 2021-04-16 12:04:05 -07:00
Mayur Pawashe 2d0b9ae356 Merge pull request #1826 from 1024jp/localizeJa
Add missing Japanese localization strings
2021-04-16 12:02:25 -07:00
Zorg d9e0265d76 Show the present update during updater progress too
This includes updater permission request, downloading updates, downloading appcast, installing update, and so on.
2021-04-16 11:32:00 -07:00
1024jp 5ff2d7765e Add missing Japanese localization strings
that added in #1819.
2021-04-17 00:02:51 +09:00
Zorg 6b3d2af21a Simplify UI driver storing showingUpdate state 2021-04-16 00:01:37 -07:00
Zorg 2f783e01f0 Show the present update in focus when checkForUpdates is invoked
When the update is shown to the user, the menu item for checking for updates is no longer disabled. Instead it is enabled, and when invoked, will bring the update to utmost focus back to the user again.

This is consistent with other options (eg Preferences...) that bring up windows. Improved user experience here is that updates are now less "lost".

We (re)define properties on SPUUpdater:

canCheckForUpdates - to mean that the user can check for updates (start a new update check or show the already present update frontmost)

sessionInProgress - to mean if Sparkle's internal driver / scheduler is running (i.e, downloading appcast or update, showing update, starting installation).
2021-04-15 22:56:41 -07:00
Mayur Pawashe 40545494f2 Merge pull request #1819 from sparkle-project/user-driver-relaunch
Show alert that non-relaunched application was installed
2021-04-15 20:02:59 -07:00
Zorg b0d9a75f98 Add new installed update localizations to Sparkle.strings 2021-04-15 19:36:14 -07:00
Zorg ed89783a0e Merge branch '2.x' into user-driver-relaunch 2021-04-13 00:05:39 -07:00
Mayur Pawashe cb17e08b92 Merge pull request #1823 from sparkle-project/entitlements
Entitlement scripts/configuration updates
2021-04-12 19:20:46 -07:00
Mayur Pawashe 286af16842 Merge pull request #1821 from sparkle-project/api-updater-doc
Update API documentation for instantiating/using updater
2021-04-12 19:20:20 -07:00
Mayur Pawashe a084e2f09d Merge pull request #1822 from sparkle-project/sample-appcast-edSignature
Update SampleAppcast.xml to use edSignatures
2021-04-12 19:19:47 -07:00
Mayur Pawashe 9524b32024 Merge pull request #1820 from sparkle-project/simplify-user-driver
Simplify user driver
2021-04-12 19:19:27 -07:00
Zorg cb10bb8046 Remove SPUUserDriverCoreComponent usage completely 2021-04-11 23:31:04 -07:00
Zorg 2d9bf07b18 Add new user driver methods to cancel update checks / downloads
Remove SPUUserDriverCoreComponent dependency from sparkle-cli and the Test App too, which really wasn't helping at all.
2021-04-11 23:15:02 -07:00
Zorg eea87561ab Update XPC Service signing script
Add entitlements to InstallerConnection and InstallerStatus services and add option to specify bundle id in the now renamed codesign_xpc_service.py script.
2021-04-11 21:52:09 -07:00
Zorg e7bc17b192 Use $(PRODUCT_BUNDLE_IDENTIFIER) for defaults exception for test app 2021-04-11 20:19:33 -07:00
Zorg 07e96961bf Sign altered app in release too for the test app 2021-04-11 20:04:53 -07:00
Zorg 895bb71fae Add InstallerStatus and InstallerConnection services to Distribution 2021-04-11 20:03:59 -07:00
Zorg 372d711d20 Remove ATS allow-exception scripts for debug / test app 2021-04-11 19:43:12 -07:00
Zorg 5408ab10c1 Remove lesser used XPC Services for Test App
Testing WebKit2 is more important than testing sandboxed downloader service.
More people should be adding entitlements to their app for connection services, so we will do that in the test app too.
2021-04-11 19:28:46 -07:00
Zorg 3ea863d82b Remove incorrect note about when relaunch happens
User driver can also request to not relaunch the app and this is worded oddly.
2021-04-11 19:01:27 -07:00
Zorg bd1769e82e Update SampleAppcast.xml to use edSignatures 2021-04-11 15:17:53 -07:00
Zorg 0b634f4d76 Update API documentation for instantiating/using updater 2021-04-11 15:00:43 -07:00
Zorg 9052ea912d Ensure permission request response is handled on main thread
We were doing this before but I accidentally removed it in a recent commit.
2021-04-11 14:43:52 -07:00
Zorg 833eb89bb5 Simplify user driver API
Deprecate the "done" statuses for user initiated update checks and downloading updates because they really did nothing but burden implementor (there was a relic of an XPC reason back in the day that no longer applies).
2021-04-11 14:41:07 -07:00
Zorg e909c0d988 Show alert that non-relaunched application was installed
This only applies when the updater outlives the application it is updating and the application is not relaunched (i.e, an external/remote updater).
2021-04-11 14:01:03 -07:00
Mayur Pawashe 1f90f7c993 Merge pull request #1818 from sparkle-project/update-cycle-2
Defer requiring feed URL until checking for updates
2021-04-11 13:12:11 -07:00
Zorg 6db6a9892a Defer requiring feed URL until checking for updates
Also don't automatically reset update cycle if updater hasn't been started yet.
2021-04-10 15:18:13 -07:00
Mayur Pawashe e20f099c90 Merge pull request #1815 from sparkle-project/fix-interactive
Fix interactive flag being ignored in sparkle-cli
2021-04-05 19:05:59 -07:00
Zorg 9b6e7ba828 Fix interactive flag being ignored in sparkle-cli 2021-04-04 16:57:37 -07:00
Mayur Pawashe 8c53b1d3ec Merge pull request #1812 from sparkle-project/system-domain
Pass whether or not system domain is being used back to framework
2021-04-04 16:37:37 -07:00
Mayur Pawashe faf047c4ea Merge pull request #1813 from sparkle-project/service-length
Increase max mach service name length to 127 characters
2021-04-04 16:36:08 -07:00
Zorg 71a36f8be4 Add comments on message type tags 2021-04-04 14:06:27 -07:00
Zorg ebc48cee5c Increase max mach service name length to 127 characters 2021-04-03 22:43:01 -07:00
Zorg 467ffb15ca Pass whether or not system domain is being used back to framework
This avoids needing to do a file system check in InstallerConnection to determine if we need to connect to the system or user domain.
2021-04-03 17:16:38 -07:00
Mayur Pawashe a79aa1690b Merge pull request #1810 from sparkle-project/permission-prompt-no-modal
Don't make permission prompt a modal window
2021-03-29 19:12:41 -07:00
Mayur Pawashe e1fdd5a6c4 Merge pull request #1809 from sparkle-project/update-cycle
Universally start update cycle one runloop cycle later
2021-03-29 19:12:27 -07:00
Mayur Pawashe a108d4bc72 Merge pull request #1811 from sparkle-project/relaunch-host
Provide option to open host bundle path instead of app path
2021-03-29 19:08:21 -07:00
Zorg 5a0529a2cd Provide option to open host bundle path instead of app path
This is useful for plug-ins that may want Sparkle to open eg a .prefpane or .saver instead of re-launching System Preferences (which is the app used to wait for termination; normally we only relaunch an app that was proven to be alive).

In a plug-in world, it may not be possible to tell which is more desirable so we provide both options. In 1.x, there was a delegate -pathToRelaunchForUpdater: method to pick between these, however in 2.x for hardening sake, there isn't an API to open any arbitrary bundle path so we provide explicit options.
2021-03-28 23:39:10 -07:00
Zorg 3a201a45ac Don't make permission prompt a modal window
This can block the rest of the UI from being loaded on an app that is just starting. I saw this myself in a pref pane plugin.
2021-03-28 17:35:32 -07:00
Zorg 93b8700060 Add self.driver != nil assert 2021-03-28 17:10:10 -07:00
Zorg 2614af86ff Don't defer some of sparkle-cli delegate callbacks 2021-03-28 16:35:21 -07:00
Zorg 5ae944778a Set canCheckForUpdates to NO before probing install status 2021-03-28 16:25:05 -07:00
Zorg f2986ef090 Start updater one runloop cycle later
And remove logic in SPUStandardUpdaterController and SUUpdater that defers starting the updater one cycle later, because that logic is now in SPUUpdater which they invoke.

It is too easy to start the updater "too soon" (if not using SPUStandardUpdaterController or SUUpdater) and I had some weird approach before that allowed the developer to check for updates before starting the updater and it would get deferred until the updater was started (without showing a permission prompt). Instead, defer the update cycle check allowing developer to check for updates immediately after starting the updater if needed (sparkle-cli needs to do this in one case).

Errors are now logged when checking for updates without having started the updater.

This fixes edge cases of UI being shown too early.
2021-03-28 13:21:20 -07:00
Mayur Pawashe 923bb96eda Merge pull request #1802 from sparkle-project/features
Add quicker & more reliable updating to features
2021-03-28 12:47:44 -07:00
Mayur Pawashe 2af01e8844 Merge pull request #1808 from sparkle-project/normalization
Compute app path normalization in progress agent
2021-03-28 10:51:10 -07:00
Zorg 414c8affc5 Compute app path normalization in progress agent
Compute path instead of having installer pass over arbitrary path to agent.
2021-03-27 22:17:25 -07:00
Zorg 90aa98b68c Update changelog 2021-03-25 23:24:18 -07:00
Zorg 7e8084b064 Update readme / changelog 2021-03-23 19:37:20 -07:00
Mayur Pawashe 25001d83ee Merge pull request #1803 from sparkle-project/preventAccidentalInstalls-2.x
Disable keyboard shortcut for active not-initiated scheduled checks
2021-03-23 19:22:32 -07:00
Mayur Pawashe 78b0570a76 Merge pull request #1804 from sparkle-project/no-hide-on-deactivate
Don't hide standard updater window on deactivation
2021-03-23 19:22:20 -07:00
Zorg 9555cb7397 Fix UI tests from not making update alert hide on deactivation 2021-03-22 23:05:02 -07:00
Zorg 78ec0f46b7 Disable keyboard shortcut for active not-initiated scheduled checks
This ports #1036 over to 2.x. Looks like I forgot to port half of it.
2021-03-22 16:17:07 -07:00
Zorg f95bf0c7d5 Don't hide standard updater window on deactivation
Sometimes when the app is re-activated, the window is ordered back behind other applications. Also it may be useful to eg read the release notes when browsing another application. We still preserve the logic that defers showing the update alert when the application isn't initially frontmost.
2021-03-22 15:48:47 -07:00
Zorg cf14d09ee0 Update CHANGELOG 2021-03-22 01:36:31 -07:00
Zorg 90448fd564 Add quicker & more reliable updating to features 2021-03-22 01:14:20 -07:00
Mayur Pawashe 0a4846a186 Merge pull request #1801 from sparkle-project/atomic-swap
Update and replace bundle directories even more atomically on apfs
2021-03-21 18:54:36 -07:00
Zorg b3e7a03660 Update and replace bundle directories even more atomically on apfs
With these changes, it should not be possible for neither an old or new bundle to be at the destination.

We also perform temporary directory cleanup after final installation stage is and relaunching an app is performed because we can save some time (150 ms+ in one of my cases).
2021-03-21 17:54:51 -07:00
Mayur Pawashe 83aac00fe6 Merge pull request #1800 from sparkle-project/log-nserror
Add and use function to log NSError objects recursively
2021-03-19 13:50:14 -07:00
Zorg 89b7fef457 Add and use function to log NSError objects recursively 2021-03-19 12:35:22 -07:00
Mayur Pawashe 5fbf119e6a Merge pull request #1799 from sparkle-project/graceful-change-owner-group-failure
Don't make changing owner/group a hard fatal error
2021-03-19 11:18:39 -07:00
Zorg 2e8fc4d17a Don't make changing owner/group a hard fatal error 2021-03-19 10:28:59 -07:00
Mayur Pawashe 454e6d2f13 Merge pull request #1798 from sparkle-project/disable-hardened-runtime-sparkle-cli
Disable hardened runtime for sparkle-cli
2021-03-19 09:20:54 -07:00
Zorg 28924f4b2a Disable hardened runtime for sparkle-cli 2021-03-18 20:49:08 -07:00
Mayur Pawashe d102a50f66 Merge pull request #1795 from sparkle-project/main-dev
Main development change
2021-03-08 21:12:05 -08:00
Zorg bfc55ac8b0 Add 1.x feature frozen note 2021-03-08 00:54:02 -08:00
Zorg 1f35e7b5cd Add GitHub issue / pull request templates 2021-03-08 00:51:09 -08:00
Zorg f23799a531 Re-add INSTALL document which directs user to Sparkle website docs 2021-03-08 00:40:44 -08:00
Zorg 81453d1410 Update ReadMe to update development branch and feature-freeze 1.x 2021-03-08 00:40:12 -08:00
Mayur Pawashe 7064ac160b Merge pull request #1794 from sparkle-project/sync-localizations
Sync localizations
2021-03-07 10:21:45 -08:00
Mayur Pawashe f74f9d288d Merge pull request #1793 from sparkle-project/ci-upload-dist
Test validity of archived products and upload distribution in CI
2021-03-07 09:23:50 -08:00
Mayur Pawashe 3c8ebd921f Merge pull request #1792 from sparkle-project/1.x-sync
Sync SPM + changelog changes
2021-03-07 09:23:13 -08:00
Zorg 579e7bd98b Add Persian localizations 2021-03-06 23:56:24 -08:00
Zorg 6d548efb2b Sync localization changes from 1.x 2021-03-06 23:51:21 -08:00
Zorg 2179eb1e39 Upload release distribution only for Xcode 12 builds currently 2021-03-06 23:19:25 -08:00
Zorg 3ded119af5 Include Xcode version in artifact upload 2021-03-06 22:47:49 -08:00
Zorg 018d4ea630 Reference relative path 2021-03-06 22:14:27 -08:00
Zorg ef68656783 Test validity of archived products and upload distribution in CI 2021-03-06 21:53:31 -08:00
Kornel aeffb2710a Changelog 2021-03-06 20:56:07 -08:00
Kornel 7c223ef0d1 Changelog 2021-03-06 20:54:45 -08:00
Zorg 724e9eb79e Fight SPM retagging
https://github.com/sparkle-project/Sparkle/commit/b5c9539f16de5b8647418fc467c6ca8fd5c8d22c
2021-03-06 20:20:08 -08:00
Jonas Zaugg 59c2c7358f Update make-release-package.sh
Now provides an error and exits when not complying with SemVer
2021-03-06 20:19:18 -08:00
Jonas Zaugg dc7b2f2030 Update make-release-package.sh
Only check and update tag in Package.swift when not running a CI build. As long as GitHub actions are reserved for tests, this should be ok as this is a "fake" update of Package.swift anyway. If you ever use GitHub actions for releases, you'll probably have to rethink the tagging logic once again
2021-03-06 20:19:04 -08:00
Jonas Zaugg 78a0d4e4e7 Checks SemVer and default to force tagging 2021-03-06 20:18:45 -08:00
Jonas Zaugg cd8794acce Various fixes to SPM logic
Improves prompt asking to force move tag (default is NO, but can be triggered after `make release`). Fixes issues with single quotes in make-release-package.sh.
2021-03-06 20:18:23 -08:00
Jonas Zaugg fd940884c8 Include tag instead of version in Package.swift 2021-03-06 20:16:41 -08:00
Zorg e76e34ead8 Rename SPM zip
https://github.com/sparkle-project/Sparkle/commit/891afd44c7075e699924ed9b81d8dc94a5111dfd#diff-507d750ad623604486faa5c9772800e8a019c7675a08688e94bde91872c0f1d8
2021-03-06 20:16:06 -08:00
Mayur Pawashe 2dd324d316 Merge pull request #1789 from sparkle-project/relocate-tools
Move helper tools into executables directory of framework
2021-03-02 22:25:18 -08:00
Mayur Pawashe 9e7548c4ff Merge pull request #1790 from sparkle-project/propogate-errors
Propagate errors from installer and agent to Sparkle
2021-03-01 19:53:14 -08:00
Zorg e21f7c4e87 Ensure startInstallationToURL method populates error object 2021-02-28 23:47:14 -08:00
Zorg 370fdb8368 Fix auto-synthesize warning 2021-02-28 23:47:07 -08:00
Zorg d3f6370828 Re-add SUSignatureError because I didn't see Swift code using it 2021-02-28 23:27:18 -08:00
Zorg efa9cc20d0 Fix tests 2021-02-28 23:20:06 -08:00
Zorg 7d8e3059ec Add and use SUAgentInvalidationError 2021-02-28 22:23:58 -08:00
Zorg f400b27cb2 Re-add __attribute__((noreturn)) attribute 2021-02-28 22:20:32 -08:00
Zorg f43b5ee3c3 Propagate agent errors to Sparkle 2021-02-28 22:14:35 -08:00
Zorg 1526a024b8 Propagate installer errors to Sparkle 2021-02-28 21:40:17 -08:00
Zorg 5cd1d3c824 Move helper tools into executables directory of framework 2021-02-28 10:25:42 -08:00
Mayur Pawashe 8a868914e5 Merge pull request #1786 from sparkle-project/bump-unarchiving-test-timeout-2x
Bump unarchiving tests timeout from 7 seconds to 30 seconds (2.x)
2021-02-22 07:44:40 -08:00
Zorg f5ee4dedb4 Bump unarchiving tests timeout from 7 seconds to 30 seconds 2021-02-21 18:05:51 -08:00
Mayur Pawashe ef23e7d65e Merge pull request #1781 from sparkle-project/add-release-distribution-2x
Add building distribution in Release in CI (2.x)
2021-02-21 17:51:00 -08:00
Mayur Pawashe d29d3f97a5 Merge pull request #1784 from sparkle-project/bz2-make-fallback-2x
Add fallback to bz2 when building Sparkle distribution (2.x)
2021-02-21 17:50:19 -08:00
Zorg a1cba4dd91 Add fallback to bz2 when building Sparkle distribution 2021-02-21 17:21:02 -08:00
Zorg 699a9df7bf Add building distribution in Release in CI 2021-02-21 15:42:43 -08:00
Mayur Pawashe 5aa68fa82b Merge pull request #1778 from sparkle-project/user-disable-automatic
Revert logic that prevented users from disabling automatic downloads
2021-02-21 15:01:56 -08:00
Mayur Pawashe adc62f8e34 Merge pull request #1777 from sparkle-project/installer-progress-locale-symlink
Remove locale symlinks in installer progress tool
2021-02-21 08:47:38 -08:00
Zorg f977a92e4c Revert logic that prevented users from disabling automatic downloads
In 2.x, updates can be downloaded automatically and presented later even if they can't be installed automatically without user intervention. Users need to in control and be able to disable automatic downloads regardless of developer's Info.plist intention.
2021-02-21 08:33:32 -08:00
Zorg dd24e8d938 Remove locale symlinks in installer progress tool 2021-02-21 08:27:59 -08:00
Mayur Pawashe 03f20a05a8 Merge pull request #1776 from sparkle-project/error-messages
Improve error messages developers run into
2021-02-21 07:14:59 -08:00
Mayur Pawashe 7ecc624afb Merge pull request #1774 from sparkle-project/delegate-methods
Add download, extract, skip delegate methods from 1.x
2021-02-21 07:13:53 -08:00
Zorg e331afddb1 Add host name of bundle in potential user facing error messages 2021-02-20 21:50:45 -08:00
Zorg 45581d5658 Log to users to check for Autoupdate console logs 2021-02-20 21:32:34 -08:00
Zorg 9931992912 Provide URL to troubleshoot XPC timed out issues 2021-02-20 21:09:57 -08:00
Zorg df3d9e2b14 Update error messages to specify Sparkle 2
This makes it more clear the developer is using Sparkle 2.
2021-02-20 20:48:32 -08:00
Zorg e148659cbb Add userDidSkipThisVersion case for informational updates 2021-02-20 20:33:58 -08:00
Mayur Pawashe 0a8443c94a Merge pull request #1773 from sparkle-project/lovette-patch-2
Correct generate_appcast -s command line argument usage help (2.x)
2021-02-20 20:00:56 -08:00
Lance Lovette 0e26a3e27a Correct generate_appcast -s command line argument usage help
Fixes sparkle-project/Sparkle#1766
2021-02-20 19:46:34 -08:00
Zorg ea472ae3f0 Add updater:shouldPostponeRelaunchForUpdate: 1.x stub 2021-02-20 19:40:02 -08:00
Zorg 59326e80d4 Add 1.x willInstallUpdateOnQuit:immediateInstallationBlock: stub 2021-02-20 19:32:21 -08:00
Zorg 3c0962b137 Add delegate methods for downloading/extracting updates 2021-02-20 19:05:24 -08:00
Zorg 2d666b4d84 Add updater:userDidSkipThisVersion: delegate method 2021-02-20 00:38:12 -08:00
Mayur Pawashe c822f88cf1 Merge pull request #1767 from sparkle-project/generate-appcast-priv-dsa-flag
Fix -f command line argument handling (2.x)
2021-02-17 20:32:33 -08:00
Lance Lovette 16dc6c2b5b Fix -f command line argument handling
https://github.com/sparkle-project/Sparkle/issues/1763
2021-02-17 20:14:34 -08:00
Mayur Pawashe 08a7122b36 Merge pull request #1761 from sparkle-project/real-time-2
Use wall time for our updater scheduled check timer
2021-02-14 08:48:58 -08:00
Zorg 8792137fda Use wall time for our updater scheduled check timer 2021-02-14 00:40:08 -08:00
Mayur Pawashe 25820ccd4b Merge pull request #1758 from sparkle-project/flat-package-mpkg
Support mpkg for updating/installing flat non-archived packages
2021-02-13 11:12:56 -08:00
Zorg 1290b974de Support mpkg for updating/installing flat non-archived packages 2021-02-13 10:04:08 -08:00
Mayur Pawashe c39370e64b Merge pull request #1745 from sparkle-project/flat-package-2x
Add support for updating/installing from flat non-archived packages
2021-02-10 22:23:46 -08:00
Mayur Pawashe 0b9bacfd0e Merge pull request #1755 from sparkle-project/not-found-reporting
Alter update not found error message
2021-02-07 11:59:49 -08:00
Kornel ad545813f0 Merge pull request #1754 from grit96/1748-2.x
Apply custom headers to app download (2.x)
2021-02-07 15:02:19 +00:00
Geraint White 3f226ccdd7 Apply custom headers to app download
The custom headers added in #489 only applied to the appcast download.
This makes them apply to the app download as well for the case when both are hosted behind authentication.
2021-02-07 10:05:08 +00:00
Zorg 13a36cb904 Add fallback to legacy showUpdateNotFoundWithAcknowledgement method 2021-02-06 23:46:06 -08:00
Zorg c5def52133 Update user driver methods for passing error to updates not found 2021-02-06 23:31:29 -08:00
Zorg 6b0d9f0de2 Tell user if they are running newer version than latest appcast item
This ports https://github.com/sparkle-project/Sparkle/pull/1427 to 2.x
2021-02-06 23:26:51 -08:00
Zorg a9254d1e02 Create alert using NSError for update not found error 2021-02-06 23:00:44 -08:00
Mayur Pawashe 2b9a02c825 Merge pull request #1753 from sparkle-project/fix-swallow-scheduled-ui-error
Don't swallow errors for scheduled driver after update is shown
2021-02-06 10:42:00 -08:00
Zorg 9d335b1233 Don't swallow errors for scheduled driver after update is shown 2021-02-05 21:42:24 -08:00
Mayur Pawashe 43379af33e Merge pull request #1747 from sparkle-project/fix-unimplemented-preventsAutoupdate-warning
Fix minor unimplemented preventsAutoupdate synthesize warning
2021-01-31 21:48:36 -08:00
Zorg 4c14d7d556 Fix minor unimplemented preventsAutoupdate synthesize warning 2021-01-31 21:34:02 -08:00
Zorg afe03b7161 Fix compile errors in generate_appcast 2021-01-30 23:24:50 -08:00
Zorg 79a9c50d2d Add support for updating/installing from flat packages
With these changes, modern pkg's should no longer need to be archived.

Only guided package installations are supported for flat packages. Specifying an interactive package installation type will result in a rejection. If the file URL has a ".pkg" suffix it is by default assumed to be a guided pkg installation now, which relieves the burden of needing to previously specify sparkle:installationType in the app cast item enclosure, in this case (for 2.x). Moreover, this relieves the burden of developers needing to archive their pkg for Sparkle.
2021-01-30 22:59:09 -08:00
Mayur Pawashe c5add680aa Merge pull request #1736 from sparkle-project/phased-group-rollout-2x
Port phased group rollout to 2.x
2021-01-30 19:13:28 -08:00
Zorg e8ebf23504 Compute current date only once for all app cast items 2021-01-30 18:09:39 -08:00
Mayur Pawashe da5be8902c Merge pull request #1741 from sparkle-project/remove-disable-automatic-skip
Remove hiding skip button on automatic updates logic
2021-01-30 12:45:21 -08:00
Zorg 7cffceb1f7 Remove hiding skip button on automatic updates
If user opts-out of automatic downloads (eg via app pref), they should be able to skip.

This logic for detecting minimumAutoupdateVersion present isn't sufficient and consistent enough, chooses to have skip visible in cases updates aren't prevented.
2021-01-30 08:25:54 -08:00
Zorg 6c846d0fad Combine phasedUpdateGroup / background flags 2021-01-29 22:21:26 -08:00
Zorg 044313db59 Remove redundant method 2021-01-29 22:15:50 -08:00
Zorg e089b9b435 Filter supported app cast items before finding the best item
This fixes scenarios where delegates may not take min/max OS version or phased update groups in account (and they shouldn't).
2021-01-29 21:45:58 -08:00
Zorg 98dc6314a5 Remove unused delegate method addition 2021-01-24 23:44:24 -08:00
Zorg 915786e11f Fix hostSupportsItem: returning YES too early 2021-01-24 23:39:33 -08:00
Zorg 60fcc89b7e Make phased rollout interval an app cast element not an enclosure one
Previous behavior doesn't work properly with delta update items. They should not be treated separately.
2021-01-24 23:21:18 -08:00
Zorg f9d421f851 Update from previous version if newest item doesn't pass rollout 2021-01-24 21:48:33 -08:00
Zorg 27d7058e0e Don't track if update was downloaded or checked in background
Note the prior check was also wrong, it should have used the background flag from the app cast check, not the download driver.
2021-01-24 21:22:24 -08:00
Zorg 03503d37b6 Fix SUUpdateGroupIdentifierKey not being read from user defaults 2021-01-24 21:21:42 -08:00
Zorg 0364e01c3a Remove method not used publicly in SUPhasedUpdateGroupInfo.h 2021-01-24 20:18:56 -08:00
Zorg bc0e338cde Use new update group for next downloaded update if applicable 2021-01-24 20:17:10 -08:00
Zorg d97dbf7ba0 Remove unused header import 2021-01-24 18:18:01 -08:00
Zorg 9818eff9a2 Add support for phased group updates to 2.x 2021-01-24 18:14:48 -08:00
Mayur Pawashe 4767ef60ec Merge pull request #1733 from sparkle-project/alert-state
Hide skip and later buttons in appropriate scenarios
2021-01-24 10:35:53 -08:00
Zorg e197f3093a Update hiding skip button case with checking minimumAutoupdateVersion 2021-01-24 10:25:45 -08:00
Zorg 1d930b585e Merge branch '2.x' into alert-state 2021-01-24 10:20:11 -08:00
Mayur Pawashe 6da14f7c46 Merge pull request #1735 from sparkle-project/prevent-autoupdate-2x
Port preventing new version from being auto installed to 2.x
2021-01-24 10:16:42 -08:00
Zorg 5ca8984c10 Port preventing new version from being auto installed to 2.x
Original PR for master: https://github.com/sparkle-project/Sparkle/pull/1688
2021-01-24 00:21:47 -08:00
Zorg 27f31a2913 Change capitalization 2021-01-23 21:32:51 -08:00
Zorg 3e544c7d26 Use "Install On Quit" localization again 2021-01-23 21:30:47 -08:00
Zorg 507255224a Fix hidden state for automatic install button and add comments 2021-01-23 20:50:07 -08:00
Zorg c1381d48d1 Add comments and rename some title alert strings to match 1.x 2021-01-23 19:29:50 -08:00
Zorg c3ce4f624b Hide skip button when developer enables automatic downloads too 2021-01-23 18:15:58 -08:00
Zorg 0a35f9d807 Hide skip and later buttons in appropriate scenarios 2021-01-23 17:23:04 -08:00
Mayur Pawashe fd209ced12 Merge pull request #1730 from sparkle-project/migrate-keys
Add export/import options to generate_keys
2021-01-23 16:38:33 -08:00
Zorg d85c1df752 Add options to export and import private/public key pair 2021-01-23 07:51:32 -08:00
Zorg 4fdd01052b Add option to store a specified private+public key pair directly
This is useful for migrating keys from one machine to another.
2021-01-23 01:43:41 -08:00
Kornel 1278b426f2 Merge pull request #1726 from zorgiepoo/cancheckforupdates 2021-01-19 11:59:23 +00:00
Kornel e880f34f7c Merge branch '2.x' into cancheckforupdates 2021-01-19 11:41:12 +00:00
Kornel 1d178a9a19 Merge pull request #1722 from zorgiepoo/important-1x-fixes 2021-01-19 11:38:22 +00:00
Kornel 22af258dc8 Merge pull request #1728 from zorgiepoo/about-blank-fix-2x
Ignore opening about:blank URLs (2.x)
2021-01-19 11:36:28 +00:00
Zorg 01d19ca92e Ignore opening about:blank URLs
Fix from 8f19f6a8cc which I regressed accidentally.
2021-01-18 09:12:16 -08:00
Zorg 173ccc845a Fix project references from previous commit of updating bin scripts 2021-01-17 22:07:20 -08:00
Zorg a0401fade9 Update and sync bin directory from 1.x 2021-01-17 21:58:02 -08:00
Zorg c6a89eb32b Integrate "Remove locale symlinks"
https://github.com/sparkle-project/Sparkle/commit/d4d4c68ad2e11ecdf21b2a71d45710cec4834c0c
2021-01-17 19:31:44 -08:00
Zorg f7906c45c0 Fix typo 2021-01-17 17:24:29 -08:00
Zorg 6d0f7fce26 Remove outdated user driver any thread comments 2021-01-17 17:23:11 -08:00
Zorg 6308b262a0 Preserve showCanCheckForUpdates: method on user driver 2021-01-17 17:17:49 -08:00
Zorg 2066cd7232 Migrate canCheckForUpdates property from user driver -> updater 2021-01-17 17:01:48 -08:00
Zorg 64d2ee1b5d Integrate "Remove max size from update alert" (#1676)
https://github.com/sparkle-project/Sparkle/pull/1676
2021-01-17 13:14:26 -08:00
Zorg 7896b5ab44 Remove extraneous [] in ReadMe 2021-01-17 12:24:17 -08:00
Zorg c70b39ba79 Fix SUHost nullability compile errors in unit tests 2021-01-16 21:10:25 -08:00
Zorg 7c7968b2f2 Fix UIDelegate not being set from master
4390eb9eb2
2021-01-16 20:45:05 -08:00
Zorg ae81bd27a2 Update resources from master branch 2021-01-16 20:42:26 -08:00
Zorg fd6d480d3d Remove executable bit from SUHost.h/.m 2021-01-16 20:37:14 -08:00
Zorg fc18529767 Add test link in test app
https://github.com/sparkle-project/Sparkle/commit/1b209e6726a4244e131a2ab0d3c1d0098c619794
2021-01-16 20:35:27 -08:00
Zorg 6fc5011362 Integrate "tiny fixes"
https://github.com/sparkle-project/Sparkle/commit/208b0dc49a79bfea604b1c10cc1b0e50a02f7e3d
2021-01-16 20:33:52 -08:00
pierswalter 176ff8f3df Update SUSystemProfiler.m
Masked sysctl hw.cputype value when evaluating the CPU type.
Used macros from mach/machine.h instead of magic numbers.
Added support for ARM in evaluation of hw.cpusubtype.
2021-01-16 20:26:04 -08:00
Zorg f64436165b Check OS in -hostSupportsItem: 2021-01-16 20:19:15 -08:00
Zorg 154b702552 Parse and serialize osString appcast item property 2021-01-16 20:14:52 -08:00
Jake Fenton c03cc0fa17 check if SUBundleName is set before normalizing
When changing the name of an app, there's a couple things to do in order
to ensure auto-updates still work:

1. set SUBundle Name. This basically tells Sparkle "ey, expect an app
of {SUBundleName}.(app|pkg) instead of the normal name."
2. set `SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME` in
commonConfig.xccconfig to reset the name of the app.

in (2), we always used the host's bundle name, instead of checking to
see if SUBundleName was set, which means normalization doesn't work as
expected during app name changes.
2021-01-16 20:00:10 -08:00
Zorg f858b99f93 Add hr Sparkle.strings file I forgot to add previously 2021-01-16 19:52:19 -08:00
Michael Buckley 85f41927f3 Integrate "Annotate SUHost for nullability" 2021-01-16 19:52:02 -08:00
Julian Mayer d8a8282b60 fix 2021-01-16 19:48:05 -08:00
Julian Mayer a6ffe0fa71 #1352 2021-01-16 19:47:46 -08:00
Zorg 523542ad90 Re-add Croatian (hr) localization
I may have accidentally removed this.
2021-01-16 19:40:34 -08:00
Quinn Taylor 57d9a780b8 Fix second bold sentence in read-only update alert dialog. (#1515)
• Updated error dialog code in SUBasicUpdateDriver, and created a local variable to reuse `[aHost name]`.
• Updated content of Sparkle.strings files, splitting existing affected translations into 2 chunks each.
• Fixed the Catalan translation, which was using an old string key.
• Removed a few unnecessary comments in the Polish translation.
2021-01-16 19:25:44 -08:00
Zorg 8d6d81c58f Integrate "Improved error when running from translocated location"
Except correctly.

https://github.com/sparkle-project/Sparkle/pull/1392/files
2021-01-16 18:54:38 -08:00
Zorg 7a228c7e1d Integrate "fix: read SUAutomaticallyUpdate from Info.plist"
https://github.com/sparkle-project/Sparkle/commit/4f47fb02db4d2572dbd8e9822f7a985ee80bb556
2021-01-16 18:29:36 -08:00
Zorg 6e326f3cea Integrate trying to preserve Finder tags in 2.x
https://github.com/sparkle-project/Sparkle/commit/1081dcdda187a9be5635594d388090f78de940f9
2021-01-16 18:27:41 -08:00
Zorg 3c0e02f333 Integrate "Fix #1061 & #835: Sparkle clients polling too frequently"
https://github.com/sparkle-project/Sparkle/pull/1135
2021-01-16 18:13:58 -08:00
Zorg 32b0ca2e0f Fix build failure due to removed INSTALL.markdown 2021-01-12 20:19:59 -08:00
Kornel 6316c53aba Merge pull request #1720 from zorgiepoo/readme-sync 2021-01-10 22:52:01 +00:00
Zorg 8fc7cadf69 Update internal docs regarding 2.x 2021-01-10 11:10:59 -08:00
Zorg cb5eb0e47d Update repo readme & docs to sync with 1.x 2021-01-10 11:05:54 -08:00
Maurice Parker ea11447ab2 Don't initialize the webview if we don't show release notes (#1713) 2021-01-06 14:39:00 +00:00
Kornel 8a3cc2e073 Merge pull request #1711 from thebluepotato/fix-catch-22-2.x 2021-01-05 14:45:50 +00:00
Jonas Zaugg 03fb6d969f Match changes made to 1.x branch
Fixes the issue of Package.swift being updated after tag, see #1710.
2021-01-05 15:37:21 +01:00
Kornel d4fb14f1fd Merge pull request #1705 from zorgiepoo/remove-async-user-driver 2021-01-03 21:38:20 +00:00
Zorg ec4b113d17 Add assertion checks for user driver methods called from main thread 2021-01-03 10:57:49 -08:00
Boy van Amstel ace5d99a27 Update INSTALL to include submodule init step
The install description currently fails to notify the user that they should install the git submodule(s) present in the repo.

This causes `make release` to fail.
2021-01-03 15:19:03 +00:00
Zorg 164e0e4f9a Adopt WKWebView
We fallback to legacy WebView in two cases:

* On systems prior to macOS 10.11 (it may be possible to support WKWebView in 10.10, but due to an 10.11+ only API I didn't bother putting in the effort)
* For apps using the downloader XPC service which are most likely sandboxed apps without an outgoing network entitlement. WKWebView doesn't function in that case (FB6993802 - https://github.com/feedback-assistant/reports/issues/1)

Additional notes:

* Added an abstraction for using WebView or WKWebView
* Web view is created and inserted programmatically rather than from the nib which has previously caused issues (and is not allowed for WKWebView prior to 10.12 due to some NSCoding bug).
* We need to rely on WKWebView private API for drawing transparent background (FB7539179 - https://github.com/feedback-assistant/reports/issues/81). Additional notes in the code.
* We always inject a custom stylesheet for dark mode colors and default font family/size (for WKWebView).
* This should also improve the Catalyst support story (#1482)
2021-01-03 10:10:57 +00:00
Mayur Pawashe 09178f70e9 Migrate to GitHub Actions CI (2.x) (#1706) 2021-01-03 10:08:35 +00:00
Zorg 3bc20cb096 Add noreturn attributes to command line user driver methods 2020-12-31 11:17:55 -08:00
Zorg 80cecd37b5 Fix compile error with missing '[' 2020-12-31 11:16:11 -08:00
Zorg 7951b81b69 Eliminate assumption that user driver calls are invoked in any thread
This reduces friction in creating a SPUUserDriver. This assumption that the calls could be made from any thread is a relic of the past of separating the user driver into a different process from the updater/scheduler, which is no longer sane or supported.

This should speed up things very slightly too.
2020-12-31 11:00:59 -08:00
Kornel 066da58f4d Merge pull request #1703 from sparkle-project/base-internationalization-2.x 2020-12-29 21:36:32 +00:00
Zorg 5e5aebffd3 Reduce code duplication by using SUAdHocCodeSigning 2020-12-28 15:35:45 -08:00
Zorg 98eef51931 Fix Test Application by disabling hardened runtime for XPC helper 2020-12-28 15:24:03 -08:00
Zorg 5e0b3f2a19 Add localization strings files for Test Application 2020-12-28 15:20:37 -08:00
Zorg 48a1379dbe Add strings files for SUUpdateAlert and SUUpdatePermissionPrompt 2020-12-28 15:13:28 -08:00
Zorg 3038218ea7 Enable base internationalization
Fix issues with Test Application.
2020-12-28 14:48:59 -08:00
Charles Srstka 238fd42bb3 Support getting app icon from asset catalog 2020-12-10 08:56:53 +00:00
Martin Pilkington eac4522817 System profiler privacy and transparency (#1690) 2020-11-30 13:12:48 +00:00
Kornel 94d05336a6 Merge pull request #1664 from skelpo/improve-generator-tools 2020-10-13 12:35:14 +01:00
Gwynne Raskind 93e4fd9424 Fix generate_appcast so links to localized release notes are embedded as full URLs instead of unescaped filenames. This makes them load reliably in complex contexts (such as the presence of characters like spaces in the filenames). 2020-10-12 12:43:43 -05:00
Gwynne Raskind 741ec1a08b Further cleanup generate_keys and its new "lookup-only mode". 2020-10-06 08:14:44 -05:00
Gwynne Raskind 7a8ead559b Clean up generate_keys/main.swift quite a bit - more comments, better output to console, cleaner error reporting 2020-10-06 07:54:08 -05:00
Kornel c802a38c92 Merge pull request #1662 from zorgiepoo/2.x-module-imports 2020-10-04 12:37:14 +01:00
Zorg 8947a6e50d Merge branch '2.x' into 2.x-module-imports 2020-10-03 11:10:58 -07:00
Kornel 5e73e70322 Merge pull request #1660 from zorgiepoo/2.x-double-quote-include 2020-10-03 14:13:52 +01:00
Zorg e2bf94df7e Fix more missing import warnings 2020-10-03 01:59:29 -07:00
Zorg a266b400cb Add more missing module imports 2020-10-03 01:54:53 -07:00
Zorg 7b4c648812 Use module imports to avoid warnings from clients 2020-10-03 01:14:50 -07:00
Zorg d38fd92668 Use double quote includes in a bunch of other places I missed 2020-10-03 00:41:59 -07:00
Zorg 772e610537 Set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER instead 2020-10-03 00:38:15 -07:00
Zorg 02e11f3c3a Add -Wno-quoted-include-in-framework-header to ConfigCommon 2020-10-03 00:10:53 -07:00
Zorg 8c7adbdca7 Use double quote includes with pragma ignore warning 2020-10-03 00:10:24 -07:00
Kornel 852d678585 Merge pull request #1656 from skelpo/merge-from-1.x 2020-09-23 21:13:50 +01:00
Gwynne Raskind e3ba2388e8 Fix tests to actually build 2020-09-23 07:36:55 -05:00
Denis Dzyubenko 6f1fceb7d4 generate_appcast follow symbolic links
When archives are stored as symlinks e.g. due to storing binary files in a
git-annex repository, everything works file except file size in the generate
feed xml file. This patch makes generate_appcast correctly determine file size
by following the symlink

(cherry picked from commit 7233bb93e7)
2020-09-23 07:28:12 -05:00
Bi11 bc6d15a13c Support App Store URL scheme in release note webview
(cherry picked from commit f2fc729b69)
2020-09-23 07:27:51 -05:00
Brad Andalman 65cab6a14d generate_appcast can update the release notes element’s URL when required
Previously, generate_appcast could only add or remove the release notes element for an update. This was probably fine, because it was unlikely to change: the release notes URL was determined by the SUFeedURL.

However, now that —release-notes-url-prefix was added, the release notes element CAN change. So, with this commit, if the release notes element is present for an update, the URL will be set correctly.

(cherry picked from commit 7c7e924ed4)
2020-09-23 07:26:54 -05:00
Kornel 923f15220f Merge pull request #1648 from oneeightyg/feature-1646-generate-appcast-output-filename 2020-09-23 07:26:36 -05:00
Kornel 5fcc9a8aa9 Merge pull request #1644 from oneeightyg/feature-1642-release-notes-url-prefix
Add —release-notes-url-prefix to generate_appcast

(cherry picked from commit 7ea72a2af4)
2020-09-23 07:24:03 -05:00
Kornel 500d97d8ff Merge pull request #1635 from thebluepotato/spm-xcframework-2.x 2020-08-29 14:02:45 +01:00
Jonas Zaugg d1367393c2 Travis Xcode updated to newer beta 2020-08-29 02:02:24 +02:00
Jonas Zaugg 404b67a256 Mirror changes made to 1.x branch
Fixup Travis, build through Xcode scheme, etc.
2020-08-03 02:36:04 +02:00
Jonas Zaugg de8de29df2 Mirror changes made to the spm-xcframework branch and include SparkleCore 2020-08-03 02:09:39 +02:00
Jonas Zaugg 6a55563307 Add SPM binary target support 2020-08-03 02:06:48 +02:00
Kornel 438f4a21d5 Merge pull request #1636 from skelpo/forward-fixes 2020-08-01 20:58:28 +01:00
Gwynne Raskind 32bb57c029 Cosmetic fixes to ConfigCommon.xcconfig. Disable COPY_PHASE_STRIP in ConfigCommonRelease.xcconfig to silence a large number of warnings about failing to strip codesigned binaries. 2020-07-25 02:20:53 -05:00
Gwynne Raskind 1c77f59214 Fix incorrect paths in project file 2020-07-25 02:20:08 -05:00
Gwynne Raskind a95f1592cd Fix several dozen warnings. Fix several things to actually respect the 10.9 minimum of the beta. 2020-07-25 02:19:50 -05:00
Gwynne Raskind e7f8161ae4 Update last migration check version of project and schemes as of Xcode 12's checks. Fix how WMO is enabled for Swift code in Release builds. 2020-07-25 02:17:07 -05:00
Gwynne Raskind 9422bf16ae Forward-port improvements to generate_appcast from main branch (overridable download URL prefixes, extracting archives to uniqued output directory names during generation, -h flag to print usage, support for specifying Ed25519 key as string on command line, much smarter args parsing, ability to override keychain used to find signing keys) 2020-07-24 20:43:22 -05:00
Gwynne Raskind 418068e902 Forward-port PR #1499 (localized release notes in appcast) to 2.x 2020-07-24 20:33:35 -05:00
Gwynne Raskind 04b2122fed SUPublicEDKey expects to be a string, not data. Sigh. 2020-07-22 14:15:43 -05:00
Gwynne Raskind bdffcb0dd5 Disable the ability to create synchronizable keys for now. Requires entitlements on the generate tool which is a giant pain in the rear. Tweak the output a bit more so it's nice and consistent. 2020-07-22 10:52:01 -05:00
Gwynne Raskind be25c2ac64 Add the ability to make a generated signing key syncable over iCloud Keychain. Heavily overhauls the UI to actually explain things a little and behave how it's supposed to. 2020-07-22 10:45:02 -05:00
Gwynne Raskind 8487a24584 Default the Distribution scheme to build Release because who cares 2020-07-22 07:52:22 -05:00
Gwynne Raskind 820fdadfd7 Forward-port the fix for the stupid use of backticks in an echo command in build-docs.sh 2020-07-22 07:52:06 -05:00
Gwynne Raskind 1343c27805 Forward-port the newer generate_keys and sign_update tools (or at least their inclusion in the build) from 1.x, including changing the distribution archive from bzip2 to xz. 2020-07-22 07:51:45 -05:00
Kornel Lesiński 7acb6c4292 Revert "Add dependencies to "Set Git Version Info" Run Script phase"
This reverts commit 9592e35d1c.
2020-07-20 21:29:54 +01:00
Jordan Rose 9592e35d1c Add dependencies to "Set Git Version Info" Run Script phase
This keeps it from running when nothing's changed, which keeps Xcode
from re-signing the framework when nothing's changed, which keeps
downstream clients from re-copying the framework when nothing's
changed.
2020-07-16 15:40:39 +01:00
Jordan Rose e7e20e6ac8 Represent invalid public keys and signatures explicitly
Rather than using a valid-but-incorrect public key or signature to
make sure a failure to parse turns into a failure to validate, only
return a public key / signature when it is both present and at least
minimally valid. Syntactically invalid public keys / signatures are
also logged explicitly.
2020-06-25 00:01:09 +01:00
Jordan Rose 2b4b2a4443 SUDSAVerifierTest -> SUSignatureVerifierTest
The file got renamed, but the test class did not.
No functionality change.
2020-06-25 00:01:09 +01:00
Jordan Rose bd601b2f8c If a signature is present but invalid, don't just ignore it
Otherwise, a typo in an Ed25519 signature could lead to falling back
to DSA.
2020-06-25 00:01:09 +01:00
Jordan Rose b137b7f072 Test SUSignatureVerifier with Ed25519 keys 2020-06-25 00:01:09 +01:00
Jordan Rose 705638799c Allow relative URLs in appcasts
The base URL is taken from the server response rather than from the
original requested URL to account for redirects.
2020-06-23 22:40:53 +01:00
Jordan Rose 6b47d3fe90 Remove classes from test target that are already in Sparkle.framework
Avoids "Class SUCodeSigningVerifier is implemented in both
Sparkle.framework/Versions/A/Sparkle and
Sparkle Unit Tests.xctest/Contents/MacOS/Sparkle Unit Tests.
One of the two will be used. Which one is undefined."
2020-06-23 22:37:50 +01:00
Jordan Rose 3e000a897f Test post-validation of code-signed binaries
This gets more complicated, since binaries can be just code-signed, or
use both code signing and DSA keys, or be rotating keys for one or the
other.

The code signing test cases emulate certificate rotation by changing
the "identifier" for the bundle; the script used to sign each bundle
(with ad hoc signing) is included to support future expansion of
testing.
2020-06-16 21:13:39 +01:00
Jordan Rose b969c31f07 Test SUUpdateValidator's post-validation logic
The actual tests here are the same as pre-validation; things only get
complicated when validating with code signing. The setup's a little
more involved though, since we need a supposedly-downloaded bundle to
do anything.

Also test invalid signatures, which are not always the same as absent
signatures.
2020-06-16 21:13:39 +01:00
Jordan Rose 299157c3e7 Start SUUpdateValidatorTest with prevalidation testing 2020-06-16 21:13:39 +01:00
Philippe Casgrain 3a8040ae2e Fixed typo in sign_update usage 2020-06-16 13:19:43 +01:00
Philippe Casgrain 9a74b23f7f Replaced deprecated method
-initWithBase64Encoding has been deprecated since OS X 10.9, and that
is our deployment target.
2020-06-16 13:19:43 +01:00
550 changed files with 16819 additions and 18609 deletions

No files matched your search

@@ -0,0 +1,19 @@
---
name: Enhancements and Bug Fixes
about: Found a bug? Want to implement a new feature?
title: ''
assignees: ''
---
## Summary
[provide general summary to the issue or enhancement and its rationale]
## Possible Fix
[not obligatory, but suggest fixes or reasons for the bug]
## Version
[please specify versions of Sparkle this is applicable to; note new pull requests must be developed and landed in 2.x development branch first and the 1.x (master) branch is feature-frozen]
@@ -0,0 +1,34 @@
---
name: Sparkle 1.x doesn't work in my app
about: Problems with integration, unexpected errors
title: ''
labels: '1.x'
assignees: ''
---
<!--
The answer to your issue is probably already in Console.app on your computer.
Please use Console.app and search for Sparkle.
Please try troubleshooting steps:
https://github.com/sparkle-project/Sparkle#troubleshooting
-->
### Description of the problem
### Do you use Sandboxing in your app?
### Version of `Sparkle.framework` in the latest version of your app
### Version of `Sparkle.framework` in the old version of app that your users have (or N/A)
### Sparkle's output from Console.app
```
```
### Steps to reproduce the behavior
@@ -0,0 +1,34 @@
---
name: Sparkle 2.x doesn't work in my app
about: Problems with using the beta version of Sparkle 2
title: ''
labels: '2.x'
assignees: ''
---
<!--
The answer to your issue is probably already in Console.app on your computer.
Please use Console.app and search for Sparkle.
Please try troubleshooting steps:
https://github.com/sparkle-project/Sparkle#troubleshooting
-->
### Description of the problem
### Do you use Sandboxing in your app?
### Version of `Sparkle.framework` in the latest version of your app
### Version of `Sparkle.framework` in the old version of app that your users have (or N/A)
### Sparkle's output from Console.app
```
```
### Steps to reproduce the behavior
+29
View File
@@ -0,0 +1,29 @@
(Insert summary of your pull request here)
Fixes # (issue)
## Checklist:
- [ ] My change is being tested and reviewed against the Sparkle 2.x branch. New changes must be developed on the 2.x development branch first.
- [ ] My change is being backported to master branch (Sparkle 1.x). Please create a separate pull request for 1.x, should it be backported. Note 1.x is feature frozen and is only taking bug fixes, localization updates, and critical OS adoption enhancements.
- [ ] I have reviewed and commented my code, particularly in hard-to-understand areas.
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] My change is or requires a documentation or localization update
## Testing
I tested and verified my change by using one or multiple of these methods:
- [ ] Sparkle Test App
- [ ] Unit Tests
- [ ] My own app
- [ ] Other (please specify)
(Describe all the cases that were tested)
macOS version tested: [place version here]
+67
View File
@@ -0,0 +1,67 @@
name: Build & Tests
on:
push:
branches: [ 2.x, master ]
pull_request:
branches: [ 2.x, master ]
jobs:
build:
strategy:
matrix:
xcode: ['xcode12.5', 'xcode13']
include:
- xcode: 'xcode12.5'
xcode-path: '/Applications/Xcode_12.5.app/Contents/Developer'
upload-dist: true
- xcode: 'xcode13'
xcode-path: '/Applications/Xcode_13.0.app/Contents/Developer'
upload-dist: false # In Beta, so no upload
name: Build and Test Sparkle
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Build Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Run Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Build UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Run UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Build Release Distribution
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build
- name: Archive Test Results
if: failure()
uses: actions/upload-artifact@v2
with:
name: build-logs
path: build/Logs
- name: Upload Distribution
if: ${{ success() && matrix.upload-dist }}
uses: actions/upload-artifact@v2
with:
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz
path: build/Build/Products/Release/sparkle-dist.tar.xz
+4
View File
@@ -41,3 +41,7 @@ Carthage/Build
Network Trash Folder
Temporary Items
.apdisk
# Swift Package Manager
/.build
.swiftpm
-7
View File
@@ -1,7 +0,0 @@
os: osx
language: objective-c
osx_image:
- xcode10.3
- xcode11.4
script:
- set -o pipefail && xcodebuild test -project Sparkle.xcodeproj -scheme Distribution -derivedDataPath build -enableCodeCoverage YES | xcpretty
+1
View File
@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, readonly) BOOL connected;
@property (nonatomic, nullable) NSError *invalidationError;
@end
+8
View File
@@ -31,6 +31,7 @@
@synthesize agent = _agent;
@synthesize delegate = _delegate;
@synthesize connected = _connected;
@synthesize invalidationError = _invalidationError;
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate
{
@@ -105,4 +106,11 @@
acknowledgement();
}
- (void)connectionWillInvalidateWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
self.invalidationError = error;
});
}
@end
+6 -2
View File
@@ -9,12 +9,16 @@
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface AppInstaller : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier;
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
- (void)start;
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn));
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn));
@end
NS_ASSUME_NONNULL_END
+86 -75
View File
@@ -11,6 +11,7 @@
#import "SUInstaller.h"
#import "SUUpdateValidator.h"
#import "SULog.h"
#import "SULog+NSError.h"
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUStandardVersionComparator.h"
@@ -21,7 +22,7 @@
#import "SUFileManager.h"
#import "SPUInstallationInfo.h"
#import "SUAppcastItem.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#import "SUInstallerCommunicationProtocol.h"
#import "AgentConnection.h"
#import "SPUInstallerAgentProtocol.h"
@@ -54,6 +55,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@property (nonatomic) SUUpdateValidator *updateValidator;
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
@property (nonatomic, readonly) NSString *homeDirectory;
@property (nonatomic, readonly) NSString *userName;
@property (nonatomic) SUHost *host;
@property (nonatomic, copy) NSString *updateDirectoryPath;
@property (nonatomic, copy) NSString *downloadName;
@@ -85,6 +88,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@synthesize agentConnection = _agentConnection;
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
@synthesize terminationListener = _terminationListener;
@synthesize updateValidator = _updateValidator;
@synthesize host = _host;
@@ -106,7 +111,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@synthesize finishedValidation = _finishedValidation;
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
if (!(self = [super init])) {
return nil;
@@ -114,6 +119,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
_hostBundleIdentifier = [hostBundleIdentifier copy];
_homeDirectory = [homeDirectory copy];
_userName = [userName copy];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
_xpcListener.delegate = self;
@@ -147,8 +155,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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 cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Invalidation on remote port being called, and installation is not close enough to completion!" }]];
}
strongSelf.communicator = nil;
strongSelf.activeConnection = nil;
@@ -170,13 +177,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: installation data was never received" }]];
}
if (!self.agentConnection.connected) {
SULog(SULogLevelError, @"Timeout: agent connection was never initiated");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: agent connection was never initiated" }]];
}
});
}
@@ -186,11 +191,12 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
NSError *unarchiverError = nil;
BOOL success = NO;
if (!unarchiver) {
SULog(SULogLevelError, @"Error: No valid unarchiver for %@", archivePath);
unarchiverError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No valid unarchiver was found for %@", archivePath] }];
success = NO;
} else {
@@ -201,27 +207,27 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) {
success = [self.updateValidator validateDownloadPath];
success = [self.updateValidator validateDownloadPathWithError:&unarchiverError];
} else {
success = YES;
}
}
if (!success) {
[self unarchiverDidFail];
[self unarchiverDidFailWithError:unarchiverError];
} else {
[unarchiver
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
if (error != nil) {
[self unarchiverDidFail];
[self unarchiverDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to unarchive %@", archivePath], NSUnderlyingErrorKey: (NSError * _Nonnull)error }]];
} else {
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath];
NSError *validationError = nil;
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
if (!validationSuccess) {
SULog(SULogLevelError, @"Error: update validation was a failure");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]];
} else {
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
@@ -243,8 +249,22 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
}
- (void)unarchiverDidFail
- (void)clearUpdateDirectory
{
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);
}
self.updateDirectoryPath = nil;
}
}
- (void)unarchiverDidFailWithError:(NSError *)error
{
SULog(SULogLevelError, @"Failed to unarchive file");
SULogError(error);
// No longer need update validator until next possible extraction (eg: if initial delta update fails)
self.updateValidator = nil;
@@ -252,14 +272,15 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// 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 clearUpdateDirectory];
self.downloadName = nil;
self.decryptionPassword = nil;
self.signatures = nil;
self.relaunchPath = nil;
self.host = nil;
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:[NSData data]];
NSData *archivedError = SPUArchiveRootObjectSecurely(error);
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:archivedError != nil ? archivedError : [NSData data]];
}
- (void)agentConnectionDidInitiate
@@ -273,8 +294,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (void)agentConnectionDidInvalidate
{
if (!self.finishedValidation || !self.agentInitiatedConnection) {
SULog(SULogLevelError, @"Error: Agent connection invalidated before installation began");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Error: Agent connection invalidated before installation began" }];
NSError *agentError = self.agentConnection.invalidationError;
if (agentError != nil) {
userInfo[NSUnderlyingErrorKey] = agentError;
}
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:userInfo]];
}
}
@@ -293,8 +320,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout error: failed to retreive process identifier from agent" }]];
}
});
}
@@ -309,15 +335,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) {
SULog(SULogLevelError, @"Error: Failed to unarchive input installation data");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to unarchive input installation data" }]];
return;
}
NSString *installationType = installationData.installationType;
if (!SPUValidInstallationType(installationType)) {
SULog(SULogLevelError, @"Error: Received invalid installation type: %@", installationType);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received invalid installation type: %@", installationType] }]];
return;
}
@@ -325,15 +349,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier] }]];
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to obtain relaunch path from installation data" }]];
return;
}
@@ -344,8 +366,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSString *cacheInstallationPath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootCacheInstallationPath];
if (cacheInstallationPath == nil) {
SULog(SULogLevelError, @"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath] }]];
return;
}
@@ -358,8 +379,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to move download archive to new location", NSUnderlyingErrorKey: moveError }]];
return;
}
@@ -367,22 +387,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to retrieve download archive path from %@", downloadDestinationURL] }]];
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to retrieve download archive attributes from %@", downloadDestinationPath] }]];
return;
}
if (![(NSString *)archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) {
SULog(SULogLevelError, @"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]);
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]] }]];
return;
}
@@ -425,6 +444,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
});
}
});
} else if (identifier == SPUCancelInstallation) {
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:0 error:nil];
});
} else if (identifier == SPUUpdaterAlivePong) {
self.receivedUpdaterPong = YES;
}
@@ -438,23 +461,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(self.installerQueue, ^{
NSError *installerError = nil;
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
if (installer == nil) {
SULog(SULogLevelError, @"Error: Failed to create installer instance with error: %@", installerError);
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to create installer instance", NSUnderlyingErrorKey: installerError }]];
});
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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to start installer", NSUnderlyingErrorKey: firstStageError }]];
});
return;
}
@@ -502,11 +523,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[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];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently" }]];
});
}
}
@@ -515,8 +535,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
{
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
if (!success) {
SULog(SULogLevelError, @"Failed to listen for application termination");
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]];
return;
}
@@ -549,18 +568,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
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 performCleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE];
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
});
return;
}
@@ -577,27 +591,29 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[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.agentConnection.agent relaunchApplication];
}
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
[self.installer performCleanup];
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
});
});
}];
}
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn))
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn))
{
if (error != nil) {
SULogError(error);
NSData *errorData = SPUArchiveRootObjectSecurely((NSError * _Nonnull)error);
if (errorData != nil) {
[self.communicator handleMessageWithIdentifier:SPUInstallerError data:errorData];
}
}
// It's nice to tell the other end we're invalidating
[self.activeConnection invalidate];
@@ -609,12 +625,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[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);
}
}
[self clearUpdateDirectory];
exit(status);
}
+2
View File
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
@property (nonatomic, readonly) BOOL canSilentlyInstall;
@property (nonatomic) BOOL systemDomain;
@end
NS_ASSUME_NONNULL_END
+12 -2
View File
@@ -14,22 +14,30 @@
static NSString *SUAppcastItemKey = @"SUAppcastItem";
static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
static NSString *SUSystemDomainKey = @"SUSystemDomain";
@implementation SPUInstallationInfo
@synthesize appcastItem = _appcastItem;
@synthesize canSilentlyInstall = _canSilentlyInstall;
@synthesize systemDomain = _systemDomain;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall systemDomain:(BOOL)systemDomain
{
self = [super init];
if (self != nil) {
_appcastItem = appcastItem;
_canSilentlyInstall = canSilentlyInstall;
_systemDomain = systemDomain;
}
return self;
}
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
{
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall systemDomain:NO];
}
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
{
SUAppcastItem *appcastItem = [decoder decodeObjectOfClass:[SUAppcastItem class] forKey:SUAppcastItemKey];
@@ -38,13 +46,15 @@ static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
}
BOOL canSilentlyInstall = [decoder decodeBoolForKey:SUCanSilentlyInstallKey];
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall];
BOOL systemDomain = [decoder decodeBoolForKey:SUSystemDomainKey];
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall systemDomain:systemDomain];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
[coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
[coder encodeBool:self.systemDomain forKey:SUSystemDomainKey];
}
+ (BOOL)supportsSecureCoding
+2 -2
View File
@@ -22,14 +22,14 @@ NS_ASSUME_NONNULL_BEGIN
* 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;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)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, readonly, nullable) SUSignatures *signatures; // nullable because although not using signatures is deprecated, it's still supported
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
@end
+1 -1
View File
@@ -30,7 +30,7 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
@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
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
+7 -6
View File
@@ -10,10 +10,6 @@
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
extern NSString *SPUAppcastItemArchiveKey;
// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
{
@@ -26,7 +22,8 @@ typedef NS_ENUM(int32_t, SPUInstallerMessageType)
SPUInstallationFinishedStage1 = 6,
SPUInstallationFinishedStage2 = 7,
SPUInstallationFinishedStage3 = 8,
SPUUpdaterAlivePing = 9
SPUUpdaterAlivePing = 9,
SPUInstallerError = 10
};
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
@@ -34,15 +31,19 @@ typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
SPUInstallationData = 0,
SPUSentUpdateAppcastItemData = 1,
SPUResumeInstallationToStage2 = 2,
SPUUpdaterAlivePong = 3
SPUUpdaterAlivePong = 3,
SPUCancelInstallation = 4
};
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
// Used by framework to communicate to installer (Autoupdate)
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
// Used by framework to communicate to progress agent tool (Updater)
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
// Used by progress agent tool to communicate to installer (Autoupdate)
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
NS_ASSUME_NONNULL_END
+6 -10
View File
@@ -7,24 +7,19 @@
//
#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
// These should be very short because of length restrictions
#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
// macOS 10.8 couldn't handle service names that are >= 64 characters,
// but 10.9 raised this to >= 128 characters
#define MAX_SERVICE_NAME_LENGTH 127u
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
{
@@ -55,9 +50,10 @@ BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUI
case SPUInstallationFinishedStage3:
legal = (oldMessageType == SPUInstallationFinishedStage2);
break;
case SPUInstallerError:
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
// So just always allow these type of messages
legal = YES;
break;
}
+3 -3
View File
@@ -30,7 +30,7 @@ static void printUsage(NSString *programName)
fprintf(stderr, "%s version [<patch-file>]\n", [programName UTF8String]);
}
static BOOL runCreateCommand(NSString *programName, NSArray *args)
static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
{
if (args.count < 3 || args.count > 5) {
printUsage(programName);
@@ -62,7 +62,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
BOOL verbose = (verboseIndex != NSNotFound);
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
NSArray *versionComponents = nil;
NSArray<NSString *> *versionComponents = nil;
if (versionField) {
versionComponents = [versionField componentsSeparatedByString:@"="];
if (versionComponents.count != 2) {
@@ -218,7 +218,7 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args)
int main(int __unused argc, char __unused *argv[])
{
@autoreleasepool {
NSArray *args = [[NSProcessInfo processInfo] arguments];
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
NSString *programName = [args[0] lastPathComponent];
if (args.count < 2) {
+21
View File
@@ -0,0 +1,21 @@
//
// SUFlatPackageUnarchiver.h
// Autoupdate
//
// Created by Mayur Pawashe on 1/30/21.
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
// An unarchiver for flat packages that doesn't really do any unarchiving
@interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType;
@end
NS_ASSUME_NONNULL_END
+67
View File
@@ -0,0 +1,67 @@
//
// SUFlatPackageUnarchiver.m
// Autoupdate
//
// Created by Mayur Pawashe on 1/30/21.
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#import "SUFlatPackageUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SPUInstallationType.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SUFlatPackageUnarchiver ()
@property (nonatomic, readonly) NSString *flatPackagePath;
@property (nonatomic, readonly) NSString *expectedInstallationType;
@end
@implementation SUFlatPackageUnarchiver
@synthesize flatPackagePath = _flatPackagePath;
@synthesize expectedInstallationType = _expectedInstallationType;
+ (BOOL)canUnarchivePath:(NSString *)path
{
return [path.pathExtension isEqualToString:@"pkg"] || [path.pathExtension isEqualToString:@"mpkg"];
}
+ (BOOL)mustValidateBeforeExtraction
{
return YES;
}
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType
{
self = [super init];
if (self != nil) {
_flatPackagePath = [flatPackagePath copy];
_expectedInstallationType = [installationType copy];
}
return self;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
// Flat packages must use guided package installs, not interactive
BOOL isDirectory = NO;
if (![self.expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not have guided installation type but %@ instead", self.expectedInstallationType]}]];
} else if (![[NSFileManager defaultManager] fileExistsAtPath:self.flatPackagePath isDirectory:&isDirectory] || isDirectory) {
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", self.flatPackagePath]}]];
} else {
[notifier notifyProgress:1.0];
[notifier notifySuccess];
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.flatPackagePath]; }
@end
+1 -1
View File
@@ -21,6 +21,6 @@ A guided installation can be started by applications other than the application
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
@end
+14 -5
View File
@@ -8,7 +8,7 @@
#import <sys/stat.h>
#import "SUGuidedPackageInstaller.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#include "AppKitPrevention.h"
@@ -16,21 +16,24 @@
@interface SUGuidedPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *installationPath;
@property (nonatomic, readonly, copy) NSString *homeDirectory;
@property (nonatomic, readonly, copy) NSString *userName;
@end
@implementation SUGuidedPackageInstaller
@synthesize packagePath = _packagePath;
@synthesize installationPath = _installationPath;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
self = [super init];
if (self != nil) {
_packagePath = [packagePath copy];
_installationPath = [installationPath copy];
_homeDirectory = [homeDirectory copy];
_userName = [userName copy];
}
return self;
}
@@ -48,6 +51,8 @@
NSTask *task = [[NSTask alloc] init];
task.launchPath = installerPath;
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
// Set the $HOME and $USER variables so pre/post install scripts reference the correct user environment
task.environment = @{@"HOME": self.homeDirectory, @"USER": self.userName};
task.standardError = [NSPipe pipe];
task.standardOutput = [NSPipe pipe];
@@ -70,6 +75,10 @@
return success;
}
- (void)performCleanup
{
}
- (BOOL)canInstallSilently
{
return YES;
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SUInstaller : NSObject
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
+7 -17
View File
@@ -13,8 +13,9 @@
#import "SUHost.h"
#import "SUConstants.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#import "SPUInstallationType.h"
#import "SUNormalization.h"
#include "AppKitPrevention.h"
@@ -111,7 +112,7 @@
return newAppDownloadPath;
}
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
{
BOOL isPackage = NO;
BOOL isGuided = NO;
@@ -134,7 +135,7 @@
*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];
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath homeDirectory:homeDirectory userName:userName];
}
} else if (isPackage) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
@@ -142,7 +143,7 @@
*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];
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
}
} else {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
@@ -152,11 +153,12 @@
} else {
NSString *normalizedInstallationPath = nil;
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
normalizedInstallationPath = SUNormalizedInstallationPath(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
// Check progress agent app which computes normalized path too according to these rules
NSString *installationPath;
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
installationPath = normalizedInstallationPath;
@@ -171,16 +173,4 @@
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
+6 -3
View File
@@ -22,14 +22,17 @@ NS_ASSUME_NONNULL_BEGIN
// Should be able to be called from non-main thread
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
// Any clean up work can be done here
// This is work that may be performed after the user application may have been updated / relaunched,
// or after an error occurred in the previous stages.
// Should be able to be called from any thread
- (void)performCleanup;
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
// If this returns NO, then the installation can fail if the user did not directly request for the install to occur.
// Should be thread safe
- (BOOL)canInstallSilently;
// The destination and installation path of the bundle being updated
- (NSString *)installationPath;
@end
NS_ASSUME_NONNULL_END
+1 -1
View File
@@ -14,6 +14,6 @@
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath;
@end
+6 -5
View File
@@ -8,7 +8,7 @@
#import "SUPackageInstaller.h"
#import "SUConstants.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#import "SULog.h"
@@ -17,7 +17,6 @@
@interface SUPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *installationPath;
@end
@@ -26,14 +25,12 @@
static NSString *SUOpenUtilityPath = @"/usr/bin/open";
@synthesize packagePath = _packagePath;
@synthesize installationPath = _installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
- (instancetype)initWithPackagePath:(NSString *)packagePath
{
self = [super init];
if (self != nil) {
_packagePath = [packagePath copy];
_installationPath = [installationPath copy];
}
return self;
}
@@ -73,6 +70,10 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
return YES;
}
- (void)performCleanup
{
}
- (BOOL)canInstallSilently
{
return NO;
+35 -29
View File
@@ -9,7 +9,7 @@
#import "SUPipedUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#include "AppKitPrevention.h"
@@ -105,43 +105,49 @@
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];
@try {
[task launch];
}
@catch (NSException *e) {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
}
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]}];
if (!error) {
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
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, command '%@' returned %d", command, [task terminationStatus]]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
+127 -78
View File
@@ -11,8 +11,8 @@
#import "SUConstants.h"
#import "SUHost.h"
#import "SULog.h"
#import <Sparkle/SUErrors.h>
#import <Sparkle/SUVersionComparisonProtocol.h>
#import "SUErrors.h"
#import "SUVersionComparisonProtocol.h"
#import "SUStandardVersionComparator.h"
@@ -24,6 +24,10 @@
@property (nonatomic, copy, readonly) NSString *bundlePath;
@property (nonatomic, copy, readonly) NSString *installationPath;
@property (nonatomic) NSURL *temporaryOldDirectory;
// We get an obj-c warning if we use 'newTemporaryDirectory' name about new + ownership stuff, so use 'temporaryNewDirectory' instead
@property (nonatomic) NSURL *temporaryNewDirectory;
@end
@implementation SUPlainInstaller
@@ -31,6 +35,8 @@
@synthesize host = _host;
@synthesize bundlePath = _bundlePath;
@synthesize installationPath = _installationPath;
@synthesize temporaryOldDirectory = _temporaryOldDirectory;
@synthesize temporaryNewDirectory = _temporaryNewDirectory;
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
{
@@ -81,7 +87,10 @@
// 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");
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
}
return NO;
}
@@ -91,9 +100,14 @@
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
if (tempNewDirectoryURL == nil) {
SULog(SULogLevelError, @"Failed to make new temp directory");
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to make new temporary directory" }];
}
return NO;
}
self.temporaryNewDirectory = tempNewDirectoryURL;
if (progress) {
progress(2/10.0);
@@ -103,8 +117,9 @@
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];
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path] }];
}
return NO;
}
@@ -133,15 +148,22 @@
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;
// Try to preserve Finder Tags
NSArray *resourceTags = nil;
BOOL retrievedResourceTags = [oldURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
if (retrievedResourceTags && resourceTags.count > 0) {
[newTempURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
}
// 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
NSError *changeOwnerAndGroupError = nil;
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:&changeOwnerAndGroupError]) {
// Not a fatal error
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
SULog(SULogLevelError, @"Error: %@", changeOwnerAndGroupError);
}
if (progress) {
progress(5/10.0);
@@ -157,61 +179,79 @@
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;
// First try replacing the application atomically
NSError *replaceError = nil;
BOOL replacedApp;
if (@available(macOS 10.13, *)) {
// If the app is normalized and the installation path differs, go through the old swap path
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && ![oldURL.path isEqual:installationURL.path]) {
replacedApp = NO;
} else {
// Note: in my experience, a clone of the app may still be left at newTempURL
// This is OK though because we will be cleaning up the temporary directory later in -performCleanup:
replacedApp = [fileManager replaceItemAtURL:installationURL withItemAtURL:newTempURL error:&replaceError];
}
} else {
replacedApp = 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);
if (!replacedApp) {
// Otherwise swap out the old and new applications using the legacy path
// Just forget about our updated app on failure
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
if (replaceError != nil) {
SULog(SULogLevelDefault, @"Invoking fallback from failing to replace original item with error: %@", replaceError);
}
return NO;
}
// 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;
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);
// 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) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create temporary directory for old app at %@", oldURL.path] }];
}
return NO;
}
// 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;
}
self.temporaryOldDirectory = tempOldDirectoryURL;
if (progress) {
progress(9/10.0);
}
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]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path] }];
}
return NO;
}
// Cleanup
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
if (progress) {
progress(8/10.0);
}
// Move the new app to its final destination
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path] }];
}
// Attempt to restore our old app back the way it was on failure
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
return NO;
}
if (progress) {
progress(9/10.0);
}
}
if (progress) {
progress(10/10.0);
@@ -222,28 +262,24 @@
- (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];
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) {
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];
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;
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
}
return NO;
}
return YES;
@@ -256,6 +292,19 @@
return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
}
- (void)performCleanup
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
if (self.temporaryNewDirectory != nil) {
[fileManager removeItemAtURL:self.temporaryNewDirectory error:NULL];
}
if (self.temporaryOldDirectory != nil) {
[fileManager removeItemAtURL:self.temporaryOldDirectory error:NULL];
}
}
- (BOOL)canInstallSilently
{
return YES;
+71 -33
View File
@@ -96,47 +96,85 @@
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);
switch (self.pubKeys.ed25519PubKeyStatus) {
case SUSigningInputStatusAbsent:
if (signatures.ed25519SignatureStatus != SUSigningInputStatusAbsent) {
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");
}
break;
case SUSigningInputStatusInvalid:
if (signatures.ed25519SignatureStatus != SUSigningInputStatusAbsent) {
// We will have already logged an error for this failure when the public key was read in, so just do an informational log here.
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but the app has an invalid EdDSA public key, so the update will automatically be rejected.");
return NO;
}
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
if (!dsaPubKey) {
return YES;
SULog(SULogLevelDefault, @"The app has an invalid EdDSA public key, but there is no EdDSA signature in the update. Falling back to DSA.");
break;
case SUSigningInputStatusPresent:
switch (signatures.ed25519SignatureStatus) {
case SUSigningInputStatusAbsent:
SULog(SULogLevelError, @"The app has an EdDSA public key, but there is no EdDSA signature in the update, so the update will be rejected.");
return NO;
case SUSigningInputStatusInvalid:
// We will have already logged an error for this failure when the signature was read in, so just do an informational log here.
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it's invalid, so the update will automatically be rejected.");
return NO;
case SUSigningInputStatusPresent: {
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(signatures.ed25519Signature, data.bytes, data.length, self.pubKeys.ed25519PubKey)) {
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
// No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's
// erroneously invalid
if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid) {
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");
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 (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
}
return NO;
}
}
}
break;
}
switch (self.pubKeys.dsaPubKeyStatus) {
case SUSigningInputStatusAbsent:
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
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");
}
break;
case SUSigningInputStatusInvalid:
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
// We will have already logged an error for this failure when the public key was read in, so just do an informational log here.
SULog(SULogLevelDefault, @"The update has a DSA signature, but the app has an invalid DSA public key, so the update will automatically be rejected.");
return NO;
}
SULog(SULogLevelDefault, @"The app has an invalid DSA public key, but there is no DSA signature in the update.");
break;
case SUSigningInputStatusPresent:
switch (signatures.dsaSignatureStatus) {
case SUSigningInputStatusAbsent:
SULog(SULogLevelError, @"There is no DSA signature in the update");
break;
case SUSigningInputStatusInvalid:
// We will have already logged an error for this failure when the signature was read in, so just do an informational log here.
SULog(SULogLevelDefault, @"The update has a DSA signature, but it's invalid, so the update will automatically be rejected.");
return NO;
case SUSigningInputStatusPresent: {
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
return [self verifyDSASignatureOfStream:dataInputStream dsaSignature:signatures.dsaSignature];
}
}
}
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;
}
+1 -1
View File
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SUUnarchiver : NSObject
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType;
@end
+5 -1
View File
@@ -11,13 +11,14 @@
#import "SUPipedUnarchiver.h"
#import "SUDiskImageUnarchiver.h"
#import "SUBinaryDeltaUnarchiver.h"
#import "SUFlatPackageUnarchiver.h"
#include "AppKitPrevention.h"
@implementation SUUnarchiver
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType
{
if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
@@ -29,6 +30,9 @@
assert(hostPath != nil);
NSString *nonNullHostPath = hostPath;
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
// Flat packages are only supported for guided packaage installs
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path expectingInstallationType:installationType];
}
return nil;
}
+3 -1
View File
@@ -8,7 +8,7 @@
#import "SUUnarchiverNotifier.h"
#import "SULocalizations.h"
#import <Sparkle/SUErrors.h>
#import "SUErrors.h"
#include "AppKitPrevention.h"
@@ -31,6 +31,8 @@
if (self != nil) {
_completionBlock = [completionBlock copy];
_progressBlock = [progressBlock copy];
} else {
assert(false);
}
return self;
}
+5 -3
View File
@@ -9,13 +9,15 @@ int main(int __unused argc, const char __unused *argv[])
@autoreleasepool
{
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
if (args.count != 2) {
if (args.count != 4) {
return EXIT_FAILURE;
}
NSString *hostBundleIdentifier = args[1];
NSString *homeDirectory = args[2];
NSString *userName = args[3];
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier homeDirectory:homeDirectory userName:userName];
[appInstaller start];
// Ignore SIGTERM because we are going to catch it ourselves
@@ -23,7 +25,7 @@ int main(int __unused argc, const char __unused *argv[])
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
dispatch_source_set_event_handler(sigtermSource, ^{
[appInstaller cleanupAndExitWithStatus:SIGTERM];
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
});
dispatch_resume(sigtermSource);
+168
View File
@@ -1,3 +1,171 @@
# 2.0.0
* Support for Sandboxed Applications (Zorg)
* Support for writing custom user interfaces (Zorg)
* Support for updating external Sparkle-based bundles (Zorg)
* Added command line utility to update Sparkle-based bundles (Zorg)
* More modern architecture
* Moves extraction, validation, and installation into a submitted launchd agent/daemon with XPC communication (Zorg)
* Features faster installs with shorter update/relaunch times (Zorg)
* Provides more robust installs that need to request user authorization (Zorg)
* Adoption of atomic-safe bundle replacing updates leveraging APFS (#1801) (Zorg)
* API Changes
* Introduced new SPUStandardUpdaterController, SPUUpdater, SPUUserDriver classes/protocols (Zorg)
* Decoupled AppKit and UI logic in the framework from core functionality (Zorg)
* Ensure (most) API / ABI compatibility with Sparkle 1.x; you can likely test Sparkle 2 in an existing app without any changes (Zorg)
* Deprecated SUUpdater, albeit it is still functional for testing and transitional purposes (Zorg)
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`. (Zorg)
* Updater Changes
* Automatic silent and manual update alert prompts are now merged together
* Updates will attempt to install even if the user quits the application without relaunching the application update explicitly (Zorg)
* Updates can be downloaded in the background automatically but later prompt the user to install them, particularly if Sparkle doesn't have sufficient permission to install them without the user's permission (Zorg)
* Authorization now occurs before launching the installer and before terminating the application, which can be canceled by the user cleanly (Zorg)
* Sparkle uses the icon of the bundle to update for its authorization dialog. A 32x32 image representation of the icon is needed. (Zorg)
* Sudden termination for silent automatic updates isn't disabled anymore (Zorg)
* Policy Changes
* Distributing updates without EdDSA signing the archives is now deprecated (Zorg)
* Package based updates that are zipped or archived must add sparkle:installationType="package" to the appcast item enclosure (Zorg)
* System profiler privacy and transparency (#1690) (Martin Pilkington)
* Support getting app icon from asset catalog (#1694) (Charles Srstka)
* Don't hide update alert window now on deactivation (#1804) (Zorg)
* Raise minimum system version to 10.11 (Zorg)
* Special thanks to developers using early builds of this release in production and contributors for keeping this running (Kornel, Jonas Zaugg, Gwynne Raskind, Jordan Rose, Tony Arnold, Bryan Jones, Christian Tietze, Jakob Egger, and many more)
Please visit [Sparkle's website](http://sparkle-project.org) for more information on documentation and migration.
# 1.26.0
* Flat package support from #1745 (Zorg)
* Correct generate_appcast -s command line argument usage help (Lance Lovette)
* Fix -f command line argument handling (Lance Lovette)
* Fix progress for guided pkg install (Zorg)
* Fix XQuartz update failing because NSLog caused issues (Zorg)
* Update localization (Vojtěch Koňařík)
* Various fixes to SPM logic (Jonas Zaugg)
# 1.25.0
* Raise minimum system version to 10.9 (Kornel)
* Allow an appcast to prevent the new version from being installed automatically (#1688) (pierswalter)
* UI fixes
* Show check for updates button only when automatic updates are enabled (Lorena Rangel)
* Don't initialize the webview if we don't show release notes (Tobias Fonfara)
* Keep skip button available if there is a minimum autoupdate version (Zorg)
* Fix automatic updates checkbox state when not showing release notes (Zorg)
* Fix edge cases with hiding alert buttons and using "Install Later" (Zorg)
* Re-add setting WebUIDelegate fix for legacy web view (Zorg)
* Adopt WKWebView for 1.x (Zorg)
* Add auto layout constraints to SUAutomaticUpdateAlert window (Zorg)
* Made buttons wide enough to display the full text. Made window wide enough to display the widened buttons (el, fi, ru, uk) (Piers Uso Walter)
* Remove max size from update alert. (George Nachman)
* Integrate generate_keys export/import options changes from #1730 (Zorg)
* Add `—release-notes-url-prefix` support to localized release notes (Adam Tharani)
* Translations
* Enable base internalization for alert xibs (Zorg)
* Capitalizes french translation of "Vous utilisez actuellement..." ("You are currently running...") (Micah Moore)
* Fix and cleanup Hebrew, Catalan, Finnish localizations (Zorg)
* Remove non-english localizations from TestApplication (Zorg)
* Fix catch-22 Swift Package Manager binary target (Jonas Zaugg)
* Add explicit dependencies to fix Xcode linking errors (Kornel)
* Add phased rollouts feature to automatic update driver too (Zorg)
* Remove hiding skip button and retitling later button (Zorg)
* Deprecate installUpdatesIfAvailable (Zorg)
* Apply custom headers to app download (Geraint White)
# 1.24.0
* Prioritize UserDefaults when fetching value for EnableAutomaticChecks (Nicolas Bosi)
* Improve best appcast item selection handling (Ian Bytchek)
* Create lockfile for improved compatibility with 3rd party updaters (CoreCode)
* Enable SPM support via binary target (Jonas Zaugg)
* `generate_appcast` improvements:
* follow symbolic links (Denis Dzyubenko)
* update the release notes element’s URL when required (Brad Andalman)
* Added output filename option to generate_appcast (Brad Andalman)
* Added —release-notes-url-prefix to generate_appcast (Brad Andalman)
* Command line option to provide a download url prefix is now parsed and set on each archive item (Dominik H)
* Added help command line option (Dominik H)
* Locale updates:
* Update zh_CN localization (柳东原 · Dongyuan Liu)
* Update Sparkle.strings (Vojtěch Koňařík)
* Update Croatian (#1603) (milotype)
* Update SUUpdateAlert.xib (DanielFirlej)
* fix: read SUAutomaticallyUpdate from Info.plist (Trevor DeVore)
* Fix casting Boolean to BOOL on Apple Silicon (Kevin Wojniak)
* Use build matrix to test on multiple Xcode versions (Rajiv Shah)
* Set UpdateAlert and AutomaticUpdateAlert window's fullscreen collectionBehavior to NSWindowCollectionBehaviorFullScreenAuxiliary to allow them to present on top of the Main App's window if it's fullscreen. (Micah Moore)
* Fixed error about "about:blank" release notes (Louis Pontoise)
* Support App Store URL scheme in release note webview (Bi11)
* Use the SHA-256 hash of the archive as the cache path (Nate Weaver)
* Don't return an optional from the FileHandle method (Nate Weaver)
* Added URL+Hashing (Nate Weaver)
# 1.23.0
* Support generating appcast with localizations (#1499) (Alik Vovkotrub)
* Support versions with git commit SHA (#1504) (Alec Larson)
* Hide "Skip..." and "Remind..." buttons when they're not relevant (#1480) (Kenneth Johnsen)
* Preserve Finder tags while updating apps (#1512) (CoreCode)
* Read-only update alert dialog formatting improvements (#1515) (Quinn Taylor)
* Check if `SUBundleName` is set before normalizing (Jake Fenton)
* `NSInteger` cast warning on Xcode 11 (Marga Keuvelaar)
* Correct appcast file extension (Tom Vos)
* Update Sparkle.strings (Emir Sarı)
* Fix spelling (#1508) (Frank Chiarulli Jr)
# 1.22.0
* Enabled "Hardened Runtime" build option for Apple's notarization requirement
* Add delegate methods to suppress update alerts (George Nachman)
* Improved error when running from translocated location (Michael Buckley)
* Add phased rollout feature (#1381) (Fabian Jäger)
* Ignore non-standard permissions in delta updates instead of failing the build (Kornel Lesiński)
* Notify user when installed version is newer than the latest in the appcast (CoreCode)
* Reset timers after computer sleep (CoreCode)
* Block-based alternatives to `NSInvocation`-based delegate methods (Fabian Jäger)
* Add delegate `userDidSkipThisVersion` (BobZombie, Leo Natan, bono yusuke)
* Pass item to updaterShouldShowUpdateAlertForScheduledUpdate delegate method (George Nachman)
* Support providing private key as argument in `generate_appcast` (Yakuhzi, marchyang)
* Separate the ed25519 sources into a new static library (Tony Arnold)
* Disambiguate signing error messages (Nate Weaver)
* Use `XMLNode.Options.nodePrettyPrint` in `generate_appcast` instead of trying to add whitespace manually (fumoboy007)
* Annotate SUHost for nullability (Michael Buckley)
* Use SUAVAILABLE macro (Christiaan Hofman)
* Fix warnings when using modules (nivekkagicom)
* Correction of Czech localization inconsistency (#1403) (vojtakonarik)
* BR locale fix (BR Lingo)
* Update Japanese localization (fujisoft)
* French Sparkle.strings (Jean-Baptiste)
# 1.21.3
* Losslessly reduced the size of PNG (Barijaona Ramaholimihaso)
* Catch exceptions from subcommands (Julian Mayer)
* `generate_appcast` can sign any bundles instead of just apps (Nate Weaver)
* Check that effectiveAppearance is being observed before calling removeObserver (Pierluigi)
# 1.21.2
* Allow EdDSA for delta updates, too (Kornel)
* Warning fixes (Brian Bergstrand)
* Improvements to release notes view context menu and dark mode (Bi11)
# 1.21.0
* Added support EdDSA (ed25519) signatures (Kornel)
* DSA signatures are considered outdated, and Apple's `Security.framework` only supports weaker SHA-1-based DSA.
* Both old DSA and new EdDSA are still supported (and one app can use both), but new applications should use EdDSA only, and we recommend migrating away from DSA signatures.
* `generate_keys` is now a Swift tool that stores EdDSA private keys in the Keychain
* Existing apps can continue using their old DSA keys, but we've dropped support for generation of old DSA keys
* `sign_update` is now a Swift tool that signs using EdDSA from private keys in the Keychain
* The old DSA-based signing script has been moved to `bin/old_dsa_scripts`
* The old DSA-based signing script has been fixed to work on pre-10.13 systems (Thomas Tempelmann)
* `generate_appcast` has been updated to support EdDSA signatures
* It can sign both DSA (if `dsa_priv.pem` file is specified) and EdDSA (from Keychain)
* The tool now uses Caches directory and doesn't generate unnecessary delta files
* Fixed verification of delta updates on filesystems that change permissions of symlinks
* Fixed `NSURLSession` leak (Michael Ehrmann)
# 1.20.0
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
@@ -3,4 +3,4 @@
#include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
MACOSX_DEPLOYMENT_TARGET = 10.11
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TOOL=1
+15 -14
View File
@@ -4,13 +4,15 @@ SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
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
SPARKLE_AUTOMATED_DOWNGRADES = 0
// Set to 0 to only build all non-UI bits
SPARKLE_BUILD_UI_BITS = 1
// If your app file on disk is named "MyApp 1.1b4", Sparkle usually updates it
// in place, giving you an app named 1.1b4 that is actually 1.2. Turn the
// following on to always reset the name back to "MyApp":
// following on to always reset the name back to "MyApp"
// If you are using this option to change the name of your app, you should
// disable the option again when you no longer need it
// Note this option is only supported for regular application updates and not plug-ins
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_ICON_NAME = AppIcon
@@ -26,8 +28,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
ARCHS = $(ARCHS_STANDARD)
// NSURLSession requirements
MACOSX_DEPLOYMENT_TARGET = 10.9
MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
@@ -37,15 +38,18 @@ 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}\"
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) 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}\"
CODE_SIGN_IDENTITY = -
SDKROOT = macosx
ENABLE_HARDENED_RUNTIME = YES
CLANG_ENABLE_OBJC_ARC = YES
GCC_ENABLE_PASCAL_STRINGS = NO
GCC_NO_COMMON_BLOCKS = YES;
COMBINE_HIDPI_IMAGES = NO;
GCC_NO_COMMON_BLOCKS = YES
COMBINE_HIDPI_IMAGES = NO
// Enable warnings
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
@@ -88,11 +92,8 @@ GCC_WARN_UNUSED_LABEL = YES
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.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-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments $(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 -Wno-format-non-iso $(WARNING_CFLAGS_EXTRA)
@@ -1,6 +1,5 @@
#include "ConfigCommonDebug.xcconfig"
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
@@ -2,8 +2,6 @@
// Debug only
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
+2 -3
View File
@@ -2,8 +2,6 @@
// Release only
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 0
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
@@ -13,7 +11,8 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = s
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=0
DEAD_CODE_STRIPPING = YES
GCC_TREAT_WARNINGS_AS_ERRORS = NO
GCC_WARN_UNINITIALIZED_AUTOS = YES
COPY_PHASE_STRIP = NO
+1
View File
@@ -5,3 +5,4 @@ WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
@@ -1,4 +1,2 @@
// Downloader Debug
#include "ConfigDownloader.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -1,5 +1,3 @@
// InstallerConnection Debug
#include "ConfigInstallerConnection.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -1,4 +1,2 @@
// Installer Launcher Debug
#include "ConfigInstallerLauncher.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -2,5 +2,6 @@
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0
SKIP_INSTALL = YES
CLANG_ENABLE_MODULES = NO
@@ -1,5 +1,3 @@
// InstallerStatus Debug
#include "ConfigInstallerStatus.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -4,3 +4,4 @@ INFOPLIST_FILE = sparkle-cli/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.sparkle-cli
PRODUCT_NAME = sparkle
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks/
ENABLE_HARDENED_RUNTIME = NO
+1 -1
View File
@@ -1,2 +1,2 @@
SWIFT_VERSION = 4.0
SWIFT_VERSION = 5
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
+2 -1
View File
@@ -1 +1,2 @@
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
SWIFT_OPTIMIZATION_LEVEL = -O
SWIFT_COMPILATION_MODE = wholemodule
+1 -1
View File
@@ -6,4 +6,4 @@ 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
ENABLE_HARDENED_RUNTIME = NO
@@ -1,4 +1,2 @@
// Test Application Debug
#include "ConfigTestApp.xcconfig"
CODE_SIGN_IDENTITY = -
@@ -4,3 +4,4 @@ INFOPLIST_FILE = TestAppHelper/Info.plist
WRAPPER_EXTENSION = xpc
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
ENABLE_HARDENED_RUNTIME = NO
@@ -1,4 +1,2 @@
// Test Application Helper Debug
#include "ConfigTestAppHelper.xcconfig"
CODE_SIGN_IDENTITY = -
+1 -1
View File
@@ -4,7 +4,7 @@
INFOPLIST_FILE = UITests/UITests-Info.plist
WRAPPER_EXTENSION = xctest
MACOSX_DEPLOYMENT_TARGET = 10.11
ENABLE_HARDENED_RUNTIME = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
+1 -1
View File
@@ -9,6 +9,6 @@ GCC_SYMBOLS_PRIVATE_EXTERN = NO
WARNING_CFLAGS = $(inherited) -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments
FRAMEWORK_SEARCH_PATHS = $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
MACOSX_DEPLOYMENT_TARGET = 10.9
CLANG_ENABLE_MODULES = YES
SWIFT_OBJC_BRIDGING_HEADER = Tests/Sparkle Unit Tests-Bridging-Header.h
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TESTS=1
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/env python3
import os, sys, subprocess, tempfile, pathlib
PRODUCT_BUNDLE_ID_MACRO = "$(PRODUCT_BUNDLE_IDENTIFIER)"
def log_message(message):
sys.stderr.write(message + "\n")
#Surround a token with double quotes if it has a space in it
def sanitize(argument):
return ('"' + argument + '"' if ' ' in argument else argument)
def _codesign_service(identity, path, entitlements_path=None):
command = ["codesign", "-o", "runtime", "-fs", identity, path] + ([] if entitlements_path is None else ["--entitlements", entitlements_path])
log_message(" ".join(map(sanitize, command)))
process = subprocess.Popen(command, stdout=subprocess.PIPE)
process.communicate()
if process.returncode != 0:
log_message("Error: Failed to codesign %s" % (path))
sys.exit(1)
def codesign_service(service_name, identity, path, entitlements_path=None):
#Sign the auxiliary executables (if any)
executables_path = os.path.join(path, "Contents/MacOS/")
if os.path.exists(executables_path):
for executable in os.listdir(executables_path):
if executable != service_name:
_codesign_service(identity, os.path.join(executables_path, executable), entitlements_path)
#Sign the service bundle
_codesign_service(identity, path, entitlements_path)
# Returns entitlements back with a bundle id applied if needed
def applied_entitlements_path(entitlements_path, bundle_id, temp_dir):
entitlements_str = pathlib.Path(entitlements_path).read_text()
if PRODUCT_BUNDLE_ID_MACRO in entitlements_str:
if bundle_id is None:
return None
else:
new_entitlements_str = entitlements_str.replace(PRODUCT_BUNDLE_ID_MACRO, bundle_id)
new_entitlements_path = os.path.join(temp_dir, os.path.basename(entitlements_path))
pathlib.Path(new_entitlements_path).write_text(new_entitlements_str)
return new_entitlements_path
else:
return entitlements_path
def print_usage():
log_message("Usage:\n\t%s code-signing-identity [-b app-bundle-id] service1 service2 ..." % (sys.argv[0]))
log_message("Example:\n\t%s \"Developer ID Application\" ./XPCServices/org.sparkle-project.InstallerLauncher.xpc" % (sys.argv[0]))
log_message("")
log_message("Use this script to sign XPC Services to include in your Sandboxed application.")
log_message("")
log_message("bundle-id is optional and only needs to be provided when signing InstallerConnection and InstallerStatus services. Most applications do not need to use these services and can provide additional entitlements to their application instead.")
log_message("")
log_message("This script may not be needed for common development workflows. Please visit https://sparkle-project.org/documentation/sandboxing/ for more details and instructions.")
if __name__ == "__main__":
if len(sys.argv) < 3:
print_usage()
sys.exit(1)
signing_identity = sys.argv[1]
remaining_args = sys.argv[2:]
bundle_id = None
if remaining_args[0] == '-b':
if len(remaining_args) < 3:
# We need the bundle-id and at least one XPC Service to sign
print_usage()
sys.exit(1)
else:
bundle_id = remaining_args[1]
services = remaining_args[2:]
else:
services = remaining_args
with tempfile.TemporaryDirectory() as temp_dir:
for service in services:
parent, child = os.path.split(service)
service_name = os.path.splitext(child)[0]
entitlements_path = os.path.join(parent, service_name + ".entitlements")
if os.path.exists(entitlements_path):
service_entitlements_path = applied_entitlements_path(entitlements_path, bundle_id, temp_dir)
if service_entitlements_path is None:
print_usage()
log_message("")
log_message("Error: Bundle ID must be specified for signing %s. As noted in the usage above, you probably don't need to embed this service." % (service_name))
sys.exit(1)
else:
service_entitlements_path = None
codesign_service(service_name, signing_identity, service, service_entitlements_path)
+3
View File
@@ -12,3 +12,6 @@ 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
// Disable dead stores analyzer warning
CLANG_ANALYZER_DEADCODE_DEADSTORES = NO
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
# Create symlinks to our helper tools in Sparkle and SparkleCore framework bundles
# so URLForAuxiliaryExecutable: will pick up the tools. Doing this is supported in the Code Signing in Depth guide.
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
ln -h -f -s "Versions/Current/""${SPARKLE_RELAUNCH_TOOL_NAME}" "${FRAMEWORK_PATH}"/"${SPARKLE_RELAUNCH_TOOL_NAME}"
ln -h -f -s "Versions/Current/""${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app "${FRAMEWORK_PATH}"/"${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app
+106 -4
View File
@@ -12,17 +12,28 @@ if [ "$ACTION" = "" ] ; then
fi
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.xz"
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2"
rm -f "Sparkle-for-Swift-Package-Manager.zip"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL.markdown" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm"
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging-spm"
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 "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$SRCROOT/Configurations/codesign_xpc_service.py" "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
chmod 0755 "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
@@ -32,25 +43,116 @@ if [ "$ACTION" = "" ] ; then
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"
cp "$SRCROOT/InstallerConnection/$INSTALLER_CONNECTION_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp "$SRCROOT/InstallerStatus/$INSTALLER_STATUS_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/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.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 Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
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
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/staging/XPCServices" "$CONFIGURATION_BUILD_DIR/staging-spm"
cd "$CONFIGURATION_BUILD_DIR/staging"
if [ -x "$(command -v xz)" ]; then
XZ_EXISTS=1
else
XZ_EXISTS=0
fi
rm -rf "/tmp/sparkle-extract"
mkdir -p "/tmp/sparkle-extract"
# Sorted file list groups similar files together, which improves tar compression
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
if [ "$XZ_EXISTS" -eq 1 ] ; then
find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz"
# Copy archived distribution for CI
cp -f "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" "../sparkle-dist.tar.xz"
# Extract archive for testing binary validity
tar -xf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz" -C "/tmp/sparkle-extract"
else
# Fallback to bz2 compression if xz utility is not available
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
# Extract archive for testing binary validity
tar -xf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" -C "/tmp/sparkle-extract"
fi
# Test code signing validity of the extracted products
# This guards against our archives being corrupt / created incorrectly
codesign --verify -vvv --deep "/tmp/sparkle-extract/Sparkle.framework"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.Downloader.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerConnection.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerLauncher.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/XPCServices/org.sparkle-project.InstallerStatus.xpc"
codesign --verify -vvv --deep "/tmp/sparkle-extract/sparkle.app"
codesign --verify -vvv --deep "/tmp/sparkle-extract/Sparkle Test App.app"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/BinaryDelta"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/generate_appcast"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/sign_update"
codesign --verify -vvv --deep "/tmp/sparkle-extract/bin/generate_keys"
rm -rf "/tmp/sparkle-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
# Generate zip containing the xcframework for SPM
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
#rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
zip -rqyX -9 "../Sparkle-for-Swift-Package-Manager.zip" *
# GitHub actions set the CI environment variable to true
if [ "$CI" != true ]; then
# Get latest git tag
cd "$SRCROOT"
latest_git_tag=$(git describe --tags --abbrev=0)
# Check semantic versioning
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "Tag $latest_git_tag follows semantic versioning"
else
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
exit 1
fi
else
# Dummy placeholder for CI test builds as we don't really need to update Package.swift for building and testing purposes
latest_git_tag="CI_BUILD"
fi
# Generate new Package manifest
cd "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
# is equivalent to shasum -a 256 FILE
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
rm -rf ".build"
sed -E -i '' -e "/let tag/ s/\".+\"/\"$latest_git_tag\"/" -e "/let version/ s/\".+\"/\"$CURRENT_PROJECT_VERSION\"/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
cp "Package.swift" "$SRCROOT"
echo "Package.swift updated with the following values:"
echo "Version: $CURRENT_PROJECT_VERSION"
echo "Tag: $latest_git_tag"
echo "Checksum: $spm_checksum"
else
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
fi
if [ "$XZ_EXISTS" -eq 1 ] ; then
echo "WARNING: xz compression is used for official releases but bz2 is being used instead because xz tool is not installed on your system."
fi
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
fi
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
latest_git_tag=$(git describe --abbrev=0) # gets the latest tag name
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
if [ "$commits_since_tag" -gt 0 ]; then
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
echo "Package.swift has not been committed and tag has not been moved."
else
# TODO: add sanity check to see if version is actually being updated or not?
read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for SPM release) [Y/n]" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "Package.swift has not been committed and tag has not been moved."
else
long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message
long_message=${long_message/$latest_git_tag} # trims tag name
long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace
git add Package.swift
git commit -m "Update Package.swift"
git tag -fa $latest_git_tag -m "${long_message}"
echo "Package.swift committed and tag '$latest_git_tag' moved."
fi
fi
-8
View File
@@ -1,8 +0,0 @@
#!/bin/sh
AGENT_PATH="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/MacOS/"${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app
#Only sign the agent app if we have code signing enabled (as we do with adhoc signatures in Debug builds for testing sandboxing)
if [ ! -z "${CODE_SIGN_IDENTITY}" ] ; then
codesign --verbose -f -s "${CODE_SIGN_IDENTITY}" "${AGENT_PATH}"
fi
@@ -1,12 +0,0 @@
#!/bin/sh
# http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment
INFOPLIST="${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
case "${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}" in
"YES"|"1")
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${INFOPLIST}"
;;
"NO"|"0")
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO" "${INFOPLIST}"
;;
esac
@@ -1,12 +0,0 @@
#!/bin/sh
# We should make sure ATS is off for the test app
DOWNLOADER_INFO_PLIST="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/XPCServices/"${DOWNLOADER_BUNDLE_ID}".xpc/Contents/Info.plist
#Only alter bundles if code signing is off, else we'll invalidate the signature on them
#If code signing is enabled (as in debug mode), then we rely on another script for turning ATS exceptions on for these services
#In release mode however, those services do not have ATS exceptions set up which is why we have to set up exceptions *here*
if [ -z "${CODE_SIGN_IDENTITY}" ] ; then
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${DOWNLOADER_INFO_PLIST}"
fi
+2 -4
View File
@@ -14,11 +14,9 @@ This fork puts a huge emphasis on splitting Sparkle into several components to a
* Progress Agent (Application; AppKit permitted)
* Installer (Agent and Daemon safe)
These achieve privilege separation, because at least theoretically, they can all be placed into different processes from one another.
These achieve privilege separation, because at least theoretically, they can all be placed into different processes from one another, although in practice the user driver and updater framework will likely be in the same process.
In practice, the user driver and updater framework will likely be in the same process, but leaving this possibility speaks well for the quality of the architecture. This is why for instance all the methods on the user driver are not assumed to be executed on the main thread, if one decided to use NSXPC to drive them.
For XPC Services, it's significant to understand that their purpose is not only for sandboxing. The services can be used regardless of whether an application is sandboxed or not. Besides privilege separation, they also have an impact on fault tolerance and termination.
For XPC Services, it's significant to understand they can be used independent of sandboxing (although I wouldn't recommend this personally). Besides privilege separation, they also have an impact on fault tolerance and termination.
XPC Services also act inside an application bundle namespace, which is one of many reasons why they aren't bundled inside the framework. We have code that detects whether or not services are available inside the main bundle. This is simpler and more efficient than attempting to create a connection and wait for a timeout. We don't have *any* checks for seeing if the "current process" is sandboxed; doing so is a rather broken behavior. The XPC Services are important, not the sandboxing.
+1 -1
View File
@@ -5,7 +5,7 @@ if [ "$ACTION" = "" ] ; then
doxygen Documentation/Doxyfile
else
echo "warning: Doxygen not found in PATH"
echo "open Terminal and type this command `brew install doxygen` then click `enter/return` key. finally build this target again"
echo "open Terminal and type this command 'brew install doxygen' then click 'enter/return' key. finally build this target again"
fi
elif [ "$ACTION" = "clean" ] ; then
rm -rf "$SRCROOT/Documentation/html"
+49 -12
View File
@@ -10,8 +10,8 @@
#import "SPUDownloaderDelegate.h"
#import "SPULocalCacheDirectory.h"
#import "SPUURLRequest.h"
#import <Sparkle/SPUDownloadData.h>
#import <Sparkle/SUErrors.h>
#import "SPUDownloadData.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@@ -111,12 +111,29 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
}
}
- (void)cancelDownload
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier
{
[self cleanup];
return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
}
- (void)cleanup
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier
{
// Only take the directory name and compute most of the base path ourselves
// This way we do not have to send/trust an absolute path
// The downloader instance that creates this temp directory isn't necessarily the same as the one
// that clears it (eg upon skipping an already downloaded update), so we can't just preserve it here too
dispatch_async(dispatch_get_main_queue(), ^{
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
if (rootPersistentDownloadCachePath != nil) {
NSString *sanitizedDirectoryName = directoryName.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDirectoryName];
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
}
});
}
- (void)_cleanup
{
[self enableAutomaticTermination];
[self.download cancel];
@@ -132,6 +149,15 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
}
}
- (void)cleanup:(void (^)(void))completionHandler
{
dispatch_async(dispatch_get_main_queue(), ^{
[self _cleanup];
completionHandler();
});
}
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didFinishDownloadingToURL:(NSURL *)location
{
if (self.mode == SPUDownloadModeTemporary)
@@ -142,8 +168,8 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
else
{
// Remove our old caches path so we don't start accumulating files in there
NSString *rootPersistentDownloadCachePath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:self.bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:self.bundleIdentifier];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootPersistentDownloadCachePath];
NSString *tempDir = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootPersistentDownloadCachePath];
@@ -208,7 +234,17 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
if (data != nil) {
NSURLResponse *response = self.download.response;
assert(response != nil);
downloadData = [[SPUDownloadData alloc] initWithData:data textEncodingName:response.textEncodingName MIMEType:response.MIMEType];
NSURL *responseURL = response.URL;
if (responseURL == nil) {
responseURL = self.download.currentRequest.URL;
}
if (responseURL == nil) {
responseURL = self.download.originalRequest.URL;
}
assert(responseURL != nil);
downloadData = [[SPUDownloadData alloc] initWithData:data URL:responseURL textEncodingName:response.textEncodingName MIMEType:response.MIMEType];
}
}
@@ -221,20 +257,21 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
} else {
[self.delegate downloaderDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read temporary downloaded data from %@", self.downloadFilename]}]];
}
[self _cleanup];
break;
case SPUDownloadModePersistent:
[self.delegate downloaderDidFinishWithTemporaryDownloadData:nil];
break;
}
[self cleanup];
}
- (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error
{
self.download = nil;
[self.delegate downloaderDidFailWithError:error];
[self cleanup];
if (error != nil) {
[self.delegate downloaderDidFailWithError:error];
}
}
// NSURLDownload has a [downlaod:shouldDecodeSourceDataOfMIMEType:] to determine if the data should be decoded.
+3 -2
View File
@@ -19,8 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request;
// Cancels any ongoing download
- (void)cancelDownload;
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier;
- (void)cleanup:(void (^)(void))completionHandler;
@end
+5
View File
@@ -0,0 +1,5 @@
For integration and usage, please visit Sparkle's Documentation:
https://sparkle-project.org/documentation/
For integrating XPC Services in a Sandboxed Application, please visit:
https://sparkle-project.org/documentation/sandboxing/
-59
View File
@@ -1,59 +0,0 @@
# Building
If release products have not already been built, they can be built by:
```
cd <path-to>/Sparkle/
make release
```
Upon success, a Finder window will open revealing an archive containing the newly-built Sparkle binaries. Expand the archive (e.g., to the Desktop).
Alternatively, you can build the "Distribution" scheme from within the Xcode project.
Debug builds of Sparkle can also be built from Xcode. Note that debug builds change Sparkle's default behavior to ease development. Never use a debug build of Sparkle for distribution.
# Installing
To install Sparkle, drag Sparkle.framework into your project as you would any other framework. Make sure you have a build phase to copy the framework into your application's Frameworks directory at build time.
# XPC Services and Embedded Applications
If your application is sandboxed, you will need to embed one or more of Sparkle's XPC services into your application. These are used to perform privileged operations that your sandboxed app, and the rest of the Sparkle framework, are not authorized to perform. Even if you are not strictly required to use a particular XPC service, there may still be some merit to separating privileges.
* `SparkleInstallerLauncher`, `SparkleInstallerConnection`, and `SparkleInstallerStatus`: These are required for most sandboxed apps, and are used by Sparkle to perform the privileged operations of upgrading your app, relaunching it, and reporting progress to the app as it proceeds.
* `SparkleDownloader`: This is required only if your sandboxed app does not already possess the "com.apple.security.network.client" entitlement, allowing it to make outgoing HTTP(S) connections. If you do decide to include the Downloader service and your app does not pass Apple's App Transport Security requirements, then you may have to add exceptions inside the downloader service's Info.plist.
Note: If your sandboxed app does not have the networking entitlement mentioned above, then linked release notes cannot contain external references (e.g.: images or external style sheets), because loading them will be prevented by the sandbox.
Apps that are not sandboxed may still want to embed the services if they need to code sign the services with their own signatures. The copies of these services within the built Sparkle framework will have the same signature as the framework.
If you want to code sign Sparkle's installer tools (Autoupdate and Updater.app), then you should include the SparkleInstallerLauncher XPC service even if your app is not sandboxed. Note that Sparkle keeps a copy of these tools inside the framework, because using the XPC services is optional, and they need to be inside the XPC service for security reasons. If you wish, you can remove them from the framework if you use the InstallerLauncher service.
If you code sign your application, these XPC services also need to be signed by you with the attached entitlements. Included is a script to automate this.
Here is an example of invoking the script with a Developer ID identity (replace `XXX` appropriately):
```
./bin/codesign_embedded_executable "Developer ID Application: XXX" XPCServices/*.xpc
./bin/codesign_embedded_executable "Developer ID Application: XXX" ./Sparkle.framework/Versions/A/Resources/Autoupdate
./bin/codesign_embedded_executable "Developer ID Application: XXX" ./Sparkle.framework/Versions/A/Resources/Updater.app/
```
After signing the executables, add them to the appropriate copy phases and link settings in the app target. Check the "Code Sign on Copy" option for the FW phase (it's not offered for the XPC copy phase).
Note that the `codesign_embedded_executable` script uses the hardened runtime option, so your app can be notarized ([required](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution?language=objc) for macOS 10.14.5 and higher).
# Testing
If you're not using the sandboxed version, you can just lower the `CURRENT_PROJECT_VERSION` in your app target below the latest version in your appcast, build & run from Xcode, and hit the Check for Updates… UI element.
For the sandboxed version, testing with a debug build running from Xcode doesn't work—the "Extracting Update" phase either hangs or fails. You'll have to do an Archive build and export a Developer ID-signed or notarized app.
# Known Issues
Search the [issues database](https://github.com/sparkle-project/Sparkle/issues) for bugs specific to the `ui-separation-and-xpc` branch.
+2 -3
View File
@@ -7,7 +7,6 @@
//
#import "SUInstallerConnection.h"
#import "SPUSystemAuthorization.h"
#include "AppKitPrevention.h"
@@ -61,9 +60,9 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
[self enableAutomaticTermination];
}
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
{
NSXPCConnectionOptions options = SPUNeedsSystemAuthorizationAccess(hostPath, installationType) ? NSXPCConnectionPrivileged : 0;
NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : 0;
NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options];
connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler;
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType;
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain;
- (void)invalidate;
@@ -62,9 +62,9 @@
}];
}
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
{
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath installationType:installationType];
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName systemDomain:systemDomain];
}
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spki</string>
</array>
</dict>
</plist>
+112 -28
View File
@@ -10,14 +10,13 @@
#import "SUFileManager.h"
#import "SULog.h"
#import "SPUMessageTypes.h"
#import "SPUSystemAuthorization.h"
#import "SUBundleIcon.h"
#import "SPULocalCacheDirectory.h"
#import "SPUInstallationType.h"
#import "SUHost.h"
#import <ImageIO/ImageIO.h>
#import <ServiceManagement/ServiceManagement.h>
#include "AppKitPrevention.h"
@implementation SUInstallerLauncher
@@ -57,7 +56,10 @@
// We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid
// using it because the headers indicate it may be removed one day without any replacement
CFErrorRef removeError = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) {
#pragma clang diagnostic pop
if (removeError != NULL) {
// It's normal for a job to not be found, so this is not an interesting error
if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) {
@@ -78,7 +80,12 @@
jobDictionary[@"MachServices"] = @{SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES};
CFErrorRef submitError = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// SMJobSubmit is deprecated but is the only way to submit a non-permanent
// helper and allows us to submit to user domain without requiring authorization
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
#pragma clang diagnostic pop
if (!submittedJob) {
if (submitError != NULL) {
SULog(SULogLevelError, @"Submit progress error: %@", submitError);
@@ -92,7 +99,7 @@
return (submittedJob == true);
}
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -102,11 +109,19 @@
NSString *hostBundleIdentifier = hostBundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
NSString *homeDirectory = NSHomeDirectory();
assert(homeDirectory != nil);
NSString *userName = NSUserName();
assert(userName != nil);
// The first argument has to be the path to the program, and the second is a host identifier so that the installer knows what mach services to host
// The third and forth arguments are for home directory and user name which only pkg installer scripts may need
// We intentionally do not pass any more arguments. Anything else should be done via IPC.
// This is compatible to SMJobBless() which does not allow arguments
// Even though we aren't using that function for now, it'd be wise to not decrease compatibility to it
NSArray<NSString *> *arguments = @[installerPath, hostBundleIdentifier];
NSArray<NSString *> *arguments = @[installerPath, hostBundleIdentifier, homeDirectory, userName];
AuthorizationRef auth = NULL;
OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);
@@ -122,8 +137,19 @@
// https://developer.apple.com/library/mac/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110-CH1-SECTION7
// We can set a custom right name for authenticating as an administrator
// Using this right rather than using something like kSMRightModifySystemDaemons allows us to present a better worded prompt
// Note the right name is cached, so if we want to change the authorization
// prompt, we may need to change the right name. I have found no good way around this :|
NSString *sparkleAuthTag = @"sparkle2-auth"; // this needs to change if auth wording changes
NSString *rightNameString;
if ([hostBundleIdentifier isEqualToString:updaterIdentifier]) {
// Application bundle is likely updating itself
rightNameString = [NSString stringWithFormat:@"%@.%@", hostBundleIdentifier, sparkleAuthTag];
} else {
// Updater is likely updating a bundle that is not itself
rightNameString = [NSString stringWithFormat:@"%@.%@.%@", updaterIdentifier, hostBundleIdentifier, sparkleAuthTag];
}
const char *rightName = [[NSString stringWithFormat:@"%@.sparkle-auth", hostBundleIdentifier] UTF8String];
const char *rightName = rightNameString.UTF8String;
assert(rightName != NULL);
OSStatus getRightResult = AuthorizationRightGet(rightName, NULL);
@@ -229,7 +255,10 @@
// We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid
// using it because the headers indicate it may be removed one day without any replacement
CFErrorRef removeError = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) {
#pragma clang diagnostic pop
if (removeError != NULL) {
// It's normal for a job to not be found, so this is not an interesting error
if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) {
@@ -242,7 +271,12 @@
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
CFErrorRef submitError = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// SMJobSubmit is deprecated but is the only way to submit a non-permanent
// helper and allows us to submit to user domain without requiring authorization
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
#pragma clang diagnostic pop
if (!submittedJob) {
if (submitError != NULL) {
SULog(SULogLevelError, @"Submit error: %@", submitError);
@@ -266,44 +300,93 @@
return status;
}
// First we check if the tool is in an auxiliary directory. If that fails, we then check if it is in a resources directory
- (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension inBundle:(NSBundle *)bundle
{
NSString *resultPath = nil;
// If the path extension is empty, we don't want to add a "." at the end
NSString *pathWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
assert(pathWithExtension != nil);
NSString *auxiliaryPath = [bundle pathForAuxiliaryExecutable:pathWithExtension];
if (auxiliaryPath == nil || ![[NSFileManager defaultManager] fileExistsAtPath:auxiliaryPath]) {
resultPath = [bundle pathForResource:toolName ofType:extension];
} else {
resultPath = auxiliaryPath;
}
return resultPath;
NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
assert(nameWithExtension != nil);
NSURL *auxiliaryToolURL = [bundle URLForAuxiliaryExecutable:nameWithExtension];
assert(auxiliaryToolURL != nil);
NSURL *resolvedAuxiliaryToolURL = [auxiliaryToolURL URLByResolvingSymlinksInPath];
assert(resolvedAuxiliaryToolURL != nil);
return resolvedAuxiliaryToolURL.path;
}
static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType)
{
BOOL needsAuthorization;
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
needsAuthorization = YES;
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
needsAuthorization = NO;
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL hasWritability = [fileManager isWritableFileAtPath:path] && [fileManager isWritableFileAtPath:[path stringByDeletingLastPathComponent]];
if (!hasWritability) {
needsAuthorization = YES;
} else {
// Just because we have writability access does not mean we can set the correct owner/group
// Test if we can set the owner/group on a temporarily created file
// If we can, then we can probably perform an update without authorization
NSString *tempFilename = @"permission_test" ;
SUFileManager *suFileManager = [[SUFileManager alloc] init];
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
if (tempDirectoryURL == nil) {
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
needsAuthorization = YES;
} else {
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
// Obvious indicator we may need authorization
needsAuthorization = YES;
} else {
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:path] error:NULL];
}
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
}
}
}
return needsAuthorization;
}
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus))completionHandler
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
{
dispatch_async(dispatch_get_main_queue(), ^{
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
BOOL needsSystemAuthorization = SPUNeedsSystemAuthorizationAccess(hostBundlePath, installationType);
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
if (hostBundle == nil) {
SULog(SULogLevelError, @"InstallerLauncher failed to create bundle at %@", hostBundlePath);
SULog(SULogLevelError, @"Please make sure InstallerLauncher is not sandboxed and do not sign your app by passing --deep. Check: codesign -d --entitlements :- \"%@\"", NSBundle.mainBundle.bundlePath);
SULog(SULogLevelError, @"More information regarding sandboxing: https://sparkle-project.org/documentation/sandboxing/");
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
if (needsSystemAuthorization && !allowingUpdaterInteraction) {
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher.");
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
if (!allowingUpdaterInteraction && [installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher for performing an interactive type package installation.");
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
// if we need to use the system domain and we aren't allowed interaction, then try sometime later when interaction is allowed
if (needsSystemAuthorization && !allowingDriverInteraction) {
completionHandler(SUInstallerLauncherAuthorizeLater);
completionHandler(SUInstallerLauncherAuthorizeLater, needsSystemAuthorization);
return;
}
@@ -318,7 +401,7 @@
NSString *installerPath = [self pathForBundledTool:@""SPARKLE_RELAUNCH_TOOL_NAME extension:@"" inBundle:ourBundle];
if (installerPath == nil) {
SULog(SULogLevelError, @"Error: Cannot submit installer because the installer could not be located");
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
@@ -327,7 +410,7 @@
if (progressToolResourcePath == nil) {
SULog(SULogLevelError, @"Error: Cannot submit progress tool because the progress tool could not be located");
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
@@ -343,7 +426,7 @@
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath];
if (launcherCachePath == nil) {
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
@@ -353,11 +436,11 @@
// SUFileManager is more reliable for copying files around
if (![[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:&copyError]) {
SULog(SULogLevelError, @"Failed to copy progress tool to cache: %@", copyError);
completionHandler(SUInstallerLauncherFailure);
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle authorizationPrompt:authorizationPrompt inSystemDomain:needsSystemAuthorization];
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier authorizationPrompt:authorizationPrompt inSystemDomain:needsSystemAuthorization];
BOOL submittedProgressTool = NO;
if (installerStatus == SUInstallerLauncherSuccess) {
@@ -368,12 +451,13 @@
}
} else if (installerStatus == SUInstallerLauncherFailure) {
SULog(SULogLevelError, @"Failed to submit installer job");
SULog(SULogLevelError, @"If your application is sandboxed please follow steps at: https://sparkle-project.org/documentation/sandboxing/");
}
if (installerStatus == SUInstallerLauncherCanceled) {
completionHandler(installerStatus);
completionHandler(installerStatus, needsSystemAuthorization);
} else {
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure);
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure, needsSystemAuthorization);
}
});
}
@@ -11,7 +11,7 @@
@protocol SUInstallerLauncherProtocol
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus))completionHandler;
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL requiresAuthorization))reply;
-1
View File
@@ -7,7 +7,6 @@
//
#import "SUInstallerStatus.h"
#import "SPUSystemAuthorization.h"
#include "AppKitPrevention.h"
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spks</string>
</array>
</dict>
</plist>
+3 -1
View File
@@ -14,9 +14,11 @@ localizable-strings:
release:
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build
open -R "$(BUILDDIR)/Build/Products/Release/Sparkle-"*.tar.bz2
./Configurations/release-move-tag.sh
open "$(BUILDDIR)/Build/Products/Release/"
cat Sparkle.podspec
@echo "Don't forget to update CocoaPods! pod trunk push"
@echo "Don't forget to upload Sparkle-for-Swift-Package-Manager.zip!"
build:
xcodebuild clean build
+26
View File
@@ -0,0 +1,26 @@
// swift-tools-version:5.3
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.0.0"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "2.0.0"
let checksum = "ef0d0cc46421f8644f455b62537f4e4db2c97bdca5820641219a1836f3782878"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
name: "Sparkle",
platforms: [.macOS(.v10_11)],
products: [
.library(
name: "Sparkle",
targets: ["Sparkle"])
],
targets: [
.binaryTarget(
name: "Sparkle",
url: url,
checksum: checksum
)
]
)
+41 -68
View File
@@ -1,89 +1,64 @@
# Sparkle 2.x (Beta)
# Sparkle 2 (Beta) ![Build Status](https://github.com/sparkle-project/Sparkle/workflows/Build%20%26%20Tests/badge.svg?branch=2.x) <a href="https://www.stackpath.com/?utm_source=sparkle-github&amp;utm_medium=badge&amp;utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-StackPath-orange.svg" alt="sponsored by: StackPath"></a>
Secure and reliable software update framework for Cocoa developers.
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
This is the upcoming new version of Sparkle, based on the `ui-separation-and-xpc` branch.
Major new features are support for sandboxing, custom user interfaces, updating other bundles, and a modern secure architecture.
This is the upcoming new version of Sparkle.
Major new features are support for sandboxing, custom user interfaces, updating external bundles, and a more modern secure architecture which includes faster and more reliable installs.
Sparkle 2.x is currently in beta. Some people already use it in production, but some work is still required before it can be released:
For the production ready version of Sparkle, please see the [Sparkle 1.x (master) branch](https://github.com/sparkle-project/Sparkle/tree/master). Note development has shifted to Sparkle 2 and the 1.x branch is now only accepting bug fixes, localization updates, and adoption of critical upcoming OS features.
1. Documentation for the website needs to be written (see [https://github.com/sparkle-project/sparkle-project.github.io](sparkle-project.github.io))
2. Changes from the master branch need to be merged
3. Bugs and issues have to be fixed
Sparkle 2 is currently in beta. Applications, typically sandboxed, have already been using it in production, but some work including testing is still required before an official version can be released. In the meantime, a nightly build can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact. The current status of Sparkle 2 is tracked in issue [#1523](https://github.com/sparkle-project/Sparkle/issues/1523).
The current status of Sparkle 2.x is tracked in issue [#1523](https://github.com/sparkle-project/Sparkle/issues/1523).
If you can help with testing or reviewing over the new changes, please report issues or submit pull requests!
If you can help with any of the above, please submit pull requests!
New issues should be [reported here](https://github.com/sparkle-project/Sparkle/issues). Internal design documents can be found in [Documentation](Documentation/).
New issues that are found should be [reported here](https://github.com/sparkle-project/Sparkle/issues). Internal design documents can be found in [Documentation](Documentation/). Discussion of this fork can be found in [this issue](https://github.com/sparkle-project/Sparkle/issues/363).
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes.
# Features
## Features
## Sandboxing
This fork includes several XPC services that are generally optional to include in your application, but are required for sandboxed applications. See the [INSTALL](INSTALL.markdown) file for more detail.
When sandboxed, linked release notes are allowed. External references inside the linked release notes are only allowed if the host application has an incoming network entitlement. Lastly, updates can still be extracted from DMG files just as they are in the official branch.
## Custom User Interfaces
<img src="Resources/Screenshot2.png" width="350" alt="Sparkle shows a custom update window with release notes">
See the `SPUUserDriver` protocol and classes that implement it for how to write your own user interface. This enables extensibility of Sparkle without altering or extending internal classes.
Hold shift when launching the `Sparkle Test App` to try out the experimental user interface shown above (note: this custom interface requires running macOS 10.10 or later).
## Command Line Tool
<img src="Resources/Screenshot3.png" width="400" alt="Sparkle shows command line interface to installing updates">
The `sparkle` command line tool can be used to update any Sparkle supported bundle. `sparkle` is a great demonstration of updating other bundles, though that aspect is not limited to just this tool!
This utility may also be an ideal choice for plug-ins where loading a copy of Sparkle's framework into a host's application may lead to conflicts or have undesirable consequences.
## Modern Security
Not only is sandboxing supported, but launchd is now used for submitting the installer. XPC is used to communicate to the launchd job. Uses of `AuthorizationExecuteWithPrivileges`, which is neither secure or reliable, have been removed. Installation on standard user accounts has been tested heavily rather than being treated as an edge case.
Extraction, validation, and installation of the update are all handled by the installer. The XPC services and the installer job don't implicitly trust the other end of the connection. Signing downloads with a DSA signature is now encouraged more aggressively.
Usage of AppKit has been minimized greatly. No linkage of it is found in the installer daemon. All code core to Sparkle's functionality prevents it from being imported. Only user driver classes and a progress agent may use AppKit for showing UI. A `SparkleCore.framework` target has been created that just uses the core.
## API Compatibility
Despite decoupling update scheduling, UI, installation, and minimizing AppKit usage, a great deal of effort was made to maintain ABI compatibility with older versions of Sparkle. A deprecated `SUUpdater` shim exists for maintaining runtime compatibility. Please check out `SPUStandardUpdaterController` and `SPUUpdater` instead for modern replacements.
Interactive package based installations have been deprecated in favor for guided package installations. As a consequence, interactive installations now have to be opted into (eg: `foo.sparkle_interactive.pkg`). A `sparkle:installationType="package"` or `sparkle:installationType="interactive-package"` tag is also now required in the appcast enclosure item for package based installs.
No attempt is made to preserve compatibility with regards to subclassing Sparkle's internal classes. Doing this is not supported or maintainable anymore. Much of this desire will go away with the extensibility provided by the user driver API.
New Sparkle classes are now prefixed with `SPU` rather than `SU`. Older classes still use the `SU` prefix to maintain compatibility.
## Misc. Changes
* Updates are more instant to install once extracted. The "installing update" dialog seldomly shows up after the old application quits.
* The installer will attempt installing the update after extraction is finished, even if the user quits the process and doesn't relaunch the application explicitly.
* Updates can be downloaded in the background automatically (if enabled) and be resumed by the user later, even if the user has insufficent permission to install them initially.
* Authentication now occurs before launching the installer and before terminating the application, which can be canceled by the user cleanly.
* Sudden termination for silent updates isn't disabled because Sparkle doesn't listen for AppKit events anymore such as termination or power off (note the installer running as a separate process listens for termination).
* Distributing updates without DSA signing the archives is now deprecated.
* Sparkle's icon in the official branch is no longer used for installation. Instead, the icon of the bundle to update is used. A 32x32 image representation of the icon is needed for the authorization dialog.
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`.
* Seamless. There's no mention of Sparkle; your icons and app name are used.
* Secure. Updates are verified using EdDSA signatures and Apple Code Signing.
* Fast. Supports delta updates which only patch files that have changed.
* Easy to install. Sparkle requires no code in your app, and only needs static files on a web server.
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
* Handles permissions, quarantine and automatically asks for authentication if needed.
* Uses RSS-based appcasts for release information. Appcasts are a de-facto standard supported by 3rd party update-tracking programs and websites.
* Stays hidden until second launch for better first impressions.
* Truly self-updating — the user can choose to automatically download and install all updates in the background.
* Ability to mark updates as critical.
* Progress and status notifications for the host app.
## Requirements
* Runtime: **macOS 10.9** or greater for 64bit, **macOS 10.10** or greater for 32bit (this has been bumped up!)
* Build: Xcode 7 or greater required.
* Runtime: macOS 10.11 or greater
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less; at least Xcode 12 if using Swift Package Manager.
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
## Usage
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required. If your app is sandboxed, see the [INSTALL](INSTALL.markdown) document for more details about installing XPC binaries that support sandboxed apps.
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required.
## Development
This repository uses git submodules, and will not build unless you clone recursively. Also, GitHub-provided ZIP/tar archives are broken due to GitHub not supporting git submodules properly.
git clone https://github.com/sparkle-project/Sparkle
git checkout 2.x
git submodule update --init --recursive
### Troubleshooting
* Please check **Console.app**. Sparkle prints detailed information there about all problems it encounters. It often also suggests solutions to the problems, so please read Sparkle's log messages carefully.
* Use the `generate_appcast` tool which creates appcast files, correct signatures, and delta updates automatically.
* Make sure the URL specified in [`SUFeedURL`](https://sparkle-project.org/documentation/customization/) is valid (typos/404s are a common error!), and that it uses modern TLS ([test it](https://www.ssllabs.com/ssltest/)).
* Delete your app's preferences (in `~/Library/Preferences/<your bundle id>`) if you've set another feed URL programmatically via Sparkle's Objective-C interface.
### API symbols
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
@@ -91,13 +66,11 @@ If you are adding a symbol to the public API you must decorate the declaration w
### Building the distribution package
`cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.bz2 will be created in a temporary directory and revealed in Finder after the build has completed.
`cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.xz (or .bz2) will be created in a temporary directory and revealed in Finder after the build has completed.
Alternatively, build the Distribution scheme in the Xcode UI.
See the [INSTALL](INSTALL.markdown) file after building Sparkle, especially if interested in sandboxing support. The XPC services are not required for non-sandboxed applications.
## Code of Conduct
### Code of Conduct
We pledge to have an open and welcoming environment. See our [Code of Conduct](CODE_OF_CONDUCT.md).
-10
View File
@@ -1,10 +0,0 @@
html {
color: white;
background: transparent;
}
:link {
color: #419CFF;
}
:link:active {
color: #FF1919;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 176 KiB

+12
View File
@@ -0,0 +1,12 @@
@media (prefers-color-scheme: dark) {
html {
color: white;
background: transparent;
}
:link {
color: #419CFF;
}
:link:active {
color: #FF1919;
}
}
+13 -6
View File
@@ -6,33 +6,40 @@
<language>en</language>
<item>
<title>Version 2.0 (2 bugs fixed; 3 new features)</title>
<link>http://sparkle-project.org</link>
<sparkle:version>2.0</sparkle:version>
<sparkle:releaseNotesLink>
http://you.com/app/2.0.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:dsaSignature="BAFJW4B6B1K1JyW30nbkBwainOzrN6EQuAh" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
<item>
<title>Version 1.5 (8 bugs fixed; 2 new features)</title>
<link>http://sparkle-project.org</link>
<sparkle:version>1.5</sparkle:version>
<sparkle:releaseNotesLink>
http://you.com/app/1.5.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
<item>
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
<link>http://sparkle-project.org</link>
<sparkle:releaseNotesLink>
http://you.com/app/1.4.html
</sparkle:releaseNotesLink>
<sparkle:version>241</sparkle:version>
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
</channel>
</rss>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 100 KiB

+1 -1
View File
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
'Andy Matuschak' => 'andy@andymatuschak.org',
}
s.platform = :osx, '10.7'
s.platform = :osx, '10.11'
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.bz2" }
s.source_files = 'Sparkle.framework/Versions/A/Headers/*.h'
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -40,23 +39,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "14732BC51960F69300593899"
BuildableName = "Distribution"
BlueprintName = "Distribution"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -72,8 +59,6 @@
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
BuildableName = "Sparkle Test App.app"
BlueprintName = "Sparkle Test App"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3"
enableGPUValidationMode = "1"
allowLocationSimulation = "NO">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
BuildableName = "Sparkle Test App.app"
BlueprintName = "Sparkle Test App"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
BuildableName = "Sparkle Test App.app"
BlueprintName = "Sparkle Test App"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1300"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -40,23 +39,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
BuildableName = "Sparkle.framework"
BlueprintName = "Sparkle"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -73,8 +60,6 @@
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -10,7 +10,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -24,22 +23,17 @@
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Loaded 100 of 550 files, more files were not shown because too many files have changed in this diff. Show more