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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Removed isUpdaterRelaunching property.

* Revert SUHost.
2017-08-08 00:21:51 +01:00
Kornel 43b4472d3c Better error message 2017-08-01 15:55:25 +01:00
Kornel 260170f372 Warning 2017-08-01 15:54:52 +01:00
Kornel ea85fc6442 Update to Xcode 9/Swift 4 2017-07-27 16:42:44 +01:00
Kornel a52604a264 Revert "Ensure UI code always runs on the main thread"
This reverts commit 423ee5a9d6.
2017-07-20 13:20:20 +01:00
Kornel 39d6c616b0 Merge pull request #1051 from sparkle-project/mainalert
Ensure UI code always runs on the main thread
2017-07-16 21:03:20 +01:00
Kornel 043ad0464a Merge pull request #1098 from Eitot/dutch
Update Dutch localization for informal style and changed terminology
2017-06-24 22:19:09 +01:00
Kornel d99339cf08 Merge pull request #1097 from Eitot/german
Update German localization for informal style and changed terminology
2017-06-24 22:11:16 +01:00
Eitot c541f95036 Update German localization with some terminology changes
Apple uses the term "Update" instead of "Aktualisierung" and
"laden" instead of "herunterladen".
2017-06-23 10:00:05 +02:00
Eitot e678ffb3ca Update German localization for informal style
This is the style in Apple's localizations in macOS Sierra.
Also makes some slight changes to wording.
2017-06-23 09:59:48 +02:00
Eitot 070ea362a2 Update Dutch localization for informal style
This is the style in Apple's localizations in macOS Sierra.
2017-06-23 09:57:55 +02:00
Eitot c4db636d0b Update Dutch localization with some style changes
This reflects Apple's localizations a bit better.
2017-06-23 09:57:49 +02:00
Kornel 7e9f05865a Merge pull request #1094 from keith/ks/cocoapods-bin
Include bin files in CocoaPods installation
2017-06-19 10:24:38 +01:00
Keith Smiley 3c14c950ef Include bin files in CocoaPods installation
This updates the podspec to include the bin scripts in Pods directory
when using CocoaPods. This way users don't also have to download the
Sparkle repo out of band to sign releases.
2017-06-18 20:33:24 -07:00
Kornel c3c2e51a08 Merge pull request #1091 from ksuther/remove-unused-function
Remove unused escapeURLComponent
2017-06-10 23:38:38 +01:00
Kent Sutherland d11eb126a1 Remove unused escapeURLComponent 2017-06-10 17:29:07 -05:00
Kornel fa7235c54e Merge pull request #1090 from ksuther/init-for-spustandardupdatercontroller
Added initWithUpdaterDelegate:userDriverDelegate: to SPUStandardUpdaterController
2017-06-09 23:32:00 +01:00
Kent Sutherland ed1e6031b6 Added initWithUpdaterDelegate:userDriverDelegate: to SPUStandardUpdaterController 2017-06-09 12:26:18 -05:00
Kornel 4438b69b50 Simplified check 2017-06-07 23:56:45 +01:00
Kornel 6d0c734c26 Rename OSX macOS 2017-06-07 23:55:34 +01:00
Kornel e8805e0563 Merge pull request #1089 from Memphiz/add_osx_attribute
Add support for the sparkle:os attribute in the enclosure tag
2017-06-07 23:51:10 +01:00
Memphiz 193036b2c4 [BasicUpdateDriver] - extend hostSupportsItem method to also check the sparkle:os attribute from the enclosure element to decide if an update item is valid for the host 2017-06-07 22:11:08 +02:00
Memphiz 33bf6732ea [AppcastItem] - parse and save the sparkle:os attribute of the enclosure element and add isOsxUpdate method to item class 2017-06-07 22:10:56 +02:00
Kornel e94fb63ff0 Merge pull request #1087 from 1024jp/japanese
Updated Japanese translation to reflect change on 55be13c
2017-06-04 15:12:32 +01:00
Kornel 84e5925578 Merge pull request #1086 from vitu/master
Updated translation to reflect change on 55be13c
2017-06-04 15:11:51 +01:00
1024jp bb83e9a0da Updated Japanese translation to reflect change on 55be13c 2017-06-04 10:55:45 +09:00
Victor 26d4d75c36 Updated translation to reflect change on “Update error message to mention temp folders rather than optical drives”. 2017-06-03 20:23:14 -04:00
Kornel fe5737f0b6 Changelog 2017-06-02 12:21:08 +01:00
Kornel 7fc20434b9 Merge remote-tracking branch 'origin/master' into ui-separation-and-xpc
* origin/master:
  Don't assume that the progress block exists (the parameter is nullable)
  Prepend app name to Autoupdate.app name
  Error message tweak
  Update error message to mention temp folders rather than optical drives
  1.18.0
  Log more errors
  Unify handling of aborted updates
2017-06-02 12:07:36 +01:00
Kornel ac49a3b5b6 Merge pull request #1081 from sparkle-project/autoname
Prepend app name to Autoupdate.app name
2017-06-02 12:01:22 +01:00
Kornel cbeaeb29ec Merge pull request #1084 from ksuther/nil-progress-block
Don't assume that the progress block exists (the parameter is nullable)
2017-06-02 04:14:22 +01:00
Kent Sutherland d0a6c699da Don't assume that the progress block exists (the parameter is nullable) 2017-06-01 16:55:52 -05:00
Kornel 84b7e5e22f Prepend app name to Autoupdate.app name 2017-05-27 11:38:19 +01:00
Kornel 61774b3f7d Error message tweak 2017-05-27 11:37:06 +01:00
Kornel 55be13ca6f Update error message to mention temp folders rather than optical drives
Finder is required to remove quarantine from downloaded apps
2017-05-20 17:09:56 +01:00
Kornel fc48e5e4df 1.18.0 2017-05-18 21:54:56 +01:00
Kornel bfada07a2c Log more errors 2017-05-18 21:48:51 +01:00
Kornel 4f965660f3 Merge pull request #1072 from sparkle-project/autoerror
Unify handling of aborted updates
2017-05-03 16:51:06 +01:00
Kornel a2764158d6 Unify handling of aborted updates 2017-05-03 12:34:28 +01:00
Kornel 415b4fe164 Merge commit '60727bffa53ebfbfaf701575904847827bc1656a' into ui-separation-and-xpc
* commit '60727bffa53ebfbfaf701575904847827bc1656a':
  Log key read failure
  Formatting
  Escape + as well
  Escape profile URLs better
  Special case for .tar.gz extension
  Inline release notes if they don't look like a standalone HTML document
  Simplify release notes link check
  Feed formatting
2017-04-24 18:10:35 +01:00
Kornel 60727bffa5 Log key read failure 2017-04-24 18:05:13 +01:00
Kornel 715163fe0d Formatting 2017-04-24 18:05:13 +01:00
Kornel 629c42d62d Merge pull request #1050 from sparkle-project/genapp
generate_appcast improvements
2017-04-14 21:28:07 +02:00
Kornel 3e45211bbe Escape + as well 2017-03-31 15:15:22 +01:00
Kornel 89acca1318 Escape profile URLs better
Fixes #1059
2017-03-31 11:08:03 +01:00
Kornel Lesiński 2d30762570 Merge remote-tracking branch 'origin/master' into ui-separation-and-xpc
* origin/master: (39 commits)
  %s is deliberate in this format string
  Unused
  Make generate_appcast available as a shared scheme
  Shush Xcode
  Link straight to docs from the readme
  ignore .html files when scanning for archives
  Missing strings translation.
  Updated swift
  Warn against abusing installUpdatesIfAvailable
  when generating the appcast, if an .html file exists of the same name as the archive, then it will be linked in as the releaseNotesLink
  Revert "Fix pt_BR translations"
  Revert "Fix pt_BR translations (#1039)"
  Fix Japanse localization
  Add more info to auth tool run failure
  Fix pt_BR translations (#1039)
  Fix pt_BR translations
  Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs.
  added `sparkle:shortVersionString` to the enclosure, #1032
  Changelog
  percent encode the filename used in the delta url
  ...
2017-03-24 12:14:05 +00:00
Kornel Lesiński 4bc2e6e891 %s is deliberate in this format string
Fixes #1053
2017-03-24 12:00:12 +00:00
Kornel Lesiński 405c9fd9a1 Unused 2017-03-24 12:00:12 +00:00
Kornel 9232316b19 Merge pull request #1052 from sparkle-project/scheme
Make generate_appcast available as a shared scheme
2017-03-24 11:05:33 +00:00
Kornel Lesiński 0569c73391 Make generate_appcast available as a shared scheme
#1049
2017-03-17 09:27:00 +00:00
Kornel Lesiński 423ee5a9d6 Ensure UI code always runs on the main thread 2017-03-15 21:31:11 +00:00
Kornel Lesiński ac042821d8 Special case for .tar.gz extension 2017-03-15 18:42:08 +00:00
Kornel Lesiński 36139c57bc Shush Xcode 2017-03-15 18:42:08 +00:00
Kornel Lesiński 662e84400a Inline release notes if they don't look like a standalone HTML document 2017-03-15 18:42:08 +00:00
Kornel Lesiński b6b5c6d927 Link straight to docs from the readme 2017-03-15 18:42:08 +00:00
Kornel Lesiński 1683d2de34 Simplify release notes link check 2017-03-15 18:42:08 +00:00
Kornel Lesiński 615a08bc32 Feed formatting 2017-03-15 18:42:08 +00:00
Kornel c7bf998913 Merge pull request #1016 from sparkle-project/installprogress
Report installation progress from Installer
2017-03-12 14:39:43 +00:00
Kornel 1dd9d93090 Merge pull request #1046 from digitalmoksha/master
generate_appcast: if an .html file exists of the same name, create the releaseNotesLink
2017-03-11 11:31:58 +00:00
Brett Walker ac8c37096e ignore .html files when scanning for archives 2017-03-11 12:09:53 +01:00
Kornel c86e825a5f Merge pull request #1048 from vitu/master
Missing strings translation.
2017-03-09 17:03:57 +00:00
vitu 40a777f5d9 Missing strings translation. 2017-03-09 11:58:52 -05:00
Kornel Lesiński 3098afc90b Updated swift 2017-03-09 13:32:05 +00:00
Kornel Lesiński 3809da20bf Warn against abusing installUpdatesIfAvailable 2017-03-09 13:13:29 +00:00
Brett Walker c623480f72 when generating the appcast, if an .html file exists of the same name as
the archive, then it will be linked in as the releaseNotesLink
2017-03-08 10:57:59 +01:00
Kornel Lesiński 2a644672ca Report installer progress 2017-01-24 13:46:21 +00:00
Kornel Lesiński 81e71844d6 Report plain install progress 2017-01-24 13:46:01 +00:00
Kornel Lesiński e4821e0454 Ability to report installation progress 2017-01-24 13:45:50 +00:00
Zorg a4eefe6725 Move SPUUpdateDriver.h up in the Xcode project 2017-01-20 22:09:41 -05:00
Zorg 934f9e2c32 Add some documentation to internal SPUUpdateDriver 2017-01-20 22:09:19 -05:00
Zorg 446df27354 Document why the user driver API was designed the way it was 2017-01-20 21:00:05 -05:00
Zorg b24ea83d0f Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-20 20:50:28 -05:00
Zorg aaac6cd594 Document TerminationListener a bit 2017-01-19 23:14:08 -05:00
Zorg a000e3b311 Handle listening for termination of already-dead processes
Before our TerminationListener didn't handle a process that has already been terminated. In my fork this is unlikely to be an actual issue but in master, the application can very well be dead before the termination listener initiates.
2017-01-19 23:11:20 -05:00
Zorg dc02d2d614 Merge branch 'master' into ui-separation-and-xpc 2017-01-18 19:55:39 -05:00
Zorg 7a1e396530 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-17 19:13:30 -05:00
Zorg dfaed624ae Merge branch 'master' into ui-separation-and-xpc 2017-01-17 15:58:02 -05:00
Zorg 9dd4d46bb9 Merge branch 'master' into ui-separation-and-xpc 2017-01-16 20:08:56 -05:00
Zorg 0c7db7f24d Remove ask for updater permission changes from Read Me
This no longer differs from master's current behavior.
2017-01-16 16:23:00 -05:00
Zorg a34102a140 Revert back to asking for updater permission on 2nd launch
I don't think I have a great justification anymore for waiting more than 'x' hours. This may just be an artifact when I was initially architecting Sparkle so that the entire framework could be stuffed into an XPC service.
2017-01-16 16:20:36 -05:00
Zorg 0b32116f65 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-16 15:17:16 -05:00
Zorg fdebf50f81 Merge branch 'master' into ui-separation-and-xpc 2017-01-15 20:21:49 -05:00
Zorg 62c9a8c785 Merge branch '1.17.x' into ui-separation-and-xpc 2017-01-12 21:50:14 -05:00
Zorg 6a4f1e6340 Merge branch 'master' into ui-separation-and-xpc 2017-01-12 21:13:24 -05:00
Zorg d980fe8783 Merge branch 'master' into ui-separation-and-xpc 2017-01-12 21:12:50 -05:00
Zorg 5cff3cd543 Change network service type to background where appropriate 2017-01-10 18:42:33 -05:00
Zorg 866fbfe4fd Remove bullet points in ReadMe that are less relevant now
Either they're merged in master now or are in the process of being merged soon.
2017-01-09 00:02:32 -05:00
Zorg c543edf6f6 Update graph of sparkle image 2017-01-08 23:56:31 -05:00
Zorg 930346d24b Remove unused header that must have been added from master 2017-01-08 23:54:20 -05:00
Zorg 55b586f4dc Split resumable updates type into downloadable and info update types 2017-01-08 23:42:25 -05:00
Zorg 4c01a69870 Rename SPUDownloadedUpdate -> SPUResumableUpdate
A resumable update isn't necessarily a downloaded update now, due to informational only updates.
2017-01-08 23:12:23 -05:00
Zorg 604d3f578a Use -[SUHost objectForInfoDictionaryKey:] in couple more places 2017-01-08 09:23:15 -05:00
Zorg 005a9a069e Merge branch 'master' into ui-separation-and-xpc 2017-01-07 23:26:57 -05:00
Zorg 2bb5ce4318 Make SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle
When we retrieve the "CFBundleIconFile" key from the Info dictionary, we should rely on SUHost's method of obtaining that value now.
2017-01-07 22:55:13 -05:00
Zorg b645005689 Improve -[SUHost objectForInfoDictionaryKey:]
We use the cached host bundle if the host bundle is equal to the main bundle.
Otherwise we read in the latest Info dictionary every time.

The cached case is the most common case. The odd case (updating other bundles) is less common. Thus we have better performance for the common case, and we retain correct code in both cases.
2017-01-07 22:32:08 -05:00
Zorg 3b2ea83c6f Fix latest analyzer warnings 2017-01-07 11:22:13 -05:00
Zorg 874ec099b9 Merge branch 'master' into ui-separation-and-xpc 2017-01-07 11:13:40 -05:00
Zorg 23011345cb Add SUOperatingSystem.m to generate_appcast since SULog now needs it 2017-01-06 22:29:03 -05:00
Zorg f04c73445e Document logging levels 2017-01-06 12:59:01 -05:00
Zorg 36fd5a8bbd Add some comments to SULog.h/m 2017-01-05 23:19:28 -05:00
Zorg 31cfbbccd9 Change around SULog.m #include's 2017-01-05 23:15:59 -05:00
Zorg af0a88dab3 Remove private _SULogDisableStandardErrorStream() function
When using ASL, don't log to stderr if a terminal is attached. This behavior closely matches os_log()
2017-01-05 23:09:58 -05:00
Zorg e1a4ad9371 Add level parameter to SULog()
Current levels are: default and error
2017-01-05 22:51:36 -05:00
Zorg 36e7cf263c Use os_log API for errors instead of ASL if it's available 2017-01-05 21:23:16 -05:00
Zorg 19df2867af Merge branch 'master' into ui-separation-and-xpc 2017-01-03 22:19:21 -05:00
Zorg 5ce1d7b3dc Merge branch 'master' into ui-separation-and-xpc 2017-01-02 18:12:01 -05:00
Zorg dca2114934 Add user driver method to show informational only updates
This will increase the chance of a user driver implementing being able to show informational only updates. Also it's better to use a new method rather than re-use another existing one inappropriately.
2017-01-02 18:00:17 -05:00
Zorg c25f127188 Merge branch 'master' into ui-separation-and-xpc 2017-01-01 22:45:28 -05:00
Zorg 2001328032 Add user driver docs & handling for showing informational updates
Perhaps I should add another method to the user driver for showing informational updates in the near future.
2017-01-01 22:22:07 -05:00
Zorg 9d354e5606 Improve title text of update alert for normal & informational updates 2017-01-01 21:38:39 -05:00
Zorg ad43a6d0c9 Informational only updates shouldn't be presented as downloadable 2017-01-01 21:38:08 -05:00
Zorg 0bb3ab51b3 Handle informational only updates from the automatic update driver
The automatic update driver defers the informational only update & aborts, allowing a scheduled UI driver to resume it. The automatic update driver aborts before the point an update would normally be downloaded.
2017-01-01 21:22:02 -05:00
Zorg 27a24a5413 Make sure downloader progress doesn't exceed expected max progress 2016-12-29 11:46:17 -05:00
Zorg e3f68b70bf Prefer using HTTP expected content length over appcast item length
Also use (u)int64_t instead of NS(U)Integer
2016-12-29 11:11:05 -05:00
Zorg a82f5acdd6 Sort the project file using webkit's script:
https://github.com/WebKit/webkit/blob/master/Tools/Scripts/sort-Xcode-project-file

This may help with mergability a bit.
2016-12-28 21:28:16 -05:00
Zorg e463ed4bcb Merge branch 'master' into ui-separation-and-xpc 2016-12-28 21:19:40 -05:00
Zorg 52397d616f Download response may not return expected length for a smaller part 2016-12-28 12:54:05 -05:00
Zorg 47b1c8a9a2 Expected content length from http header should not be accumulated 2016-12-28 12:39:18 -05:00
Zorg 6d69b1215d Prevalidation is mostly merged into master now 2016-12-27 17:51:33 -05:00
Zorg 7609068886 Sync unit test configuration files to be similar to master branch 2016-12-27 17:47:47 -05:00
Zorg f7d9e44ab6 Xcode fixing its project file again 2016-12-27 15:41:21 -05:00
Zorg ab64d8d19f Merge branch 'master' into ui-separation-and-xpc 2016-12-27 15:38:13 -05:00
Zorg 76013ba66c Merge branch 'master' into ui-separation-and-xpc 2016-12-27 15:32:56 -05:00
Zorg cba7f51132 Merge branch 'master' into ui-separation-and-xpc 2016-12-27 10:29:33 -05:00
Zorg e3a467b126 Rename update permission prompt & nib to use SU prefix 2016-12-27 10:06:41 -05:00
Zorg 9fa601c08f Remove old SUAutomaticUpdateAlert strings 2016-12-27 09:03:56 -05:00
Zorg 29ef0150b5 Use [NSApplication sharedApplication] instead to match master 2016-12-26 21:07:21 -05:00
Zorg 65c0c1e7fe Move code from SPUInstallerValidation.m to SUUpdateValidator.m 2016-12-26 21:01:47 -05:00
Zorg b482f55e46 Merge branch 'master' into ui-separation-and-xpc 2016-12-26 19:30:28 -05:00
Zorg 36ed896d0f Rename SPUInstallerProtocol -> SUInstallerProtocol, remove -cleanup
This is to prepare for the next merge from master.
2016-12-26 19:12:02 -05:00
Zorg fd533f937e Don't pass version comparator to SUInstaller 2016-12-26 13:03:20 -05:00
Zorg d362caac98 Rename applicationPath to bundlePath in SUPlainInstaller
This is less confusing. I also documented the SUPlainInstaller initializer method.
2016-12-26 12:58:26 -05:00
Zorg cc77f11e22 Use self instead of [self class] to refer to class method 2016-12-26 11:17:27 -05:00
Zorg 55bc22b1ae Merge branch 'master' into ui-separation-and-xpc 2016-12-26 11:04:56 -05:00
Zorg 66e5460208 Remove some specific deprecated markings in SUUpdaterDelegate.h
The entire protocol is deprecated anyway.
2016-12-26 10:43:21 -05:00
Zorg bd6df5b707 Add nullability annotations to SUUpdaterDelegate.h 2016-12-26 10:35:28 -05:00
Zorg f656bf5068 Clarify where this delegate method exists 2016-12-24 21:42:54 -05:00
Zorg 2a612f450e Merge branch 'master' into ui-separation-and-xpc 2016-12-24 21:34:49 -05:00
Zorg 853a0ecd82 Use SU prefix for ApplicationInfo and BundleIcon classes
This is to hopefully make merging recent changes from master easier.
2016-12-24 21:19:20 -05:00
Zorg 1943d971fc Remove SUParameterAssert.h since I removed it in master 2016-12-23 19:17:17 -05:00
Zorg 8aada73941 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 19:14:27 -05:00
Zorg ae35c09624 Fix update validation code from recent merge for pkg updates 2016-12-23 14:58:31 -05:00
Zorg fe79d29665 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 14:50:54 -05:00
Zorg 553168ba51 Merge branch 'master' into ui-separation-and-xpc 2016-12-23 14:44:32 -05:00
Zorg 2c1e996fab Update comments 2016-12-22 09:36:37 -05:00
Zorg b28fd2410d Mark SPUInstallerValidation and SUUpdateValidator as daemon-safe 2016-12-20 22:00:54 -05:00
Zorg 35ef590f2b Update graph of sparkle image in documentation 2016-12-20 21:50:21 -05:00
Zorg 574c0f63ca Add documentation files to Xcode project group 2016-12-20 21:48:06 -05:00
Zorg b6b554e830 Appcast instance cannot be nil here. 2016-12-20 20:54:35 -05:00
Zorg d5e54005ce Fix static analyzer warning by marking method return type as nullable 2016-12-20 20:47:59 -05:00
Zorg 09da99f4cf Merge branch 'master' into ui-separation-and-xpc 2016-12-20 20:23:07 -05:00
Mayur Pawashe 07b9b71f8f Merge pull request #2 from ksuther/ui-separation-and-xpc
Fixed retain cycle between SPUBasicUpdateDriver and SUAppcastDriver
2016-12-19 11:40:19 -05:00
Kent Sutherland 70af94624d Fixed retain cycle between SPUBasicUpdateDriver and SUAppcastDriver 2016-12-15 15:56:36 -06:00
Zorg 9ea4cf1bf6 Merge branch 'master' into ui-separation-and-xpc 2016-12-04 17:05:01 -05:00
Zorg fee1b0c126 Mention ABI compatibility specifically 2016-12-03 22:41:43 -05:00
Zorg 2c9d44a341 Improve documentation wording for setFeedURL: 2016-12-03 22:23:48 -05:00
Zorg 9392e3260a Comment style changes 2016-12-03 22:19:13 -05:00
Zorg eb78f61f41 Annotate that -[SPUUpdater setFeedURL:] can take nil as a value 2016-12-03 22:15:08 -05:00
Zorg a6abd1c206 Specify nonatomic in SPUUpdater and SUUpdater where applicable. 2016-12-03 22:00:12 -05:00
Zorg 7b0d0d8909 Merge branch 'master' into ui-separation-and-xpc 2016-12-03 21:50:33 -05:00
Zorg 7783e9f704 Merge branch 'master' into ui-separation-and-xpc 2016-11-11 19:28:02 -05:00
Zorg 8106aa8700 Merge branch 'master' into ui-separation-and-xpc 2016-11-10 15:57:25 -05:00
Zorg efd39a31e9 Remove Makefile-icon 2016-11-03 16:11:59 -04:00
Zorg f46d4b7c4d Mark startUpdater method as being invoked on main thread only 2016-11-03 15:29:25 -04:00
Zorg 5a7462e5b9 Remove the optimized Sparkle.icns that was merged from master
This branch doesn't have Sparkle bundle an icon in the first place.
2016-11-03 15:22:48 -04:00
Zorg 8e7cb0ac79 Merge branch 'master' into ui-separation-and-xpc 2016-11-01 19:46:30 -04:00
Zorg c72efdfb34 Merge branch 'master' into ui-separation-and-xpc 2016-10-31 21:49:00 -04:00
Zorg e2adfd2617 No need to have debug warning in SUUpdater when one is in SPUUpdater
This came from a recent merge.
2016-09-17 09:17:51 -04:00
Zorg 2d4568671c Remove unused 'Invalidate Connection' menu item in Test App 2016-09-16 23:16:32 -04:00
Zorg 6b452b2861 Move swift build settings to xcconfig files 2016-09-16 15:22:19 -04:00
Zorg 163158cacf Merge branch 'master' into ui-separation-and-xpc 2016-09-16 15:08:04 -04:00
Zorg a0ced6018d Update ReadMe 2016-09-05 13:58:59 -04:00
Zorg f36e7a46cd Merge branch 'master' into ui-separation-and-xpc
Updating some documentation
2016-09-05 13:48:25 -04:00
Zorg fd4ff8a6e7 Merge branch 'master' into ui-separation-and-xpc 2016-09-04 23:52:40 -04:00
Zorg 1a5cf6e48f Add @import Foundation handling for SPUStatusCompletionResults.h 2016-09-04 23:49:41 -04:00
Zorg 17277b1f77 Merge updater delegate installer interaction allowed methods 2016-09-04 22:57:59 -04:00
Zorg 30d4a5eb5c Merge code sign test changes from master 2016-09-04 18:23:23 -04:00
Zorg def9a599a3 More SU -> SPU renaming
Some of these class names conflicted with the official branch even though they are almost nothing like code-wise now.
2016-09-04 18:21:41 -04:00
Zorg 32373e8185 Use -[NSURL checkResourceIsReachableAndReturnError:] in tests
This avoids nullability warnings when converting NSURL -> NSString path
2016-09-03 22:56:38 -04:00
Zorg 213bedfa37 Merge branch 'master' into ui-separation-and-xpc 2016-09-03 22:50:25 -04:00
Zorg d3ebffb267 Update header documentation for SPUUpdater/SPUUpdaterDelegate 2016-08-30 00:33:03 -04:00
Zorg b911b8c540 Use @import module syntax in exported headers if available
This will decrease compiler warnings to module-based projects that include Sparkle.
2016-08-29 23:59:10 -04:00
Zorg cc38a3d7a6 Pass user initiated flag when update is found to the user driver
This is better than the hack in the previous commit. Also, a user driver may very well want to act differently in showing UI if the user initiated the update check.
2016-08-29 00:31:29 -04:00
Zorg f9a2c7a450 Let user driver know if resume update checks are user initiated 2016-08-29 00:04:23 -04:00
Zorg f5a79ecc79 Merge branch 'master' into ui-separation-and-xpc 2016-08-28 09:42:05 -04:00
Zorg 64bf8d02e2 Remove note about removing mdimport since it's been merged in master 2016-08-28 00:11:07 -04:00
Zorg 325059484f Only log missing 'length' warning once per all appcast item instances 2016-08-27 23:58:01 -04:00
Zorg 56cd205880 Merge branch 'master' into ui-separation-and-xpc 2016-08-27 22:46:14 -04:00
Mayur Pawashe 021c1a7803 Merge pull request #1 from michelf/ui-separation-and-xpc
Fixing memory leak transferring dictionary to ARC
2016-08-27 14:17:58 -04:00
Zorg 4d13c54d4c Merge branch 'master' into ui-separation-and-xpc 2016-08-27 13:54:20 -04:00
Zorg 7c49f722a8 Merge branch 'master' into ui-separation-and-xpc 2016-08-27 11:34:42 -04:00
Michel Fortin 5f255c4865 Fixing memory leak where transferring of property dictionary to ARC. 2016-08-27 11:20:34 -04:00
Zorg fb2aea0d86 Fix normalization relaunch path setting and improve relaunching code
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=1 now works properly again. In the progress agent, we don't use the path sent from the installer unless the normalized setting is enabled.
2016-08-27 10:40:38 -04:00
Zorg 251feb7e07 Rename registerRelaunchBundlePath to registerApplicationBundlePath 2016-08-27 02:24:37 -04:00
Zorg 6f337aa6f3 Remove outdated comment about command key being held down in test app 2016-08-26 22:32:49 -04:00
Zorg 9b4aaef3dd Update documentation on -[SPUUserDriver dismissUpdateInstallation] 2016-08-26 18:58:59 -04:00
Zorg 2548057da8 Clarify why installer has handling for timeouts 2016-08-26 18:46:25 -04:00
Zorg fb5c577dad Update comment to reflect what occurs after sending stage 2 request 2016-08-26 18:35:52 -04:00
Zorg db642a0700 Fix relaunching if multiple instances of app were running
We leave the "application was alive and needs to terminate logic" to the progress agent rather than to the installer too.
2016-08-26 18:23:42 -04:00
Zorg 328a445b5c Clarify that the agent tool shouldn't monitor processes' death 2016-08-26 18:01:44 -04:00
Zorg fbad9e466f Update installation document to include termination, SU->SPU changes 2016-08-26 01:47:57 -04:00
Zorg 44b70bb16c Remove SPUApplicationIcon and merge it into SPUApplicationInfo
Every component that needed SPUApplicationIcon also needed SPUApplicationInfo
2016-08-26 01:08:06 -04:00
Zorg 46a75cde97 Terminate application in the progress agent instead of user driver
This allows us to remove SPUUserDriverUIComponent and remove a bunch of logic in the user driver regarding termination. The user drivers generally don't need to know about the application bundle anymore, and strictly now only show UI events.

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

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

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

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

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

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

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

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

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

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

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

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

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

Currently, the GUI progress tool doesn't work properly, but everything else should be behaving like before.
2016-07-12 19:59:24 -04:00
Zorg 80bc8353ed Handle defer installation when resuming updates in sparkle-cli 2016-07-12 19:50:00 -04:00
Zorg 7d1c0aa83b Merge branch 'master' into ui-separation-and-xpc 2016-07-04 23:29:09 -04:00
Zorg 1b5b4972c9 Document -grantAuthorizationPrivilegesWithError: 2016-07-04 21:33:51 -04:00
Zorg ddb4262b7b Rename and document -updateAccessTimeOfItemAtRootURL:error: 2016-07-04 21:25:54 -04:00
Zorg 599c3fb3c1 Add unit test for updating access dates 2016-07-04 21:10:49 -04:00
Zorg b8bb06fb2f Change step # references to section names now 2016-07-04 19:56:23 -04:00
Zorg 63febfd9cd Updating installation docs into sections rather than bulleted points
Also make some other changes with choice of wording
2016-07-04 19:51:40 -04:00
Zorg b4f7a28aa3 Add updater delegate immediate installation handler to installation docs 2016-07-03 20:18:21 -04:00
Zorg 998a349617 Add updater delegate method for installing & relaunching new update 2016-07-03 18:44:11 -04:00
Zorg 9881476008 Update updater delegate documentation 2016-07-03 14:22:22 -04:00
Zorg 340633fd79 Comment more on why launching Autoupdate with LaunchServices is necessary 2016-07-03 11:54:28 -04:00
Zorg a615703883 Suppress const void* to void* warning for context info 2016-07-03 00:42:42 -04:00
Zorg e4d6e268e2 Stage 2 installation seems to be handled fine 2016-07-03 00:24:38 -04:00
Zorg e32d0dbc1a This validation warning note isn't a real concern for now 2016-07-02 23:32:56 -04:00
Zorg ef4af6b4a8 Marking main parameters as unused 2016-07-02 23:31:05 -04:00
Zorg 8de5c5cfa2 Update installation data documentation 2016-07-02 23:30:36 -04:00
Zorg 54408ca1a9 Fix bug where updater ignored 3rd stage installation failures
Only prevalent if the updater lives in a different process than the app being updated
2016-07-02 23:23:57 -04:00
Zorg 4240138818 The installer shells out to authorization 2016-07-02 19:29:53 -04:00
Zorg 39f7915492 Non-guided pkg installers show progress already 2016-07-02 19:28:35 -04:00
Zorg 23a07127d0 Add installation documentation detailing IPC 2016-07-02 19:26:33 -04:00
Zorg 641f3b0d47 Update mdimporter bundles during delta extraction
During delta extraction, these bundles may not be updated appropriately, so we should just be safe and update them ourselves
2016-07-01 21:23:51 -04:00
Zorg a7aad3b16a Use the authorization environment when requesting for auth
This probably went missing accidently when I did a merge
2016-07-01 20:13:39 -04:00
Zorg a6ccd4cfa9 Avoid unguided package installers if we may be running as root 2016-06-30 22:14:19 -04:00
Zorg b982e9460c Handle package installer (non-guided) errors 2016-06-29 00:09:22 -04:00
Zorg a09aa0b33f Package installs should be guided by default. Opt out for non-guided. 2016-06-29 00:09:08 -04:00
Zorg 9acfe7f180 Don't pass allowsAutomaticUpdates to user driver
Let the user driver read from updater settings to know if automatic updates are allowed
2016-06-28 00:28:21 -04:00
Zorg 30f346a967 Fix normal & resumable update handlers for popup titlebar user driver 2016-06-27 23:57:34 -04:00
Zorg 9a528d912a Fix PopUp Titlebar user driver not showing embedded release notes 2016-06-27 23:57:12 -04:00
Zorg c117837785 Add resumable update handler & fix normal update handler in sparkle-cli 2016-06-27 23:29:45 -04:00
Zorg 34ce18c44f Add private function for disabling stderr logging
This is useful for releasing sparkle-cli
2016-06-27 23:15:51 -04:00
Zorg e919c13f55 Always log output to stderr (for now...) 2016-06-27 00:02:37 -04:00
Zorg a3a6e3b3b7 Separate showing downloadable update from resumable update in user driver 2016-06-27 00:00:20 -04:00
Zorg 23a3ad4b05 Remove pch files, don't use older __nullable/__nonnull attributes 2016-06-25 10:18:12 -04:00
Zorg dc5298ce54 Make method for finding running appliction to reduce duped code 2016-06-24 23:42:31 -04:00
Zorg 1aedf2f9ed Remove duplicated Sparkle Cache directory code 2016-06-23 23:31:18 -04:00
Zorg 1392190d47 Make sure SULog delivers messages synchronously 2016-06-21 19:04:01 -04:00
Zorg b1606648cf Use isValidVersion: method in SUHost that already exists 2016-06-20 23:35:17 -04:00
Zorg 4d379f3e0a Add copying SparkleLocalMessagePort to release package script 2016-06-20 00:21:11 -04:00
Zorg da39e841f9 Fix build errors for fileop 2016-06-20 00:17:46 -04:00
Zorg 7e54e94472 Remove build settings I didn't configure
Maybe these happened during a bad merge.
2016-06-20 00:12:00 -04:00
Zorg 6cca0673c5 Change SURemoteMessagePort protocol to SURemoteMessagePortProtocol 2016-06-19 23:52:46 -04:00
Zorg 6a4b96580a Info only updates shouldn't require enclosure length 2016-06-16 23:27:39 -04:00
Zorg a780894d14 Fix appcast unit tests 2016-06-16 23:23:43 -04:00
Zorg af7c7cea2b Merge branch 'master' into ui-separation-and-xpc 2016-06-16 22:46:26 -04:00
Zorg 29d32eaaa0 Disable automatic termination when using SULocalMessagePort 2016-06-16 22:38:11 -04:00
Zorg 061e99995f Add XPC service for local message port
This should work under 10.12 (beta) environment now when sandboxed.
2016-06-15 21:44:24 -04:00
Zorg 911f2150f9 Don't think update driver should be interruptible anymore 2016-06-11 23:52:05 -04:00
Zorg adba3bd945 Don't allow SUUpdater to be kept alive by cycle resets 2016-06-11 23:31:24 -04:00
Zorg 71b91734e5 Merge branch 'master' into ui-separation-and-xpc 2016-06-11 21:07:57 -04:00
Zorg f70c7429ba Merge branch 'auth-wait-fileop' into ui-separation-and-xpc 2016-06-08 23:44:05 -04:00
Zorg 207390a2c1 Retrieve child pid by using fcntl() 2016-06-06 23:11:38 -04:00
Zorg 86d5d49111 Comment why AuthorizationExecuteWithPrivileges() is still being used 2016-06-04 18:02:21 -04:00
Zorg b2cb1bd531 Wait for all children processes to stop
This fixes installation failing when we check for the wrong child and don't let the installer finish. However, this code now ignores the status from the child. I might see if there's a better way around fixing that..
2016-06-04 17:38:21 -04:00
Zorg f36397e89c Handle EINTR for wait() and don't store / back up ECHILD handler 2016-06-04 13:31:57 -04:00
Zorg 623f535883 We can do guided installation silently if we're root 2016-06-03 23:16:21 -04:00
Zorg 070686b488 Use NS_ASSUME_NONNULL macros 2016-05-29 20:21:14 -04:00
Zorg 4482e2b736 Fix unsigned cast warning 2016-05-29 20:20:42 -04:00
Zorg c80ddf99f8 Declare constants for SUAppcastItem.m 2016-05-29 17:42:34 -04:00
Zorg 45aaba9ee9 Use ivars in SUAppcastItem initializers to make code smaller 2016-05-29 17:29:13 -04:00
Zorg 53c4abaf9e Remove providing custom installer progress app
I don't think this feature would be used much, and I don't want to deal with additional maintainability. As it is, the progress app should show up in rare cases.
2016-05-29 17:01:38 -04:00
Zorg d44ef6bb75 Installer progress: change the dock icon to the bundle being updated
This way we don't have to include an icon for the installer progress app. There is a minor issue where the dock icon changes back before termination. However, this app should show up in rare cases in the first place, so I still think this is a good trade off.

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

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

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

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

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

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

Because the root user has no trash directory, we ignore logging the error if it was not found.
We also avoid invoking mdimport which fails as root on the installed app.
mdimport may have been used before for updating mdimporter files, however, it should be the developer's
responsibility to ensure their mdimporter files have an updated date stamp, which will work if a user updates an app manually.
Other than that, we already touch the app to register it with LaunchServices, so that should suffice.
2016-04-30 12:26:36 -04:00
Zorg 65e2bac89e Improve finding live target app in command line driver 2016-04-30 12:26:25 -04:00
Zorg fdee19ec69 Add installation did finish event. This is not complete.
For sparkle-cli and out-of-process updaters, I added a did finish installing event.

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

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

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

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

1. An app can be manually replaced and so the installer would have to monitor that
2. We leave a zombie process running
2016-04-29 00:37:21 -04:00
Zorg 7183d9ebc5 Merge branch 'master' into ui-separation-and-xpc 2016-04-20 00:05:45 -04:00
Zorg 2c64d98ec8 Mention that OS X 10.8 is required 2016-04-19 23:31:43 -04:00
Zorg 0b640d5d20 Fix bug where updated app can think a new update has already been downloaded
This is fixed by invalidating the local port connection from Autoupdate right before launching the new update
2016-04-19 20:55:36 -04:00
Zorg 8a8cef7dce Add INSTALL file and add XPC services to Distribution target 2016-04-18 21:23:09 -04:00
Zorg 47d8ed8f05 Removing this codesign script because we're not including XPC services in the framework 2016-04-17 23:27:26 -04:00
Zorg 4ea4ece4fd Add XPC service dependencies to Test App 2016-04-17 23:13:27 -04:00
Zorg 3b892524a6 Rewrite ATS check by distinguishing if Sparkle is in XPC service or not
If it's not in a XPC service, then the main bundle decides the rules.
2016-04-17 23:01:20 -04:00
Zorg 2a89393853 Take XPC services out of the framework & make them optional
I'm hoping this will ease some of the build configuration issues I've been running into.
Apps (eg: unsigned, not-sandboxed) don't need to (although they still can) use the XPC services.
Sandboxed apps naturally should use the XPC services. Although, you can for example, choose not to use the
downloader services if the host app already entitlements to allow network connections.

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

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

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

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

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

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

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

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

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

So we can't keep this detection because it will generate false positives. And it's not really our responsibility anyway.
2016-04-16 01:52:29 -04:00
Zorg 63e100ae0d Instead of checking for main bundle, check for app bundle
We really want to differentiate between apps and prefpanes/plug-ins.
Using the main bundle is not at all a reliable indicator because an updater could target
any kind of bundle anywhere.
2016-04-16 01:48:54 -04:00
Zorg 291bef326b Require the updater to be started, separate from initializing
This new method also takes an error object as output, which means we can now
read a bundle in Sparkle without having to abort. If a check for updates action is invoked
before the updater has been started, it becomes a pending scheduled operation.
2016-04-15 23:36:12 -04:00
Zorg bab33b66cb Making minor improvements to property/synthesize names 2016-04-12 23:56:24 -04:00
Zorg ad0868ab4f Only use performedStage1Installation property on main thread
Should resolve any thread-safe worries
2016-04-11 21:54:29 -04:00
Zorg 18e666ac3a Don't make a permission prompt decision
We shouldn't change the user defaults on behalf of another application. This may require more thinking..
2016-04-11 09:03:25 -04:00
Zorg acaa021583 Merge branch 'master' into ui-separation-and-xpc 2016-04-11 03:25:00 -04:00
Zorg c105154ba8 Only recursively update access time, not modification time of updates 2016-04-11 02:01:58 -04:00
Zorg d4466d1448 Add Installer Progress depedency to Sparkle.framework 2016-04-11 01:31:32 -04:00
Zorg ee8fed0c2a Remove Sparkle target depedency from BinaryDelta
This shouldn't be needed.
2016-04-11 01:30:10 -04:00
Zorg e1b13f9c67 Add sparkle-cli tool that can update any arbitrary app
I added an application target but it's really intended to be used as a command line tool. The reason being was that it was the easiest way to bundle the Sparkle framework, I've found.

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

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

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

SUGuidedPackageInstaller now tries to grab authorization during stage 2 of the installation.
2016-04-09 18:00:47 -04:00
Zorg b3b12dc4be Remove unused variable warning 2016-04-09 16:31:28 -04:00
Zorg bb3a2e299e Don't show installer progress if installer already displays progress 2016-04-09 15:29:18 -04:00
Zorg 33bd47cd1f Fix deprecated API warning for -[NSData initWithBase64Encoding:] 2016-04-09 14:55:55 -04:00
Zorg 61ed9920b4 Use NSURL's checkResourceIsReachableAndReturnError: instead of FSRef's
Fixes deprecated API warning in DMG unarchiver code
2016-04-09 14:44:32 -04:00
Zorg f528f6b2ba Fix warnings for bspatch 2016-04-09 14:36:16 -04:00
Zorg 5f253e8c64 Fix not showing download update initiation when applying delta update fails 2016-04-09 13:43:47 -04:00
Zorg 00cdab1766 s/updateInProgress/canCheckForUpdates/ 2016-04-09 13:22:48 -04:00
Zorg e14077ee9a s/SUUpdaterController/SUStandardUpdaterController/ 2016-04-09 13:21:29 -04:00
Zorg e5b5952287 Avoid probing the installer multiple times 2016-04-09 12:53:49 -04:00
Zorg c80015bf99 Move invoking showCanCheckForUpdates: outside of this completion 2016-04-09 12:35:23 -04:00
Zorg 1bb301e82a Change updateInProgress to canCheckForUpdates
This more accurately reflects its intended purpose. From the beginning,
the user cannot check for updates until the updater is ready;
however this doesn't mean that the update is in progress.
2016-04-09 11:39:02 -04:00
Zorg 933504263a Use Autoupdate's icon for installer progress tool 2016-04-09 01:05:11 -04:00
Zorg 233fa268b5 Add tool for showing installer progress
This tool is only launched if a certain amount of time has passed,
and if we're allowed to show UI
2016-04-09 00:36:09 -04:00
Zorg c178e34d8f Remove unused headers from SUStatusController 2016-04-07 23:07:27 -04:00
Zorg 97a8568491 Add service for remote message port
This allows the updater to communicate to the installer without an additional entitlement
2016-04-04 01:18:15 -04:00
Zorg c4800182a2 Simplify testing for writable permissions to host path
Before there was always lag when checking for updates the first time.
This helps improve consistency.
2016-04-03 21:30:59 -04:00
Zorg b22d2c2568 Make menu item validation work in the test app 2016-04-03 20:06:56 -04:00
Zorg 44a61b830e Move debug warning up in initializer because it spawns really often.. 2016-04-03 20:04:56 -04:00
Zorg 6dedd8309f Handle multiple live remote port connections better
This also should fix a bug where sometimes an update could not be resumed
2016-04-03 19:56:29 -04:00
Zorg 32c687ed79 Make SURemoteMessagePort operations asynchronous 2016-04-03 17:05:56 -04:00
Zorg d7cca8a594 Check if runningApplication is nil for errors.. 2016-04-02 12:17:54 -04:00
Zorg 116c8ea8b7 Supply NSWorkspaceLaunchNewInstance when launching AutoUpdate
I don't think it actually matters since we are launching a copy we created, but
sounds like the right thing to do anyway.
2016-04-02 12:12:48 -04:00
Zorg 38a69cee5b Launch AutoUpdate via LaunchServices again.
I was being stupid for trying to launch the executable rather than the app.
2016-04-02 05:34:31 -04:00
Zorg a3a2310952 Fix Appcast unit tests 2016-04-02 02:14:54 -04:00
Zorg e03607a2d6 Only use SUFileManager in debug mode for the test app
This way we don't have to export it in release mode
2016-04-02 00:10:20 -04:00
Zorg 51e1e1c646 More care to handling invalidation logic 2016-04-01 23:58:32 -04:00
Zorg d5cd64159c Handle error handling for update downloader connection 2016-04-01 23:45:59 -04:00
Zorg 0b19d8d7fd Add error handling cleanup to Appcast Downloader connection 2016-04-01 23:22:52 -04:00
Zorg 92e5c30c0d Move SUUnarchiver.h from private to project 2016-04-01 22:51:10 -04:00
Zorg 9b1d441194 Add warning that Sparkle shouldn't be used when built in Debug
This is for several reasons: ATS, very short default update timer intervals, ...
2016-04-01 22:45:46 -04:00
Zorg e74a397152 Add downloader XPC services for sandboxed apps
ATS exceptions now need to be included in the appcast & update downloader services - *shrugs*.
I've a run script configured to disable ATS for release builds.
2016-04-01 22:41:12 -04:00
Zorg 9525b156a2 Export classes that we are using publicly so release build compiles 2016-04-01 22:36:42 -04:00
Zorg e7f85bb40f Add testing writability as part of SUInstallerLauncher
This is necessary for detecting if automatic updates are possible in a sandboxed environment
2016-04-01 18:56:20 -04:00
Zorg 5c08e0a1d1 Add InstallerLauncher XPC Service
This allows Sparkle to be used as-is in a sandboxed application,
without needing to place Sparkle into its own XPC service.

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

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

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

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

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

Also add some @autoreleasepool wrappers because why not.
2016-03-19 22:06:33 -04:00
Zorg 56a75bd4b6 Fix update scheduling not always firing 2016-03-19 15:25:44 -04:00
Zorg 87275b23c8 Refactor update drivers
This removes subclassing usage making the code harder to follow.
Todo: handle resuming an update already waiting to be installed,
adding impatience timer for automatic update scheduling
2016-03-19 12:09:11 -04:00
Zorg 1e645e8bd7 Remove resources/source files Autoupdate doesn't use anymore 2016-03-13 19:50:28 -04:00
Zorg d44094a692 Fix installer tests and add comment about running them 2016-03-13 19:32:58 -04:00
Zorg cb0b7c8cfe Remove all termination logic from the user driver
Autoupdate is now responsible for all of this. The user driver implementation is shorter and less complex now.
2016-03-13 19:18:51 -04:00
Zorg af126d9c82 Update automatic update driver to reflect AutoUpdate changes 2016-03-13 18:56:02 -04:00
Zorg f918368c72 Change SUCancelUpdateInstallation to SUDismissUpdateInstallation
Since this is not really canceling the installation anymore.
2016-03-13 16:52:25 -04:00
Zorg 85517dd0dd Don't think I need to handle this 2016-03-13 16:19:28 -04:00
Zorg d78f487596 Remove tempDir deletion warning 2016-03-13 16:17:51 -04:00
Zorg e7fdfb9dc9 Don't handle out of order messages 2016-03-13 16:17:24 -04:00
Zorg 64c17df1e6 Improve TerminationListener by observing NSRunningApplication instance
Listening for app termination doesn't require polling anymore.
2016-03-13 14:26:12 -04:00
Zorg f82a698937 Handle installer cleanup occur after any stage 2016-03-13 13:39:28 -04:00
Zorg b10202769f Documenting the SUInstaller protocol 2016-03-13 13:27:53 -04:00
Zorg 194c0ed63a Split installation into more stages.
We now have a stage where authorization is allowed (when the user intiates a relaunch).
This stage occurs before the user application is terminated (if the operation succeeds).

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

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

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

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

More work needs to be done to make authenticated installs more friendly,
and not making installs abortable after validation is done.
2016-03-12 13:25:07 -05:00
Zorg 59bbcfadb0 Initial work on separating the updater & installer
The installer (Autoupdate.app) is now responsible for extracting & verifying the update.
It talks to the updater via mach ports. We can't afford to use a XPC service due to
lack of perfoming privileged tasks.
2016-03-10 01:49:59 -05:00
Zorg 73a0f10010 I don't see installerForHost:error: used anywhere
We can also demote relaunchPath from being an ivar
2016-03-08 00:22:57 -05:00
Zorg 6f30ae2093 Remove passing duplicated host path 2016-03-08 00:16:03 -05:00
Zorg 7ea2d0f9cf Separating Autoupdate into separate files 2016-03-08 00:00:00 -05:00
Zorg 57f0bc4245 Make download validation function take a SUHost 2016-03-07 23:24:35 -05:00
Zorg cf3674b2d7 Exit on failure here 2016-03-07 23:15:40 -05:00
Zorg 00368011c8 Add delegate outlets to SUStandardUpdaterController
This adds delegate outlets to the updater and to the user driver, so a
developer can hook either of them up. Note we now initialize the updater and
user driver after being awoken from the nib.

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

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

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

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

applicationWillTerminate: is done from the user driver because that's the only way that will
function across different processes.
2016-02-20 19:39:48 -05:00
Zorg 835f4ac5b5 Forgot to remove -openInfoURLForAppcastItem: from previous commit 2016-02-19 21:07:48 -05:00
Zorg e6ac015dde Remove opening info URL from being an update alert choice
This option is really "do something in user driver & remind me later"
2016-02-19 21:00:54 -05:00
Zorg 6acbf0010a Merge branch 'master' into ui-separation 2016-02-19 19:56:43 -05:00
Zorg 0bb5de196a Remove initializer taking SUHost from SUUserUpdaterDriver 2016-02-19 17:27:44 -05:00
Zorg 48e0febf1a Add NSSecureCoding to SUUpdatePermissionPromptResult 2016-02-15 00:18:01 -05:00
Zorg 480feff34f Update postponing code is not as bad as I thought 2016-02-15 00:08:07 -05:00
Zorg 1cfbffa74c Making Sparkle more XPC friendly
We support NSSecureCoding for SUAppcastItem and SUHost

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

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

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

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

Relaunching Sparkle should give customization over showing the UI of the autoupdater app
2016-02-13 23:09:01 -05:00
Zorg 0a29626615 Initial work on UI separation
Separated just the permission prompt so far
2016-02-11 23:45:36 -05:00
707 changed files with 32731 additions and 23149 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
+3
View File
@@ -0,0 +1,3 @@
[submodule "Vendor/ed25519"]
path = Vendor/ed25519
url = https://github.com/orlp/ed25519
+20
View File
@@ -0,0 +1,20 @@
excluded:
- Vendor
disabled_rules:
- opening_brace
- empty_parentheses_with_trailing_closure
- function_body_length
- line_length
- cyclomatic_complexity
- large_tuple
# Rule-specific config
trailing_comma:
mandatory_comma: true
force_try:
severity: warning
force_cast:
severity: warning
identifier_name:
min_length:
warning: 2
-5
View File
@@ -1,5 +0,0 @@
language: objective-c
osx_image: xcode8.2
before_install:
- brew update
script: make ci
+35
View File
@@ -0,0 +1,35 @@
//
// AgentConnection.h
// Sparkle
//
// Created by Mayur Pawashe on 7/17/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol AgentConnectionDelegate <NSObject>
- (void)agentConnectionDidInitiate;
- (void)agentConnectionDidInvalidate;
@end
@protocol SPUInstallerAgentProtocol;
@interface AgentConnection : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate;
- (void)startListener;
- (void)invalidate;
@property (nonatomic, readonly, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, readonly) BOOL connected;
@property (nonatomic, nullable) NSError *invalidationError;
@end
NS_ASSUME_NONNULL_END
+116
View File
@@ -0,0 +1,116 @@
//
// AgentConnection.m
// Sparkle
//
// Created by Mayur Pawashe on 7/17/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "AgentConnection.h"
#import "SPUMessageTypes.h"
#import "SPUInstallerAgentProtocol.h"
#import "SUInstallerAgentInitiationProtocol.h"
#include "AppKitPrevention.h"
@interface AgentConnection () <NSXPCListenerDelegate, SUInstallerAgentInitiationProtocol>
@property (nonatomic) NSXPCListener *xpcListener;
@property (nonatomic, nullable) NSXPCConnection *activeConnection;
@property (nonatomic, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, weak) id<AgentConnectionDelegate> delegate;
@property (nonatomic) BOOL connected;
@end
@implementation AgentConnection
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize agent = _agent;
@synthesize delegate = _delegate;
@synthesize connected = _connected;
@synthesize invalidationError = _invalidationError;
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate
{
self = [super init];
if (self != nil) {
// Agents should always be the one that connect to daemons due to how mach bootstraps work
// For this reason, we are the ones that are creating a listener, not the agent
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
_delegate = delegate;
}
return self;
}
- (void)startListener
{
[self.xpcListener resume];
}
- (void)invalidate
{
self.delegate = nil;
[self.activeConnection invalidate];
self.activeConnection = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (self.activeConnection != nil) {
[newConnection invalidate];
return NO;
}
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)];
newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
self.activeConnection = newConnection;
__weak AgentConnection *weakSelf = self;
newConnection.interruptionHandler = ^{
[weakSelf.activeConnection invalidate];
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf.delegate agentConnectionDidInvalidate];
});
};
[newConnection resume];
self.agent = newConnection.remoteObjectProxy;
return YES;
}
- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement
{
dispatch_async(dispatch_get_main_queue(), ^{
self.connected = YES;
[self.delegate agentConnectionDidInitiate];
self.delegate = nil;
});
acknowledgement();
}
- (void)connectionWillInvalidateWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
self.invalidationError = error;
});
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// AppInstaller.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface AppInstaller : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
- (void)start;
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn));
@end
NS_ASSUME_NONNULL_END
+633
View File
@@ -0,0 +1,633 @@
//
// AppInstaller.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "AppInstaller.h"
#import "TerminationListener.h"
#import "SUInstaller.h"
#import "SUUpdateValidator.h"
#import "SULog.h"
#import "SULog+NSError.h"
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUStandardVersionComparator.h"
#import "SPUMessageTypes.h"
#import "SPUSecureCoding.h"
#import "SPUInstallationInputData.h"
#import "SUUnarchiver.h"
#import "SUFileManager.h"
#import "SPUInstallationInfo.h"
#import "SUAppcastItem.h"
#import "SUErrors.h"
#import "SUInstallerCommunicationProtocol.h"
#import "AgentConnection.h"
#import "SPUInstallerAgentProtocol.h"
#import "SPUInstallationType.h"
#import "SPULocalCacheDirectory.h"
#include "AppKitPrevention.h"
#define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull
/*!
* Show display progress UI after a delay from starting the final part of the installation.
* This should be long enough so that we don't show progress for very fast installations, but
* short enough so that we don't leave the user wondering why nothing is happening.
*/
static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@interface AppInstaller () <NSXPCListenerDelegate, SUInstallerCommunicationProtocol, AgentConnectionDelegate>
@property (nonatomic) NSXPCListener* xpcListener;
@property (nonatomic) NSXPCConnection *activeConnection;
@property (nonatomic) id<SUInstallerCommunicationProtocol> communicator;
@property (nonatomic) AgentConnection *agentConnection;
@property (nonatomic) BOOL receivedUpdaterPong;
@property (nonatomic, strong) TerminationListener *terminationListener;
@property (nonatomic) SUUpdateValidator *updateValidator;
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
@property (nonatomic, readonly) NSString *homeDirectory;
@property (nonatomic, readonly) NSString *userName;
@property (nonatomic) SUHost *host;
@property (nonatomic, copy) NSString *updateDirectoryPath;
@property (nonatomic, copy) NSString *downloadName;
@property (nonatomic, copy) NSString *decryptionPassword;
@property (nonatomic, strong) SUSignatures *signatures;
@property (nonatomic, copy) NSString *relaunchPath;
@property (nonatomic, copy) NSString *installationType;
@property (nonatomic, assign) BOOL shouldRelaunch;
@property (nonatomic, assign) BOOL shouldShowUI;
@property (nonatomic) id<SUInstallerProtocol> installer;
@property (nonatomic) BOOL willCompleteInstallation;
@property (nonatomic) BOOL receivedInstallationData;
@property (nonatomic) BOOL finishedValidation;
@property (nonatomic) BOOL agentInitiatedConnection;
@property (nonatomic) dispatch_queue_t installerQueue;
@property (nonatomic) BOOL performedStage1Installation;
@property (nonatomic) BOOL performedStage2Installation;
@property (nonatomic) BOOL performedStage3Installation;
@end
@implementation AppInstaller
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize communicator = _communicator;
@synthesize agentConnection = _agentConnection;
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
@synthesize terminationListener = _terminationListener;
@synthesize updateValidator = _updateValidator;
@synthesize host = _host;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize signatures = _signatures;
@synthesize relaunchPath = _relaunchPath;
@synthesize installationType = _installationType;
@synthesize shouldRelaunch = _shouldRelaunch;
@synthesize shouldShowUI = _shouldShowUI;
@synthesize installer = _installer;
@synthesize willCompleteInstallation = _willCompleteInstallation;
@synthesize receivedInstallationData = _receivedInstallationData;
@synthesize installerQueue = _installerQueue;
@synthesize performedStage1Installation = _performedStage1Installation;
@synthesize performedStage2Installation = _performedStage2Installation;
@synthesize performedStage3Installation = _performedStage3Installation;
@synthesize finishedValidation = _finishedValidation;
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
if (!(self = [super init])) {
return nil;
}
_hostBundleIdentifier = [hostBundleIdentifier copy];
_homeDirectory = [homeDirectory copy];
_userName = [userName copy];
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
_xpcListener.delegate = self;
_agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self];
return self;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (self.activeConnection != nil) {
SULog(SULogLevelDefault, @"Rejecting multiple connections...");
[newConnection invalidate];
return NO;
}
self.activeConnection = newConnection;
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
__weak AppInstaller *weakSelf = self;
newConnection.interruptionHandler = ^{
[weakSelf.activeConnection invalidate];
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
AppInstaller *strongSelf = weakSelf;
if (strongSelf != nil) {
if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) {
[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;
}
});
};
[newConnection resume];
self.communicator = newConnection.remoteObjectProxy;
return YES;
}
- (void)start
{
[self.xpcListener resume];
[self.agentConnection startListener];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self.receivedInstallationData) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: installation data was never received" }]];
}
if (!self.agentConnection.connected) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: agent connection was never initiated" }]];
}
});
}
- (void)extractAndInstallUpdate
{
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
NSError *unarchiverError = nil;
BOOL success = NO;
if (!unarchiver) {
unarchiverError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No valid unarchiver was found for %@", archivePath] }];
success = NO;
} else {
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
// Delta & package updates will require validation before extraction
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or DSA keys
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) {
success = [self.updateValidator validateDownloadPathWithError:&unarchiverError];
} else {
success = YES;
}
}
if (!success) {
[self unarchiverDidFailWithError:unarchiverError];
} else {
[unarchiver
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
if (error != nil) {
[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]];
NSError *validationError = nil;
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
if (!validationSuccess) {
[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]];
self.finishedValidation = YES;
if (self.agentInitiatedConnection) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
}
}
progressBlock:^(double progress) {
if (sizeof(progress) == sizeof(uint64_t)) {
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
[self.communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data];
}
}];
}
}
- (void)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;
// Client could try update again with different inputs
// Eg: one common case is if a delta update fails, client may want to fall back to regular update
// We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data,
// but may as well set other fields to nil too
[self clearUpdateDirectory];
self.downloadName = nil;
self.decryptionPassword = nil;
self.signatures = nil;
self.relaunchPath = nil;
self.host = nil;
NSData *archivedError = SPUArchiveRootObjectSecurely(error);
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:archivedError != nil ? archivedError : [NSData data]];
}
- (void)agentConnectionDidInitiate
{
self.agentInitiatedConnection = YES;
if (self.finishedValidation) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
- (void)agentConnectionDidInvalidate
{
if (!self.finishedValidation || !self.agentInitiatedConnection) {
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]];
}
}
- (void)retrieveProcessIdentifierAndStartInstallation
{
// We use the relaunch path for the bundle to listen for termination instead of the host path
// For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates
// Otherwise for an app, the relaunch path and host path should be identical
[self.agentConnection.agent registerApplicationBundlePath:self.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) {
dispatch_async(dispatch_get_main_queue(), ^{
self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier];
[self startInstallation];
});
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.terminationListener == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout error: failed to retreive process identifier from agent" }]];
}
});
}
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{
if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
dispatch_async(dispatch_get_main_queue(), ^{
// Mark that we have received the installation data
// Do not rely on eg: self.ipdateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
self.receivedInstallationData = YES;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) {
[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)) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received invalid installation type: %@", installationType] }]];
return;
}
NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath];
NSString *bundleIdentifier = hostBundle.bundleIdentifier;
if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) {
[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) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to obtain relaunch path from installation data" }]];
return;
}
// This installation path is specific to sparkle and the bundle identifier
NSString *rootCacheInstallationPath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"Installation"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootCacheInstallationPath];
NSString *cacheInstallationPath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootCacheInstallationPath];
if (cacheInstallationPath == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath] }]];
return;
}
// Move the download archive to somewhere where probably only we will be touching it
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
// When this tool is ran as root, we are moving it into a directory that only root will have access to
NSURL *downloadURL = [[NSURL fileURLWithPath:installationData.updateDirectoryPath] URLByAppendingPathComponent:installationData.downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:installationData.downloadName];
NSError *moveError = nil;
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to move download archive to new location", NSUnderlyingErrorKey: moveError }]];
return;
}
// Make sure the downloaded archive we moved over is a regular file and not a symbolic link placed by an attacker
NSError *attributesError = nil;
NSString *downloadDestinationPath = downloadDestinationURL.path;
if (downloadDestinationPath == nil) {
[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) {
[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]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]] }]];
return;
}
// Carry these properities separately rather than using the SUInstallationInputData object
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
self.installationType = installationType;
self.relaunchPath = installationData.relaunchPath;
self.downloadName = installationData.downloadName;
self.signatures = installationData.signatures;
self.updateDirectoryPath = cacheInstallationPath;
self.host = [[SUHost alloc] initWithBundle:hostBundle];
[self extractAndInstallUpdate];
});
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
if (archivedData != nil) {
[self.agentConnection.agent registerInstallationInfoData:archivedData];
}
}
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
// Because anyone can ask us to resume the installation, it may be wise to think about backwards compatibility here if IPC changes
uint8_t relaunch = *((const uint8_t *)data.bytes);
uint8_t showsUI = *((const uint8_t *)data.bytes + 1);
dispatch_async(dispatch_get_main_queue(), ^{
// This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
self.shouldShowUI = (BOOL)showsUI;
// Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
self.shouldRelaunch = (BOOL)relaunch;
if (self.performedStage1Installation) {
// Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
});
}
});
} else if (identifier == SPUCancelInstallation) {
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:0 error:nil];
});
} else if (identifier == SPUUpdaterAlivePong) {
self.receivedUpdaterPong = YES;
}
}
- (void)startInstallation
{
self.willCompleteInstallation = YES;
self.installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL);
dispatch_async(self.installerQueue, ^{
NSError *installerError = nil;
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
if (installer == nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[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]) {
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to start installer", NSUnderlyingErrorKey: firstStageError }]];
});
return;
}
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
dispatch_async(dispatch_get_main_queue(), ^{
self.installer = installer;
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
self.performedStage1Installation = YES;
// Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated
[self finishInstallationAfterHostTermination];
});
});
}
- (void)performStage2InstallationIfNeeded
{
if (self.performedStage2Installation) {
return;
}
BOOL performedSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
if (performedSecondStage) {
self.performedStage2Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
// Don't check if the target is already terminated, leave that to the progress agent
// We could be slightly off if there were multiple instances running
[self.agentConnection.agent sendTerminationSignal];
});
} else {
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[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" }]];
});
}
}
- (void)finishInstallationAfterHostTermination
{
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
if (!success) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]];
return;
}
// Show our installer progress UI tool if only after a certain amount of time passes,
// and if our installer is silent (i.e, doesn't show progress on its own)
__block BOOL shouldShowUIProgress = YES;
if (self.shouldShowUI && [self.installer canInstallSilently]) {
// Ask the updater if it is still alive
// If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side
self.receivedUpdaterPong = NO;
[self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Make sure we're still eligible for showing the installer progress
// Also if the updater process is still alive, showing the progress should not be our duty
// if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil,
// this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater
if (shouldShowUIProgress && (!self.receivedUpdaterPong || self.communicator == nil)) {
[self.agentConnection.agent showProgress];
}
});
}
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
if (!self.performedStage2Installation) {
// We failed and we're going to exit shortly
return;
}
NSError *thirdStageError = nil;
if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
[self.installer performCleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
});
return;
}
self.performedStage3Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
// Make sure to stop our displayed progress before we move onto cleanup & relaunch
// This will also stop the agent from broadcasting the status info service, which we want to do before
// we relaunch the app because the relaunched app could check the service upon launch..
[self.agentConnection.agent stopProgress];
shouldShowUIProgress = NO;
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
if (self.shouldRelaunch) {
// This will also signal to the agent that it will terminate soon
[self.agentConnection.agent relaunchApplication];
}
[self.installer performCleanup];
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
});
});
}];
}
- (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];
self.activeConnection = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
[self.agentConnection invalidate];
self.agentConnection = nil;
[self clearUpdateDirectory];
exit(status);
}
@end
+26
View File
@@ -0,0 +1,26 @@
//
// SPUInstallationInfo.h
// Sparkle
//
// Created by Mayur Pawashe on 4/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem;
@interface SPUInstallationInfo : NSObject <NSSecureCoding>
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
@property (nonatomic, readonly) BOOL canSilentlyInstall;
@property (nonatomic) BOOL systemDomain;
@end
NS_ASSUME_NONNULL_END
+65
View File
@@ -0,0 +1,65 @@
//
// SPUInstallationInfo.m
// Sparkle
//
// Created by Mayur Pawashe on 4/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUInstallationInfo.h"
#import "SUAppcastItem.h"
#include "AppKitPrevention.h"
static NSString *SUAppcastItemKey = @"SUAppcastItem";
static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
static NSString *SUSystemDomainKey = @"SUSystemDomain";
@implementation SPUInstallationInfo
@synthesize appcastItem = _appcastItem;
@synthesize canSilentlyInstall = _canSilentlyInstall;
@synthesize systemDomain = _systemDomain;
- (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];
if (appcastItem == nil) {
return nil;
}
BOOL canSilentlyInstall = [decoder decodeBoolForKey:SUCanSilentlyInstallKey];
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
{
return YES;
}
@end
+37
View File
@@ -0,0 +1,37 @@
//
// SPUInstallationInputData.h
// Sparkle
//
// Created by Mayur Pawashe on 3/24/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
@class SUSignatures;
NS_ASSUME_NONNULL_BEGIN
@interface SPUInstallationInputData : NSObject <NSSecureCoding>
/*
* relaunchPath - path to application bundle to relaunch and listen for termination
* hostBundlePath - path to host bundle to update & replace
* updateDirectoryPath - path to update directory (i.e, temporary directory containing the new update archive)
* downloadName - name of update archive in update directory
* signatures - signatures for the update that came from the appcast item
* decryptionPassword - optional decryption password for dmg archives
*/
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _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, readonly, nullable) SUSignatures *signatures; // nullable because although not using signatures is deprecated, it's still supported
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
@end
NS_ASSUME_NONNULL_END
+106
View File
@@ -0,0 +1,106 @@
//
// SPUInstallationInputData.m
// Sparkle
//
// Created by Mayur Pawashe on 3/24/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUInstallationInputData.h"
#import "SPUInstallationType.h"
#import "SUSignatures.h"
#include "AppKitPrevention.h"
static NSString *SURelaunchPathKey = @"SURelaunchPath";
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
static NSString *SUDownloadNameKey = @"SUDownloadName";
static NSString *SUSignaturesKey = @"SUSignatures";
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
static NSString *SUInstallationTypeKey = @"SUInstallationType";
@implementation SPUInstallationInputData
@synthesize relaunchPath = _relaunchPath;
@synthesize hostBundlePath = _hostBundlePath;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize signatures = _signatures;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize installationType = _installationType;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
_relaunchPath = [relaunchPath copy];
_hostBundlePath = [hostBundlePath copy];
_updateDirectoryPath = [updateDirectoryPath copy];
_downloadName = [downloadName copy];
_installationType = [installationType copy];
assert(SPUValidInstallationType(_installationType));
_signatures = signatures;
_decryptionPassword = [decryptionPassword copy];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
{
NSString *relaunchPath = [decoder decodeObjectOfClass:[NSString class] forKey:SURelaunchPathKey];
if (relaunchPath == nil) {
return nil;
}
NSString *hostBundlePath = [decoder decodeObjectOfClass:[NSString class] forKey:SUHostBundlePathKey];
if (hostBundlePath == nil) {
return nil;
}
NSString *updateDirectoryPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUUpdateDirectoryPathKey];
if (updateDirectoryPath == nil) {
return nil;
}
NSString *downloadName = [decoder decodeObjectOfClass:[NSString class] forKey:SUDownloadNameKey];
if (downloadName == nil) {
return nil;
}
NSString *installationType = [decoder decodeObjectOfClass:[NSString class] forKey:SUInstallationTypeKey];
if (!SPUValidInstallationType(installationType)) {
return nil;
}
SUSignatures *signatures = [decoder decodeObjectOfClass:[SUSignatures class] forKey:SUSignaturesKey];
if (signatures == nil) {
return nil;
}
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
[coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
[coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
[coder encodeObject:self.signatures forKey:SUSignaturesKey];
if (self.decryptionPassword != nil) {
[coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
}
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
@end
+49
View File
@@ -0,0 +1,49 @@
//
// SPUMessageTypes.h
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
{
SPUInstallerNotStarted = 0,
SPUExtractionStarted = 1,
SPUExtractedArchiveWithProgress = 2,
SPUArchiveExtractionFailed = 3,
SPUValidationStarted = 4,
SPUInstallationStartedStage1 = 5,
SPUInstallationFinishedStage1 = 6,
SPUInstallationFinishedStage2 = 7,
SPUInstallationFinishedStage3 = 8,
SPUUpdaterAlivePing = 9,
SPUInstallerError = 10
};
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
{
SPUInstallationData = 0,
SPUSentUpdateAppcastItemData = 1,
SPUResumeInstallationToStage2 = 2,
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
+85
View File
@@ -0,0 +1,85 @@
//
// SPUMessageTypes.m
// Sparkle
//
// Created by Mayur Pawashe on 3/11/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUMessageTypes.h"
#include "AppKitPrevention.h"
// Tags added to the bundle identifier which is used as Mach service names
// These should be very short because of length restrictions
#define SPARKLE_INSTALLER_TAG @"-spki"
#define SPARKLE_STATUS_TAG @"-spks"
#define SPARKLE_PROGRESS_TAG @"-spkp"
// 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)
{
BOOL legal;
switch (newMessageType) {
case SPUInstallerNotStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractionStarted:
legal = (oldMessageType == SPUInstallerNotStarted);
break;
case SPUExtractedArchiveWithProgress:
case SPUArchiveExtractionFailed:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUValidationStarted:
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
break;
case SPUInstallationStartedStage1:
legal = (oldMessageType == SPUValidationStarted);
break;
case SPUInstallationFinishedStage1:
legal = (oldMessageType == SPUInstallationStartedStage1);
break;
case SPUInstallationFinishedStage2:
legal = (oldMessageType == SPUInstallationFinishedStage1);
break;
case SPUInstallationFinishedStage3:
legal = (oldMessageType == SPUInstallationFinishedStage2);
break;
case SPUInstallerError:
case SPUUpdaterAlivePing:
// Having this state being dependent on other installation states would make the complicate our logic
// So just always allow these type of messages
legal = YES;
break;
}
return legal;
}
static NSString *SPUServiceNameWithTag(NSString *tagName, NSString *bundleIdentifier)
{
NSString *serviceName = [bundleIdentifier stringByAppendingString:tagName];
NSUInteger length = MIN(serviceName.length, MAX_SERVICE_NAME_LENGTH);
// If the service name is too long, cut off the beginning rather than cutting off the end
// This should lead to a more unique name
return [serviceName substringFromIndex:serviceName.length - length];
}
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_INSTALLER_TAG, bundleIdentifier);
}
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier);
}
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier)
{
return SPUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier);
}
File renamed without changes.
@@ -15,13 +15,14 @@
#include <stdlib.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
{
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
const char *argv[] = { "/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation] };
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
BOOL success = (bspatch(4, argv) == 0);
unlink([patchFile fileSystemRepresentation]);
return success;
File renamed without changes.
@@ -227,7 +227,8 @@ BOOL removeTree(NSString *path)
BOOL copyTree(NSString *source, NSString *dest)
{
return [[SUFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
// SUFileManager will be more reliable for copying items especially across network mounts
return [[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
}
BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
@@ -242,7 +243,7 @@ BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
return NO;
}
mode_t newMode = ([permissions unsignedShortValue] & ~PERMISSION_FLAGS) | desiredPermissions;
int (*changeModeFunc)(const char *, mode_t) = [[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
int (*changeModeFunc)(const char *, mode_t) = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
if (changeModeFunc([path fileSystemRepresentation], newMode) != 0) {
return NO;
}
File renamed without changes.
@@ -90,6 +90,15 @@ static NSDictionary *infoForFile(FTSENT *ent)
INFO_SIZE_KEY: @(size) };
}
static bool isSymLink(const FTSENT *ent)
{
if (ent->fts_info == FTS_SL)
{
return (true);
}
return false;
}
static bool aclExists(const FTSENT *ent)
{
// macOS does not currently support ACLs for symlinks
@@ -156,7 +165,7 @@ static NSString *temporaryPatchFile(NSString *patchFile)
static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo)
{
unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
unsigned long long fileSize = [(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) {
return YES;
}
@@ -165,11 +174,11 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary
return YES;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return YES;
}
if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
if ([(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
// this is possible if just the permissions have changed
return YES;
}
@@ -183,7 +192,7 @@ static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *ne
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return YES;
}
@@ -196,11 +205,11 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
if (![(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
return NO;
}
@@ -213,11 +222,11 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
if ([(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
return NO;
}
@@ -254,7 +263,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (verbose) {
fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion);
fprintf(stderr, "Processing %s...", [source fileSystemRepresentation]);
fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]);
}
FTSENT *ent = 0;
@@ -320,7 +329,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
if (verbose) {
fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]);
fprintf(stderr, "\nProcessing destination, %s...", [destination fileSystemRepresentation]);
}
pathBuffer[0] = 0;
@@ -370,8 +379,8 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
// inside an application, and since we don't preserve extended attribitutes anyway
mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!IS_VALID_PERMISSIONS(permissions)) {
mode_t permissions = [(NSNumber*)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
if (verbose) {
fprintf(stderr, "\n");
}
@@ -408,7 +417,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
} else {
newTreeState[key] = info;
if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
if (oldInfo && [(NSNumber *)oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [(NSNumber *)info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
NSArray *parentPathComponents = key.pathComponents;
for (NSString *childPath in originalTreeState) {
@@ -439,6 +448,9 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
NSString *temporaryFile = temporaryPatchFile(patchFile);
if (verbose) {
fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]);
}
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
if (!x) {
if (verbose) {
@@ -480,7 +492,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
for (NSString *key in keys) {
id value = [newTreeState valueForKey:key];
if ([value isEqual:[NSNull null]]) {
if ([(NSObject *)value isEqual:[NSNull null]]) {
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, DELETE_KEY, "true");
@@ -498,10 +510,10 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (shouldChangePermissions(originalInfo, newInfo)) {
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
}
}
} else {
@@ -574,13 +586,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_close(x);
unlink([patchFile fileSystemRepresentation]);
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
unlink([temporaryFile fileSystemRepresentation]);
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr removeItemAtPath: patchFile error: NULL];
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
{
if (verbose) {
fprintf(stderr, "Failed to move temporary file, %s, to %s!\n", [temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
}
return NO;
}
if (verbose) {
fprintf(stderr, "\nDone!\n");
}
return YES;
}
@@ -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) {
File renamed without changes.
@@ -33,7 +33,7 @@
return [[path pathExtension] isEqualToString:@"delta"];
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return YES;
}
@@ -63,7 +63,7 @@
}
}
SUFileManager *fileManager = [SUFileManager defaultManager];
SUFileManager *fileManager = [[SUFileManager alloc] init];
for (NSURL *file in filesToUpdate) {
NSError *error = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:file error:&error]) {
+20
View File
@@ -0,0 +1,20 @@
//
// SUCodeSigningVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 7/5/12.
//
//
#ifndef SUCODESIGNINGVERIFIER_H
#define SUCODESIGNINGVERIFIER_H
#import <Foundation/Foundation.h>
@interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError **)error;
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
@end
#endif
@@ -16,7 +16,7 @@
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError *__autoreleasing *)error
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError * __autoreleasing *)error
{
OSStatus result;
SecRequirementRef requirement = NULL;
@@ -87,7 +87,7 @@ finally:
if (error) {
*error = nil;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
@@ -121,7 +121,22 @@ static id valueOrNSNull(id value) {
return value ? value : [NSNull null];
}
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
+ (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath {
NSDictionary *info = nil;
SecStaticCodeRef code = NULL;
OSStatus result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundlePath, kSecCSDefaultFlags, &code);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
info = [self codeSignatureInfoForCode:code];
finally:
if (code) CFRelease(code);
return info;
}
+ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code {
CFDictionaryRef signingInfo = nil;
const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation);
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
@@ -133,8 +148,14 @@ static id valueOrNSNull(id value) {
NSDictionary *infoPlist = [signingDict objectForKey:@"info-plist"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:@"CFBundleShortVersionString"]) forKey:@"version"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:(__bridge NSString *)kCFBundleVersionKey]) forKey:@"build"];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
return [relevantInfo copy];
}
return nil;
}
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
}
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL
File renamed without changes.
@@ -30,7 +30,7 @@
return [[path pathExtension] isEqualToString:@"dmg"];
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
@@ -78,9 +78,9 @@
}
CFRelease(uuid);
}
}
}
// Note: this check does not follow symbolic links, which is what we want
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
NSData *promptData = nil;
promptData = [NSData dataWithBytes:"yes\n" length:4];
@@ -167,6 +167,7 @@
itemsCopied += 1.0;
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
+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
@@ -14,20 +14,13 @@ A guided installation allows Sparkle to download and install a package (pkg) or
The installer package is installed using macOS's built-in command line installer, `/usr/sbin/installer`. No installation interface is shown to the user.
A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used.
## To Do
- Replace the use of `AuthorizationExecuteWithPrivilegesAndWait`. This method remains because it is well supported and tested. Ideally a helper tool or XPC would be used.
*/
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath fileOperationToolPath:(NSString *)fileOperationToolPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
@end
NS_ASSUME_NONNULL_END
+87
View File
@@ -0,0 +1,87 @@
//
// SUGuidedPackageInstaller.m
// Sparkle
//
// Created by Graham Miln on 14/05/2010.
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
//
#import <sys/stat.h>
#import "SUGuidedPackageInstaller.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SUGuidedPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *homeDirectory;
@property (nonatomic, readonly, copy) NSString *userName;
@end
@implementation SUGuidedPackageInstaller
@synthesize packagePath = _packagePath;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
self = [super init];
if (self != nil) {
_packagePath = [packagePath copy];
_homeDirectory = [homeDirectory copy];
_userName = [userName copy];
}
return self;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)__unused error
{
return YES;
}
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError * __autoreleasing *)error
{
// This command *must* be run as root
NSString *installerPath = @"/usr/sbin/installer";
NSTask *task = [[NSTask alloc] init];
task.launchPath = installerPath;
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
// 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];
BOOL success = YES;
@try {
[task launch];
[task waitUntilExit];
if (task.terminationStatus != EXIT_SUCCESS) {
success = NO;
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }];
}
}
} @catch (NSException *) {
success = NO;
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }];
}
}
return success;
}
- (void)performCleanup
{
}
- (BOOL)canInstallSilently
{
return YES;
}
@end
@@ -7,17 +7,15 @@
//
#import <Foundation/Foundation.h>
#import "SUVersionComparisonProtocol.h"
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@protocol SUInstallerProtocol;
@interface SUInstaller : NSObject
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath 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,13 +7,15 @@
//
#import "SUInstaller.h"
#import "SUInstallerProtocol.h"
#import "SUPlainInstaller.h"
#import "SUPackageInstaller.h"
#import "SUGuidedPackageInstaller.h"
#import "SUHost.h"
#import "SUConstants.h"
#import "SULog.h"
#import "SUErrors.h"
#import "SPUInstallationType.h"
#import "SUNormalization.h"
#include "AppKitPrevention.h"
@@ -29,7 +31,7 @@
return aliasFlag.boolValue && directoryFlag.boolValue;
}
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
{
NSParameterAssert(inUpdateFolder);
NSParameterAssert(host);
@@ -110,7 +112,7 @@
return newAppDownloadPath;
}
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath 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;
@@ -123,41 +125,52 @@
return nil;
}
id <SUInstallerProtocol> installer;
// Make sure we find the type of installer that we were expecting to find
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
// ahead of time whether or not this installer tool should be ran as root or not
id <SUInstallerProtocol> installer = nil;
if (isPackage && isGuided) {
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath fileOperationToolPath:fileOperationToolPath];
} else if (isPackage) {
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
} else {
NSString *normalizedInstallationPath = nil;
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
}
// If we have a normalized path, we'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
// Otherwise if there's no normalized path (the more likely case), we'll just use the host bundle's path
NSString *installationPath;
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
installationPath = normalizedInstallationPath;
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found guided package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeGuidedPackage] }];
}
} else {
installationPath = host.bundlePath;
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath homeDirectory:homeDirectory userName:userName];
}
} else if (isPackage) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeInteractivePackage] }];
}
} else {
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
}
} else {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }];
}
} else {
NSString *normalizedInstallationPath = nil;
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
normalizedInstallationPath = 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;
} else {
installationPath = host.bundlePath;
}
installer = [[SUPlainInstaller alloc] initWithHost:host bundlePath:newDownloadPath installationPath:installationPath];
}
installer = [[SUPlainInstaller alloc] initWithHost:host bundlePath:newDownloadPath installationPath:installationPath fileOperationToolPath:fileOperationToolPath];
}
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
+38
View File
@@ -0,0 +1,38 @@
//
// SUInstallerProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 3/12/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUInstallerProtocol <NSObject>
// Any installation work can be done prior to user application being terminated and relaunched
// No UI should occur during this stage (i.e, do not show package installer apps, etc..)
// Should be able to be called from non-main thread
- (BOOL)performInitialInstallation:(NSError **)error;
// Any installation work after the user application has has been terminated. This is where the final installation work can be done.
// After this stage is done, the user application may be relaunched.
// Should be able to be called from non-main thread
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
// 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;
@end
NS_ASSUME_NONNULL_END
@@ -9,12 +9,11 @@
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
// This is the deprecated package installation type, aka the "interactive" package installer
// For a more supported package installation, see SUGuidedPackageInstaller
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
- (instancetype)initWithPackagePath:(NSString *)packagePath;
@end
NS_ASSUME_NONNULL_END
@@ -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;
}
@@ -49,7 +46,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
return YES;
}
- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError *__autoreleasing*)error
{
// Run installer using the "open" command to ensure it is launched in front of current application.
// -W = wait until the app has quit.
@@ -73,6 +70,10 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
return YES;
}
- (void)performCleanup
{
}
- (BOOL)canInstallSilently
{
return NO;
File renamed without changes.
@@ -58,7 +58,7 @@
return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
@@ -100,48 +100,54 @@
// Get the file size.
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
NSUInteger expectedLength = [[attributes objectForKey:NSFileSize] unsignedIntegerValue];
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
if (expectedLength > 0) {
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSTask *task = [[NSTask alloc] init];
[task setStandardInput:[pipe fileHandleForReading]];
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
[task setLaunchPath:command];
[task setArguments:[args arrayByAddingObject:destination]];
[task launch];
NSUInteger bytesRead = 0;
do {
NSData *data = [archiveInput readDataOfLength:256*1024];
NSUInteger len = [data length];
if (!len) {
break;
}
bytesRead += len;
[archiveOutput writeData:data];
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
@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]}];
@@ -9,9 +9,8 @@
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@protocol SUVersionComparison;
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
@@ -19,10 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@param host The current (old) bundle host
@param bundlePath The path to the new bundle that will be installed.
@param installationPath The path the new bundlePath will be installed to.
@param fileOperationToolPath The path to the file operation tool for authorized operations.
*/
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath fileOperationToolPath:(NSString *)fileOperationToolPath;
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath;
@end
NS_ASSUME_NONNULL_END
+313
View File
@@ -0,0 +1,313 @@
//
// SUPlainInstaller.m
// Sparkle
//
// Created by Andy Matuschak on 4/10/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#import "SUPlainInstaller.h"
#import "SUFileManager.h"
#import "SUConstants.h"
#import "SUHost.h"
#import "SULog.h"
#import "SUErrors.h"
#import "SUVersionComparisonProtocol.h"
#import "SUStandardVersionComparator.h"
#include "AppKitPrevention.h"
@interface SUPlainInstaller ()
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, copy, readonly) NSString *bundlePath;
@property (nonatomic, copy, readonly) NSString *installationPath;
@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
@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
{
self = [super init];
if (self != nil) {
_host = host;
_bundlePath = [bundlePath copy];
_installationPath = [installationPath copy];
}
return self;
}
// Returns the bundle version from the specified host that is appropriate to use as a filename, or nil if we're unable to retrieve one
- (NSString *)bundleVersionAppropriateForFilenameFromHost:(SUHost *)host
{
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *trimmedVersion = @"";
if (bundleVersion != nil) {
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
}
return trimmedVersion.length > 0 ? trimmedVersion : nil;
}
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
{
if (installationURL == nil || newURL == nil) {
// this really shouldn't happen but just in case
SULog(SULogLevelError, @"Failed to perform installation because either installation URL (%@) or new URL (%@) is nil", installationURL, newURL);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because the paths to install at and from are not valid" }];
}
return NO;
}
if (progress) {
progress(1/10.0);
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
// Update the access time of our entire application before moving it into a temporary directory
// The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
// before being installed
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:error]) {
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;
}
// Create a temporary directory for our new app that resides on our destination's volume
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
if (tempNewDirectoryURL == nil) {
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);
}
// Move the new app to our temporary directory
NSString *newURLLastPathComponent = newURL.lastPathComponent;
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:error]) {
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;
}
if (progress) {
progress(3/10.0);
}
// Release our new app from quarantine
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
// Not big enough of a deal to fail the entire installation
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
}
if (progress) {
progress(4/10.0);
}
NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath];
if (oldURL == nil) {
// this really shouldn't happen but just in case
SULog(SULogLevelError, @"Failed to construct URL from bundle path: %@", host.bundlePath);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because a path could not be constructed for the old installation" }];
}
return NO;
}
// 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);
}
NSError *touchError = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:&touchError]) {
// Not a fatal error, but a pretty unfortunate one
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
SULog(SULogLevelError, @"Error: %@", touchError);
}
if (progress) {
progress(6/10.0);
}
// 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 (!replacedApp) {
// Otherwise swap out the old and new applications using the legacy path
if (replaceError != nil) {
SULog(SULogLevelDefault, @"Invoking fallback from failing to replace original item with error: %@", replaceError);
}
// 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) {
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;
}
self.temporaryOldDirectory = tempOldDirectoryURL;
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;
}
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);
}
return YES;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
{
// Prevent malicious downgrades
// Note that we may not be able to do this for package installations, hence this code being done here
NSString *hostVersion = [self.host version];
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
if (error != NULL) {
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, updateVersion];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
}
return NO;
}
return YES;
}
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error
{
// Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories.
// It must not be possible for our update to sit in temporary directories for a very long time.
return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
}
- (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;
}
@end
+32
View File
@@ -0,0 +1,32 @@
//
// SUSignatureVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#ifndef SUDSAVERIFIER_H
#define SUDSAVERIFIER_H
#import <Foundation/Foundation.h>
@class SUSignatures;
@class SUPublicKeys;
@interface SUSignatureVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys;
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pkeys;
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures;
@end
#endif
+255
View File
@@ -0,0 +1,255 @@
//
// SUDSAVerifier.m
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#import "SUSignatureVerifier.h"
#import "SULog.h"
#import "SUSignatures.h"
#include <CommonCrypto/CommonDigest.h>
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
#include "AppKitPrevention.h"
@interface SUSignatureVerifier ()
@property (readonly) SUPublicKeys *pubKeys;
@end
@implementation SUSignatureVerifier {
}
@synthesize pubKeys = _pubKeys;
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys
{
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
if (!verifier) {
return NO;
}
return [verifier verifyFileAtPath:path signatures:signatures];
}
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pubkeys
{
self = [super init];
_pubKeys = pubkeys;
return self;
}
- (SecKeyRef)dsaSecKeyRef {
NSData *data = [self.pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
if (!self || !data.length) {
SULog(SULogLevelError, @"Could not read public DSA key");
return nil;
}
SecExternalFormat format = kSecFormatOpenSSL;
SecExternalItemType itemType = kSecItemTypePublicKey;
CFArrayRef items = NULL;
OSStatus status = SecItemImport((__bridge CFDataRef)data, NULL, &format, &itemType, (SecItemImportExportFlags)0, NULL, NULL, &items);
if (status != errSecSuccess || !items) {
if (items) {
CFRelease(items);
}
SULog(SULogLevelError, @"Public DSA key could not be imported: %d", status);
return nil;
}
SecKeyRef dsaPubKeySecKey = nil;
if (format == kSecFormatOpenSSL && itemType == kSecItemTypePublicKey && CFArrayGetCount(items) == 1) {
// Seems silly, but we can't quiet the warning about dropping CFTypeRef's const qualifier through
// any manner of casting I've tried, including interim explicit cast to void*. The -Wcast-qual
// warning is on by default with -Weverything and apparently became more noisy as of Xcode 7.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
dsaPubKeySecKey = (SecKeyRef)CFRetain(CFArrayGetValueAtIndex(items, 0));
#pragma clang diagnostic pop
}
CFRelease(items);
return dsaPubKeySecKey;
}
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures
{
if (!path || !path.length) {
return NO;
}
if (!signatures) {
SULog(SULogLevelDefault, @"No signatures given to verifyFileAtPath");
return NO;
}
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;
}
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(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];
}
}
}
return NO;
}
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature
{
if (!stream || !dsaSignature) {
SULog(SULogLevelError, @"Invalid arguments to verifyStream");
return NO;
}
SecKeyRef dsaPubKeySecKey = [self dsaSecKeyRef];
if (!dsaPubKeySecKey) {
return NO;
}
__block SecGroupTransformRef group = SecTransformCreateGroupTransform();
__block SecTransformRef dataReadTransform = NULL;
__block SecTransformRef dataDigestTransform = NULL;
__block SecTransformRef dataVerifyTransform = NULL;
__block CFErrorRef error = NULL;
BOOL (^cleanup)(void) = ^{
if (group) CFRelease(group);
if (dataReadTransform) CFRelease(dataReadTransform);
if (dataDigestTransform) CFRelease(dataDigestTransform);
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
if (error) CFRelease(error);
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
return NO;
};
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
if (!dataReadTransform) {
SULog(SULogLevelError, @"File containing update archive could not be read (failed to create SecTransform for input stream)");
return cleanup();
}
dataDigestTransform = SecDigestTransformCreate(kSecDigestSHA1, CC_SHA1_DIGEST_LENGTH, NULL);
if (!dataDigestTransform) {
return cleanup();
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform || error) {
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
return cleanup();
}
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
if (error) {
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
return cleanup();
}
if (!result.boolValue) {
SULog(SULogLevelError, @"DSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
}
cleanup();
return result.boolValue;
}
@end
+21
View File
@@ -0,0 +1,21 @@
//
// SUStatusInfoProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUStatusInfoProtocol
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply;
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply;
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -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;
}
File renamed without changes.
@@ -31,6 +31,8 @@
if (self != nil) {
_completionBlock = [completionBlock copy];
_progressBlock = [progressBlock copy];
} else {
assert(false);
}
return self;
}
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)canUnarchivePath:(NSString *)path;
+ (BOOL)unsafeIfArchiveIsNotValidated;
+ (BOOL)mustValidateBeforeExtraction;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
+26
View File
@@ -0,0 +1,26 @@
//
// StatusInfo.h
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SUStatusInfoProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface StatusInfo : NSObject <SUStatusInfoProtocol>
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier;
@property (nonatomic, nullable) NSData *installationInfoData;
- (void)startListener;
- (void)invalidate;
@end
NS_ASSUME_NONNULL_END
+69
View File
@@ -0,0 +1,69 @@
//
// StatusInfo.m
// Sparkle
//
// Created by Mayur Pawashe on 7/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "StatusInfo.h"
#import "SPUMessageTypes.h"
#include "AppKitPrevention.h"
@interface StatusInfo () <NSXPCListenerDelegate>
@property (nonatomic) NSXPCListener *xpcListener;
@end
@implementation StatusInfo
@synthesize xpcListener = _xpcListener;
@synthesize installationInfoData = _installationInfoData;
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier
{
self = [super init];
if (self != nil) {
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
_xpcListener.delegate = self;
}
return self;
}
- (void)startListener
{
[self.xpcListener resume];
}
- (void)invalidate
{
[self.xpcListener invalidate];
self.xpcListener = nil;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)];
newConnection.exportedObject = self;
[newConnection resume];
return YES;
}
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable))reply
{
dispatch_async(dispatch_get_main_queue(), ^{
reply(self.installationInfoData);
});
}
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply
{
reply();
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// TerminationListener.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TerminationListener : NSObject
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
@property (nonatomic, readonly) BOOL terminated;
// If the process identifier provided was nil, then the completion block will invoke immediately with a YES success
- (void)startListeningWithCompletion:(void (^)(BOOL success))completionBlock;
@end
NS_ASSUME_NONNULL_END
+131
View File
@@ -0,0 +1,131 @@
//
// TerminationListener.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "TerminationListener.h"
#import "SULog.h"
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include "AppKitPrevention.h"
@interface TerminationListener ()
@property (nonatomic, readonly, nullable) NSNumber *processIdentifier;
@property (nonatomic) BOOL watchedTermination;
@property (nonatomic, copy) void (^completionBlock)(BOOL);
@end
@implementation TerminationListener
@synthesize completionBlock = _completionBlock;
@synthesize processIdentifier = _processIdentifier;
@synthesize watchedTermination = _watchedTermination;
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
{
self = [super init];
if (self != nil) {
_processIdentifier = processIdentifier;
}
return self;
}
- (BOOL)terminated
{
return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
}
- (void)invokeCompletionWithSuccess:(BOOL)success
{
if (self.completionBlock != nil) {
self.completionBlock(success);
self.completionBlock = nil;
}
}
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
{
self.completionBlock = completionBlock;
if (self.processIdentifier == nil) {
[self invokeCompletionWithSuccess:YES];
return;
}
// Use kqueues to determine when the process will terminate
// As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10
// By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it
pid_t processIdentifier = self.processIdentifier.intValue;
int queue = kqueue();
if (queue == -1) {
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
struct kevent changes;
EV_SET(&changes, processIdentifier, EVFILT_PROC, EV_ADD | EV_RECEIPT, NOTE_EXIT, 0, NULL);
if (kevent(queue, &changes, 1, &changes, 1, NULL) == -1) {
SULog(SULogLevelError, @"Failed to invoke kevent() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
// We will assume this terminationListener will never be deallocated
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
CFFileDescriptorContext context = { 0, (void *)CFBridgingRetain(self), NULL, NULL, NULL };
#pragma clang diagnostic pop
CFFileDescriptorRef noteExitKQueueRef = CFFileDescriptorCreate(NULL, queue, true, noteExitKQueueCallback, &context);
if (noteExitKQueueRef == NULL) {
SULog(SULogLevelError, @"Failed to create file descriptor via CFFileDescriptorCreate()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopSourceRef runLoopSource = CFFileDescriptorCreateRunLoopSource(NULL, noteExitKQueueRef, 0);
if (runLoopSource == NULL) {
SULog(SULogLevelError, @"Failed to create runLoopSource via CFFileDescriptorCreateRunLoopSource()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
CFRelease(runLoopSource);
CFFileDescriptorEnableCallBacks(noteExitKQueueRef, kCFFileDescriptorReadCallBack);
// Make sure we didn't set the listener callback to a dead PID
// If we did, we could hang forever. To avoid this, we check if the process has terminated *after* we set up the callback
// If we tried to do this check before setting the callback, we could run into an issue where the process can terminate after our check
// but before setting the callback
if ([self terminated]) {
[self invokeCompletionWithSuccess:YES];
}
}
static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unused callBackTypes, void *info)
{
struct kevent event;
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
TerminationListener *self = CFBridgingRelease(info);
self.watchedTermination = YES;
[self invokeCompletionWithSuccess:YES];
}
@end
+36
View File
@@ -0,0 +1,36 @@
#import <Foundation/Foundation.h>
#import "AppInstaller.h"
#include "AppKitPrevention.h"
int main(int __unused argc, const char __unused *argv[])
{
@autoreleasepool
{
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
if (args.count != 4) {
return EXIT_FAILURE;
}
NSString *hostBundleIdentifier = args[1];
NSString *homeDirectory = args[2];
NSString *userName = args[3];
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier homeDirectory:homeDirectory userName:userName];
[appInstaller start];
// Ignore SIGTERM because we are going to catch it ourselves
signal(SIGTERM, SIG_IGN);
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
dispatch_source_set_event_handler(sigtermSource, ^{
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
});
dispatch_resume(sigtermSource);
[[NSRunLoop currentRunLoop] run];
}
return EXIT_SUCCESS;
}
+222
View File
@@ -1,3 +1,225 @@
# 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)
* Add delegate callbacks for fininshed download and extraction related events (Csaba Horony)
* Don't check for updates if Do Not Disturb is on (Kornel)
* Expose `CodesigningVerifier`, add codesign info API (sunuslee)
* Threading fixes:
* Fix potential hang with `dispatch_sync` to main thread (Brian Bergstrand)
* Fix closeCheckingWindow called from background thread (Alexey Martemyanov)
* Improve 'read-only' error message (#1192) (Adrian Thomas)
* New Spanish localisation (Ken Arroyo Ohori)
* Updated Finnish language resources (Jason Pollack)
* Hungarian localization (Csaba Horony)
* Log more information about authentication requests (Kornel)
* Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings. (Kent Sutherland)
* Fix binary delta creation on network drives (sagecook)
* Fix compilation issues on Xcode 10 with new build system (Leo Natan)
# 1.19.0
* Refactoring of downloader code to avoid deprecated methods (Deadpikle)
* Changes to which methods run on the main thread.
Note: some delegate methods may be called on non-main thread now. (Kornel)
* Update Japanese localization (1024jp)
* Update Sparkle.strings (Stefan Paychère)
* Fix Sparkle clients polling too frequently (Jonathan Bullard)
* Handle SecTransformExecute errors (Kornel)
* Silence Touch Bar availability warnings on Xcode 9 by using API_AVAILABLE. Disable gnu-zero-variadic-macro-arguments to prevent warnings from use of API_AVAILABLE. (Kent Sutherland)
* 10.11 SDK compatibility (David Fuhrmann)
# 1.18.1
* Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115) (App Tyrant)
* Implemented sparkle:os attribute as documented (Memphiz)
* Additional termination detection in case kpoll fails. (fujisoft)
* Included bin files in CocoaPods installation (Keith Smiley)
* Updated Dutch localization (Eitot)
* Updated German localization (Eitot)
* Updated Japanese translation (1024jp)
* Updated Portuguese translation (Victor)
* Updated to Xcode 9/Swift 4
# 1.18.0
* Name of the host app is used in authorization prompt (the `SPARKLE_RELAUNCH_TOOL_NAME` setting is now obsolete)
* More detailed progress bar for package installers (Kornel Lesiński)
* Disabled the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. (George Nachman)
* generate_appcast tool adds release notes if there's an .html file with the same base name as the archive (Brett Walker)
* Added `sparkle:shortVersionString` to the enclosure, #1032 (Brett Walker)
* Fixed Japanese localization (1024jp)
* Fixed escaping of system profile URLs
* Added more logging in various failure cases (Kornel Lesiński)
* Better error message for quarantined apps that can't be updated
# 1.17.0
* Added Touch Bar support (Bi11)
@@ -1,4 +1,4 @@
// Generate Appcast Debug
#include "ConfigGenerateAppcast.xcconfig"
#include "CommandLineTool-Shared.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
@@ -1,4 +1,4 @@
// Generate Appcast Release
#include "ConfigGenerateAppcast.xcconfig"
#include "CommandLineTool-Shared.xcconfig"
#include "ConfigSwiftRelease.xcconfig"
@@ -0,0 +1,6 @@
// Generate Appcast only
#include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TOOL=1
@@ -1,2 +0,0 @@
#include "ConfigBinaryDelta.xcconfig"
@@ -1 +0,0 @@
#include "ConfigBinaryDelta.xcconfig"
+27 -19
View File
@@ -2,21 +2,23 @@
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
SPARKLE_FILEOP_TOOL_NAME = fileop
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
SPARKLE_APPEND_VERSION_NUMBER = 1
// 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_VERSION_MAJOR = 1
SPARKLE_VERSION_MINOR = 17
SPARKLE_ICON_NAME = AppIcon
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 0
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
@@ -26,19 +28,28 @@ ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
ARCHS = $(ARCHS_STANDARD)
MACOSX_DEPLOYMENT_TARGET = 10.7
MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\"
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_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
@@ -54,6 +65,7 @@ CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
CLANG_WARN_UNREACHABLE_CODE = YES
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
@@ -80,12 +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.7] = NO
CLANG_ENABLE_MODULES[sdk=macosx10.8] = NO
// These should be removed once the conversion to ARC is complete
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
// Turn on all warnings, then disable a few which are almost impossible to avoid
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import $(WARNING_CFLAGS_EXTRA)
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso $(WARNING_CFLAGS_EXTRA)
@@ -1,4 +1,12 @@
#include "ConfigCommonDebug.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = YES
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES
@@ -2,6 +2,12 @@
// Debug only
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = 0
DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES
+8 -1
View File
@@ -2,10 +2,17 @@
// Release only
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = s
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
+8
View File
@@ -0,0 +1,8 @@
// Downloader
INFOPLIST_FILE = Downloader/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
@@ -0,0 +1,2 @@
// Downloader Debug
#include "ConfigDownloader.xcconfig"
-5
View File
@@ -1,5 +0,0 @@
// Fileop tool only
PRODUCT_NAME = $(SPARKLE_FILEOP_TOOL_NAME)
SKIP_INSTALL = YES
CLANG_ENABLE_MODULES = NO
+5 -1
View File
@@ -7,7 +7,11 @@ WRAPPER_EXTENSION = framework
FRAMEWORK_VERSION = A
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
SKIP_INSTALL = YES
DEFINES_MODULE = YES
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
// As long as we don't ourselves depend upon any Frameworks that are incompatible
// with Application Extensions, then we should allow frameworks that require
// compatibility to be able to link with us.
APPLICATION_EXTENSION_API_ONLY = YES
@@ -1,2 +0,0 @@
#include "ConfigFramework.xcconfig"
@@ -1,7 +0,0 @@
// Generate Appcast only
#include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = generate_appcast/Appcast-Bridging-Header.h
MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = generate_appcast
@@ -0,0 +1,6 @@
// InstallerConnection
INFOPLIST_FILE = InstallerConnection/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_CONNECTION_BUNDLE_ID}
@@ -0,0 +1,3 @@
// InstallerConnection Debug
#include "ConfigInstallerConnection.xcconfig"
@@ -0,0 +1,6 @@
// Installer Launcher
INFOPLIST_FILE = InstallerLauncher/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_LAUNCHER_BUNDLE_ID}
@@ -0,0 +1,2 @@
// Installer Launcher Debug
#include "ConfigInstallerLauncher.xcconfig"
@@ -0,0 +1,7 @@
// Installer Progress only
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
@@ -0,0 +1,6 @@
// InstallerStatus
INFOPLIST_FILE = InstallerStatus/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_STATUS_BUNDLE_ID}
@@ -0,0 +1,3 @@
// InstallerStatus Debug
#include "ConfigInstallerStatus.xcconfig"
-3
View File
@@ -1,8 +1,5 @@
// Relaunch Tool only
INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist
PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME)
SKIP_INSTALL = YES
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
CLANG_ENABLE_MODULES = NO
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
@@ -1 +0,0 @@
#include "ConfigRelaunch.xcconfig"
@@ -1 +0,0 @@
#include "ConfigRelaunch.xcconfig"
@@ -0,0 +1,7 @@
// sparkle command line tool only
INFOPLIST_FILE = sparkle-cli/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.sparkle-cli
PRODUCT_NAME = sparkle
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks/
ENABLE_HARDENED_RUNTIME = NO
+2 -1
View File
@@ -1 +1,2 @@
SWIFT_VERSION = 3.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
+4 -2
View File
@@ -1,7 +1,9 @@
// Test Application only
// Test Application
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
WRAPPER_EXTENSION = app
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME)
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
ENABLE_HARDENED_RUNTIME = NO
+1 -1
View File
@@ -1,2 +1,2 @@
// Test Application Debug
#include "ConfigTestApp.xcconfig"
@@ -0,0 +1,7 @@
// Test Application Helper
INFOPLIST_FILE = TestAppHelper/Info.plist
WRAPPER_EXTENSION = xpc
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
ENABLE_HARDENED_RUNTIME = NO
@@ -0,0 +1,2 @@
// Test Application Helper Debug
#include "ConfigTestAppHelper.xcconfig"
@@ -1 +0,0 @@
#include "ConfigTestApp.xcconfig"
+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,4 +1,5 @@
#include "ConfigUITest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
GCC_GENERATE_TEST_COVERAGE_FILES = NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
+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
@@ -1,4 +1,5 @@
#include "ConfigUnitTest.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
GCC_GENERATE_TEST_COVERAGE_FILES = NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "bsdiff-Shared.xcconfig"
+3
View File
@@ -0,0 +1,3 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
#include "bsdiff-Shared.xcconfig"
+14
View File
@@ -0,0 +1,14 @@
// Copyright © 2019 Sparkle Project. All rights reserved.
// Deployment
SKIP_INSTALL = YES
// Packaging
EXECUTABLE_PREFIX = lib
PRODUCT_NAME = $(TARGET_NAME)
// Search Paths
ALWAYS_SEARCH_USER_PATHS = NO
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
WARNING_CFLAGS = $(inherited) -Wno-comma
+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)
Loaded 100 of 707 files, more files were not shown because too many files have changed in this diff. Show more