mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
542
Commits
ed2x
..
2.0.0-beta.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76acd9cb5f | ||
|
|
e4b2d96faf | ||
|
|
9229fc57b1 | ||
|
|
c396a53c6f | ||
|
|
2a67e2d732 | ||
|
|
a135f1a1ee | ||
|
|
30361b0128 | ||
|
|
cce5edd78d | ||
|
|
515b8259bc | ||
|
|
edc0fd0e56 | ||
|
|
b4e0dcca6c | ||
|
|
ee679586cf | ||
|
|
c6f1cd4e3c | ||
|
|
306ea26df8 | ||
|
|
d719b92636 | ||
|
|
b43b188c82 | ||
|
|
6b9981f567 | ||
|
|
34fcb8784b | ||
|
|
4f7ed347ab | ||
|
|
9823892062 | ||
|
|
a22562431b | ||
|
|
4db96f6c4f | ||
|
|
385673ff24 | ||
|
|
c3cdbf46cb | ||
|
|
89ab067477 | ||
|
|
29a2fa7974 | ||
|
|
cb9386a4ea | ||
|
|
119766a650 | ||
|
|
9eba644190 | ||
|
|
4a87deeb7f | ||
|
|
a09aad7ca0 | ||
|
|
9c360b465b | ||
|
|
d9d7e310a5 | ||
|
|
5677ca3f5a | ||
|
|
29d4b801fc | ||
|
|
2157f78ffd | ||
|
|
e5c63b6369 | ||
|
|
9f2629c892 | ||
|
|
b21647bcef | ||
|
|
ac1bb7036c | ||
|
|
eecc4802db | ||
|
|
e0a7304a81 | ||
|
|
78a66c7dda | ||
|
|
d8f5f58468 | ||
|
|
e5f1bd5e02 | ||
|
|
c329319b0c | ||
|
|
ad4ec8e3ab | ||
|
|
8997bad17e | ||
|
|
c631a52b48 | ||
|
|
dab34b62a0 | ||
|
|
c968334192 | ||
|
|
6639feaafc | ||
|
|
29c9b72be6 | ||
|
|
64484507b5 | ||
|
|
bc7e2d4845 | ||
|
|
9bb59b8c00 | ||
|
|
267f2b82b1 | ||
|
|
5fba1fe046 | ||
|
|
ccd8886bfd | ||
|
|
1c1b7416ba | ||
|
|
ed3e331f56 | ||
|
|
aa867a0cb9 | ||
|
|
5d27dc6fb3 | ||
|
|
fefce16697 | ||
|
|
28065e7240 | ||
|
|
d0f43e04d1 | ||
|
|
746bb1b248 | ||
|
|
ba5d895e8f | ||
|
|
7efa996ba9 | ||
|
|
2411d7538d | ||
|
|
3e1651d1cd | ||
|
|
4780cfccd5 | ||
|
|
50df5ed438 | ||
|
|
3d8e00eecd | ||
|
|
25e0de5988 | ||
|
|
6e3cd6b313 | ||
|
|
31f6f512e1 | ||
|
|
686fd05fce | ||
|
|
da30373a30 | ||
|
|
1444561899 | ||
|
|
fb8a0a02c8 | ||
|
|
9a3ada03f9 | ||
|
|
d794a2d803 | ||
|
|
b1f9bff9a1 | ||
|
|
c548721e16 | ||
|
|
eeb24ed92d | ||
|
|
66de9697f3 | ||
|
|
cb1e58e309 | ||
|
|
24a0485e98 | ||
|
|
29e7ad4495 | ||
|
|
961605c6d6 | ||
|
|
2b8d2a2be7 | ||
|
|
dfdd6ac978 | ||
|
|
52f3337eda | ||
|
|
defa8e4332 | ||
|
|
3636e22cc5 | ||
|
|
50ba774bbe | ||
|
|
432f10f804 | ||
|
|
232ce2543e | ||
|
|
efe1c8c02e | ||
|
|
1697c7966c | ||
|
|
5203518fbd | ||
|
|
9fd2e72913 | ||
|
|
ff83896e01 | ||
|
|
89ecb88f2b | ||
|
|
4825ac5d62 | ||
|
|
e2723717f1 | ||
|
|
b6956a480d | ||
|
|
7f87d8842e | ||
|
|
cbd1503c06 | ||
|
|
eda1b4bdaa | ||
|
|
7861cea66c | ||
|
|
c0691c4606 | ||
|
|
0063fbda17 | ||
|
|
d468757ee1 | ||
|
|
1013b2506a | ||
|
|
1aadf1b351 | ||
|
|
5287453cfd | ||
|
|
88f678ebe6 | ||
|
|
ee5e98d3dd | ||
|
|
062bfaaa97 | ||
|
|
f51bb996e6 | ||
|
|
8fb44df0b7 | ||
|
|
8f488c6ffd | ||
|
|
63e0b47c98 | ||
|
|
fabf415999 | ||
|
|
0e264dae2f | ||
|
|
60bbb373e2 | ||
|
|
1cc11d76a2 | ||
|
|
90bdd84832 | ||
|
|
b7f9b76dd9 | ||
|
|
253f45b476 | ||
|
|
433e1bf3de | ||
|
|
bbdebfdbee | ||
|
|
8a62dc06fe | ||
|
|
d7c504a254 | ||
|
|
87a4e349ce | ||
|
|
549a8ce117 | ||
|
|
91fc440d15 | ||
|
|
79cd07fc70 | ||
|
|
0cdb0976ef | ||
|
|
e0a414909c | ||
|
|
8e466eecc8 | ||
|
|
17eb15e9d3 | ||
|
|
7d3c7ae78a | ||
|
|
a630614dc4 | ||
|
|
87ecba77d3 | ||
|
|
455e63cc59 | ||
|
|
57b39fc1e5 | ||
|
|
b2127da6f5 | ||
|
|
8fc1689c26 | ||
|
|
898ac7253a | ||
|
|
f8ef9608dc | ||
|
|
d22ef79d9e | ||
|
|
8af1d18764 | ||
|
|
a7e090e3ca | ||
|
|
e607bf19dc | ||
|
|
7490a91406 | ||
|
|
9ee2a525d0 | ||
|
|
54caf47602 | ||
|
|
ed87bcdab6 | ||
|
|
ef577fe0c0 | ||
|
|
7c8defb75e | ||
|
|
f6d8b506ae | ||
|
|
3306ccd994 | ||
|
|
07aca30e11 | ||
|
|
be75bb38f6 | ||
|
|
debab803c9 | ||
|
|
8dc4e78cb2 | ||
|
|
e91ae897e7 | ||
|
|
91e71c219c | ||
|
|
f56e923043 | ||
|
|
50bec90279 | ||
|
|
1f9d76bc13 | ||
|
|
59fbd37bb1 | ||
|
|
f671b82e50 | ||
|
|
1565db3fec | ||
|
|
25b3d01efa | ||
|
|
d193f2e28b | ||
|
|
a79f6b2a85 | ||
|
|
0ee12d881d | ||
|
|
6d6cc2d052 | ||
|
|
039adc1ef2 | ||
|
|
62695379d9 | ||
|
|
f82f9eb878 | ||
|
|
a1aef4eca0 | ||
|
|
3d2dc8a7f6 | ||
|
|
5a3b71b96a | ||
|
|
3c9508bd2a | ||
|
|
79c1141155 | ||
|
|
ebb822af43 | ||
|
|
c882da7bc7 | ||
|
|
f1be9f72d5 | ||
|
|
e7441351d7 | ||
|
|
3cafb688b7 | ||
|
|
d84a79cfc2 | ||
|
|
c33ccd5921 | ||
|
|
6ad996338d | ||
|
|
46f7898d36 | ||
|
|
85ac073e6d | ||
|
|
7c46e8db3e | ||
|
|
fbe48e5738 | ||
|
|
b140c05bad | ||
|
|
c79785aad4 | ||
|
|
5da8199818 | ||
|
|
79a6bb1318 | ||
|
|
9b8756d824 | ||
|
|
712753d812 | ||
|
|
e8d5c8024c | ||
|
|
af245bfe62 | ||
|
|
9a12dbf62a | ||
|
|
477d0a243f | ||
|
|
ab294d607d | ||
|
|
26c63c1a7b | ||
|
|
6adb0c3017 | ||
|
|
7cb72238fa | ||
|
|
0eb5a706f8 | ||
|
|
e179443799 | ||
|
|
c00946ee20 | ||
|
|
12a3da9629 | ||
|
|
84cdb0c7e8 | ||
|
|
478cc98b90 | ||
|
|
bf35926cf3 | ||
|
|
8034404cc7 | ||
|
|
411360deb2 | ||
|
|
d91223a5b6 | ||
|
|
063974c553 | ||
|
|
97f15943e4 | ||
|
|
564f0c316a | ||
|
|
50942909f2 | ||
|
|
71557fac85 | ||
|
|
e51eb32403 | ||
|
|
6d0d1a7aa8 | ||
|
|
c44c164aff | ||
|
|
1244612946 | ||
|
|
842d258330 | ||
|
|
ef7c16bb9d | ||
|
|
f56f937ad2 | ||
|
|
02b85635c7 | ||
|
|
ce70a30be5 | ||
|
|
e8f41640dc | ||
|
|
7247803fea | ||
|
|
fe8b6b3e2a | ||
|
|
f0ff2e3ef0 | ||
|
|
c7ff8f4bb0 | ||
|
|
669c369ce7 | ||
|
|
db6ef214ab | ||
|
|
ba11897345 | ||
|
|
cc4c02f467 | ||
|
|
f58cc9e9b5 | ||
|
|
8f3e340e47 | ||
|
|
547fde293d | ||
|
|
302f3f41a3 | ||
|
|
af9935540a | ||
|
|
188a893174 | ||
|
|
3309abf936 | ||
|
|
1abe5f70db | ||
|
|
ab9ffdb901 | ||
|
|
e64253be0b | ||
|
|
8ff356bc7d | ||
|
|
3593157e3d | ||
|
|
2d0b9ae356 | ||
|
|
d9e0265d76 | ||
|
|
5ff2d7765e | ||
|
|
6b3d2af21a | ||
|
|
2f783e01f0 | ||
|
|
40545494f2 | ||
|
|
b0d9a75f98 | ||
|
|
ed89783a0e | ||
|
|
cb17e08b92 | ||
|
|
286af16842 | ||
|
|
a084e2f09d | ||
|
|
9524b32024 | ||
|
|
cb10bb8046 | ||
|
|
2d9bf07b18 | ||
|
|
eea87561ab | ||
|
|
e7bc17b192 | ||
|
|
07e96961bf | ||
|
|
895bb71fae | ||
|
|
372d711d20 | ||
|
|
5408ab10c1 | ||
|
|
3ea863d82b | ||
|
|
bd1769e82e | ||
|
|
0b634f4d76 | ||
|
|
9052ea912d | ||
|
|
833eb89bb5 | ||
|
|
e909c0d988 | ||
|
|
1f90f7c993 | ||
|
|
6db6a9892a | ||
|
|
e20f099c90 | ||
|
|
9b6e7ba828 | ||
|
|
8c53b1d3ec | ||
|
|
faf047c4ea | ||
|
|
71a36f8be4 | ||
|
|
ebc48cee5c | ||
|
|
467ffb15ca | ||
|
|
a79aa1690b | ||
|
|
e1fdd5a6c4 | ||
|
|
a108d4bc72 | ||
|
|
5a0529a2cd | ||
|
|
3a201a45ac | ||
|
|
93b8700060 | ||
|
|
2614af86ff | ||
|
|
5ae944778a | ||
|
|
f2986ef090 | ||
|
|
923bb96eda | ||
|
|
2af01e8844 | ||
|
|
414c8affc5 | ||
|
|
90aa98b68c | ||
|
|
7e8084b064 | ||
|
|
25001d83ee | ||
|
|
78b0570a76 | ||
|
|
9555cb7397 | ||
|
|
78ec0f46b7 | ||
|
|
f95bf0c7d5 | ||
|
|
cf14d09ee0 | ||
|
|
90448fd564 | ||
|
|
0a4846a186 | ||
|
|
b3e7a03660 | ||
|
|
83aac00fe6 | ||
|
|
89b7fef457 | ||
|
|
5fbf119e6a | ||
|
|
2e8fc4d17a | ||
|
|
454e6d2f13 | ||
|
|
28924f4b2a | ||
|
|
d102a50f66 | ||
|
|
bfc55ac8b0 | ||
|
|
1f35e7b5cd | ||
|
|
f23799a531 | ||
|
|
81453d1410 | ||
|
|
7064ac160b | ||
|
|
f74f9d288d | ||
|
|
3c8ebd921f | ||
|
|
579e7bd98b | ||
|
|
6d548efb2b | ||
|
|
2179eb1e39 | ||
|
|
3ded119af5 | ||
|
|
018d4ea630 | ||
|
|
ef68656783 | ||
|
|
aeffb2710a | ||
|
|
7c223ef0d1 | ||
|
|
724e9eb79e | ||
|
|
59c2c7358f | ||
|
|
dc7b2f2030 | ||
|
|
78a0d4e4e7 | ||
|
|
cd8794acce | ||
|
|
fd940884c8 | ||
|
|
e76e34ead8 | ||
|
|
2dd324d316 | ||
|
|
9e7548c4ff | ||
|
|
e21f7c4e87 | ||
|
|
370fdb8368 | ||
|
|
d3f6370828 | ||
|
|
efa9cc20d0 | ||
|
|
7d8e3059ec | ||
|
|
f400b27cb2 | ||
|
|
f43b5ee3c3 | ||
|
|
1526a024b8 | ||
|
|
5cd1d3c824 | ||
|
|
8a868914e5 | ||
|
|
f5ee4dedb4 | ||
|
|
ef23e7d65e | ||
|
|
d29d3f97a5 | ||
|
|
a1cba4dd91 | ||
|
|
699a9df7bf | ||
|
|
5aa68fa82b | ||
|
|
adc62f8e34 | ||
|
|
f977a92e4c | ||
|
|
dd24e8d938 | ||
|
|
03f20a05a8 | ||
|
|
7ecc624afb | ||
|
|
e331afddb1 | ||
|
|
45581d5658 | ||
|
|
9931992912 | ||
|
|
df3d9e2b14 | ||
|
|
e148659cbb | ||
|
|
0a8443c94a | ||
|
|
0e26a3e27a | ||
|
|
ea472ae3f0 | ||
|
|
59326e80d4 | ||
|
|
3c0962b137 | ||
|
|
2d666b4d84 | ||
|
|
c822f88cf1 | ||
|
|
16dc6c2b5b | ||
|
|
08a7122b36 | ||
|
|
8792137fda | ||
|
|
25820ccd4b | ||
|
|
1290b974de | ||
|
|
c39370e64b | ||
|
|
0b9bacfd0e | ||
|
|
ad545813f0 | ||
|
|
3f226ccdd7 | ||
|
|
13a36cb904 | ||
|
|
c5def52133 | ||
|
|
6b0d9f0de2 | ||
|
|
a9254d1e02 | ||
|
|
2b9a02c825 | ||
|
|
9d335b1233 | ||
|
|
43379af33e | ||
|
|
4c14d7d556 | ||
|
|
afe03b7161 | ||
|
|
79a9c50d2d | ||
|
|
c5add680aa | ||
|
|
e8ebf23504 | ||
|
|
da5be8902c | ||
|
|
7cffceb1f7 | ||
|
|
6c846d0fad | ||
|
|
044313db59 | ||
|
|
e089b9b435 | ||
|
|
98dc6314a5 | ||
|
|
915786e11f | ||
|
|
60fcc89b7e | ||
|
|
f9d421f851 | ||
|
|
27d7058e0e | ||
|
|
03503d37b6 | ||
|
|
0364e01c3a | ||
|
|
bc0e338cde | ||
|
|
d97dbf7ba0 | ||
|
|
9818eff9a2 | ||
|
|
4767ef60ec | ||
|
|
e197f3093a | ||
|
|
1d930b585e | ||
|
|
6da14f7c46 | ||
|
|
5ca8984c10 | ||
|
|
27f31a2913 | ||
|
|
3e544c7d26 | ||
|
|
507255224a | ||
|
|
c1381d48d1 | ||
|
|
c3ce4f624b | ||
|
|
0a35f9d807 | ||
|
|
fd209ced12 | ||
|
|
d85c1df752 | ||
|
|
4fdd01052b | ||
|
|
1278b426f2 | ||
|
|
e880f34f7c | ||
|
|
1d178a9a19 | ||
|
|
22af258dc8 | ||
|
|
01d19ca92e | ||
|
|
173ccc845a | ||
|
|
a0401fade9 | ||
|
|
c6a89eb32b | ||
|
|
f7906c45c0 | ||
|
|
6d0f7fce26 | ||
|
|
6308b262a0 | ||
|
|
2066cd7232 | ||
|
|
64d2ee1b5d | ||
|
|
7896b5ab44 | ||
|
|
c70b39ba79 | ||
|
|
7c7968b2f2 | ||
|
|
ae81bd27a2 | ||
|
|
fd6d480d3d | ||
|
|
fc18529767 | ||
|
|
6fc5011362 | ||
|
|
176ff8f3df | ||
|
|
f64436165b | ||
|
|
154b702552 | ||
|
|
c03cc0fa17 | ||
|
|
f858b99f93 | ||
|
|
85f41927f3 | ||
|
|
d8a8282b60 | ||
|
|
a6ffe0fa71 | ||
|
|
523542ad90 | ||
|
|
57d9a780b8 | ||
|
|
8d6d81c58f | ||
|
|
7a228c7e1d | ||
|
|
6e326f3cea | ||
|
|
3c0e02f333 | ||
|
|
32b0ca2e0f | ||
|
|
6316c53aba | ||
|
|
8fc7cadf69 | ||
|
|
cb5eb0e47d | ||
|
|
ea11447ab2 | ||
|
|
8a3cc2e073 | ||
|
|
03fb6d969f | ||
|
|
d4fb14f1fd | ||
|
|
ec4b113d17 | ||
|
|
ace5d99a27 | ||
|
|
164e0e4f9a | ||
|
|
09178f70e9 | ||
|
|
3bc20cb096 | ||
|
|
80cecd37b5 | ||
|
|
7951b81b69 | ||
|
|
066da58f4d | ||
|
|
5e5aebffd3 | ||
|
|
98eef51931 | ||
|
|
5e0b3f2a19 | ||
|
|
48a1379dbe | ||
|
|
3038218ea7 | ||
|
|
238fd42bb3 | ||
|
|
eac4522817 | ||
|
|
94d05336a6 | ||
|
|
93e4fd9424 | ||
|
|
741ec1a08b | ||
|
|
7a8ead559b | ||
|
|
c802a38c92 | ||
|
|
8947a6e50d | ||
|
|
5e73e70322 | ||
|
|
e2bf94df7e | ||
|
|
a266b400cb | ||
|
|
7b4c648812 | ||
|
|
d38fd92668 | ||
|
|
772e610537 | ||
|
|
02e11f3c3a | ||
|
|
8c7adbdca7 | ||
|
|
852d678585 | ||
|
|
e3ba2388e8 | ||
|
|
6f1fceb7d4 | ||
|
|
bc6d15a13c | ||
|
|
65cab6a14d | ||
|
|
923f15220f | ||
|
|
5fcc9a8aa9 | ||
|
|
500d97d8ff | ||
|
|
d1367393c2 | ||
|
|
404b67a256 | ||
|
|
de8de29df2 | ||
|
|
6a55563307 | ||
|
|
438f4a21d5 | ||
|
|
32bb57c029 | ||
|
|
1c77f59214 | ||
|
|
a95f1592cd | ||
|
|
e7f8161ae4 | ||
|
|
9422bf16ae | ||
|
|
418068e902 | ||
|
|
04b2122fed | ||
|
|
bdffcb0dd5 | ||
|
|
be25c2ac64 | ||
|
|
8487a24584 | ||
|
|
820fdadfd7 | ||
|
|
1343c27805 | ||
|
|
7acb6c4292 | ||
|
|
9592e35d1c | ||
|
|
e7e20e6ac8 | ||
|
|
2b4b2a4443 | ||
|
|
bd601b2f8c | ||
|
|
b137b7f072 | ||
|
|
705638799c | ||
|
|
6b47d3fe90 | ||
|
|
3e000a897f | ||
|
|
b969c31f07 | ||
|
|
299157c3e7 | ||
|
|
3a8040ae2e | ||
|
|
9a74b23f7f |
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
|
||||
@@ -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]
|
||||
@@ -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
|
||||
@@ -0,0 +1,75 @@
|
||||
name: "Create Draft Release"
|
||||
|
||||
env:
|
||||
BUILDDIR: "build"
|
||||
DEVELOPER_DIR: "/Applications/Xcode_12.5.1.app/Contents/Developer"
|
||||
|
||||
on:
|
||||
workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: publish-release-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: "Publish binaries for release"
|
||||
runs-on: macos-11
|
||||
|
||||
steps:
|
||||
- name: "Checkout sources"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "Extract latest changes from CHANGELOG"
|
||||
run: |
|
||||
./Configurations/generate_latest_changes.py > latest-changes.txt
|
||||
|
||||
- name: "Extract version information from project"
|
||||
run: |
|
||||
MARKETING_VERSION=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*MARKETING_VERSION' | sed -E 's/.+=[[:space:]]+(.*)$/\1/')
|
||||
echo "MARKETING_VERSION=${MARKETING_VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- name: "Determine if this is a pre-release version"
|
||||
run: |
|
||||
SPARKLE_VERSION_SUFFIX=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*SPARKLE_VERSION_SUFFIX' | sed -E 's/.+=[[:space:]]+(.*)$/\1/')
|
||||
if [[ ! -z "$SPARKLE_VERSION_SUFFIX" ]]; then
|
||||
echo "PRERELEASE_VERSION=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: "Set up git and create tag"
|
||||
run: |
|
||||
git config user.name Sparkle-Bot
|
||||
git config user.email sparkle.project.bot@gmail.com
|
||||
git tag "${{ env.MARKETING_VERSION }}"
|
||||
|
||||
- name: "Build release distribution"
|
||||
run: make release
|
||||
env:
|
||||
GITHUB_ACTOR: ${{ github.actor }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
|
||||
- name: "Push the updated Swift package description"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
run: git push
|
||||
|
||||
- name: "Draft a release"
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ env.PRERELEASE_VERSION }}
|
||||
name: "Sparkle ${{ env.MARKETING_VERSION }}"
|
||||
tag_name: ${{ env.MARKETING_VERSION }}
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
body_path: latest-changes.txt
|
||||
files: |
|
||||
build/Build/Products/Release/Sparkle-*.tar.xz
|
||||
build/Build/Products/Release/Sparkle-for-Swift-Package-Manager.zip
|
||||
@@ -41,3 +41,7 @@ Carthage/Build
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Swift Package Manager
|
||||
/.build
|
||||
.swiftpm
|
||||
@@ -1,7 +0,0 @@
|
||||
os: osx
|
||||
language: objective-c
|
||||
osx_image:
|
||||
- xcode10.3
|
||||
- xcode11.4
|
||||
script:
|
||||
- set -o pipefail && xcodebuild test -project Sparkle.xcodeproj -scheme Distribution -derivedDataPath build -enableCodeCoverage YES | xcpretty
|
||||
@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, readonly, nullable) id<SPUInstallerAgentProtocol> agent;
|
||||
@property (nonatomic, readonly) BOOL connected;
|
||||
@property (nonatomic, nullable) NSError *invalidationError;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
@synthesize agent = _agent;
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize connected = _connected;
|
||||
@synthesize invalidationError = _invalidationError;
|
||||
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate
|
||||
{
|
||||
@@ -105,4 +106,11 @@
|
||||
acknowledgement();
|
||||
}
|
||||
|
||||
- (void)connectionWillInvalidateWithError:(NSError *)error
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.invalidationError = error;
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -9,12 +9,16 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUUnarchiverProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AppInstaller : NSObject
|
||||
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier;
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
|
||||
|
||||
- (void)start;
|
||||
|
||||
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn));
|
||||
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+87
-76
@@ -11,6 +11,7 @@
|
||||
#import "SUInstaller.h"
|
||||
#import "SUUpdateValidator.h"
|
||||
#import "SULog.h"
|
||||
#import "SULog+NSError.h"
|
||||
#import "SUHost.h"
|
||||
#import "SULocalizations.h"
|
||||
#import "SUStandardVersionComparator.h"
|
||||
@@ -21,7 +22,7 @@
|
||||
#import "SUFileManager.h"
|
||||
#import "SPUInstallationInfo.h"
|
||||
#import "SUAppcastItem.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
#import "SUInstallerCommunicationProtocol.h"
|
||||
#import "AgentConnection.h"
|
||||
#import "SPUInstallerAgentProtocol.h"
|
||||
@@ -34,7 +35,7 @@
|
||||
#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.
|
||||
@@ -54,6 +55,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@property (nonatomic) SUUpdateValidator *updateValidator;
|
||||
|
||||
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
|
||||
@property (nonatomic, readonly) NSString *homeDirectory;
|
||||
@property (nonatomic, readonly) NSString *userName;
|
||||
@property (nonatomic) SUHost *host;
|
||||
@property (nonatomic, copy) NSString *updateDirectoryPath;
|
||||
@property (nonatomic, copy) NSString *downloadName;
|
||||
@@ -85,6 +88,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@synthesize agentConnection = _agentConnection;
|
||||
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
|
||||
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
|
||||
@synthesize homeDirectory = _homeDirectory;
|
||||
@synthesize userName = _userName;
|
||||
@synthesize terminationListener = _terminationListener;
|
||||
@synthesize updateValidator = _updateValidator;
|
||||
@synthesize host = _host;
|
||||
@@ -106,7 +111,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@synthesize finishedValidation = _finishedValidation;
|
||||
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
|
||||
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier
|
||||
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
|
||||
{
|
||||
if (!(self = [super init])) {
|
||||
return nil;
|
||||
@@ -114,6 +119,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
_hostBundleIdentifier = [hostBundleIdentifier copy];
|
||||
|
||||
_homeDirectory = [homeDirectory copy];
|
||||
_userName = [userName copy];
|
||||
|
||||
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||
_xpcListener.delegate = self;
|
||||
|
||||
@@ -147,8 +155,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
AppInstaller *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) {
|
||||
SULog(SULogLevelError, @"Invalidation on remote port being called, and installation is not close enough to completion!");
|
||||
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Invalidation on remote port being called, and installation is not close enough to completion!" }]];
|
||||
}
|
||||
strongSelf.communicator = nil;
|
||||
strongSelf.activeConnection = nil;
|
||||
@@ -170,13 +177,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (!self.receivedInstallationData) {
|
||||
SULog(SULogLevelError, @"Timeout: installation data was never received");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: installation data was never received" }]];
|
||||
}
|
||||
|
||||
if (!self.agentConnection.connected) {
|
||||
SULog(SULogLevelError, @"Timeout: agent connection was never initiated");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: agent connection was never initiated" }]];
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -186,11 +191,12 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
|
||||
|
||||
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
|
||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword];
|
||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
|
||||
|
||||
NSError *unarchiverError = nil;
|
||||
BOOL success = NO;
|
||||
if (!unarchiver) {
|
||||
SULog(SULogLevelError, @"Error: No valid unarchiver for %@", archivePath);
|
||||
unarchiverError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No valid unarchiver was found for %@", archivePath] }];
|
||||
|
||||
success = NO;
|
||||
} else {
|
||||
@@ -201,27 +207,27 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||
|
||||
if (needsPrevalidation) {
|
||||
success = [self.updateValidator validateDownloadPath];
|
||||
success = [self.updateValidator validateDownloadPathWithError:&unarchiverError];
|
||||
} else {
|
||||
success = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
[self unarchiverDidFail];
|
||||
[self unarchiverDidFailWithError:unarchiverError];
|
||||
} else {
|
||||
[unarchiver
|
||||
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
|
||||
if (error != nil) {
|
||||
[self unarchiverDidFail];
|
||||
[self unarchiverDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to unarchive %@", archivePath], NSUnderlyingErrorKey: (NSError * _Nonnull)error }]];
|
||||
} else {
|
||||
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
|
||||
|
||||
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath];
|
||||
NSError *validationError = nil;
|
||||
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
|
||||
|
||||
if (!validationSuccess) {
|
||||
SULog(SULogLevelError, @"Error: update validation was a failure");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]];
|
||||
} else {
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
|
||||
|
||||
@@ -243,8 +249,22 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFail
|
||||
- (void)clearUpdateDirectory
|
||||
{
|
||||
if (self.updateDirectoryPath != nil) {
|
||||
NSError *theError = nil;
|
||||
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
|
||||
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
|
||||
}
|
||||
self.updateDirectoryPath = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFailWithError:(NSError *)error
|
||||
{
|
||||
SULog(SULogLevelError, @"Failed to unarchive file");
|
||||
SULogError(error);
|
||||
|
||||
// No longer need update validator until next possible extraction (eg: if initial delta update fails)
|
||||
self.updateValidator = nil;
|
||||
|
||||
@@ -252,14 +272,15 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
// Eg: one common case is if a delta update fails, client may want to fall back to regular update
|
||||
// We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data,
|
||||
// but may as well set other fields to nil too
|
||||
self.updateDirectoryPath = nil;
|
||||
[self clearUpdateDirectory];
|
||||
self.downloadName = nil;
|
||||
self.decryptionPassword = nil;
|
||||
self.signatures = nil;
|
||||
self.relaunchPath = nil;
|
||||
self.host = nil;
|
||||
|
||||
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:[NSData data]];
|
||||
NSData *archivedError = SPUArchiveRootObjectSecurely(error);
|
||||
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:archivedError != nil ? archivedError : [NSData data]];
|
||||
}
|
||||
|
||||
- (void)agentConnectionDidInitiate
|
||||
@@ -273,8 +294,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
- (void)agentConnectionDidInvalidate
|
||||
{
|
||||
if (!self.finishedValidation || !self.agentInitiatedConnection) {
|
||||
SULog(SULogLevelError, @"Error: Agent connection invalidated before installation began");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Error: Agent connection invalidated before installation began" }];
|
||||
|
||||
NSError *agentError = self.agentConnection.invalidationError;
|
||||
if (agentError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = agentError;
|
||||
}
|
||||
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:userInfo]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,8 +320,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (self.terminationListener == nil) {
|
||||
SULog(SULogLevelError, @"Timeout error: failed to retreive process identifier from agent");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout error: failed to retreive process identifier from agent" }]];
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -309,15 +335,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
|
||||
if (installationData == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to unarchive input installation data");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to unarchive input installation data" }]];
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *installationType = installationData.installationType;
|
||||
if (!SPUValidInstallationType(installationType)) {
|
||||
SULog(SULogLevelError, @"Error: Received invalid installation type: %@", installationType);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received invalid installation type: %@", installationType] }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,15 +349,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
NSString *bundleIdentifier = hostBundle.bundleIdentifier;
|
||||
if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) {
|
||||
SULog(SULogLevelError, @"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier] }]];
|
||||
return;
|
||||
}
|
||||
|
||||
// This will be important later
|
||||
if (installationData.relaunchPath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to obtain relaunch path from installation data");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to obtain relaunch path from installation data" }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,8 +366,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
NSString *cacheInstallationPath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootCacheInstallationPath];
|
||||
if (cacheInstallationPath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath] }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -358,8 +379,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
NSError *moveError = nil;
|
||||
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
|
||||
SULog(SULogLevelError, @"Error: Failed to move download archive to new location: %@", moveError);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to move download archive to new location", NSUnderlyingErrorKey: moveError }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -367,22 +387,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
NSError *attributesError = nil;
|
||||
NSString *downloadDestinationPath = downloadDestinationURL.path;
|
||||
if (downloadDestinationPath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to retrieve download archive path from %@", downloadDestinationURL);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to retrieve download archive path from %@", downloadDestinationURL] }]];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary<NSString *, id> *archiveAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:downloadDestinationPath error:&attributesError];
|
||||
|
||||
if (archiveAttributes == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to retrieve download archive attributes from %@", downloadDestinationPath);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to retrieve download archive attributes from %@", downloadDestinationPath] }]];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (![(NSString *)archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) {
|
||||
SULog(SULogLevelError, @"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]);
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]] }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -425,6 +444,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (identifier == SPUCancelInstallation) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:0 error:nil];
|
||||
});
|
||||
} else if (identifier == SPUUpdaterAlivePong) {
|
||||
self.receivedUpdaterPong = YES;
|
||||
}
|
||||
@@ -438,23 +461,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
dispatch_async(self.installerQueue, ^{
|
||||
NSError *installerError = nil;
|
||||
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
|
||||
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
|
||||
|
||||
if (installer == nil) {
|
||||
SULog(SULogLevelError, @"Error: Failed to create installer instance with error: %@", installerError);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to create installer instance", NSUnderlyingErrorKey: installerError }]];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
NSError *firstStageError = nil;
|
||||
if (![installer performInitialInstallation:&firstStageError]) {
|
||||
SULog(SULogLevelError, @"Error: Failed to start installer with error: %@", firstStageError);
|
||||
self.installer = nil;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to start installer", NSUnderlyingErrorKey: firstStageError }]];
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -502,11 +523,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.agentConnection.agent sendTerminationSignal];
|
||||
});
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently");
|
||||
self.installer = nil;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently" }]];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -515,8 +535,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
{
|
||||
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
|
||||
if (!success) {
|
||||
SULog(SULogLevelError, @"Failed to listen for application termination");
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -549,18 +568,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
return;
|
||||
}
|
||||
|
||||
// Used later for relaunching
|
||||
// Compute this now before we set this installer property to nil
|
||||
NSString *installationPath = [self.installer installationPath];
|
||||
|
||||
NSError *thirdStageError = nil;
|
||||
if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
|
||||
SULog(SULogLevelError, @"Failed to finalize installation with error: %@", thirdStageError);
|
||||
|
||||
[self.installer performCleanup];
|
||||
self.installer = nil;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -577,27 +591,29 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
|
||||
|
||||
if (self.shouldRelaunch) {
|
||||
NSString *pathToRelaunch = nil;
|
||||
// If the relaunch path is the same as the host bundle path, use the installation path from the installer which may be normalized
|
||||
// Otherwise use the requested relaunch path in all other cases
|
||||
if ([self.relaunchPath.pathComponents isEqualToArray:self.host.bundlePath.pathComponents]) {
|
||||
pathToRelaunch = installationPath;
|
||||
} else {
|
||||
pathToRelaunch = self.relaunchPath;
|
||||
}
|
||||
|
||||
// This will also signal to the agent that it will terminate soon
|
||||
[self.agentConnection.agent relaunchPath:pathToRelaunch];
|
||||
[self.agentConnection.agent relaunchApplication];
|
||||
}
|
||||
|
||||
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
|
||||
[self.installer performCleanup];
|
||||
|
||||
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
|
||||
});
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn))
|
||||
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn))
|
||||
{
|
||||
if (error != nil) {
|
||||
SULogError(error);
|
||||
|
||||
NSData *errorData = SPUArchiveRootObjectSecurely((NSError * _Nonnull)error);
|
||||
if (errorData != nil) {
|
||||
[self.communicator handleMessageWithIdentifier:SPUInstallerError data:errorData];
|
||||
}
|
||||
}
|
||||
|
||||
// It's nice to tell the other end we're invalidating
|
||||
|
||||
[self.activeConnection invalidate];
|
||||
@@ -609,12 +625,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
[self.agentConnection invalidate];
|
||||
self.agentConnection = nil;
|
||||
|
||||
if (self.updateDirectoryPath != nil) {
|
||||
NSError *theError = nil;
|
||||
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
|
||||
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
|
||||
}
|
||||
}
|
||||
[self clearUpdateDirectory];
|
||||
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
|
||||
@property (nonatomic, readonly) BOOL canSilentlyInstall;
|
||||
|
||||
@property (nonatomic) BOOL systemDomain;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -14,22 +14,30 @@
|
||||
|
||||
static NSString *SUAppcastItemKey = @"SUAppcastItem";
|
||||
static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
|
||||
static NSString *SUSystemDomainKey = @"SUSystemDomain";
|
||||
|
||||
@implementation SPUInstallationInfo
|
||||
|
||||
@synthesize appcastItem = _appcastItem;
|
||||
@synthesize canSilentlyInstall = _canSilentlyInstall;
|
||||
@synthesize systemDomain = _systemDomain;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall systemDomain:(BOOL)systemDomain
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_appcastItem = appcastItem;
|
||||
_canSilentlyInstall = canSilentlyInstall;
|
||||
_systemDomain = systemDomain;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
|
||||
{
|
||||
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall systemDomain:NO];
|
||||
}
|
||||
|
||||
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
SUAppcastItem *appcastItem = [decoder decodeObjectOfClass:[SUAppcastItem class] forKey:SUAppcastItemKey];
|
||||
@@ -38,13 +46,15 @@ static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
|
||||
}
|
||||
|
||||
BOOL canSilentlyInstall = [decoder decodeBoolForKey:SUCanSilentlyInstallKey];
|
||||
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall];
|
||||
BOOL systemDomain = [decoder decodeBoolForKey:SUSystemDomainKey];
|
||||
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall systemDomain:systemDomain];
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
[coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
|
||||
[coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
|
||||
[coder encodeBool:self.systemDomain forKey:SUSystemDomainKey];
|
||||
}
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
|
||||
@@ -22,14 +22,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* signatures - signatures for the update that came from the appcast item
|
||||
* decryptionPassword - optional decryption password for dmg archives
|
||||
*/
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *relaunchPath;
|
||||
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
|
||||
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
|
||||
@property (nonatomic, copy, readonly) NSString *downloadName;
|
||||
@property (nonatomic, copy, readonly) NSString *installationType;
|
||||
@property (nonatomic, strong, readonly) SUSignatures *signatures;
|
||||
@property (nonatomic, readonly, nullable) SUSignatures *signatures; // nullable because although not using signatures is deprecated, it's still supported
|
||||
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
|
||||
|
||||
@end
|
||||
|
||||
@@ -30,7 +30,7 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
@synthesize installationType = _installationType;
|
||||
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class SUHost;
|
||||
|
||||
extern NSString *SPUAppcastItemArchiveKey;
|
||||
|
||||
// Order matters; higher stages have higher values.
|
||||
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
|
||||
{
|
||||
@@ -26,7 +22,8 @@ typedef NS_ENUM(int32_t, SPUInstallerMessageType)
|
||||
SPUInstallationFinishedStage1 = 6,
|
||||
SPUInstallationFinishedStage2 = 7,
|
||||
SPUInstallationFinishedStage3 = 8,
|
||||
SPUUpdaterAlivePing = 9
|
||||
SPUUpdaterAlivePing = 9,
|
||||
SPUInstallerError = 10
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
|
||||
@@ -34,15 +31,19 @@ typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
|
||||
SPUInstallationData = 0,
|
||||
SPUSentUpdateAppcastItemData = 1,
|
||||
SPUResumeInstallationToStage2 = 2,
|
||||
SPUUpdaterAlivePong = 3
|
||||
SPUUpdaterAlivePong = 3,
|
||||
SPUCancelInstallation = 4
|
||||
};
|
||||
|
||||
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
|
||||
|
||||
// Used by framework to communicate to installer (Autoupdate)
|
||||
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||
|
||||
// Used by framework to communicate to progress agent tool (Updater)
|
||||
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||
|
||||
// Used by progress agent tool to communicate to installer (Autoupdate)
|
||||
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -7,24 +7,19 @@
|
||||
//
|
||||
|
||||
#import "SPUMessageTypes.h"
|
||||
#import "SUHost.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive";
|
||||
|
||||
// Tags added to the bundle identifier which is used as Mach service names
|
||||
// These should be very short because length restrictions exist on earlier versions of macOS
|
||||
// These should be very short because of length restrictions
|
||||
#define SPARKLE_INSTALLER_TAG @"-spki"
|
||||
#define SPARKLE_STATUS_TAG @"-spks"
|
||||
#define SPARKLE_PROGRESS_TAG @"-spkp"
|
||||
#define SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG @"-spkl"
|
||||
|
||||
// macOS 10.8 at least can't handle service names that are 64 characters or longer
|
||||
// This was fixed some point after 10.8, but I'm not sure if it was fixed in 10.9 or 10.10 or 10.11
|
||||
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
|
||||
#define MAX_SERVICE_NAME_LENGTH 63u
|
||||
// macOS 10.8 couldn't handle service names that are >= 64 characters,
|
||||
// but 10.9 raised this to >= 128 characters
|
||||
#define MAX_SERVICE_NAME_LENGTH 127u
|
||||
|
||||
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
|
||||
{
|
||||
@@ -55,9 +50,10 @@ BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUI
|
||||
case SPUInstallationFinishedStage3:
|
||||
legal = (oldMessageType == SPUInstallationFinishedStage2);
|
||||
break;
|
||||
case SPUInstallerError:
|
||||
case SPUUpdaterAlivePing:
|
||||
// Having this state being dependent on other installation states would make the complicate our logic
|
||||
// So just always allow this type of message
|
||||
// So just always allow these type of messages
|
||||
legal = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -186,6 +186,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
|
||||
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
|
||||
BOOL removedFile = NO;
|
||||
|
||||
// Files that have no property set that we check for will get ignored
|
||||
// This is important because they aren't part of the delta, just part of the directory structure
|
||||
|
||||
const char *value;
|
||||
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
||||
|
||||
@@ -61,7 +61,6 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
|
||||
|
||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||
extern NSData *hashOfFileContents(FTSENT *ent);
|
||||
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
||||
extern NSString *hashOfTree(NSString *path);
|
||||
extern BOOL removeTree(NSString *path);
|
||||
|
||||
@@ -45,7 +45,7 @@ int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||
case SUAzureMajorVersion:
|
||||
return 1;
|
||||
case SUBeigeMajorVersion:
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -137,15 +137,6 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSData *hashOfFileContents(FTSENT *ent)
|
||||
{
|
||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
||||
if (!_hashOfFileContents(fileHash, ent)) {
|
||||
return nil;
|
||||
}
|
||||
return [NSData dataWithBytes:fileHash length:CC_SHA1_DIGEST_LENGTH];
|
||||
}
|
||||
|
||||
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
{
|
||||
char pathBuffer[PATH_MAX] = { 0 };
|
||||
@@ -190,6 +181,11 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
||||
uint16_t mode = ent->fts_statp->st_mode;
|
||||
// permission of symlinks is irrelevant and can't be changed.
|
||||
// hardcoding a value helps avoid differences between filesystems.
|
||||
if (ent->fts_info == FTS_SL) {
|
||||
mode = 0755;
|
||||
}
|
||||
uint16_t type = ent->fts_info;
|
||||
uint16_t permissions = mode & PERMISSION_FLAGS;
|
||||
|
||||
|
||||
@@ -66,25 +66,23 @@ extern int bsdiff(int argc, const char **argv);
|
||||
|
||||
@end
|
||||
|
||||
#define INFO_HASH_KEY @"hash"
|
||||
#define INFO_PATH_KEY @"path"
|
||||
#define INFO_TYPE_KEY @"type"
|
||||
#define INFO_PERMISSIONS_KEY @"permissions"
|
||||
#define INFO_SIZE_KEY @"size"
|
||||
|
||||
static NSDictionary *infoForFile(FTSENT *ent)
|
||||
{
|
||||
NSData *hash = hashOfFileContents(ent);
|
||||
if (!hash) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
|
||||
|
||||
assert(ent->fts_statp != NULL);
|
||||
|
||||
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
|
||||
|
||||
return @{ INFO_HASH_KEY: hash,
|
||||
NSString *path = @(ent->fts_path);
|
||||
assert(path != nil);
|
||||
|
||||
return @{ INFO_PATH_KEY: path != nil ? path : @"",
|
||||
INFO_TYPE_KEY: @(ent->fts_info),
|
||||
INFO_PERMISSIONS_KEY: @(permissions),
|
||||
INFO_SIZE_KEY: @(size) };
|
||||
@@ -174,12 +172,19 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
if (originalInfoType != newInfoType) {
|
||||
// File types are different
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
|
||||
// this is possible if just the permissions have changed
|
||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||
|
||||
// Skip delta if both entries are directories, or if the files/symlinks are equal in content
|
||||
if (originalInfoType == FTS_D || [[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||
// this is possible if just the permissions have changed but contents have not
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -205,11 +210,21 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
|
||||
if (originalInfoType != newInfoType) {
|
||||
// File types are different
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
|
||||
|
||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||
|
||||
// Don't skip extract if files/symlinks entries are not equal in content
|
||||
// (note if the entries are directories, they are equal)
|
||||
if (originalInfoType != FTS_D && ![[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -233,6 +248,52 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
|
||||
return YES;
|
||||
}
|
||||
|
||||
static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTable, xar_t x, NSString *relativePath, NSString *filePath)
|
||||
{
|
||||
NSArray<NSString *> *rootRelativePathComponents = relativePath.pathComponents;
|
||||
// Relative path must at least have starting "/" component and one more path component
|
||||
if (rootRelativePathComponents.count < 2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSArray<NSString *> *relativePathComponents = [rootRelativePathComponents subarrayWithRange:NSMakeRange(1, rootRelativePathComponents.count - 1)];
|
||||
|
||||
NSUInteger relativePathComponentsCount = relativePathComponents.count;
|
||||
|
||||
// Build parent files as needed until we get to our final file we want to add
|
||||
// So if we get "Contents/Resources/foo.txt", we will first add "Contents" parent,
|
||||
// then "Resources" parent, then "foo.txt" as the final entry we want to add
|
||||
// We store every file we add into a fileTable for easy referencing
|
||||
// Note if a diff has Contents/Resources/foo/ and Contents/Resources/foo/bar.txt,
|
||||
// due to sorting order we will add the foo directory first and won't end up with
|
||||
// mis-ordering bugs
|
||||
xar_file_t lastParent = NULL;
|
||||
for (NSUInteger componentIndex = 0; componentIndex < relativePathComponentsCount; componentIndex++) {
|
||||
NSArray<NSString *> *subpathComponents = [relativePathComponents subarrayWithRange:NSMakeRange(0, componentIndex + 1)];
|
||||
NSString *subpathKey = [subpathComponents componentsJoinedByString:@"/"];
|
||||
|
||||
xar_file_t cachedFile = [fileTable[subpathKey] pointerValue];
|
||||
if (cachedFile != NULL) {
|
||||
lastParent = cachedFile;
|
||||
} else {
|
||||
xar_file_t newParent;
|
||||
|
||||
BOOL atLastIndex = (componentIndex == relativePathComponentsCount - 1);
|
||||
|
||||
NSString *lastPathComponent = subpathComponents.lastObject;
|
||||
if (atLastIndex && filePath != nil) {
|
||||
newParent = xar_add_frompath(x, lastParent, lastPathComponent.fileSystemRepresentation, filePath.fileSystemRepresentation);
|
||||
} else {
|
||||
newParent = xar_add_frombuffer(x, lastParent, lastPathComponent.fileSystemRepresentation, "", 1);
|
||||
}
|
||||
|
||||
lastParent = newParent;
|
||||
fileTable[subpathKey] = [NSValue valueWithPointer:newParent];
|
||||
}
|
||||
}
|
||||
return lastParent;
|
||||
}
|
||||
|
||||
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error)
|
||||
{
|
||||
assert(source);
|
||||
@@ -489,11 +550,14 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
|
||||
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
||||
}];
|
||||
|
||||
NSMutableDictionary<NSString *, NSValue *> *fileTable = [NSMutableDictionary dictionary];
|
||||
|
||||
for (NSString *key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
|
||||
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||
|
||||
@@ -508,7 +572,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldSkipExtracting(originalInfo, newInfo)) {
|
||||
if (shouldChangePermissions(originalInfo, newInfo)) {
|
||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
||||
|
||||
@@ -518,7 +582,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
} else {
|
||||
NSString *path = [destination stringByAppendingPathComponent:key];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, path);
|
||||
assert(newFile);
|
||||
|
||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
||||
@@ -570,7 +634,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, [operation relativePath], resultPath);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
||||
unlink([resultPath fileSystemRepresentation]);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Security/SecCode.h>
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SULog.h"
|
||||
#import "SUErrors.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -23,24 +24,38 @@
|
||||
SecStaticCodeRef staticCode = NULL;
|
||||
SecStaticCodeRef oldCode = NULL;
|
||||
CFErrorRef cfError = NULL;
|
||||
if (error) {
|
||||
*error = nil;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)oldBundleURL, kSecCSDefaultFlags, &oldCode);
|
||||
if (result == errSecCSUnsigned) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Bundle is not code signed: %@", newBundleURL] }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
result = SecCodeCopyDesignatedRequirement(oldCode, kSecCSDefaultFlags, &requirement);
|
||||
if (result != noErr) {
|
||||
SULog(SULogLevelError, @"Failed to copy designated requirement. Code Signing OSStatus code: %d", result);
|
||||
NSString *message = [NSString stringWithFormat:@"Failed to copy designated requirement. Code Signing OSStatus code: %d", result];
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
goto finally;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)newBundleURL, kSecCSDefaultFlags, &staticCode);
|
||||
if (result != noErr) {
|
||||
SULog(SULogLevelError, @"Failed to get static code %d", result);
|
||||
NSString *message = [NSString stringWithFormat:@"Failed to get static code %d", result];
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
goto finally;
|
||||
}
|
||||
|
||||
@@ -51,24 +66,56 @@
|
||||
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError);
|
||||
|
||||
if (cfError) {
|
||||
NSError *tmpError = CFBridgingRelease(cfError);
|
||||
if (error) *error = tmpError;
|
||||
}
|
||||
|
||||
if (result != noErr) {
|
||||
if (result == errSecCSUnsigned) {
|
||||
SULog(SULogLevelError, @"The host app is signed, but the new version of the app is not signed using Apple Code Signing. Please ensure that the new app is signed and that archiving did not corrupt the signature.");
|
||||
if (result != errSecSuccess) {
|
||||
NSError *underlyingError;
|
||||
if (cfError != NULL) {
|
||||
NSError *tmpError = CFBridgingRelease(cfError);
|
||||
underlyingError = tmpError;
|
||||
} else {
|
||||
underlyingError = nil;
|
||||
}
|
||||
if (result == errSecCSReqFailed) {
|
||||
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
if (underlyingError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = underlyingError;
|
||||
}
|
||||
|
||||
if (result == errSecCSUnsigned) {
|
||||
NSString *message = @"The host app is signed, but the new version of the app is not signed using Apple Code Signing. Please ensure that the new app is signed and that archiving did not corrupt the signature.";
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
userInfo[NSLocalizedDescriptionKey] = message;
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
} else if (result == errSecCSReqFailed) {
|
||||
CFStringRef requirementString = nil;
|
||||
NSString *initialMessage;
|
||||
if (SecRequirementCopyString(requirement, kSecCSDefaultFlags, &requirementString) == noErr) {
|
||||
SULog(SULogLevelError, @"Code signature of the new version doesn't match the old version: %@. Please ensure that old and new app is signed using exactly the same certificate.", requirementString);
|
||||
initialMessage = [NSString stringWithFormat:@"Code signature of the new version doesn't match the old version: %@. Please ensure that old and new app is signed using exactly the same certificate.", requirementString];
|
||||
|
||||
SULog(SULogLevelError, @"%@", initialMessage);
|
||||
CFRelease(requirementString);
|
||||
} else {
|
||||
initialMessage = @"Code signature of new version doesn't match the old version. Please ensure that old and new app is signed using exactly the same certificate.";
|
||||
}
|
||||
|
||||
[self logSigningInfoForCode:oldCode label:@"old info"];
|
||||
[self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
NSDictionary *oldInfo = [self logSigningInfoForCode:oldCode label:@"old info"];
|
||||
NSDictionary *newInfo = [self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
|
||||
if (error != NULL) {
|
||||
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"%@ old info: %@. new info: %@", initialMessage, oldInfo, newInfo];
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
} else {
|
||||
if (error != NULL) {
|
||||
userInfo[NSLocalizedDescriptionKey] = @"Error: Old app bundle code signing signature failed to match new bundle code signature";
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,13 +131,15 @@ finally:
|
||||
OSStatus result;
|
||||
SecStaticCodeRef staticCode = NULL;
|
||||
CFErrorRef cfError = NULL;
|
||||
if (error) {
|
||||
*error = nil;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
|
||||
if (result != noErr) {
|
||||
SULog(SULogLevelError, @"Failed to get static code %d", result);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to get static code for verifying code signature: %d", result] }];
|
||||
}
|
||||
|
||||
goto finally;
|
||||
}
|
||||
|
||||
@@ -98,17 +147,47 @@ finally:
|
||||
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError);
|
||||
|
||||
if (cfError) {
|
||||
NSError *tmpError = CFBridgingRelease(cfError);
|
||||
if (error) *error = tmpError;
|
||||
}
|
||||
|
||||
if (result != noErr) {
|
||||
if (result == errSecCSUnsigned) {
|
||||
SULog(SULogLevelError, @"Error: The app is not signed using Apple Code Signing. %@", bundleURL);
|
||||
if (result != errSecSuccess) {
|
||||
NSError *underlyingError;
|
||||
if (cfError != NULL) {
|
||||
NSError *tmpError = CFBridgingRelease(cfError);
|
||||
underlyingError = tmpError;
|
||||
} else {
|
||||
underlyingError = nil;
|
||||
}
|
||||
if (result == errSecCSReqFailed) {
|
||||
[self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
if (underlyingError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = underlyingError;
|
||||
}
|
||||
|
||||
if (result == errSecCSUnsigned) {
|
||||
NSString *message = [NSString stringWithFormat:@"Error: The app is not signed using Apple Code Signing. %@", bundleURL];
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
userInfo[NSLocalizedDescriptionKey] = message;
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
} else if (result == errSecCSReqFailed) {
|
||||
if (error != NULL) {
|
||||
NSDictionary *newInfo = [self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
|
||||
NSString *message = [NSString stringWithFormat:@"Error: The app failed Apple Code Signing checks: %@ - new info: %@", bundleURL, newInfo];
|
||||
|
||||
userInfo[NSLocalizedDescriptionKey] = message;
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
} else {
|
||||
if (error != NULL) {
|
||||
NSString *message = [NSString stringWithFormat:@"Error: The app failed Apple Code Signing checks: %@", bundleURL];
|
||||
|
||||
userInfo[NSLocalizedDescriptionKey] = message;
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,9 +232,10 @@ finally:
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
|
||||
+ (NSDictionary *)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
|
||||
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
|
||||
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
|
||||
return relevantInfo;
|
||||
}
|
||||
|
||||
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -6,7 +6,7 @@
|
||||
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
|
||||
//
|
||||
|
||||
/*!
|
||||
/**
|
||||
# Sparkle Guided Installations
|
||||
|
||||
A guided installation allows Sparkle to download and install a package (pkg) or multi-package (mpkg) without user interaction.
|
||||
@@ -21,6 +21,6 @@ A guided installation can be started by applications other than the application
|
||||
|
||||
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
|
||||
|
||||
@end
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <sys/stat.h>
|
||||
#import "SUGuidedPackageInstaller.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -16,21 +16,24 @@
|
||||
@interface SUGuidedPackageInstaller ()
|
||||
|
||||
@property (nonatomic, readonly, copy) NSString *packagePath;
|
||||
@property (nonatomic, readonly, copy) NSString *installationPath;
|
||||
@property (nonatomic, readonly, copy) NSString *homeDirectory;
|
||||
@property (nonatomic, readonly, copy) NSString *userName;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUGuidedPackageInstaller
|
||||
|
||||
@synthesize packagePath = _packagePath;
|
||||
@synthesize installationPath = _installationPath;
|
||||
@synthesize homeDirectory = _homeDirectory;
|
||||
@synthesize userName = _userName;
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_packagePath = [packagePath copy];
|
||||
_installationPath = [installationPath copy];
|
||||
_homeDirectory = [homeDirectory copy];
|
||||
_userName = [userName copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -48,6 +51,8 @@
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = installerPath;
|
||||
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
|
||||
// Set the $HOME and $USER variables so pre/post install scripts reference the correct user environment
|
||||
task.environment = @{@"HOME": self.homeDirectory, @"USER": self.userName};
|
||||
task.standardError = [NSPipe pipe];
|
||||
task.standardOutput = [NSPipe pipe];
|
||||
|
||||
@@ -70,6 +75,10 @@
|
||||
return success;
|
||||
}
|
||||
|
||||
- (void)performCleanup
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return YES;
|
||||
|
||||
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUInstaller : NSObject
|
||||
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
|
||||
|
||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
#import "SPUInstallationType.h"
|
||||
#import "SUNormalization.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -111,7 +112,7 @@
|
||||
return newAppDownloadPath;
|
||||
}
|
||||
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
|
||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
BOOL isGuided = NO;
|
||||
@@ -134,7 +135,7 @@
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found guided package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeGuidedPackage] }];
|
||||
}
|
||||
} else {
|
||||
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
|
||||
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath homeDirectory:homeDirectory userName:userName];
|
||||
}
|
||||
} else if (isPackage) {
|
||||
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
@@ -142,7 +143,7 @@
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeInteractivePackage] }];
|
||||
}
|
||||
} else {
|
||||
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
|
||||
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
|
||||
}
|
||||
} else {
|
||||
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||
@@ -152,11 +153,12 @@
|
||||
} else {
|
||||
NSString *normalizedInstallationPath = nil;
|
||||
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
|
||||
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
|
||||
normalizedInstallationPath = SUNormalizedInstallationPath(host);
|
||||
}
|
||||
|
||||
// If we have a normalized path, we'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
|
||||
// Otherwise if there's no normalized path (the more likely case), we'll just use the host bundle's path
|
||||
// Check progress agent app which computes normalized path too according to these rules
|
||||
NSString *installationPath;
|
||||
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
|
||||
installationPath = normalizedInstallationPath;
|
||||
@@ -171,16 +173,4 @@
|
||||
return installer;
|
||||
}
|
||||
|
||||
+ (NSString *)normalizedInstallationPathForHost:(SUHost *)host
|
||||
{
|
||||
NSBundle *bundle = host.bundle;
|
||||
assert(bundle != nil);
|
||||
|
||||
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
|
||||
|
||||
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
|
||||
// rather than arbitrary Unicode form from Info.plist - #1017
|
||||
return [NSString stringWithUTF8String:[normalizedAppPath fileSystemRepresentation]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -22,14 +22,17 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Should be able to be called from non-main thread
|
||||
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
|
||||
|
||||
// Any clean up work can be done here
|
||||
// This is work that may be performed after the user application may have been updated / relaunched,
|
||||
// or after an error occurred in the previous stages.
|
||||
// Should be able to be called from any thread
|
||||
- (void)performCleanup;
|
||||
|
||||
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
|
||||
// If this returns NO, then the installation can fail if the user did not directly request for the install to occur.
|
||||
// Should be thread safe
|
||||
- (BOOL)canInstallSilently;
|
||||
|
||||
// The destination and installation path of the bundle being updated
|
||||
- (NSString *)installationPath;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -14,6 +14,6 @@
|
||||
|
||||
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath;
|
||||
|
||||
@end
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "SUPackageInstaller.h"
|
||||
#import "SUConstants.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
#import "SULog.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
@interface SUPackageInstaller ()
|
||||
|
||||
@property (nonatomic, readonly, copy) NSString *packagePath;
|
||||
@property (nonatomic, readonly, copy) NSString *installationPath;
|
||||
|
||||
@end
|
||||
|
||||
@@ -26,14 +25,12 @@
|
||||
static NSString *SUOpenUtilityPath = @"/usr/bin/open";
|
||||
|
||||
@synthesize packagePath = _packagePath;
|
||||
@synthesize installationPath = _installationPath;
|
||||
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
|
||||
- (instancetype)initWithPackagePath:(NSString *)packagePath
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_packagePath = [packagePath copy];
|
||||
_installationPath = [installationPath copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -73,6 +70,10 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)performCleanup
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return NO;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "SUPipedUnarchiver.h"
|
||||
#import "SUUnarchiverNotifier.h"
|
||||
#import "SULog.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -105,43 +105,49 @@
|
||||
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
|
||||
|
||||
NSPipe *pipe = [NSPipe pipe];
|
||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
[task setStandardInput:[pipe fileHandleForReading]];
|
||||
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
|
||||
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
|
||||
[task setLaunchPath:command];
|
||||
[task setArguments:[args arrayByAddingObject:destination]];
|
||||
[task launch];
|
||||
|
||||
NSUInteger bytesRead = 0;
|
||||
do {
|
||||
NSData *data = [archiveInput readDataOfLength:256*1024];
|
||||
NSUInteger len = [data length];
|
||||
if (!len) {
|
||||
break;
|
||||
}
|
||||
bytesRead += len;
|
||||
[archiveOutput writeData:data];
|
||||
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
|
||||
@try {
|
||||
[task launch];
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
|
||||
}
|
||||
while(bytesRead < expectedLength);
|
||||
|
||||
[archiveOutput closeFile];
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
if ([task terminationStatus] == 0) {
|
||||
if (bytesRead == expectedLength) {
|
||||
[notifier notifySuccess];
|
||||
return;
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
|
||||
|
||||
if (!error) {
|
||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||
NSUInteger bytesRead = 0;
|
||||
do {
|
||||
NSData *data = [archiveInput readDataOfLength:256*1024];
|
||||
NSUInteger len = [data length];
|
||||
if (!len) {
|
||||
break;
|
||||
}
|
||||
bytesRead += len;
|
||||
[archiveOutput writeData:data];
|
||||
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
|
||||
}
|
||||
while(bytesRead < expectedLength);
|
||||
|
||||
[archiveOutput closeFile];
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
if ([task terminationStatus] == 0) {
|
||||
if (bytesRead == expectedLength) {
|
||||
[notifier notifySuccess];
|
||||
return;
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
|
||||
|
||||
}
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
|
||||
}
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
|
||||
}
|
||||
} else {
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
|
||||
|
||||
/*!
|
||||
/**
|
||||
@param host The current (old) bundle host
|
||||
@param bundlePath The path to the new bundle that will be installed.
|
||||
@param installationPath The path the new bundlePath will be installed to.
|
||||
|
||||
+127
-78
@@ -11,8 +11,8 @@
|
||||
#import "SUConstants.h"
|
||||
#import "SUHost.h"
|
||||
#import "SULog.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
#import "SUErrors.h"
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUStandardVersionComparator.h"
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
@property (nonatomic, copy, readonly) NSString *bundlePath;
|
||||
@property (nonatomic, copy, readonly) NSString *installationPath;
|
||||
|
||||
@property (nonatomic) NSURL *temporaryOldDirectory;
|
||||
// We get an obj-c warning if we use 'newTemporaryDirectory' name about new + ownership stuff, so use 'temporaryNewDirectory' instead
|
||||
@property (nonatomic) NSURL *temporaryNewDirectory;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUPlainInstaller
|
||||
@@ -31,6 +35,8 @@
|
||||
@synthesize host = _host;
|
||||
@synthesize bundlePath = _bundlePath;
|
||||
@synthesize installationPath = _installationPath;
|
||||
@synthesize temporaryOldDirectory = _temporaryOldDirectory;
|
||||
@synthesize temporaryNewDirectory = _temporaryNewDirectory;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
|
||||
{
|
||||
@@ -81,7 +87,10 @@
|
||||
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
|
||||
// before being installed
|
||||
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:error]) {
|
||||
SULog(SULogLevelError, @"Failed to recursively update new application's modification time before moving into temporary directory");
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -91,9 +100,14 @@
|
||||
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
|
||||
|
||||
if (tempNewDirectoryURL == nil) {
|
||||
SULog(SULogLevelError, @"Failed to make new temp directory");
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to make new temporary directory" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
self.temporaryNewDirectory = tempNewDirectoryURL;
|
||||
|
||||
if (progress) {
|
||||
progress(2/10.0);
|
||||
@@ -103,8 +117,9 @@
|
||||
NSString *newURLLastPathComponent = newURL.lastPathComponent;
|
||||
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
|
||||
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:error]) {
|
||||
SULog(SULogLevelError, @"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path);
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -133,15 +148,22 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
// We must leave moving the app to its destination as the final step in installing it, so that
|
||||
// it's not possible our new app can be left in an incomplete state at the final destination
|
||||
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:error]) {
|
||||
// But this is big enough of a deal to fail
|
||||
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
return NO;
|
||||
// Try to preserve Finder Tags
|
||||
NSArray *resourceTags = nil;
|
||||
BOOL retrievedResourceTags = [oldURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
|
||||
if (retrievedResourceTags && resourceTags.count > 0) {
|
||||
[newTempURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
|
||||
}
|
||||
|
||||
// We must leave moving the app to its destination as the final step in installing it, so that
|
||||
// it's not possible our new app can be left in an incomplete state at the final destination
|
||||
|
||||
NSError *changeOwnerAndGroupError = nil;
|
||||
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:&changeOwnerAndGroupError]) {
|
||||
// Not a fatal error
|
||||
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
|
||||
SULog(SULogLevelError, @"Error: %@", changeOwnerAndGroupError);
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(5/10.0);
|
||||
@@ -157,61 +179,79 @@
|
||||
if (progress) {
|
||||
progress(6/10.0);
|
||||
}
|
||||
|
||||
// Decide on a destination name we should use for the older app when we move it around the file system
|
||||
NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
|
||||
NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent;
|
||||
|
||||
// Create a temporary directory for our old app that resides on its volume
|
||||
NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent;
|
||||
NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil;
|
||||
if (tempOldDirectoryURL == nil) {
|
||||
SULog(SULogLevelError, @"Failed to create temporary directory for old app at %@", oldURL.path);
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
return NO;
|
||||
|
||||
// First try replacing the application atomically
|
||||
NSError *replaceError = nil;
|
||||
BOOL replacedApp;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
// If the app is normalized and the installation path differs, go through the old swap path
|
||||
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && ![oldURL.path isEqual:installationURL.path]) {
|
||||
replacedApp = NO;
|
||||
} else {
|
||||
// Note: in my experience, a clone of the app may still be left at newTempURL
|
||||
// This is OK though because we will be cleaning up the temporary directory later in -performCleanup:
|
||||
replacedApp = [fileManager replaceItemAtURL:installationURL withItemAtURL:newTempURL error:&replaceError];
|
||||
}
|
||||
} else {
|
||||
replacedApp = NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(7/10.0);
|
||||
}
|
||||
|
||||
// Move the old app to the temporary directory
|
||||
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
|
||||
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
|
||||
SULog(SULogLevelError, @"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path);
|
||||
|
||||
if (!replacedApp) {
|
||||
// Otherwise swap out the old and new applications using the legacy path
|
||||
|
||||
// Just forget about our updated app on failure
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||
if (replaceError != nil) {
|
||||
SULog(SULogLevelDefault, @"Invoking fallback from failing to replace original item with error: %@", replaceError);
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
// Decide on a destination name we should use for the older app when we move it around the file system
|
||||
NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
|
||||
NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent;
|
||||
|
||||
if (progress) {
|
||||
progress(8/10.0);
|
||||
}
|
||||
|
||||
// Move the new app to its final destination
|
||||
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
|
||||
SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
|
||||
// Create a temporary directory for our old app that resides on its volume
|
||||
NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent;
|
||||
NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil;
|
||||
if (tempOldDirectoryURL == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create temporary directory for old app at %@", oldURL.path] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Forget about our updated app on failure
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
|
||||
// Attempt to restore our old app back the way it was on failure
|
||||
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
|
||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||
|
||||
return NO;
|
||||
}
|
||||
self.temporaryOldDirectory = tempOldDirectoryURL;
|
||||
|
||||
if (progress) {
|
||||
progress(9/10.0);
|
||||
}
|
||||
if (progress) {
|
||||
progress(7/10.0);
|
||||
}
|
||||
|
||||
// Move the old app to the temporary directory
|
||||
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
|
||||
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||
if (progress) {
|
||||
progress(8/10.0);
|
||||
}
|
||||
|
||||
// Move the new app to its final destination
|
||||
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path] }];
|
||||
}
|
||||
|
||||
// Attempt to restore our old app back the way it was on failure
|
||||
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(9/10.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
progress(10/10.0);
|
||||
@@ -222,28 +262,24 @@
|
||||
|
||||
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
|
||||
{
|
||||
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
|
||||
|
||||
// Prevent malicious downgrades
|
||||
// Note that we may not be able to do this for package installations, hence this code being done here
|
||||
if (!allowDowngrades) {
|
||||
NSString *hostVersion = [self.host version];
|
||||
NSString *hostVersion = [self.host version];
|
||||
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
|
||||
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
|
||||
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
|
||||
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
|
||||
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
|
||||
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
|
||||
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
|
||||
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
|
||||
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
|
||||
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
|
||||
if (error != NULL) {
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, updateVersion];
|
||||
|
||||
if (error != NULL) {
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, updateVersion];
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
@@ -256,6 +292,19 @@
|
||||
return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
|
||||
}
|
||||
|
||||
- (void)performCleanup
|
||||
{
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||
|
||||
if (self.temporaryNewDirectory != nil) {
|
||||
[fileManager removeItemAtURL:self.temporaryNewDirectory error:NULL];
|
||||
}
|
||||
|
||||
if (self.temporaryOldDirectory != nil) {
|
||||
[fileManager removeItemAtURL:self.temporaryOldDirectory error:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canInstallSilently
|
||||
{
|
||||
return YES;
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
@interface SUSignatureVerifier : NSObject
|
||||
|
||||
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys;
|
||||
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error;
|
||||
|
||||
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pkeys;
|
||||
|
||||
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures;
|
||||
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures error:(NSError * __autoreleasing *)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "SUSignatureVerifier.h"
|
||||
#import "SULog.h"
|
||||
#import "SUSignatures.h"
|
||||
#import "SUErrors.h"
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||
|
||||
@@ -30,22 +31,26 @@
|
||||
|
||||
@synthesize pubKeys = _pubKeys;
|
||||
|
||||
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys
|
||||
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
|
||||
|
||||
if (!verifier) {
|
||||
if (verifier == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to create SUSignatureVerifier instance" }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [verifier verifyFileAtPath:path signatures:signatures];
|
||||
return [verifier verifyFileAtPath:path signatures:signatures error:error];
|
||||
}
|
||||
|
||||
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pubkeys
|
||||
{
|
||||
self = [super init];
|
||||
_pubKeys = pubkeys;
|
||||
|
||||
if (self != nil) {
|
||||
_pubKeys = pubkeys;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -85,70 +90,178 @@
|
||||
return dsaPubKeySecKey;
|
||||
}
|
||||
|
||||
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures
|
||||
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
if (!path || !path.length) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"Path passed to verify has zero length and is not valid" }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!signatures) {
|
||||
SULog(SULogLevelDefault, @"No signatures given to verifyFileAtPath");
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"No signatures given to verifyFileAtPath" }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSData *dsaSignature = signatures.dsaSignature;
|
||||
NSString *dsaPubKey = self.pubKeys.dsaPubKey;
|
||||
|
||||
const unsigned char *edSignature = signatures.ed25519Signature;
|
||||
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
|
||||
|
||||
if (edPubKey && !edSignature) {
|
||||
SULog(SULogLevelDefault, @"There is no EdDSA signature in the update, but the app is capable of verifying them");
|
||||
} if (!edPubKey && edSignature) {
|
||||
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
|
||||
} else if (edPubKey && edSignature) {
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&error];
|
||||
if (!data || !data.length) {
|
||||
SULog(SULogLevelError, @"Failed to load file %@: %@", path, error);
|
||||
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) {
|
||||
NSString *message = @"The update has an EdDSA signature, but the app has an invalid EdDSA public key, so the update will automatically be rejected.";
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
|
||||
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
||||
if (!dsaPubKey) {
|
||||
return YES;
|
||||
SULog(SULogLevelDefault, @"The app has an invalid EdDSA public key, but there is no EdDSA signature in the update. Falling back to DSA.");
|
||||
break;
|
||||
case SUSigningInputStatusPresent:
|
||||
switch (signatures.ed25519SignatureStatus) {
|
||||
case SUSigningInputStatusAbsent: {
|
||||
NSString *message = @"The app has an EdDSA public key, but there is no EdDSA signature in the update, so the update will be rejected.";
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
case SUSigningInputStatusInvalid: {
|
||||
NSString *message = @"The update has an EdDSA signature, but it's invalid, so the update will automatically be rejected.";
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
case SUSigningInputStatusPresent: {
|
||||
NSError *dataError = nil;
|
||||
NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&dataError];
|
||||
if (!data || !data.length) {
|
||||
SULog(SULogLevelError, @"Failed to load file %@: %@", path, dataError);
|
||||
|
||||
if (error != NULL) {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"Failed to load file: %@", path];
|
||||
if (dataError != nil) {
|
||||
userInfo[NSUnderlyingErrorKey] = dataError;
|
||||
}
|
||||
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:[userInfo copy]];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
if (ed25519_verify(signatures.ed25519Signature, data.bytes, data.length, self.pubKeys.ed25519PubKey)) {
|
||||
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
||||
// No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's
|
||||
// erroneously invalid
|
||||
if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid) {
|
||||
return YES;
|
||||
}
|
||||
} else {
|
||||
SULog(SULogLevelDefault, @"This app has a DSA public key, so a DSA signature is required too");
|
||||
NSString *message = @"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.";
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
|
||||
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
|
||||
}
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
} else {
|
||||
SULog(SULogLevelError, @"EdDSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
|
||||
if (dsaSignature) {
|
||||
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
|
||||
}
|
||||
}
|
||||
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.
|
||||
NSString *message = @"The update has a DSA signature, but the app has an invalid DSA public key, so the update will automatically be rejected.";
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
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: {
|
||||
NSString *message = @"The update has a DSA signature, but it's invalid, so the update will automatically be rejected.";
|
||||
|
||||
SULog(SULogLevelError, @"%@", message);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
case SUSigningInputStatusPresent: {
|
||||
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
|
||||
return [self verifyDSASignatureOfStream:dataInputStream dsaSignature:signatures.dsaSignature error:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dsaSignature) {
|
||||
SULog(SULogLevelError, @"There is no DSA signature in the update");
|
||||
} else if (!dsaPubKey) {
|
||||
SULog(SULogLevelDefault, @"The update has a DSA signature, but it can't be used, because the old app doesn't have a DSA public key");
|
||||
} else {
|
||||
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
|
||||
return [self verifyDSASignatureOfStream:dataInputStream dsaSignature:dsaSignature];
|
||||
if (error != NULL) {
|
||||
// Use generic failure
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"EdDSA and DSA verification for the update has failed" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature
|
||||
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature error:(NSError * __autoreleasing *)outError
|
||||
{
|
||||
if (!stream || !dsaSignature) {
|
||||
SULog(SULogLevelError, @"Invalid arguments to verifyStream");
|
||||
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"Invalid arguments to verifyStream" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
SecKeyRef dsaPubKeySecKey = [self dsaSecKeyRef];
|
||||
if (!dsaPubKeySecKey) {
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to create DSA Sec Key Ref" }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -170,12 +283,18 @@
|
||||
|
||||
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
|
||||
if (!dataReadTransform) {
|
||||
SULog(SULogLevelError, @"File containing update archive could not be read (failed to create SecTransform for input stream)");
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"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) {
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"File containing update archive could not be read (failed to create SecDigest for input stream)" }];
|
||||
}
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
@@ -183,31 +302,54 @@
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
|
||||
#pragma clang diagnostic pop
|
||||
if (!dataVerifyTransform || error) {
|
||||
if (!dataVerifyTransform) {
|
||||
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
|
||||
if (outError != NULL) {
|
||||
NSError *underlyingError = (__bridge NSError *)error;
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"Could not understand format of the signature data %@", dsaSignature];
|
||||
if (underlyingError != NULL) {
|
||||
userInfo[NSUnderlyingErrorKey] = underlyingError;
|
||||
}
|
||||
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:[userInfo copy]];
|
||||
}
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
|
||||
if (error) {
|
||||
SULog(SULogLevelError, @"%@", error);
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data read transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||
}
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
|
||||
if (error) {
|
||||
SULog(SULogLevelError, @"%@", error);
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data digest transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||
}
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
|
||||
if (error) {
|
||||
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"DSA signature verification failed", NSUnderlyingErrorKey: (__bridge NSError *)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.");
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "SUUnarchiverNotifier.h"
|
||||
#import "SULocalizations.h"
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SUErrors.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -31,6 +31,8 @@
|
||||
if (self != nil) {
|
||||
_completionBlock = [completionBlock copy];
|
||||
_progressBlock = [progressBlock copy];
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+5
-3
@@ -9,13 +9,15 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
@autoreleasepool
|
||||
{
|
||||
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
|
||||
if (args.count != 2) {
|
||||
if (args.count != 4) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
NSString *hostBundleIdentifier = args[1];
|
||||
NSString *homeDirectory = args[2];
|
||||
NSString *userName = args[3];
|
||||
|
||||
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
|
||||
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier homeDirectory:homeDirectory userName:userName];
|
||||
[appInstaller start];
|
||||
|
||||
// Ignore SIGTERM because we are going to catch it ourselves
|
||||
@@ -23,7 +25,7 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
|
||||
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
|
||||
dispatch_source_set_event_handler(sigtermSource, ^{
|
||||
[appInstaller cleanupAndExitWithStatus:SIGTERM];
|
||||
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
|
||||
});
|
||||
dispatch_resume(sigtermSource);
|
||||
|
||||
|
||||
@@ -1,3 +1,183 @@
|
||||
# 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 (#1802) (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)
|
||||
* `-bestValidUpdateInAppcast:forUpdater:` delegate method behavior has been refined and discouraged for some cases. Please review its updated header documentation in `SPUUpdaterDelegate.h` if you use this method. (#1838, #1862, #1879, #1880) (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 (Zorg)
|
||||
* 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)
|
||||
* We now recommend using sparkle:version and sparkle:shortVersionString top level elements instead of enclosure attributes (#1878) (Zorg)
|
||||
* The link element in an appcast item is now used for directing users to the product's website if they don't meet minimum system requirements (#1877) (Zorg)
|
||||
* Major/Paid Upgrades Enhancements
|
||||
* Latest minor updates are preferred over major updates (specified by sparkle:minimumAutoupdateVersion) (#1850) Zorg
|
||||
* Major updates can be skipped with a user confirmation (#1853) Zorg
|
||||
* Informational only and critical updates can be specified selectively by app version (#1862)
|
||||
* Expose why a new update is unavailable and direct user to prior release notes or website info (#1877, #1886) (Zorg)
|
||||
* Add support for posting updates only on specific channels (#1879) (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)
|
||||
* Don't bring up authorization just because group ID doesn't match (#1830) (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.
|
||||
|
||||
If you are migrating from earlier alpha versions of Sparkle 2, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with code signing has been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
|
||||
|
||||
# 1.26.0
|
||||
|
||||
* Flat package support from #1745 (Zorg)
|
||||
* Correct generate_appcast -s command line argument usage help (Lance Lovette)
|
||||
* Fix -f command line argument handling (Lance Lovette)
|
||||
* Fix progress for guided pkg install (Zorg)
|
||||
* Fix XQuartz update failing because NSLog caused issues (Zorg)
|
||||
* Update localization (Vojtěch Koňařík)
|
||||
* Various fixes to SPM logic (Jonas Zaugg)
|
||||
|
||||
# 1.25.0
|
||||
|
||||
* Raise minimum system version to 10.9 (Kornel)
|
||||
* Allow an appcast to prevent the new version from being installed automatically (#1688) (pierswalter)
|
||||
* UI fixes
|
||||
* Show check for updates button only when automatic updates are enabled (Lorena Rangel)
|
||||
* Don't initialize the webview if we don't show release notes (Tobias Fonfara)
|
||||
* Keep skip button available if there is a minimum autoupdate version (Zorg)
|
||||
* Fix automatic updates checkbox state when not showing release notes (Zorg)
|
||||
* Fix edge cases with hiding alert buttons and using "Install Later" (Zorg)
|
||||
* Re-add setting WebUIDelegate fix for legacy web view (Zorg)
|
||||
* Adopt WKWebView for 1.x (Zorg)
|
||||
* Add auto layout constraints to SUAutomaticUpdateAlert window (Zorg)
|
||||
* Made buttons wide enough to display the full text. Made window wide enough to display the widened buttons (el, fi, ru, uk) (Piers Uso Walter)
|
||||
* Remove max size from update alert. (George Nachman)
|
||||
* Integrate generate_keys export/import options changes from #1730 (Zorg)
|
||||
* Add `—release-notes-url-prefix` support to localized release notes (Adam Tharani)
|
||||
* Translations
|
||||
* Enable base internalization for alert xibs (Zorg)
|
||||
* Capitalizes french translation of "Vous utilisez actuellement..." ("You are currently running...") (Micah Moore)
|
||||
* Fix and cleanup Hebrew, Catalan, Finnish localizations (Zorg)
|
||||
* Remove non-english localizations from TestApplication (Zorg)
|
||||
* Fix catch-22 Swift Package Manager binary target (Jonas Zaugg)
|
||||
* Add explicit dependencies to fix Xcode linking errors (Kornel)
|
||||
* Add phased rollouts feature to automatic update driver too (Zorg)
|
||||
* Remove hiding skip button and retitling later button (Zorg)
|
||||
* Deprecate installUpdatesIfAvailable (Zorg)
|
||||
* Apply custom headers to app download (Geraint White)
|
||||
|
||||
# 1.24.0
|
||||
|
||||
* Prioritize UserDefaults when fetching value for EnableAutomaticChecks (Nicolas Bosi)
|
||||
* Improve best appcast item selection handling (Ian Bytchek)
|
||||
* Create lockfile for improved compatibility with 3rd party updaters (CoreCode)
|
||||
* Enable SPM support via binary target (Jonas Zaugg)
|
||||
* `generate_appcast` improvements:
|
||||
* follow symbolic links (Denis Dzyubenko)
|
||||
* update the release notes element’s URL when required (Brad Andalman)
|
||||
* Added output filename option to generate_appcast (Brad Andalman)
|
||||
* Added —release-notes-url-prefix to generate_appcast (Brad Andalman)
|
||||
* Command line option to provide a download url prefix is now parsed and set on each archive item (Dominik H)
|
||||
* Added help command line option (Dominik H)
|
||||
* Locale updates:
|
||||
* Update zh_CN localization (柳东原 · Dongyuan Liu)
|
||||
* Update Sparkle.strings (Vojtěch Koňařík)
|
||||
* Update Croatian (#1603) (milotype)
|
||||
* Update SUUpdateAlert.xib (DanielFirlej)
|
||||
* fix: read SUAutomaticallyUpdate from Info.plist (Trevor DeVore)
|
||||
* Fix casting Boolean to BOOL on Apple Silicon (Kevin Wojniak)
|
||||
* Use build matrix to test on multiple Xcode versions (Rajiv Shah)
|
||||
* Set UpdateAlert and AutomaticUpdateAlert window's fullscreen collectionBehavior to NSWindowCollectionBehaviorFullScreenAuxiliary to allow them to present on top of the Main App's window if it's fullscreen. (Micah Moore)
|
||||
* Fixed error about "about:blank" release notes (Louis Pontoise)
|
||||
* Support App Store URL scheme in release note webview (Bi11)
|
||||
* Use the SHA-256 hash of the archive as the cache path (Nate Weaver)
|
||||
* Don't return an optional from the FileHandle method (Nate Weaver)
|
||||
* Added URL+Hashing (Nate Weaver)
|
||||
|
||||
# 1.23.0
|
||||
|
||||
* Support generating appcast with localizations (#1499) (Alik Vovkotrub)
|
||||
* Support versions with git commit SHA (#1504) (Alec Larson)
|
||||
* Hide "Skip..." and "Remind..." buttons when they're not relevant (#1480) (Kenneth Johnsen)
|
||||
* Preserve Finder tags while updating apps (#1512) (CoreCode)
|
||||
* Read-only update alert dialog formatting improvements (#1515) (Quinn Taylor)
|
||||
* Check if `SUBundleName` is set before normalizing (Jake Fenton)
|
||||
* `NSInteger` cast warning on Xcode 11 (Marga Keuvelaar)
|
||||
* Correct appcast file extension (Tom Vos)
|
||||
* Update Sparkle.strings (Emir Sarı)
|
||||
* Fix spelling (#1508) (Frank Chiarulli Jr)
|
||||
|
||||
# 1.22.0
|
||||
|
||||
* Enabled "Hardened Runtime" build option for Apple's notarization requirement
|
||||
* Add delegate methods to suppress update alerts (George Nachman)
|
||||
* Improved error when running from translocated location (Michael Buckley)
|
||||
* Add phased rollout feature (#1381) (Fabian Jäger)
|
||||
* Ignore non-standard permissions in delta updates instead of failing the build (Kornel Lesiński)
|
||||
* Notify user when installed version is newer than the latest in the appcast (CoreCode)
|
||||
* Reset timers after computer sleep (CoreCode)
|
||||
* Block-based alternatives to `NSInvocation`-based delegate methods (Fabian Jäger)
|
||||
* Add delegate `userDidSkipThisVersion` (BobZombie, Leo Natan, bono yusuke)
|
||||
* Pass item to updaterShouldShowUpdateAlertForScheduledUpdate delegate method (George Nachman)
|
||||
* Support providing private key as argument in `generate_appcast` (Yakuhzi, marchyang)
|
||||
* Separate the ed25519 sources into a new static library (Tony Arnold)
|
||||
* Disambiguate signing error messages (Nate Weaver)
|
||||
* Use `XMLNode.Options.nodePrettyPrint` in `generate_appcast` instead of trying to add whitespace manually (fumoboy007)
|
||||
* Annotate SUHost for nullability (Michael Buckley)
|
||||
* Use SUAVAILABLE macro (Christiaan Hofman)
|
||||
* Fix warnings when using modules (nivekkagicom)
|
||||
* Correction of Czech localization inconsistency (#1403) (vojtakonarik)
|
||||
* BR locale fix (BR Lingo)
|
||||
* Update Japanese localization (fujisoft)
|
||||
* French Sparkle.strings (Jean-Baptiste)
|
||||
|
||||
# 1.21.3
|
||||
|
||||
* Losslessly reduced the size of PNG (Barijaona Ramaholimihaso)
|
||||
* Catch exceptions from subcommands (Julian Mayer)
|
||||
* `generate_appcast` can sign any bundles instead of just apps (Nate Weaver)
|
||||
* Check that effectiveAppearance is being observed before calling removeObserver (Pierluigi)
|
||||
|
||||
# 1.21.2
|
||||
|
||||
* Allow EdDSA for delta updates, too (Kornel)
|
||||
* Warning fixes (Brian Bergstrand)
|
||||
* Improvements to release notes view context menu and dark mode (Bi11)
|
||||
|
||||
# 1.21.0
|
||||
|
||||
* Added support EdDSA (ed25519) signatures (Kornel)
|
||||
* DSA signatures are considered outdated, and Apple's `Security.framework` only supports weaker SHA-1-based DSA.
|
||||
* Both old DSA and new EdDSA are still supported (and one app can use both), but new applications should use EdDSA only, and we recommend migrating away from DSA signatures.
|
||||
* `generate_keys` is now a Swift tool that stores EdDSA private keys in the Keychain
|
||||
* Existing apps can continue using their old DSA keys, but we've dropped support for generation of old DSA keys
|
||||
* `sign_update` is now a Swift tool that signs using EdDSA from private keys in the Keychain
|
||||
* The old DSA-based signing script has been moved to `bin/old_dsa_scripts`
|
||||
* The old DSA-based signing script has been fixed to work on pre-10.13 systems (Thomas Tempelmann)
|
||||
* `generate_appcast` has been updated to support EdDSA signatures
|
||||
* It can sign both DSA (if `dsa_priv.pem` file is specified) and EdDSA (from Keychain)
|
||||
* The tool now uses Caches directory and doesn't generate unnecessary delta files
|
||||
* Fixed verification of delta updates on filesystems that change permissions of symlinks
|
||||
* Fixed `NSURLSession` leak (Michael Ehrmann)
|
||||
|
||||
# 1.20.0
|
||||
|
||||
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
#include "ConfigSwift.xcconfig"
|
||||
|
||||
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TOOL=1
|
||||
@@ -4,30 +4,35 @@ SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
|
||||
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
|
||||
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
|
||||
|
||||
// Sparkle usually doesn't allow downgrades as they're usually accidental, but
|
||||
// if your app has a downgrade function or URL handler, turn this on
|
||||
SPARKLE_AUTOMATED_DOWNGRADES = 0
|
||||
// Set to 0 to only build all non-UI bits
|
||||
SPARKLE_BUILD_UI_BITS = 1
|
||||
|
||||
// If your app file on disk is named "MyApp 1.1b4", Sparkle usually updates it
|
||||
// in place, giving you an app named 1.1b4 that is actually 1.2. Turn the
|
||||
// following on to always reset the name back to "MyApp":
|
||||
// following on to always reset the name back to "MyApp"
|
||||
// If you are using this option to change the name of your app, you should
|
||||
// disable the option again when you no longer need it
|
||||
// Note this option is only supported for regular application updates and not plug-ins
|
||||
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
||||
|
||||
SPARKLE_ICON_NAME = AppIcon
|
||||
|
||||
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
||||
SPARKLE_VERSION_MAJOR = 2
|
||||
SPARKLE_VERSION_MINOR = 0
|
||||
SPARKLE_VERSION_PATCH = 0
|
||||
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||
|
||||
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
SPARKLE_VERSION_SUFFIX = -beta.2
|
||||
CURRENT_PROJECT_VERSION = 2002
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
||||
ARCHS = $(ARCHS_STANDARD)
|
||||
// NSURLSession requirements
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
PRODUCT_NAME = ${TARGET_NAME}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@@ -37,15 +42,18 @@ INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
|
||||
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
|
||||
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
|
||||
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
SDKROOT = macosx
|
||||
ENABLE_HARDENED_RUNTIME = YES
|
||||
CLANG_ENABLE_OBJC_ARC = YES
|
||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
COMBINE_HIDPI_IMAGES = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES
|
||||
COMBINE_HIDPI_IMAGES = NO
|
||||
|
||||
// Enable warnings
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
|
||||
@@ -88,11 +96,8 @@ GCC_WARN_UNUSED_LABEL = YES
|
||||
GCC_WARN_UNUSED_PARAMETER = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
|
||||
// Fixes a strange issue where the compiler thinks references to some enums are ambiguous
|
||||
CLANG_ENABLE_MODULES[sdk=macosx10.8] = NO
|
||||
|
||||
// These should be removed once the conversion to ARC is complete
|
||||
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
|
||||
|
||||
// Turn on all warnings, then disable a few which are almost impossible to avoid
|
||||
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments $(WARNING_CFLAGS_EXTRA)
|
||||
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso $(WARNING_CFLAGS_EXTRA)
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
|
||||
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
|
||||
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
// Debug only
|
||||
|
||||
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
|
||||
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
// Release only
|
||||
|
||||
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 0
|
||||
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
@@ -13,7 +11,8 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=0
|
||||
DEAD_CODE_STRIPPING = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||
COPY_PHASE_STRIP = NO
|
||||
@@ -5,3 +5,4 @@ WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
|
||||
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
|
||||
@@ -1,4 +1,2 @@
|
||||
// Downloader Debug
|
||||
#include "ConfigDownloader.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -1,5 +1,3 @@
|
||||
// InstallerConnection Debug
|
||||
|
||||
#include "ConfigInstallerConnection.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -1,4 +1,2 @@
|
||||
// Installer Launcher Debug
|
||||
#include "ConfigInstallerLauncher.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
|
||||
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0
|
||||
SKIP_INSTALL = YES
|
||||
CLANG_ENABLE_MODULES = NO
|
||||
@@ -1,5 +1,3 @@
|
||||
// InstallerStatus Debug
|
||||
|
||||
#include "ConfigInstallerStatus.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -4,3 +4,4 @@ INFOPLIST_FILE = sparkle-cli/Info.plist
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.sparkle-cli
|
||||
PRODUCT_NAME = sparkle
|
||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks/
|
||||
ENABLE_HARDENED_RUNTIME = NO
|
||||
@@ -1,2 +1,2 @@
|
||||
SWIFT_VERSION = 4.0
|
||||
SWIFT_VERSION = 5
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
@@ -1 +1,2 @@
|
||||
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
|
||||
SWIFT_OPTIMIZATION_LEVEL = -O
|
||||
SWIFT_COMPILATION_MODE = wholemodule
|
||||
@@ -6,4 +6,4 @@ ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME)
|
||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
|
||||
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
ENABLE_HARDENED_RUNTIME = NO
|
||||
@@ -1,4 +1,2 @@
|
||||
// Test Application Debug
|
||||
#include "ConfigTestApp.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -4,3 +4,4 @@ INFOPLIST_FILE = TestAppHelper/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
|
||||
ENABLE_HARDENED_RUNTIME = NO
|
||||
@@ -1,4 +1,2 @@
|
||||
// Test Application Helper Debug
|
||||
#include "ConfigTestAppHelper.xcconfig"
|
||||
|
||||
CODE_SIGN_IDENTITY = -
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -12,3 +12,6 @@ ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
|
||||
WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversion
|
||||
|
||||
// Disable dead stores analyzer warning
|
||||
CLANG_ANALYZER_DEADCODE_DEADSTORES = NO
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os, sys
|
||||
|
||||
# Ignore the first version line starting with # x.y.z..
|
||||
# and print everything until the second version line starting with # x.y.z..
|
||||
|
||||
hit_first_changelog_note = False
|
||||
with open("CHANGELOG", "r") as changelog_file:
|
||||
for line in changelog_file:
|
||||
if line.startswith("#"):
|
||||
if hit_first_changelog_note:
|
||||
# We are done with printing changes
|
||||
break
|
||||
else:
|
||||
# We haven't hit an important changelog line yet, so continue
|
||||
continue
|
||||
|
||||
if not hit_first_changelog_note and len(line.strip()) == 0:
|
||||
continue
|
||||
|
||||
hit_first_changelog_note = True
|
||||
sys.stdout.write(line)
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Create symlinks to our helper tools in Sparkle and SparkleCore framework bundles
|
||||
# so URLForAuxiliaryExecutable: will pick up the tools. Doing this is supported in the Code Signing in Depth guide.
|
||||
|
||||
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
|
||||
|
||||
ln -h -f -s "Versions/Current/""${SPARKLE_RELAUNCH_TOOL_NAME}" "${FRAMEWORK_PATH}"/"${SPARKLE_RELAUNCH_TOOL_NAME}"
|
||||
ln -h -f -s "Versions/Current/""${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app "${FRAMEWORK_PATH}"/"${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app
|
||||
@@ -1,28 +1,54 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$ACTION" = "" ] ; then
|
||||
# If using cocoapods, sanity check that the Podspec version matches the Sparkle version
|
||||
if [ -x "$(command -v pod)" ]; then
|
||||
spec_version=$(printf "require 'cocoapods'\nspec = %s\nprint spec.version" "$(cat "$SRCROOT/Sparkle.podspec")" | LANG=en_US.UTF-8 ruby)
|
||||
if [ "$spec_version" != "$CURRENT_PROJECT_VERSION" ] ; then
|
||||
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Tests the code signing validity of the extracted products within the provided path.
|
||||
# This guards against our archives being corrupt / created incorrectly.
|
||||
function verify_code_signatures() {
|
||||
verification_directory="$1"
|
||||
|
||||
if [[ -z "$verification_directory" ]]; then
|
||||
echo "Provided verification directory does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Search the current directory for all instances of the framework to verify them (XCFrameworks can have multiple copies of a framework for different platforms).
|
||||
find "${verification_directory}" -name "Sparkle.framework" -type d -exec codesign --verify -vvv --deep {} \;
|
||||
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.Downloader.xpc"
|
||||
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerConnection.xpc"
|
||||
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerLauncher.xpc"
|
||||
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerStatus.xpc"
|
||||
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
|
||||
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
|
||||
codesign --verify -vvv --deep "${verification_directory}/bin/BinaryDelta"
|
||||
codesign --verify -vvv --deep "${verification_directory}/bin/generate_appcast"
|
||||
codesign --verify -vvv --deep "${verification_directory}/bin/sign_update"
|
||||
codesign --verify -vvv --deep "${verification_directory}/bin/generate_keys"
|
||||
}
|
||||
|
||||
if [ "$ACTION" = "" ] ; then
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2"
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
rm -f "Sparkle-$MARKETING_VERSION.tar.xz"
|
||||
rm -f "Sparkle-$MARKETING_VERSION.tar.bz2"
|
||||
rm -f "Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL.markdown" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp "$CONFIGURATION_BUILD_DIR/generate_appcast" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp "$SRCROOT/Configurations/codesign_xpc_service.py" "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
|
||||
chmod 0755 "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
|
||||
@@ -32,25 +58,118 @@ if [ "$ACTION" = "" ] ; then
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
|
||||
cp "$SRCROOT/Downloader/$DOWNLOADER_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
cp "$SRCROOT/InstallerConnection/$INSTALLER_CONNECTION_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
cp "$SRCROOT/InstallerStatus/$INSTALLER_STATUS_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
|
||||
# Only copy dSYMs for Release builds, but don't check for the presence of the actual files
|
||||
# because missing dSYMs in a release build SHOULD trigger a build failure
|
||||
if [ "$CONFIGURATION" = "Release" ] ; then
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||
fi
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/XPCServices" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
|
||||
cd "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
if [ -x "$(command -v xz)" ]; then
|
||||
XZ_EXISTS=1
|
||||
else
|
||||
XZ_EXISTS=0
|
||||
fi
|
||||
|
||||
rm -rf "/tmp/sparkle-extract"
|
||||
mkdir -p "/tmp/sparkle-extract"
|
||||
|
||||
# Sorted file list groups similar files together, which improves tar compression
|
||||
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
|
||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
||||
find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$MARKETING_VERSION.tar.xz"
|
||||
|
||||
# Copy archived distribution for CI
|
||||
cp -f "../Sparkle-$MARKETING_VERSION.tar.xz" "../sparkle-dist.tar.xz"
|
||||
|
||||
# Extract archive for testing binary validity
|
||||
tar -xf "../Sparkle-$MARKETING_VERSION.tar.xz" -C "/tmp/sparkle-extract"
|
||||
else
|
||||
# Fallback to bz2 compression if xz utility is not available
|
||||
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$MARKETING_VERSION.tar.bz2" --files-from=-
|
||||
|
||||
# Extract archive for testing binary validity
|
||||
tar -xf "../Sparkle-$MARKETING_VERSION.tar.bz2" -C "/tmp/sparkle-extract"
|
||||
fi
|
||||
|
||||
# Test code signing validity of the extracted products
|
||||
# This guards against our archives being corrupt / created incorrectly
|
||||
verify_code_signatures "/tmp/sparkle-extract"
|
||||
|
||||
rm -rf "/tmp/sparkle-extract"
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
# Generate zip containing the xcframework for SPM
|
||||
rm -rf "/tmp/sparkle-spm-extract"
|
||||
mkdir -p "/tmp/sparkle-spm-extract"
|
||||
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
# rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
|
||||
ditto -c -k --zlibCompressionLevel 9 --rsrc . "../Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
# Test code signing validity of the extracted Swift package
|
||||
# This guards against our archives being corrupt / created incorrectly
|
||||
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
|
||||
verify_code_signatures "/tmp/sparkle-spm-extract"
|
||||
|
||||
rm -rf "/tmp/sparkle-spm-extract"
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
|
||||
# Get latest git tag
|
||||
cd "$SRCROOT"
|
||||
latest_git_tag=$(git describe --tags --abbrev=0)
|
||||
|
||||
# Check semantic versioning
|
||||
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
||||
echo "Tag $latest_git_tag follows semantic versioning"
|
||||
else
|
||||
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate new Package manifest and podspec
|
||||
cd "$CONFIGURATION_BUILD_DIR"
|
||||
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
|
||||
cp "$SRCROOT/Sparkle.podspec" "$CONFIGURATION_BUILD_DIR"
|
||||
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
|
||||
# is equivalent to shasum -a 256 FILE
|
||||
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
|
||||
rm -rf ".build"
|
||||
sed -E -i '' -e "/let tag/ s/\".+\"/\"$latest_git_tag\"/" -e "/let version/ s/\".+\"/\"$MARKETING_VERSION\"/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
|
||||
cp "Package.swift" "$SRCROOT"
|
||||
echo "Package.swift updated with the following values:"
|
||||
echo "Version: $MARKETING_VERSION"
|
||||
echo "Tag: $latest_git_tag"
|
||||
echo "Checksum: $spm_checksum"
|
||||
|
||||
sed -E -i '' -e "/s\.version.+=/ s/\".+\"/\"$MARKETING_VERSION\"/" "Sparkle.podspec"
|
||||
cp "Sparkle.podspec" "$SRCROOT"
|
||||
echo "Sparkle.podspec updated with following values:"
|
||||
echo "Version: $MARKETING_VERSION"
|
||||
else
|
||||
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
|
||||
fi
|
||||
|
||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
||||
echo "WARNING: xz compression is used for official releases but bz2 is being used instead because xz tool is not installed on your system."
|
||||
fi
|
||||
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||
fi
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
|
||||
latest_git_tag=$(git describe --tags --abbrev=0) # gets the latest tag name
|
||||
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
|
||||
|
||||
function move_tag() {
|
||||
long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message
|
||||
long_message=${long_message/$latest_git_tag} # trims tag name
|
||||
long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace
|
||||
git add Package.swift Sparkle.podspec
|
||||
git commit -m "Update Package.swift and Sparkle.podspec for version ${latest_git_tag}"
|
||||
git tag -fa $latest_git_tag -m "${long_message}"
|
||||
echo "Package.swift and Sparkle.podspec committed and tag '$latest_git_tag' moved."
|
||||
}
|
||||
|
||||
if [ "$commits_since_tag" -gt 0 ]; then
|
||||
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
|
||||
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
|
||||
echo "Package.swift has not been committed and tag has not been moved."
|
||||
elif [ "$CI" == true ]; then
|
||||
move_tag
|
||||
else
|
||||
# TODO: add sanity check to see if version is actually being updated or not?
|
||||
read -p "Do you want to commit changes to Package.swift and Sparkle.podspec, and force move tag '$latest_git_tag'? (required for official release) [Y/n]" -n 1 -r
|
||||
echo # (optional) move to a new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
move_tag
|
||||
else
|
||||
echo "Package.swift and Sparkle.podspec have not been committed and tag has not been moved."
|
||||
fi
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
AGENT_PATH="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/MacOS/"${SPARKLE_INSTALLER_PROGRESS_TOOL_NAME}".app
|
||||
|
||||
#Only sign the agent app if we have code signing enabled (as we do with adhoc signatures in Debug builds for testing sandboxing)
|
||||
if [ ! -z "${CODE_SIGN_IDENTITY}" ] ; then
|
||||
codesign --verbose -f -s "${CODE_SIGN_IDENTITY}" "${AGENT_PATH}"
|
||||
fi
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment
|
||||
INFOPLIST="${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
|
||||
case "${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}" in
|
||||
"YES"|"1")
|
||||
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${INFOPLIST}"
|
||||
;;
|
||||
"NO"|"0")
|
||||
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO" "${INFOPLIST}"
|
||||
;;
|
||||
esac
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# We should make sure ATS is off for the test app
|
||||
|
||||
DOWNLOADER_INFO_PLIST="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/XPCServices/"${DOWNLOADER_BUNDLE_ID}".xpc/Contents/Info.plist
|
||||
|
||||
#Only alter bundles if code signing is off, else we'll invalidate the signature on them
|
||||
#If code signing is enabled (as in debug mode), then we rely on another script for turning ATS exceptions on for these services
|
||||
#In release mode however, those services do not have ATS exceptions set up which is why we have to set up exceptions *here*
|
||||
if [ -z "${CODE_SIGN_IDENTITY}" ] ; then
|
||||
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${DOWNLOADER_INFO_PLIST}"
|
||||
fi
|
||||
@@ -8,12 +8,12 @@ fi
|
||||
if [ -z "$SRCROOT" ] || \
|
||||
[ -z "$BUILT_PRODUCTS_DIR" ] || \
|
||||
[ -z "$INFOPLIST_PATH" ] || \
|
||||
[ -z "$CURRENT_PROJECT_VERSION" ]; then
|
||||
[ -z "$MARKETING_VERSION" ]; then
|
||||
echo "$0: Must be run from Xcode!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="$CURRENT_PROJECT_VERSION"
|
||||
version="$MARKETING_VERSION"
|
||||
|
||||
# Get version in format 1.x.x-commits-hash
|
||||
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
|
||||
@@ -22,10 +22,10 @@ if [ -z "$gitversion" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove everything before the first "-" to keep the hash part only
|
||||
versionsuffix=${gitversion#*-};
|
||||
# remove everything before the second last "-" to keep the hash part only
|
||||
versionsuffix=$( echo "${gitversion}" | sed -E 's/.+((-[^.]+){2})$/\1/' )
|
||||
if [ "$versionsuffix" != "$gitversion" ]; then
|
||||
version="$version $versionsuffix"
|
||||
version="$version$versionsuffix"
|
||||
fi
|
||||
|
||||
# and use it to set the CFBundleShortVersionString value
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Sparkle 2 API Reference
|
||||
|
||||
These are the primary classes and protocols in Sparkle 2 you may be interested in:
|
||||
|
||||
- `SPUStandardUpdaterController` for creating a standard updater (encapsulates a `SPUUpdater` and `SPUStandardUserDriver`)
|
||||
- `SPUUpdater` for invoking update checks and retrieving updater properties.
|
||||
- `SPUUpdaterDelegate` for delegation methods to control the behavior of `SPUUpdater`.
|
||||
- `SPUUserDriver` for making custom user interfaces.
|
||||
|
||||
If you are migrating from Sparkle 1, please refer to `SPUStandardUpdaterController` and `SPUUpdater`.
|
||||
|
||||
Please also visit the [Basic Setup](https://sparkle-project.org/documentation/) guide which shows how to instantiate an updater in a nib or how to create one programmatically.
|
||||
@@ -1,20 +0,0 @@
|
||||
PROJECT_NAME = Sparkle
|
||||
PROJECT_NUMBER = 1.14.0
|
||||
PROJECT_BRIEF = "A software update framework for macOS"
|
||||
PROJECT_LOGO = Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png
|
||||
|
||||
RECURSIVE = YES
|
||||
INPUT = Sparkle
|
||||
OUTPUT_DIRECTORY = Documentation
|
||||
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
QT_AUTOBRIEF = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
@@ -13,9 +13,9 @@
|
||||
### Launching the Installer
|
||||
SPUCoreBasedUpdateDriver invokes SPUInstallerDriver's extraction method which invokes SUInstallerLauncher's launch installer method. The launcher can be inside a XPC service or running inside the updater/sparkle framework itself. The launcher XPC bundle includes a copy of the installer and agent application in its bundle so it can compute the path to them itself (instead of relying on the updater to pass the paths), which is for security trust reasons.
|
||||
|
||||
First, the launcher makes sure that if the updater delegate doesn't allow interaction, that installation can be done without interaction. If it can't, then the launcher fails. If the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
|
||||
First, if the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
|
||||
|
||||
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path, and then its resources path. If the launcher is running inside a XPC service, the tools will be in the auxiliary path location, which allows the developer using the service to also code sign the tools. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative depedencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative dependencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
|
||||
The installer is first submitted. If it requires root privileges, it will ask for an admin user name and password. How it determines if root privileges are necessary is based on:
|
||||
|
||||
@@ -27,7 +27,7 @@ The installer makes sure, after extraction, that the expected installation type
|
||||
|
||||
If the user cancels submitting the installer on authorization (if it's required), the launcher aborts the installation process silently. If everything does alright, the progress agent application is submitted next. If either of the submissions fail, the installation fails and aborts, otherwise the launcher succeeds and its job is done. Note before the submissions are done, the jobs are removed from launchd, and the jobs are submitted in a way that act as "one-time" jobs. If they fail or succeed, the jobs aren't restarted, and the jobs aren't installed in a system location for launchd to attempt launching again.
|
||||
|
||||
The only argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
|
||||
The most important argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Mostly everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
|
||||
|
||||
### Timeouts
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@ This fork puts a huge emphasis on splitting Sparkle into several components to a
|
||||
* Progress Agent (Application; AppKit permitted)
|
||||
* Installer (Agent and Daemon safe)
|
||||
|
||||
These achieve privilege separation, because at least theoretically, they can all be placed into different processes from one another.
|
||||
These achieve privilege separation, because at least theoretically, they can all be placed into different processes from one another, although in practice the user driver and updater framework will likely be in the same process.
|
||||
|
||||
In practice, the user driver and updater framework will likely be in the same process, but leaving this possibility speaks well for the quality of the architecture. This is why for instance all the methods on the user driver are not assumed to be executed on the main thread, if one decided to use NSXPC to drive them.
|
||||
|
||||
For XPC Services, it's significant to understand that their purpose is not only for sandboxing. The services can be used regardless of whether an application is sandboxed or not. Besides privilege separation, they also have an impact on fault tolerance and termination.
|
||||
For XPC Services, it's significant to understand they can be used independent of sandboxing (although I wouldn't recommend this personally). Besides privilege separation, they also have an impact on fault tolerance and termination.
|
||||
|
||||
XPC Services also act inside an application bundle namespace, which is one of many reasons why they aren't bundled inside the framework. We have code that detects whether or not services are available inside the main bundle. This is simpler and more efficient than attempting to create a connection and wait for a timeout. We don't have *any* checks for seeing if the "current process" is sandboxed; doing so is a rather broken behavior. The XPC Services are important, not the sandboxing.
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$ACTION" = "" ] ; then
|
||||
if which -s doxygen ; then
|
||||
doxygen Documentation/Doxyfile
|
||||
else
|
||||
echo "warning: Doxygen not found in PATH"
|
||||
echo "open Terminal and type this command `brew install doxygen` then click `enter/return` key. finally build this target again"
|
||||
fi
|
||||
elif [ "$ACTION" = "clean" ] ; then
|
||||
rm -rf "$SRCROOT/Documentation/html"
|
||||
fi
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
+50
-12
@@ -10,8 +10,9 @@
|
||||
#import "SPUDownloaderDelegate.h"
|
||||
#import "SPULocalCacheDirectory.h"
|
||||
#import "SPUURLRequest.h"
|
||||
#import <Sparkle/SPUDownloadData.h>
|
||||
#import <Sparkle/SUErrors.h>
|
||||
#import "SPUDownloadData.h"
|
||||
#import "SPUDownloadDataPrivate.h"
|
||||
#import "SUErrors.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -111,12 +112,29 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cancelDownload
|
||||
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier
|
||||
{
|
||||
[self cleanup];
|
||||
return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
|
||||
}
|
||||
|
||||
- (void)cleanup
|
||||
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier
|
||||
{
|
||||
// Only take the directory name and compute most of the base path ourselves
|
||||
// This way we do not have to send/trust an absolute path
|
||||
// The downloader instance that creates this temp directory isn't necessarily the same as the one
|
||||
// that clears it (eg upon skipping an already downloaded update), so we can't just preserve it here too
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
|
||||
if (rootPersistentDownloadCachePath != nil) {
|
||||
NSString *sanitizedDirectoryName = directoryName.lastPathComponent;
|
||||
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDirectoryName];
|
||||
|
||||
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)_cleanup
|
||||
{
|
||||
[self enableAutomaticTermination];
|
||||
[self.download cancel];
|
||||
@@ -132,6 +150,15 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cleanup:(void (^)(void))completionHandler
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self _cleanup];
|
||||
|
||||
completionHandler();
|
||||
});
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didFinishDownloadingToURL:(NSURL *)location
|
||||
{
|
||||
if (self.mode == SPUDownloadModeTemporary)
|
||||
@@ -142,8 +169,8 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
else
|
||||
{
|
||||
// Remove our old caches path so we don't start accumulating files in there
|
||||
NSString *rootPersistentDownloadCachePath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:self.bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
|
||||
|
||||
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:self.bundleIdentifier];
|
||||
|
||||
[SPULocalCacheDirectory removeOldItemsInDirectory:rootPersistentDownloadCachePath];
|
||||
|
||||
NSString *tempDir = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootPersistentDownloadCachePath];
|
||||
@@ -208,7 +235,17 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
if (data != nil) {
|
||||
NSURLResponse *response = self.download.response;
|
||||
assert(response != nil);
|
||||
downloadData = [[SPUDownloadData alloc] initWithData:data textEncodingName:response.textEncodingName MIMEType:response.MIMEType];
|
||||
|
||||
NSURL *responseURL = response.URL;
|
||||
if (responseURL == nil) {
|
||||
responseURL = self.download.currentRequest.URL;
|
||||
}
|
||||
if (responseURL == nil) {
|
||||
responseURL = self.download.originalRequest.URL;
|
||||
}
|
||||
assert(responseURL != nil);
|
||||
|
||||
downloadData = [[SPUDownloadData alloc] initWithData:data URL:responseURL textEncodingName:response.textEncodingName MIMEType:response.MIMEType];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,20 +258,21 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
} else {
|
||||
[self.delegate downloaderDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read temporary downloaded data from %@", self.downloadFilename]}]];
|
||||
}
|
||||
|
||||
[self _cleanup];
|
||||
break;
|
||||
case SPUDownloadModePersistent:
|
||||
[self.delegate downloaderDidFinishWithTemporaryDownloadData:nil];
|
||||
break;
|
||||
}
|
||||
|
||||
[self cleanup];
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error
|
||||
{
|
||||
self.download = nil;
|
||||
[self.delegate downloaderDidFailWithError:error];
|
||||
[self cleanup];
|
||||
if (error != nil) {
|
||||
[self.delegate downloaderDidFailWithError:error];
|
||||
}
|
||||
}
|
||||
|
||||
// NSURLDownload has a [downlaod:shouldDecodeSourceDataOfMIMEType:] to determine if the data should be decoded.
|
||||
|
||||
@@ -19,8 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request;
|
||||
|
||||
// Cancels any ongoing download
|
||||
- (void)cancelDownload;
|
||||
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier;
|
||||
|
||||
- (void)cleanup:(void (^)(void))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
For integration and usage, please visit Sparkle's Documentation:
|
||||
https://sparkle-project.org/documentation/
|
||||
|
||||
For integrating XPC Services in a Sandboxed Application, please visit:
|
||||
https://sparkle-project.org/documentation/sandboxing/
|
||||
@@ -1,59 +0,0 @@
|
||||
# Building
|
||||
|
||||
If release products have not already been built, they can be built by:
|
||||
|
||||
```
|
||||
cd <path-to>/Sparkle/
|
||||
|
||||
make release
|
||||
```
|
||||
|
||||
Upon success, a Finder window will open revealing an archive containing the newly-built Sparkle binaries. Expand the archive (e.g., to the Desktop).
|
||||
|
||||
Alternatively, you can build the "Distribution" scheme from within the Xcode project.
|
||||
|
||||
Debug builds of Sparkle can also be built from Xcode. Note that debug builds change Sparkle's default behavior to ease development. Never use a debug build of Sparkle for distribution.
|
||||
|
||||
# Installing
|
||||
|
||||
To install Sparkle, drag Sparkle.framework into your project as you would any other framework. Make sure you have a build phase to copy the framework into your application's Frameworks directory at build time.
|
||||
|
||||
# XPC Services and Embedded Applications
|
||||
|
||||
If your application is sandboxed, you will need to embed one or more of Sparkle's XPC services into your application. These are used to perform privileged operations that your sandboxed app, and the rest of the Sparkle framework, are not authorized to perform. Even if you are not strictly required to use a particular XPC service, there may still be some merit to separating privileges.
|
||||
|
||||
* `SparkleInstallerLauncher`, `SparkleInstallerConnection`, and `SparkleInstallerStatus`: These are required for most sandboxed apps, and are used by Sparkle to perform the privileged operations of upgrading your app, relaunching it, and reporting progress to the app as it proceeds.
|
||||
|
||||
* `SparkleDownloader`: This is required only if your sandboxed app does not already possess the "com.apple.security.network.client" entitlement, allowing it to make outgoing HTTP(S) connections. If you do decide to include the Downloader service and your app does not pass Apple's App Transport Security requirements, then you may have to add exceptions inside the downloader service's Info.plist.
|
||||
|
||||
Note: If your sandboxed app does not have the networking entitlement mentioned above, then linked release notes cannot contain external references (e.g.: images or external style sheets), because loading them will be prevented by the sandbox.
|
||||
|
||||
Apps that are not sandboxed may still want to embed the services if they need to code sign the services with their own signatures. The copies of these services within the built Sparkle framework will have the same signature as the framework.
|
||||
|
||||
If you want to code sign Sparkle's installer tools (Autoupdate and Updater.app), then you should include the SparkleInstallerLauncher XPC service even if your app is not sandboxed. Note that Sparkle keeps a copy of these tools inside the framework, because using the XPC services is optional, and they need to be inside the XPC service for security reasons. If you wish, you can remove them from the framework if you use the InstallerLauncher service.
|
||||
|
||||
If you code sign your application, these XPC services also need to be signed by you with the attached entitlements. Included is a script to automate this.
|
||||
|
||||
Here is an example of invoking the script with a Developer ID identity (replace `XXX` appropriately):
|
||||
|
||||
```
|
||||
./bin/codesign_embedded_executable "Developer ID Application: XXX" XPCServices/*.xpc
|
||||
|
||||
./bin/codesign_embedded_executable "Developer ID Application: XXX" ./Sparkle.framework/Versions/A/Resources/Autoupdate
|
||||
|
||||
./bin/codesign_embedded_executable "Developer ID Application: XXX" ./Sparkle.framework/Versions/A/Resources/Updater.app/
|
||||
```
|
||||
|
||||
After signing the executables, add them to the appropriate copy phases and link settings in the app target. Check the "Code Sign on Copy" option for the FW phase (it's not offered for the XPC copy phase).
|
||||
|
||||
Note that the `codesign_embedded_executable` script uses the hardened runtime option, so your app can be notarized ([required](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution?language=objc) for macOS 10.14.5 and higher).
|
||||
|
||||
# Testing
|
||||
|
||||
If you're not using the sandboxed version, you can just lower the `CURRENT_PROJECT_VERSION` in your app target below the latest version in your appcast, build & run from Xcode, and hit the Check for Updates… UI element.
|
||||
|
||||
For the sandboxed version, testing with a debug build running from Xcode doesn't work—the "Extracting Update" phase either hangs or fails. You'll have to do an Archive build and export a Developer ID-signed or notarized app.
|
||||
|
||||
# Known Issues
|
||||
|
||||
Search the [issues database](https://github.com/sparkle-project/Sparkle/issues) for bugs specific to the `ui-separation-and-xpc` branch.
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//
|
||||
|
||||
#import "SUInstallerConnection.h"
|
||||
#import "SPUSystemAuthorization.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -61,9 +60,9 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
|
||||
[self enableAutomaticTermination];
|
||||
}
|
||||
|
||||
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType
|
||||
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
|
||||
{
|
||||
NSXPCConnectionOptions options = SPUNeedsSystemAuthorizationAccess(hostPath, installationType) ? NSXPCConnectionPrivileged : 0;
|
||||
NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : 0;
|
||||
NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options];
|
||||
|
||||
connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
|
||||
|
||||
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler;
|
||||
|
||||
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType;
|
||||
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType
|
||||
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
|
||||
{
|
||||
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath installationType:installationType];
|
||||
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName systemDomain:systemDomain];
|
||||
}
|
||||
|
||||
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spki</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// SUInstallerLauncher+Private.h
|
||||
// SUInstallerLauncher+Private
|
||||
//
|
||||
// Created by Mayur Pawashe on 8/21/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUInstallerLauncher_Private_h
|
||||
#define SUInstallerLauncher_Private_h
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
// Chances are clients will need this too
|
||||
#import <Sparkle/SPUInstallationType.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
/**
|
||||
Private API for determining if the system needs authorization access to update a bundle path
|
||||
|
||||
This API is not supported when used directly from a Sandboxed applications and will always return @c YES in that case.
|
||||
|
||||
@param bundlePath The bundle path to test if authorization is needed when performing an update that replaces this bundle.
|
||||
@return @c YES if Sparkle thinks authorization is needed to update the @p bundlePath, otherwise @c NO.
|
||||
*/
|
||||
SU_EXPORT BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath);
|
||||
|
||||
#endif /* SUInstallerLauncher_Private_h */
|
||||
@@ -7,17 +7,17 @@
|
||||
//
|
||||
|
||||
#import "SUInstallerLauncher.h"
|
||||
#import "SUInstallerLauncher+Private.h"
|
||||
#import "SUFileManager.h"
|
||||
#import "SULog.h"
|
||||
#import "SPUMessageTypes.h"
|
||||
#import "SPUSystemAuthorization.h"
|
||||
#import "SUBundleIcon.h"
|
||||
#import "SPULocalCacheDirectory.h"
|
||||
#import "SPUInstallationType.h"
|
||||
#import "SUHost.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import <ServiceManagement/ServiceManagement.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@implementation SUInstallerLauncher
|
||||
@@ -57,7 +57,10 @@
|
||||
// We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid
|
||||
// using it because the headers indicate it may be removed one day without any replacement
|
||||
CFErrorRef removeError = NULL;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) {
|
||||
#pragma clang diagnostic pop
|
||||
if (removeError != NULL) {
|
||||
// It's normal for a job to not be found, so this is not an interesting error
|
||||
if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) {
|
||||
@@ -78,7 +81,12 @@
|
||||
jobDictionary[@"MachServices"] = @{SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES};
|
||||
|
||||
CFErrorRef submitError = NULL;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// SMJobSubmit is deprecated but is the only way to submit a non-permanent
|
||||
// helper and allows us to submit to user domain without requiring authorization
|
||||
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
|
||||
#pragma clang diagnostic pop
|
||||
if (!submittedJob) {
|
||||
if (submitError != NULL) {
|
||||
SULog(SULogLevelError, @"Submit progress error: %@", submitError);
|
||||
@@ -92,7 +100,7 @@
|
||||
return (submittedJob == true);
|
||||
}
|
||||
|
||||
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain
|
||||
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain
|
||||
{
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||
|
||||
@@ -102,11 +110,19 @@
|
||||
NSString *hostBundleIdentifier = hostBundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
NSString *homeDirectory = NSHomeDirectory();
|
||||
assert(homeDirectory != nil);
|
||||
|
||||
NSString *userName = NSUserName();
|
||||
assert(userName != nil);
|
||||
|
||||
// The first argument has to be the path to the program, and the second is a host identifier so that the installer knows what mach services to host
|
||||
// The third and forth arguments are for home directory and user name which only pkg installer scripts may need
|
||||
// We intentionally do not pass any more arguments. Anything else should be done via IPC.
|
||||
// This is compatible to SMJobBless() which does not allow arguments
|
||||
// Even though we aren't using that function for now, it'd be wise to not decrease compatibility to it
|
||||
NSArray<NSString *> *arguments = @[installerPath, hostBundleIdentifier];
|
||||
|
||||
NSArray<NSString *> *arguments = @[installerPath, hostBundleIdentifier, homeDirectory, userName];
|
||||
|
||||
AuthorizationRef auth = NULL;
|
||||
OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);
|
||||
@@ -122,8 +138,19 @@
|
||||
// https://developer.apple.com/library/mac/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110-CH1-SECTION7
|
||||
// We can set a custom right name for authenticating as an administrator
|
||||
// Using this right rather than using something like kSMRightModifySystemDaemons allows us to present a better worded prompt
|
||||
// Note the right name is cached, so if we want to change the authorization
|
||||
// prompt, we may need to change the right name. I have found no good way around this :|
|
||||
NSString *sparkleAuthTag = @"sparkle2-auth"; // this needs to change if auth wording changes
|
||||
NSString *rightNameString;
|
||||
if ([hostBundleIdentifier isEqualToString:updaterIdentifier]) {
|
||||
// Application bundle is likely updating itself
|
||||
rightNameString = [NSString stringWithFormat:@"%@.%@", hostBundleIdentifier, sparkleAuthTag];
|
||||
} else {
|
||||
// Updater is likely updating a bundle that is not itself
|
||||
rightNameString = [NSString stringWithFormat:@"%@.%@.%@", updaterIdentifier, hostBundleIdentifier, sparkleAuthTag];
|
||||
}
|
||||
|
||||
const char *rightName = [[NSString stringWithFormat:@"%@.sparkle-auth", hostBundleIdentifier] UTF8String];
|
||||
const char *rightName = rightNameString.UTF8String;
|
||||
assert(rightName != NULL);
|
||||
|
||||
OSStatus getRightResult = AuthorizationRightGet(rightName, NULL);
|
||||
@@ -229,7 +256,10 @@
|
||||
// We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid
|
||||
// using it because the headers indicate it may be removed one day without any replacement
|
||||
CFErrorRef removeError = NULL;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) {
|
||||
#pragma clang diagnostic pop
|
||||
if (removeError != NULL) {
|
||||
// It's normal for a job to not be found, so this is not an interesting error
|
||||
if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) {
|
||||
@@ -242,7 +272,12 @@
|
||||
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
|
||||
|
||||
CFErrorRef submitError = NULL;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// SMJobSubmit is deprecated but is the only way to submit a non-permanent
|
||||
// helper and allows us to submit to user domain without requiring authorization
|
||||
submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError);
|
||||
#pragma clang diagnostic pop
|
||||
if (!submittedJob) {
|
||||
if (submitError != NULL) {
|
||||
SULog(SULogLevelError, @"Submit error: %@", submitError);
|
||||
@@ -266,44 +301,90 @@
|
||||
return status;
|
||||
}
|
||||
|
||||
// First we check if the tool is in an auxiliary directory. If that fails, we then check if it is in a resources directory
|
||||
- (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension inBundle:(NSBundle *)bundle
|
||||
{
|
||||
NSString *resultPath = nil;
|
||||
// If the path extension is empty, we don't want to add a "." at the end
|
||||
NSString *pathWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
|
||||
assert(pathWithExtension != nil);
|
||||
NSString *auxiliaryPath = [bundle pathForAuxiliaryExecutable:pathWithExtension];
|
||||
if (auxiliaryPath == nil || ![[NSFileManager defaultManager] fileExistsAtPath:auxiliaryPath]) {
|
||||
resultPath = [bundle pathForResource:toolName ofType:extension];
|
||||
} else {
|
||||
resultPath = auxiliaryPath;
|
||||
}
|
||||
return resultPath;
|
||||
NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
|
||||
assert(nameWithExtension != nil);
|
||||
|
||||
NSURL *auxiliaryToolURL = [bundle URLForAuxiliaryExecutable:nameWithExtension];
|
||||
assert(auxiliaryToolURL != nil);
|
||||
|
||||
NSURL *resolvedAuxiliaryToolURL = [auxiliaryToolURL URLByResolvingSymlinksInPath];
|
||||
assert(resolvedAuxiliaryToolURL != nil);
|
||||
|
||||
return resolvedAuxiliaryToolURL.path;
|
||||
}
|
||||
|
||||
BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL hasWritability = [fileManager isWritableFileAtPath:bundlePath] && [fileManager isWritableFileAtPath:[bundlePath stringByDeletingLastPathComponent]];
|
||||
|
||||
BOOL needsAuthorization;
|
||||
if (!hasWritability) {
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
// Just because we have writability access does not mean we can set the correct owner/group
|
||||
// Test if we can set the owner/group on a temporarily created file
|
||||
// If we can, then we can probably perform an update without authorization
|
||||
|
||||
NSString *tempFilename = @"permission_test" ;
|
||||
|
||||
SUFileManager *suFileManager = [[SUFileManager alloc] init];
|
||||
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
|
||||
|
||||
if (tempDirectoryURL == nil) {
|
||||
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
|
||||
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
|
||||
// Obvious indicator we may need authorization
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:bundlePath] error:NULL];
|
||||
}
|
||||
|
||||
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installationType)
|
||||
{
|
||||
BOOL needsAuthorization;
|
||||
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
needsAuthorization = YES;
|
||||
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
needsAuthorization = NO;
|
||||
} else {
|
||||
needsAuthorization = SPUSystemNeedsAuthorizationAccessForBundlePath(path);
|
||||
}
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
|
||||
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus))completionHandler
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
BOOL needsSystemAuthorization = SPUSystemNeedsAuthorizationAccess(hostBundlePath, installationType);
|
||||
|
||||
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
|
||||
BOOL needsSystemAuthorization = SPUNeedsSystemAuthorizationAccess(hostBundlePath, installationType);
|
||||
|
||||
if (needsSystemAuthorization && !allowingUpdaterInteraction) {
|
||||
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher.");
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!allowingUpdaterInteraction && [installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher for performing an interactive type package installation.");
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
if (hostBundle == nil) {
|
||||
SULog(SULogLevelError, @"InstallerLauncher failed to create bundle at %@", hostBundlePath);
|
||||
SULog(SULogLevelError, @"Please make sure InstallerLauncher is not sandboxed and do not sign your app by passing --deep. Check: codesign -d --entitlements :- \"%@\"", NSBundle.mainBundle.bundlePath);
|
||||
SULog(SULogLevelError, @"More information regarding sandboxing: https://sparkle-project.org/documentation/sandboxing/");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
// if we need to use the system domain and we aren't allowed interaction, then try sometime later when interaction is allowed
|
||||
if (needsSystemAuthorization && !allowingDriverInteraction) {
|
||||
completionHandler(SUInstallerLauncherAuthorizeLater);
|
||||
completionHandler(SUInstallerLauncherAuthorizeLater, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -318,7 +399,7 @@
|
||||
NSString *installerPath = [self pathForBundledTool:@""SPARKLE_RELAUNCH_TOOL_NAME extension:@"" inBundle:ourBundle];
|
||||
if (installerPath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Cannot submit installer because the installer could not be located");
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -327,7 +408,7 @@
|
||||
|
||||
if (progressToolResourcePath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Cannot submit progress tool because the progress tool could not be located");
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,7 +424,7 @@
|
||||
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath];
|
||||
if (launcherCachePath == nil) {
|
||||
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,11 +434,11 @@
|
||||
// SUFileManager is more reliable for copying files around
|
||||
if (![[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:©Error]) {
|
||||
SULog(SULogLevelError, @"Failed to copy progress tool to cache: %@", copyError);
|
||||
completionHandler(SUInstallerLauncherFailure);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle authorizationPrompt:authorizationPrompt inSystemDomain:needsSystemAuthorization];
|
||||
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier authorizationPrompt:authorizationPrompt inSystemDomain:needsSystemAuthorization];
|
||||
|
||||
BOOL submittedProgressTool = NO;
|
||||
if (installerStatus == SUInstallerLauncherSuccess) {
|
||||
@@ -368,20 +449,15 @@
|
||||
}
|
||||
} else if (installerStatus == SUInstallerLauncherFailure) {
|
||||
SULog(SULogLevelError, @"Failed to submit installer job");
|
||||
SULog(SULogLevelError, @"If your application is sandboxed please follow steps at: https://sparkle-project.org/documentation/sandboxing/");
|
||||
}
|
||||
|
||||
if (installerStatus == SUInstallerLauncherCanceled) {
|
||||
completionHandler(installerStatus);
|
||||
completionHandler(installerStatus, needsSystemAuthorization);
|
||||
} else {
|
||||
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure);
|
||||
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL))reply
|
||||
{
|
||||
// No need to execute on main queue
|
||||
reply(SPUNeedsSystemAuthorizationAccess(hostBundlePath, SPUInstallationTypeApplication));
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
@protocol SUInstallerLauncherProtocol
|
||||
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus))completionHandler;
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL requiresAuthorization))reply;
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
|
||||
|
||||
@end
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//
|
||||
|
||||
#import "SUInstallerStatus.h"
|
||||
#import "SPUSystemAuthorization.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spks</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -14,32 +14,22 @@ localizable-strings:
|
||||
|
||||
release:
|
||||
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build
|
||||
open -R "$(BUILDDIR)/Build/Products/Release/Sparkle-"*.tar.bz2
|
||||
./Configurations/release-move-tag.sh
|
||||
open "$(BUILDDIR)/Build/Products/Release/"
|
||||
cat Sparkle.podspec
|
||||
@echo "Don't forget to update CocoaPods! pod trunk push"
|
||||
@echo "Don't forget to upload Sparkle-for-Swift-Package-Manager.zip!"
|
||||
|
||||
build:
|
||||
xcodebuild clean build
|
||||
|
||||
test:
|
||||
xcodebuild -scheme Distribution -configuration Debug test
|
||||
./objc_dep/objc_dep.py -t .
|
||||
|
||||
# Need to first gem install jazzy to run this rule
|
||||
docs:
|
||||
jazzy --objc --umbrella-header Sparkle/Sparkle.h --framework-root . --readme Documentation/API_README.markdown --theme jony --output Documentation/html
|
||||
|
||||
uitest:
|
||||
xcodebuild -scheme UITests -configuration Debug test
|
||||
|
||||
ci:
|
||||
for i in {7..9} ; do \
|
||||
if xcrun --sdk "macosx10.$$i" --show-sdk-path 2> /dev/null ; then \
|
||||
( rm -rf build && xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Coverage -derivedDataPath build ) || exit 1 ; \
|
||||
fi ; \
|
||||
done
|
||||
for i in {10..12} ; do \
|
||||
if xcrun --sdk "macosx10.$$i" --show-sdk-path 2> /dev/null ; then \
|
||||
( rm -rf build && xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Coverage -derivedDataPath build test ) || exit 1 ; \
|
||||
fi ; \
|
||||
done
|
||||
|
||||
check-localizations:
|
||||
./Sparkle/CheckLocalizations.swift -root . -htmlPath "$(TMPDIR)/LocalizationsReport.htm"
|
||||
open "$(TMPDIR)/LocalizationsReport.htm"
|
||||
@@ -0,0 +1,26 @@
|
||||
// swift-tools-version:5.3
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0-beta.2"
|
||||
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
||||
let tag = "2.0.0-beta.2"
|
||||
let checksum = "0df58f522a002b6a2d0c02fd2a2828e6c7e1ca387680023e2dffa633c7a3ff61"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
name: "Sparkle",
|
||||
platforms: [.macOS(.v10_11)],
|
||||
products: [
|
||||
.library(
|
||||
name: "Sparkle",
|
||||
targets: ["Sparkle"])
|
||||
],
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "Sparkle",
|
||||
url: url,
|
||||
checksum: checksum
|
||||
)
|
||||
]
|
||||
)
|
||||
+41
-68
@@ -1,89 +1,64 @@
|
||||
# Sparkle 2.x (Beta)
|
||||
# Sparkle 2 (Beta)  <a href="https://www.stackpath.com/?utm_source=sparkle-github&utm_medium=badge&utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-StackPath-orange.svg" alt="sponsored by: StackPath"></a>
|
||||
|
||||
Secure and reliable software update framework for Cocoa developers.
|
||||
|
||||
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
|
||||
|
||||
This is the upcoming new version of Sparkle, based on the `ui-separation-and-xpc` branch.
|
||||
Major new features are support for sandboxing, custom user interfaces, updating other bundles, and a modern secure architecture.
|
||||
This is the upcoming new version of Sparkle.
|
||||
Major new features are support for sandboxing, custom user interfaces, updating external bundles, and a more modern secure architecture which includes faster and more reliable installs.
|
||||
|
||||
Sparkle 2.x is currently in beta. Some people already use it in production, but some work is still required before it can be released:
|
||||
For the production ready version of Sparkle, please see the [Sparkle 1.x (master) branch](https://github.com/sparkle-project/Sparkle/tree/master). Note development has shifted to Sparkle 2 and the 1.x branch is now only accepting bug fixes, localization updates, and adoption of critical upcoming OS features.
|
||||
|
||||
1. Documentation for the website needs to be written (see [https://github.com/sparkle-project/sparkle-project.github.io](sparkle-project.github.io))
|
||||
2. Changes from the master branch need to be merged
|
||||
3. Bugs and issues have to be fixed
|
||||
Sparkle 2 is currently in beta. Applications, typically sandboxed, have already been using it in production, but some work including testing is still required before an official version can be released. In the meantime, a nightly build can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact. The current status of Sparkle 2 is tracked in issue [#1523](https://github.com/sparkle-project/Sparkle/issues/1523).
|
||||
|
||||
The current status of Sparkle 2.x is tracked in issue [#1523](https://github.com/sparkle-project/Sparkle/issues/1523).
|
||||
If you can help with testing or reviewing over the new changes, please report issues or submit pull requests!
|
||||
|
||||
If you can help with any of the above, please submit pull requests!
|
||||
New issues should be [reported here](https://github.com/sparkle-project/Sparkle/issues). Internal design documents can be found in [Documentation](Documentation/).
|
||||
|
||||
New issues that are found should be [reported here](https://github.com/sparkle-project/Sparkle/issues). Internal design documents can be found in [Documentation](Documentation/). Discussion of this fork can be found in [this issue](https://github.com/sparkle-project/Sparkle/issues/363).
|
||||
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes.
|
||||
|
||||
# Features
|
||||
## Features
|
||||
|
||||
## Sandboxing
|
||||
|
||||
This fork includes several XPC services that are generally optional to include in your application, but are required for sandboxed applications. See the [INSTALL](INSTALL.markdown) file for more detail.
|
||||
|
||||
When sandboxed, linked release notes are allowed. External references inside the linked release notes are only allowed if the host application has an incoming network entitlement. Lastly, updates can still be extracted from DMG files just as they are in the official branch.
|
||||
|
||||
## Custom User Interfaces
|
||||
|
||||
<img src="Resources/Screenshot2.png" width="350" alt="Sparkle shows a custom update window with release notes">
|
||||
|
||||
See the `SPUUserDriver` protocol and classes that implement it for how to write your own user interface. This enables extensibility of Sparkle without altering or extending internal classes.
|
||||
|
||||
Hold shift when launching the `Sparkle Test App` to try out the experimental user interface shown above (note: this custom interface requires running macOS 10.10 or later).
|
||||
|
||||
## Command Line Tool
|
||||
|
||||
<img src="Resources/Screenshot3.png" width="400" alt="Sparkle shows command line interface to installing updates">
|
||||
|
||||
The `sparkle` command line tool can be used to update any Sparkle supported bundle. `sparkle` is a great demonstration of updating other bundles, though that aspect is not limited to just this tool!
|
||||
|
||||
This utility may also be an ideal choice for plug-ins where loading a copy of Sparkle's framework into a host's application may lead to conflicts or have undesirable consequences.
|
||||
|
||||
## Modern Security
|
||||
|
||||
Not only is sandboxing supported, but launchd is now used for submitting the installer. XPC is used to communicate to the launchd job. Uses of `AuthorizationExecuteWithPrivileges`, which is neither secure or reliable, have been removed. Installation on standard user accounts has been tested heavily rather than being treated as an edge case.
|
||||
|
||||
Extraction, validation, and installation of the update are all handled by the installer. The XPC services and the installer job don't implicitly trust the other end of the connection. Signing downloads with a DSA signature is now encouraged more aggressively.
|
||||
|
||||
Usage of AppKit has been minimized greatly. No linkage of it is found in the installer daemon. All code core to Sparkle's functionality prevents it from being imported. Only user driver classes and a progress agent may use AppKit for showing UI. A `SparkleCore.framework` target has been created that just uses the core.
|
||||
|
||||
## API Compatibility
|
||||
|
||||
Despite decoupling update scheduling, UI, installation, and minimizing AppKit usage, a great deal of effort was made to maintain ABI compatibility with older versions of Sparkle. A deprecated `SUUpdater` shim exists for maintaining runtime compatibility. Please check out `SPUStandardUpdaterController` and `SPUUpdater` instead for modern replacements.
|
||||
|
||||
Interactive package based installations have been deprecated in favor for guided package installations. As a consequence, interactive installations now have to be opted into (eg: `foo.sparkle_interactive.pkg`). A `sparkle:installationType="package"` or `sparkle:installationType="interactive-package"` tag is also now required in the appcast enclosure item for package based installs.
|
||||
|
||||
No attempt is made to preserve compatibility with regards to subclassing Sparkle's internal classes. Doing this is not supported or maintainable anymore. Much of this desire will go away with the extensibility provided by the user driver API.
|
||||
|
||||
New Sparkle classes are now prefixed with `SPU` rather than `SU`. Older classes still use the `SU` prefix to maintain compatibility.
|
||||
|
||||
## Misc. Changes
|
||||
|
||||
* Updates are more instant to install once extracted. The "installing update" dialog seldomly shows up after the old application quits.
|
||||
* The installer will attempt installing the update after extraction is finished, even if the user quits the process and doesn't relaunch the application explicitly.
|
||||
* Updates can be downloaded in the background automatically (if enabled) and be resumed by the user later, even if the user has insufficent permission to install them initially.
|
||||
* Authentication now occurs before launching the installer and before terminating the application, which can be canceled by the user cleanly.
|
||||
* Sudden termination for silent updates isn't disabled because Sparkle doesn't listen for AppKit events anymore such as termination or power off (note the installer running as a separate process listens for termination).
|
||||
* Distributing updates without DSA signing the archives is now deprecated.
|
||||
* Sparkle's icon in the official branch is no longer used for installation. Instead, the icon of the bundle to update is used. A 32x32 image representation of the icon is needed for the authorization dialog.
|
||||
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`.
|
||||
* Seamless. There's no mention of Sparkle; your icons and app name are used.
|
||||
* Secure. Updates are verified using EdDSA signatures and Apple Code Signing.
|
||||
* Fast. Supports delta updates which only patch files that have changed.
|
||||
* Easy to install. Sparkle requires no code in your app, and only needs static files on a web server.
|
||||
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
|
||||
* Handles permissions, quarantine and automatically asks for authentication if needed.
|
||||
* Uses RSS-based appcasts for release information. Appcasts are a de-facto standard supported by 3rd party update-tracking programs and websites.
|
||||
* Stays hidden until second launch for better first impressions.
|
||||
* Truly self-updating — the user can choose to automatically download and install all updates in the background.
|
||||
* Ability to mark updates as critical.
|
||||
* Progress and status notifications for the host app.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Runtime: **macOS 10.9** or greater for 64bit, **macOS 10.10** or greater for 32bit (this has been bumped up!)
|
||||
* Build: Xcode 7 or greater required.
|
||||
* Runtime: macOS 10.11 or greater
|
||||
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less; at least Xcode 12 if using Swift Package Manager.
|
||||
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
|
||||
|
||||
## Usage
|
||||
|
||||
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required. If your app is sandboxed, see the [INSTALL](INSTALL.markdown) document for more details about installing XPC binaries that support sandboxed apps.
|
||||
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required.
|
||||
|
||||
## Development
|
||||
|
||||
This repository uses git submodules, and will not build unless you clone recursively. Also, GitHub-provided ZIP/tar archives are broken due to GitHub not supporting git submodules properly.
|
||||
|
||||
git clone https://github.com/sparkle-project/Sparkle
|
||||
git checkout 2.x
|
||||
git submodule update --init --recursive
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
* Please check **Console.app**. Sparkle prints detailed information there about all problems it encounters. It often also suggests solutions to the problems, so please read Sparkle's log messages carefully.
|
||||
|
||||
* Use the `generate_appcast` tool which creates appcast files, correct signatures, and delta updates automatically.
|
||||
|
||||
* Make sure the URL specified in [`SUFeedURL`](https://sparkle-project.org/documentation/customization/) is valid (typos/404s are a common error!), and that it uses modern TLS ([test it](https://www.ssllabs.com/ssltest/)).
|
||||
|
||||
* Delete your app's preferences (in `~/Library/Preferences/<your bundle id>`) if you've set another feed URL programmatically via Sparkle's Objective-C interface.
|
||||
|
||||
### API symbols
|
||||
|
||||
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
|
||||
@@ -91,13 +66,11 @@ If you are adding a symbol to the public API you must decorate the declaration w
|
||||
|
||||
### Building the distribution package
|
||||
|
||||
`cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.bz2 will be created in a temporary directory and revealed in Finder after the build has completed.
|
||||
`cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.xz (or .bz2) will be created in a temporary directory and revealed in Finder after the build has completed.
|
||||
|
||||
Alternatively, build the Distribution scheme in the Xcode UI.
|
||||
|
||||
See the [INSTALL](INSTALL.markdown) file after building Sparkle, especially if interested in sandboxing support. The XPC services are not required for non-sandboxed applications.
|
||||
|
||||
## Code of Conduct
|
||||
### Code of Conduct
|
||||
|
||||
We pledge to have an open and welcoming environment. See our [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
html {
|
||||
color: white;
|
||||
background: transparent;
|
||||
}
|
||||
:link {
|
||||
color: #419CFF;
|
||||
}
|
||||
:link:active {
|
||||
color: #FF1919;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 11 KiB |
Loaded 100 of 582 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user