mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0900d09ab3 | ||
|
|
1755a3da05 | ||
|
|
bb56b5b259 | ||
|
|
5df208336a | ||
|
|
50f754c21d | ||
|
|
8455216a58 | ||
|
|
524761c50f | ||
|
|
626ccc79c6 | ||
|
|
a9ba760d6e | ||
|
|
9561b365af | ||
|
|
723e5d11be | ||
|
|
19ef31b681 | ||
|
|
50d321a1a9 | ||
|
|
55e0dc508c | ||
|
|
f6f4ac6925 | ||
|
|
2ace19e72b | ||
|
|
cb12461be1 | ||
|
|
e7c828b332 | ||
|
|
5dbc53a8b8 | ||
|
|
5dc407ddc5 | ||
|
|
261f5dc797 | ||
|
|
25d394acda | ||
|
|
401cd5f628 | ||
|
|
ddc8fac6c6 | ||
|
|
da573aa9ab | ||
|
|
8b40e22432 | ||
|
|
93a8aca7fd | ||
|
|
63aa96a076 | ||
|
|
7b13157dce | ||
|
|
aa9e05958d | ||
|
|
58fff9732e | ||
|
|
9c8fef56e3 | ||
|
|
0e0b87afd4 | ||
|
|
b8f87f1702 | ||
|
|
32db72a2fc | ||
|
|
f83f29193b | ||
|
|
93cff25e6f | ||
|
|
f886459367 | ||
|
|
54e663085b | ||
|
|
80627a4946 | ||
|
|
ba8dd4d010 | ||
|
|
5270fe0f51 | ||
|
|
03ab0b72a6 | ||
|
|
931f7855f7 | ||
|
|
a10a99ce1a | ||
|
|
a9209b94b7 | ||
|
|
d2ac8bc61e | ||
|
|
e5e4c6c2e1 | ||
|
|
a045f1a50b | ||
|
|
771b193924 | ||
|
|
0cd3aa0d9d | ||
|
|
c694980a94 | ||
|
|
7c413a3da2 | ||
|
|
b08e339a50 | ||
|
|
91b6716f85 | ||
|
|
d7d567d5e2 | ||
|
|
4a82eb3d69 | ||
|
|
d9cce796cb | ||
|
|
67819be18a | ||
|
|
03d2ddc005 | ||
|
|
1d6266e978 | ||
|
|
5de92bad8f | ||
|
|
3ad6b2b75b | ||
|
|
14871e5ee9 | ||
|
|
f42aac7797 | ||
|
|
3f978e865d | ||
|
|
c65fad6b53 | ||
|
|
6fa1302ecb | ||
|
|
9980a0f911 | ||
|
|
696f1f7bf1 | ||
|
|
9e4f395c97 | ||
|
|
e4020faae0 | ||
|
|
210a8fb165 | ||
|
|
3569b46d35 | ||
|
|
2f9c721719 | ||
|
|
47b35a737a | ||
|
|
6975392ed3 | ||
|
|
36f4955740 | ||
|
|
894f9dd683 | ||
|
|
dc819460a9 | ||
|
|
b0fe9aa09a | ||
|
|
ee64dc7574 | ||
|
|
b1c3b313f5 | ||
|
|
01bc8628da | ||
|
|
2e1596c673 | ||
|
|
0a13dfab4a | ||
|
|
96eb45efdc | ||
|
|
1784fc1a72 | ||
|
|
832902cea7 | ||
|
|
2121a7d9f2 | ||
|
|
ad0ea07252 | ||
|
|
45d27cc5d0 | ||
|
|
34e96171f3 | ||
|
|
b3fa1fc904 | ||
|
|
3cb3eb55ec | ||
|
|
bcb943a093 | ||
|
|
be29f66ddd | ||
|
|
2f6587f5a6 | ||
|
|
01bacb9647 | ||
|
|
75b7066a6e | ||
|
|
5bf8730c6b | ||
|
|
05393a8223 | ||
|
|
8f65c07a1a | ||
|
|
fbbb44bf73 | ||
|
|
9b960233ca | ||
|
|
9e67ef244b | ||
|
|
43b5382daf | ||
|
|
dbcdd76da2 | ||
|
|
b9328cc466 | ||
|
|
8ba29aa40d | ||
|
|
467325bc21 | ||
|
|
7e351b52c7 | ||
|
|
20d5b4e003 | ||
|
|
077e2b155f | ||
|
|
3ed5f3875b | ||
|
|
34fe3b52ff | ||
|
|
6daa5e152b | ||
|
|
e6d9a01316 | ||
|
|
502378553e | ||
|
|
64eb13672d | ||
|
|
e40628a78f | ||
|
|
a8528a256b | ||
|
|
cc94d66994 | ||
|
|
4bcaee7213 | ||
|
|
d574574345 | ||
|
|
89ce79488c | ||
|
|
b3ecc89f11 | ||
|
|
67320fcb80 | ||
|
|
3bf3096369 | ||
|
|
6cd66a4db9 | ||
|
|
3fd5e2315b | ||
|
|
0093e2f1c9 | ||
|
|
17fc6dbe89 | ||
|
|
ad506261ee | ||
|
|
1e31d849f5 | ||
|
|
e30d1b9f68 | ||
|
|
3ec3d6f2af | ||
|
|
abb6e28a9f | ||
|
|
f42ceec378 | ||
|
|
4565467287 | ||
|
|
8b47c5db71 | ||
|
|
30ab76da03 | ||
|
|
a3cc5f8b5d | ||
|
|
218315ffce | ||
|
|
648f8c960d | ||
|
|
4c27d7bf73 | ||
|
|
d41c8b3e60 | ||
|
|
5aea901ab6 | ||
|
|
08f19f0330 | ||
|
|
618fd6e85a | ||
|
|
7b3c3b7e58 | ||
|
|
f27416c97c | ||
|
|
ab942fa9b7 | ||
|
|
c3c2e51a08 | ||
|
|
d11eb126a1 | ||
|
|
fa7235c54e | ||
|
|
ed1e6031b6 | ||
|
|
7fc20434b9 | ||
|
|
415b4fe164 | ||
|
|
2d30762570 | ||
|
|
a4eefe6725 | ||
|
|
934f9e2c32 | ||
|
|
446df27354 | ||
|
|
b24ea83d0f | ||
|
|
aaac6cd594 | ||
|
|
a000e3b311 | ||
|
|
dc02d2d614 | ||
|
|
7a1e396530 | ||
|
|
dfaed624ae | ||
|
|
9dd4d46bb9 | ||
|
|
0c7db7f24d | ||
|
|
a34102a140 | ||
|
|
0b32116f65 | ||
|
|
fdebf50f81 | ||
|
|
62c9a8c785 | ||
|
|
6a4f1e6340 | ||
|
|
d980fe8783 | ||
|
|
5cff3cd543 | ||
|
|
866fbfe4fd | ||
|
|
c543edf6f6 | ||
|
|
930346d24b | ||
|
|
55b586f4dc | ||
|
|
4c01a69870 | ||
|
|
604d3f578a | ||
|
|
005a9a069e | ||
|
|
2bb5ce4318 | ||
|
|
b645005689 | ||
|
|
3b2ea83c6f | ||
|
|
874ec099b9 | ||
|
|
23011345cb | ||
|
|
f04c73445e | ||
|
|
36fd5a8bbd | ||
|
|
31cfbbccd9 | ||
|
|
af0a88dab3 | ||
|
|
e1a4ad9371 | ||
|
|
36e7cf263c | ||
|
|
19df2867af | ||
|
|
5ce1d7b3dc | ||
|
|
dca2114934 | ||
|
|
c25f127188 | ||
|
|
2001328032 | ||
|
|
9d354e5606 | ||
|
|
ad43a6d0c9 | ||
|
|
0bb3ab51b3 | ||
|
|
27a24a5413 | ||
|
|
e3f68b70bf | ||
|
|
a82f5acdd6 | ||
|
|
e463ed4bcb | ||
|
|
52397d616f | ||
|
|
47b1c8a9a2 | ||
|
|
6d69b1215d | ||
|
|
7609068886 | ||
|
|
f7d9e44ab6 | ||
|
|
ab64d8d19f | ||
|
|
76013ba66c | ||
|
|
cba7f51132 | ||
|
|
e3a467b126 | ||
|
|
9fa601c08f | ||
|
|
29ef0150b5 | ||
|
|
65c0c1e7fe | ||
|
|
b482f55e46 | ||
|
|
36ed896d0f | ||
|
|
fd533f937e | ||
|
|
d362caac98 | ||
|
|
cc77f11e22 | ||
|
|
55bc22b1ae | ||
|
|
66e5460208 | ||
|
|
bd6df5b707 | ||
|
|
f656bf5068 | ||
|
|
2a612f450e | ||
|
|
853a0ecd82 | ||
|
|
1943d971fc | ||
|
|
8aada73941 | ||
|
|
ae35c09624 | ||
|
|
fe79d29665 | ||
|
|
553168ba51 | ||
|
|
2c1e996fab | ||
|
|
b28fd2410d | ||
|
|
35ef590f2b | ||
|
|
574c0f63ca | ||
|
|
b6b554e830 | ||
|
|
d5e54005ce | ||
|
|
09da99f4cf | ||
|
|
07b9b71f8f | ||
|
|
70af94624d | ||
|
|
9ea4cf1bf6 | ||
|
|
fee1b0c126 | ||
|
|
2c9d44a341 | ||
|
|
9392e3260a | ||
|
|
eb78f61f41 | ||
|
|
a6abd1c206 | ||
|
|
7b0d0d8909 | ||
|
|
7783e9f704 | ||
|
|
8106aa8700 | ||
|
|
efd39a31e9 | ||
|
|
f46d4b7c4d | ||
|
|
5a7462e5b9 | ||
|
|
8e7cb0ac79 | ||
|
|
c72efdfb34 | ||
|
|
e2adfd2617 | ||
|
|
2d4568671c | ||
|
|
6b452b2861 | ||
|
|
163158cacf | ||
|
|
a0ced6018d | ||
|
|
f36e7a46cd | ||
|
|
fd4ff8a6e7 | ||
|
|
1a5cf6e48f | ||
|
|
17277b1f77 | ||
|
|
30d4a5eb5c | ||
|
|
def9a599a3 | ||
|
|
32373e8185 | ||
|
|
213bedfa37 | ||
|
|
d3ebffb267 | ||
|
|
b911b8c540 | ||
|
|
cc38a3d7a6 | ||
|
|
f9a2c7a450 | ||
|
|
f5a79ecc79 | ||
|
|
64bf8d02e2 | ||
|
|
325059484f | ||
|
|
56cd205880 | ||
|
|
021c1a7803 | ||
|
|
4d13c54d4c | ||
|
|
7c49f722a8 | ||
|
|
5f255c4865 | ||
|
|
fb2aea0d86 | ||
|
|
251feb7e07 | ||
|
|
6f337aa6f3 | ||
|
|
9b4aaef3dd | ||
|
|
2548057da8 | ||
|
|
fb5c577dad | ||
|
|
db642a0700 | ||
|
|
328a445b5c | ||
|
|
fbad9e466f | ||
|
|
44b70bb16c | ||
|
|
46a75cde97 | ||
|
|
27ea7ca2f5 | ||
|
|
b8d1ac45c3 | ||
|
|
b1fa9efa24 | ||
|
|
6a8680464b | ||
|
|
55d58a2203 | ||
|
|
f62f7fa1b8 | ||
|
|
5f0f964c65 | ||
|
|
f9c87d76db | ||
|
|
2ca76bef1c | ||
|
|
53cc1cf1ce | ||
|
|
3547cb1239 | ||
|
|
e27c5437ab | ||
|
|
47f08be1a0 | ||
|
|
7dd066d894 | ||
|
|
e2eb9f2af1 | ||
|
|
47cdd37238 | ||
|
|
eb53b58e2b | ||
|
|
e476ca2cf0 | ||
|
|
9ac76d6253 | ||
|
|
ab44d58d0e | ||
|
|
b11794b518 | ||
|
|
4b962725a5 | ||
|
|
4bbd3d6c29 | ||
|
|
1d3e5753d3 | ||
|
|
35ec3caf55 | ||
|
|
b92b7948f0 | ||
|
|
69eb10edba | ||
|
|
a6a2da7a69 | ||
|
|
c9a11a262d | ||
|
|
05e22348ca | ||
|
|
6f1b13954b | ||
|
|
97e769bab0 | ||
|
|
4bbce0a25f | ||
|
|
5a743ac366 | ||
|
|
1282e42031 | ||
|
|
423d288290 | ||
|
|
9e183b4e85 | ||
|
|
3132d19afc | ||
|
|
2cc3b4c349 | ||
|
|
e6c529e0ee | ||
|
|
010f642922 | ||
|
|
55e906ba3e | ||
|
|
bbfcd564d2 | ||
|
|
57325c7507 | ||
|
|
3f7c3933e7 | ||
|
|
e972e9072c | ||
|
|
6321329282 | ||
|
|
73f49ce573 | ||
|
|
32d9fd6526 | ||
|
|
4ec5652a0d | ||
|
|
eb319ee1b7 | ||
|
|
e21d4f1d32 | ||
|
|
d7ddfd2c6b | ||
|
|
b5ace2d037 | ||
|
|
3d7f48e03d | ||
|
|
e1397a7098 | ||
|
|
ad10096156 | ||
|
|
af7952b773 | ||
|
|
d9946273a7 | ||
|
|
29d790c63c | ||
|
|
26107994f4 | ||
|
|
f83d749a39 | ||
|
|
ad14421b24 | ||
|
|
5114cd9d83 | ||
|
|
cdc329d2c3 | ||
|
|
8eb61afe53 | ||
|
|
b8ccc5d079 | ||
|
|
fa2e857b4e | ||
|
|
d8ce7cb48b | ||
|
|
6dddbcc353 | ||
|
|
f65f4beda8 | ||
|
|
3c2875602e | ||
|
|
1a94956f71 | ||
|
|
92b94343f4 | ||
|
|
b58773cb5e | ||
|
|
6fb7b4a18b | ||
|
|
f514861871 | ||
|
|
73c659a2fe | ||
|
|
a0bc1b19c8 | ||
|
|
8e5554880d | ||
|
|
d1c2faf7e5 | ||
|
|
85914936d7 | ||
|
|
d0d39bc623 | ||
|
|
f18d410c6a | ||
|
|
878c30d17c | ||
|
|
f5afdc1cd8 | ||
|
|
bce9c083c1 | ||
|
|
93c23e938f | ||
|
|
a523621b71 | ||
|
|
86668d852b | ||
|
|
62bbf73ab4 | ||
|
|
1a0e169e7f | ||
|
|
a51edf3dad | ||
|
|
f7d1cab4a0 | ||
|
|
65d78d5129 | ||
|
|
085724322f | ||
|
|
69db74bc36 | ||
|
|
11cbecbeaa | ||
|
|
31d6d40112 | ||
|
|
ba93d9056e | ||
|
|
9dca6fd27b | ||
|
|
2b65860293 | ||
|
|
766dd50aeb | ||
|
|
bdd2b7571b | ||
|
|
f2713138b9 | ||
|
|
e53539b19e | ||
|
|
b676e3761a | ||
|
|
a303859f10 | ||
|
|
bf0aa81546 | ||
|
|
eae8ccb2e7 | ||
|
|
fdd6707f5b | ||
|
|
e3dd0d5ce5 | ||
|
|
42a9a34be4 | ||
|
|
1663a822c8 | ||
|
|
6bfdd18d9e | ||
|
|
b8d51539d7 | ||
|
|
e726dd01e4 | ||
|
|
4ed6d40af8 | ||
|
|
6e35a1b84d | ||
|
|
86e026588b | ||
|
|
ca36d9963e | ||
|
|
c9f673cda8 | ||
|
|
f5444228c5 | ||
|
|
4f285d2245 | ||
|
|
c811db1e67 | ||
|
|
5dfe4ce71b | ||
|
|
1a3466ba04 | ||
|
|
52fd21e119 | ||
|
|
411c0ac8bd | ||
|
|
682a47f4fa | ||
|
|
b8df5d3023 | ||
|
|
a7e03c7f9b | ||
|
|
607399f1e6 | ||
|
|
cc9f4d92af | ||
|
|
5ad5598a19 | ||
|
|
1ca233eadf | ||
|
|
2fc57ce288 | ||
|
|
d42ac08bf2 | ||
|
|
97ce687b86 | ||
|
|
23e027d02f | ||
|
|
8c564fef1f | ||
|
|
069f78579c | ||
|
|
ea1b04391f | ||
|
|
32584ab228 | ||
|
|
5852ecf0e7 | ||
|
|
0d0258a87f | ||
|
|
097710e27a | ||
|
|
b967c2f13f | ||
|
|
322ee026ea | ||
|
|
e2da47b7c7 | ||
|
|
32bf570b4c | ||
|
|
bd352c7db5 | ||
|
|
626e506cae | ||
|
|
cb6fd34448 | ||
|
|
3be36d8f22 | ||
|
|
8ab7bd6edb | ||
|
|
5ceeb3dfd3 | ||
|
|
2191a2b6ed | ||
|
|
2eccc3a1db | ||
|
|
c445a3f1e4 | ||
|
|
6fc5dfb8e7 | ||
|
|
929705d6dd | ||
|
|
9e1664b42e | ||
|
|
260235b2a0 | ||
|
|
646ed6f3c4 | ||
|
|
f9e2609fa1 | ||
|
|
0ca688073b | ||
|
|
9f4e44f919 | ||
|
|
eac55846a8 | ||
|
|
70cc3ea360 | ||
|
|
fe62ad0468 | ||
|
|
7d16e223c3 | ||
|
|
150f10ed05 | ||
|
|
0cb59a1b02 | ||
|
|
1384b5a80f | ||
|
|
35801a22f2 | ||
|
|
ec69aa07a3 | ||
|
|
d8196e1c5d | ||
|
|
da8065f67e | ||
|
|
8d93513813 | ||
|
|
1d3776d5c7 | ||
|
|
e5643e2990 | ||
|
|
c95b337b09 | ||
|
|
25a52439a1 | ||
|
|
e2a51347b9 | ||
|
|
ec7766022d | ||
|
|
5c0ee2d74a | ||
|
|
48938d0e78 | ||
|
|
a1d43997d9 | ||
|
|
7d4690ed17 | ||
|
|
21ad358772 | ||
|
|
ad950beab6 | ||
|
|
d98fe465b5 | ||
|
|
3200029157 | ||
|
|
41ee168f2c | ||
|
|
c2db46f656 | ||
|
|
350aeb1c81 | ||
|
|
345ed3b60e | ||
|
|
b014737e83 | ||
|
|
3244bf7f14 | ||
|
|
50594dda57 | ||
|
|
dd02cb2509 | ||
|
|
66e3083e0c | ||
|
|
6b5f014946 | ||
|
|
849d265900 | ||
|
|
59af8ae0ba | ||
|
|
f7f9ac4c6d | ||
|
|
3939fcfb82 | ||
|
|
e0109e2fd5 | ||
|
|
da185de61b | ||
|
|
e00d303c08 | ||
|
|
c37fc24389 | ||
|
|
a962c8fa8f | ||
|
|
ea6625024c | ||
|
|
64d740a761 | ||
|
|
2c3996a522 | ||
|
|
97eb25b27f | ||
|
|
e171824a74 | ||
|
|
a65a7346cf | ||
|
|
7092c19652 | ||
|
|
69b4b9e81b | ||
|
|
8563a40cd2 | ||
|
|
80bc8353ed | ||
|
|
7d1c0aa83b | ||
|
|
1b5b4972c9 | ||
|
|
ddb4262b7b | ||
|
|
599c3fb3c1 | ||
|
|
b8bb06fb2f | ||
|
|
63febfd9cd | ||
|
|
b4f7a28aa3 | ||
|
|
998a349617 | ||
|
|
9881476008 | ||
|
|
340633fd79 | ||
|
|
a615703883 | ||
|
|
e4d6e268e2 | ||
|
|
e32d0dbc1a | ||
|
|
ef4af6b4a8 | ||
|
|
8de5c5cfa2 | ||
|
|
54408ca1a9 | ||
|
|
4240138818 | ||
|
|
39f7915492 | ||
|
|
23a07127d0 | ||
|
|
641f3b0d47 | ||
|
|
a7aad3b16a | ||
|
|
a6ccd4cfa9 | ||
|
|
b982e9460c | ||
|
|
a09aa0b33f | ||
|
|
9acfe7f180 | ||
|
|
30f346a967 | ||
|
|
9a528d912a | ||
|
|
c117837785 | ||
|
|
34ce18c44f | ||
|
|
e919c13f55 | ||
|
|
a3a6e3b3b7 | ||
|
|
23a3ad4b05 | ||
|
|
dc5298ce54 | ||
|
|
1aedf2f9ed | ||
|
|
1392190d47 | ||
|
|
b1606648cf | ||
|
|
4d379f3e0a | ||
|
|
da39e841f9 | ||
|
|
7e54e94472 | ||
|
|
6cca0673c5 | ||
|
|
6a4b96580a | ||
|
|
a780894d14 | ||
|
|
af7c7cea2b | ||
|
|
29d32eaaa0 | ||
|
|
061e99995f | ||
|
|
911f2150f9 | ||
|
|
adba3bd945 | ||
|
|
71b91734e5 | ||
|
|
f70c7429ba | ||
|
|
207390a2c1 | ||
|
|
86d5d49111 | ||
|
|
b2cb1bd531 | ||
|
|
f36397e89c | ||
|
|
623f535883 | ||
|
|
070686b488 | ||
|
|
4482e2b736 | ||
|
|
c80ddf99f8 | ||
|
|
45aaba9ee9 | ||
|
|
53c4abaf9e | ||
|
|
d44ef6bb75 | ||
|
|
355d6eddbf | ||
|
|
f62285ff3b | ||
|
|
80267f22b5 | ||
|
|
da145b2100 | ||
|
|
0fb951bd4c | ||
|
|
b4f1f67ddb | ||
|
|
a113ce49bd | ||
|
|
ec0889ef83 | ||
|
|
1046cb4217 | ||
|
|
f210fddb30 | ||
|
|
0cf1aee693 | ||
|
|
7bfccc3898 | ||
|
|
87903c0d97 | ||
|
|
7df7222fe4 | ||
|
|
348426e501 | ||
|
|
bcb3f669ba | ||
|
|
1438dd6140 | ||
|
|
64a7624744 | ||
|
|
d182b28d09 | ||
|
|
c5026976ee | ||
|
|
c9cb670761 | ||
|
|
cd135d9b10 | ||
|
|
1084071810 | ||
|
|
dd0230e6c2 | ||
|
|
d463db5742 | ||
|
|
e3795194d6 | ||
|
|
cb5cf9aa69 | ||
|
|
0a53d51d89 | ||
|
|
4a0837a500 | ||
|
|
83fe6adcba | ||
|
|
7c06ceb7e4 | ||
|
|
4661fee388 | ||
|
|
1a952227a7 | ||
|
|
eec2eca0c2 | ||
|
|
a8dd49acad | ||
|
|
3826b35bc2 | ||
|
|
4ba3673dfd | ||
|
|
72d63f3992 | ||
|
|
346f996942 | ||
|
|
3b05179ccf | ||
|
|
159c16fc12 | ||
|
|
71330366d8 | ||
|
|
a1b6cbb5e2 | ||
|
|
e1af0264de | ||
|
|
7056ccb321 | ||
|
|
77ad42aab6 | ||
|
|
fa36cb300b | ||
|
|
8b19b0e1b4 | ||
|
|
fbb9fbf535 | ||
|
|
1446acf519 | ||
|
|
95416e4f65 | ||
|
|
d21c4c4785 | ||
|
|
70582639ee | ||
|
|
033f59e643 | ||
|
|
c9c1de30e4 | ||
|
|
9d1e707577 | ||
|
|
bc43e9186f | ||
|
|
4a2dd657b2 | ||
|
|
0df9bd6760 | ||
|
|
c2f4be611b | ||
|
|
702a1dffc0 | ||
|
|
704518278c | ||
|
|
738490af07 | ||
|
|
4b75564b5f | ||
|
|
305e33945f | ||
|
|
350eba452c | ||
|
|
1356024b25 | ||
|
|
235e93f0c1 | ||
|
|
7d8d5d1f46 | ||
|
|
004da55780 | ||
|
|
c0a148f5ff | ||
|
|
981f67e8b1 | ||
|
|
a4157e5989 | ||
|
|
9bea84b29e | ||
|
|
d632dcb72f | ||
|
|
11c79b7b2a | ||
|
|
83bb5354dc | ||
|
|
15483815ff | ||
|
|
d9952b8f22 | ||
|
|
ef134d9245 | ||
|
|
65e2bac89e | ||
|
|
fdee19ec69 | ||
|
|
7183d9ebc5 | ||
|
|
2c64d98ec8 | ||
|
|
0b640d5d20 | ||
|
|
8a8cef7dce | ||
|
|
47d8ed8f05 | ||
|
|
4ea4ece4fd | ||
|
|
3b892524a6 | ||
|
|
2a89393853 | ||
|
|
31dc457676 | ||
|
|
22e32a2304 | ||
|
|
b9f2a24660 | ||
|
|
a1fa7b1fa3 | ||
|
|
78f2453f2b | ||
|
|
d96fd93edf | ||
|
|
786d3d4bb6 | ||
|
|
88f4557bdd | ||
|
|
39bc068b89 | ||
|
|
e767f6a4c6 | ||
|
|
13993aea67 | ||
|
|
5eef1d1243 | ||
|
|
98f07419aa | ||
|
|
7a0ee291f9 | ||
|
|
63e100ae0d | ||
|
|
291bef326b | ||
|
|
bab33b66cb | ||
|
|
ad0868ab4f | ||
|
|
18e666ac3a | ||
|
|
acaa021583 | ||
|
|
c105154ba8 | ||
|
|
d4466d1448 | ||
|
|
ee8fed0c2a | ||
|
|
e1b13f9c67 | ||
|
|
d5f1dcc7c3 | ||
|
|
88f5d9a6d9 | ||
|
|
163a64f3fe | ||
|
|
15c9ae65e7 | ||
|
|
1151d66337 | ||
|
|
8eb0bc1921 | ||
|
|
2b84e83ba4 | ||
|
|
5fdc438fa6 | ||
|
|
7015303726 | ||
|
|
296154d467 | ||
|
|
cd108ef47c | ||
|
|
5a0ee5d56a | ||
|
|
20e8ea8603 | ||
|
|
e1a9e98d8b | ||
|
|
39f82edcf6 | ||
|
|
8d5f1edf39 | ||
|
|
beacf49158 | ||
|
|
b3b12dc4be | ||
|
|
bb3a2e299e | ||
|
|
33bd47cd1f | ||
|
|
61ed9920b4 | ||
|
|
f528f6b2ba | ||
|
|
5f253e8c64 | ||
|
|
00cdab1766 | ||
|
|
e14077ee9a | ||
|
|
e5b5952287 | ||
|
|
c80015bf99 | ||
|
|
1bb301e82a | ||
|
|
933504263a | ||
|
|
233fa268b5 | ||
|
|
c178e34d8f | ||
|
|
97a8568491 | ||
|
|
c4800182a2 | ||
|
|
b22d2c2568 | ||
|
|
44a61b830e | ||
|
|
6dedd8309f | ||
|
|
32c687ed79 | ||
|
|
d7cca8a594 | ||
|
|
116c8ea8b7 | ||
|
|
38a69cee5b | ||
|
|
a3a2310952 | ||
|
|
e03607a2d6 | ||
|
|
51e1e1c646 | ||
|
|
d5cd64159c | ||
|
|
0b19d8d7fd | ||
|
|
92e5c30c0d | ||
|
|
9b1d441194 | ||
|
|
e74a397152 | ||
|
|
9525b156a2 | ||
|
|
e7f85bb40f | ||
|
|
5c08e0a1d1 | ||
|
|
ee77bf59d5 | ||
|
|
009de37415 | ||
|
|
e0e93e3edf | ||
|
|
60fcbe4f88 | ||
|
|
c9f66cdeff | ||
|
|
32edf6cc5d | ||
|
|
941ae6481f | ||
|
|
e0b3a128b0 | ||
|
|
9e6f376285 | ||
|
|
5c624eccbe | ||
|
|
e792798294 | ||
|
|
08696841c2 | ||
|
|
0b94f56f7f | ||
|
|
d12121a265 | ||
|
|
9bb87b2018 | ||
|
|
6de75413e8 | ||
|
|
b27255468a | ||
|
|
b0963583ba | ||
|
|
46387097c1 | ||
|
|
c58eaa205e | ||
|
|
ac0aaddefa | ||
|
|
528c6f25ed | ||
|
|
a8252cbe20 | ||
|
|
7fc6896170 | ||
|
|
9c7d41dd90 | ||
|
|
eddf611ede | ||
|
|
8184838835 | ||
|
|
301f3bf4e3 | ||
|
|
fb32c8e18a | ||
|
|
8e4498adaf | ||
|
|
9d6f196111 | ||
|
|
06c2f47024 | ||
|
|
1e9292acf4 | ||
|
|
5d1d2291a0 | ||
|
|
65a6d41147 | ||
|
|
4042068c82 | ||
|
|
a3c950f480 | ||
|
|
a1d08a354d | ||
|
|
615f71474b | ||
|
|
4e8a39267d | ||
|
|
56a75bd4b6 | ||
|
|
87275b23c8 | ||
|
|
1e645e8bd7 | ||
|
|
d44094a692 | ||
|
|
cb0b7c8cfe | ||
|
|
af126d9c82 | ||
|
|
f918368c72 | ||
|
|
85517dd0dd | ||
|
|
d78f487596 | ||
|
|
e7fdfb9dc9 | ||
|
|
64c17df1e6 | ||
|
|
f82a698937 | ||
|
|
b10202769f | ||
|
|
194c0ed63a | ||
|
|
72d3634f32 | ||
|
|
25ab5a1870 | ||
|
|
f4869e584c | ||
|
|
079f1e33bc | ||
|
|
84ad85c253 | ||
|
|
6753c788f8 | ||
|
|
4dcef32eb4 | ||
|
|
38abfca4b0 | ||
|
|
46256b297b | ||
|
|
2a277c24b5 | ||
|
|
25b451b4c2 | ||
|
|
cee120065f | ||
|
|
59bbcfadb0 | ||
|
|
73a0f10010 | ||
|
|
6f30ae2093 | ||
|
|
7ea2d0f9cf | ||
|
|
57f0bc4245 | ||
|
|
cf3674b2d7 | ||
|
|
00368011c8 | ||
|
|
1e92d403ec | ||
|
|
f2b9ae97c2 | ||
|
|
96f016a790 | ||
|
|
337f39e8b9 | ||
|
|
53719cc8b7 | ||
|
|
5dca54d904 | ||
|
|
30cb984341 | ||
|
|
43942bcbad | ||
|
|
ed72d25eaa | ||
|
|
db4e8a9946 | ||
|
|
0338cd443a | ||
|
|
f2e485df87 | ||
|
|
58f4e97f9c | ||
|
|
af8e195cd9 | ||
|
|
2e44a5ecc5 | ||
|
|
6c9cbbb389 | ||
|
|
045de30926 | ||
|
|
62fa723564 | ||
|
|
cc5826d2f1 | ||
|
|
a652ab952e | ||
|
|
ada2688b86 | ||
|
|
f5a9cf14de | ||
|
|
5f572854d2 | ||
|
|
8a42975dc2 | ||
|
|
ed00162faa | ||
|
|
65f16e7e8c | ||
|
|
1b9d93f739 | ||
|
|
9ee8a6d314 | ||
|
|
b58eeeabb5 | ||
|
|
5eb715f1f3 | ||
|
|
4a2c3dd922 | ||
|
|
ad26fe9627 | ||
|
|
772c6b7d3f | ||
|
|
8b0eae8ef4 | ||
|
|
1da4ee961c | ||
|
|
efac2acf57 | ||
|
|
077b0c7bc9 | ||
|
|
f5bc152f1c | ||
|
|
ba4bbbb99a | ||
|
|
d3a09cc68a | ||
|
|
dafdcf21b6 | ||
|
|
1b46ecf663 | ||
|
|
dd3c698f3e | ||
|
|
30c2ba125b | ||
|
|
f26811b439 | ||
|
|
7dd3e02546 | ||
|
|
0c41fafb47 | ||
|
|
3362ea174a | ||
|
|
cea47960dd | ||
|
|
721ccdc5d9 | ||
|
|
49c10c8cb5 | ||
|
|
0a6db8ef7a | ||
|
|
cf31592e4a | ||
|
|
097784db95 | ||
|
|
b6fe5ea289 | ||
|
|
f7b6a70979 | ||
|
|
7c16419a6d | ||
|
|
253f544bbe | ||
|
|
16b9d47cbe | ||
|
|
d3ed152e1a | ||
|
|
5e87fe6daa | ||
|
|
34cf472834 | ||
|
|
1278a34d3b | ||
|
|
1aa6f88819 | ||
|
|
829a88be58 | ||
|
|
4a26c395d8 | ||
|
|
02ee6f9c15 | ||
|
|
6c1aa38ac9 | ||
|
|
45e6951552 | ||
|
|
8c769ca9cd | ||
|
|
2e28d47d48 | ||
|
|
21b49d41a2 | ||
|
|
8325c9a4d9 | ||
|
|
6ade2f270b | ||
|
|
15b4d1adf3 | ||
|
|
7f494f13be | ||
|
|
34ad4cfd6b | ||
|
|
cba11cac2d | ||
|
|
3725d1e14d | ||
|
|
cfd462002c | ||
|
|
caf5e01643 | ||
|
|
196bb64483 | ||
|
|
30abbb238a | ||
|
|
dccce32beb | ||
|
|
680484f7c2 | ||
|
|
030725ff2d | ||
|
|
cd83dd3769 | ||
|
|
f88eec8105 | ||
|
|
c6df59c7b0 | ||
|
|
876c7af538 | ||
|
|
513d7f39a1 | ||
|
|
3e64da75b6 | ||
|
|
6041d68db6 | ||
|
|
d216f30f47 | ||
|
|
8af18843ef | ||
|
|
2a13d62838 | ||
|
|
1fc1d3598a | ||
|
|
0d7b0037a1 | ||
|
|
4a3f0ad984 | ||
|
|
f630188255 | ||
|
|
b5a1826a47 | ||
|
|
717f741977 | ||
|
|
3d2958326c | ||
|
|
3bf91e795e | ||
|
|
cdea8015d3 | ||
|
|
bea00a99e8 | ||
|
|
0e7eba5ae9 | ||
|
|
aee0b6f7d8 | ||
|
|
dec088b9ad | ||
|
|
fbfcbbdf2d | ||
|
|
3230fd982b | ||
|
|
b6d1726d77 | ||
|
|
582381a5df | ||
|
|
beae77136b | ||
|
|
e20ecce343 | ||
|
|
14f56c519b | ||
|
|
cd66b1013a | ||
|
|
a6d6e31b2c | ||
|
|
308cfe36cf | ||
|
|
b6e558d82e | ||
|
|
a9df54eb98 | ||
|
|
f00978c87b | ||
|
|
0e97f0b4b6 | ||
|
|
5a60ddaf8c | ||
|
|
c3824b4c20 | ||
|
|
6b5a3547e7 | ||
|
|
1ebb150a1b | ||
|
|
80bdd318ba | ||
|
|
1fad56c4c3 | ||
|
|
835f4ac5b5 | ||
|
|
e6ac015dde | ||
|
|
6acbf0010a | ||
|
|
0bb5de196a | ||
|
|
48e0febf1a | ||
|
|
480feff34f | ||
|
|
1cfbffa74c | ||
|
|
a9f1e2d919 | ||
|
|
46a2485d9c | ||
|
|
7ca99547b9 | ||
|
|
96fb18e0df | ||
|
|
2ef497afcd | ||
|
|
0a29626615 |
No files matched your search
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
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]
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
(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), if deemed necessary. Please create a separate pull request for 1.x, should it be backported.
|
|
||||||
- [ ] 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]
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
name: Build & Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ 2.x, master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ 2.x, master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
xcode: ['xcode12.5.1', 'xcode13.1']
|
|
||||||
include:
|
|
||||||
- xcode: 'xcode12.5.1'
|
|
||||||
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
|
|
||||||
upload-dist: false
|
|
||||||
- xcode: 'xcode13.1'
|
|
||||||
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
|
|
||||||
upload-dist: true
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
name: "Create Draft Release"
|
|
||||||
|
|
||||||
env:
|
|
||||||
BUILDDIR: "build"
|
|
||||||
DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
marketingVersion:
|
|
||||||
description: "Marketing Version"
|
|
||||||
required: true
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
prereleaseSuffix:
|
|
||||||
description: "Pre-release Suffix"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
buildVersion:
|
|
||||||
description: "Product Build"
|
|
||||||
required: true
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
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: "Overwrite project versions in project"
|
|
||||||
run: |
|
|
||||||
IFS='.' read major minor patch <<< "${{ github.event.inputs.marketingVersion }}"
|
|
||||||
sed -E -i '' "s/SPARKLE_VERSION_MAJOR =.+/SPARKLE_VERSION_MAJOR = $major/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
sed -E -i '' "s/SPARKLE_VERSION_MINOR =.+/SPARKLE_VERSION_MINOR = $minor/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
sed -E -i '' "s/SPARKLE_VERSION_PATCH =.+/SPARKLE_VERSION_PATCH = $patch/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
|
|
||||||
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then
|
|
||||||
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX = ${{ github.event.inputs.prereleaseSuffix }}/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
else
|
|
||||||
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX =/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -E -i '' "s/CURRENT_PROJECT_VERSION =.+/CURRENT_PROJECT_VERSION = ${{ github.event.inputs.buildVersion }}/g" ./Configurations/ConfigCommon.xcconfig
|
|
||||||
git add ./Configurations/ConfigCommon.xcconfig
|
|
||||||
|
|
||||||
- name: "Determine if this is a pre-release version"
|
|
||||||
run: |
|
|
||||||
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; 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 "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
|
||||||
|
|
||||||
- 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 ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
|
||||||
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
|
||||||
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,7 +41,3 @@ Carthage/Build
|
|||||||
Network Trash Folder
|
Network Trash Folder
|
||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
# Swift Package Manager
|
|
||||||
/.build
|
|
||||||
.swiftpm
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// AgentConnection.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 7/17/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@protocol AgentConnectionDelegate <NSObject>
|
||||||
|
|
||||||
|
- (void)agentConnectionDidInitiate;
|
||||||
|
- (void)agentConnectionDidInvalidate;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol SPUInstallerAgentProtocol;
|
||||||
|
|
||||||
|
@interface AgentConnection : NSObject
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate;
|
||||||
|
|
||||||
|
- (void)startListener;
|
||||||
|
- (void)invalidate;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly, nullable) id<SPUInstallerAgentProtocol> agent;
|
||||||
|
@property (nonatomic, readonly) BOOL connected;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
//
|
||||||
|
// AgentConnection.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 7/17/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AgentConnection.h"
|
||||||
|
#import "SPUMessageTypes.h"
|
||||||
|
#import "SPUInstallerAgentProtocol.h"
|
||||||
|
#import "SUInstallerAgentInitiationProtocol.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
@interface AgentConnection () <NSXPCListenerDelegate, SUInstallerAgentInitiationProtocol>
|
||||||
|
|
||||||
|
@property (nonatomic) NSXPCListener *xpcListener;
|
||||||
|
@property (nonatomic, nullable) NSXPCConnection *activeConnection;
|
||||||
|
@property (nonatomic, nullable) id<SPUInstallerAgentProtocol> agent;
|
||||||
|
@property (nonatomic, weak) id<AgentConnectionDelegate> delegate;
|
||||||
|
@property (nonatomic) BOOL connected;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AgentConnection
|
||||||
|
|
||||||
|
@synthesize xpcListener = _xpcListener;
|
||||||
|
@synthesize activeConnection = _activeConnection;
|
||||||
|
@synthesize agent = _agent;
|
||||||
|
@synthesize delegate = _delegate;
|
||||||
|
@synthesize connected = _connected;
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
// Agents should always be the one that connect to daemons due to how mach bootstraps work
|
||||||
|
// For this reason, we are the ones that are creating a listener, not the agent
|
||||||
|
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUProgressAgentServiceNameForBundleIdentifier(bundleIdentifier)];
|
||||||
|
_xpcListener.delegate = self;
|
||||||
|
_delegate = delegate;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startListener
|
||||||
|
{
|
||||||
|
[self.xpcListener resume];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invalidate
|
||||||
|
{
|
||||||
|
self.delegate = nil;
|
||||||
|
|
||||||
|
[self.activeConnection invalidate];
|
||||||
|
self.activeConnection = nil;
|
||||||
|
|
||||||
|
[self.xpcListener invalidate];
|
||||||
|
self.xpcListener = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
|
||||||
|
{
|
||||||
|
if (self.activeConnection != nil) {
|
||||||
|
[newConnection invalidate];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)];
|
||||||
|
newConnection.exportedObject = self;
|
||||||
|
|
||||||
|
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
|
||||||
|
|
||||||
|
self.activeConnection = newConnection;
|
||||||
|
|
||||||
|
__weak AgentConnection *weakSelf = self;
|
||||||
|
newConnection.interruptionHandler = ^{
|
||||||
|
[weakSelf.activeConnection invalidate];
|
||||||
|
};
|
||||||
|
|
||||||
|
newConnection.invalidationHandler = ^{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[weakSelf.delegate agentConnectionDidInvalidate];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
[newConnection resume];
|
||||||
|
|
||||||
|
self.agent = newConnection.remoteObjectProxy;
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement
|
||||||
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
self.connected = YES;
|
||||||
|
|
||||||
|
[self.delegate agentConnectionDidInitiate];
|
||||||
|
self.delegate = nil;
|
||||||
|
});
|
||||||
|
|
||||||
|
acknowledgement();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// AppInstaller.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/7/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "SUUnarchiverProtocol.h"
|
||||||
|
|
||||||
|
@interface AppInstaller : NSObject
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier;
|
||||||
|
|
||||||
|
- (void)start;
|
||||||
|
|
||||||
|
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn));
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,622 @@
|
|||||||
|
//
|
||||||
|
// AppInstaller.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/7/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AppInstaller.h"
|
||||||
|
#import "TerminationListener.h"
|
||||||
|
#import "SUInstaller.h"
|
||||||
|
#import "SUUpdateValidator.h"
|
||||||
|
#import "SULog.h"
|
||||||
|
#import "SUHost.h"
|
||||||
|
#import "SULocalizations.h"
|
||||||
|
#import "SUStandardVersionComparator.h"
|
||||||
|
#import "SPUMessageTypes.h"
|
||||||
|
#import "SPUSecureCoding.h"
|
||||||
|
#import "SPUInstallationInputData.h"
|
||||||
|
#import "SUUnarchiver.h"
|
||||||
|
#import "SUFileManager.h"
|
||||||
|
#import "SPUInstallationInfo.h"
|
||||||
|
#import "SUAppcastItem.h"
|
||||||
|
#import <Sparkle/SUErrors.h>
|
||||||
|
#import "SUInstallerCommunicationProtocol.h"
|
||||||
|
#import "AgentConnection.h"
|
||||||
|
#import "SPUInstallerAgentProtocol.h"
|
||||||
|
#import "SPUInstallationType.h"
|
||||||
|
#import "SPULocalCacheDirectory.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
#define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull
|
||||||
|
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Show display progress UI after a delay from starting the final part of the installation.
|
||||||
|
* This should be long enough so that we don't show progress for very fast installations, but
|
||||||
|
* short enough so that we don't leave the user wondering why nothing is happening.
|
||||||
|
*/
|
||||||
|
static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||||
|
|
||||||
|
@interface AppInstaller () <NSXPCListenerDelegate, SUInstallerCommunicationProtocol, AgentConnectionDelegate>
|
||||||
|
|
||||||
|
@property (nonatomic) NSXPCListener* xpcListener;
|
||||||
|
@property (nonatomic) NSXPCConnection *activeConnection;
|
||||||
|
@property (nonatomic) id<SUInstallerCommunicationProtocol> communicator;
|
||||||
|
@property (nonatomic) AgentConnection *agentConnection;
|
||||||
|
@property (nonatomic) BOOL receivedUpdaterPong;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) TerminationListener *terminationListener;
|
||||||
|
|
||||||
|
@property (nonatomic) SUUpdateValidator *updateValidator;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
|
||||||
|
@property (nonatomic) SUHost *host;
|
||||||
|
@property (nonatomic, copy) NSString *updateDirectoryPath;
|
||||||
|
@property (nonatomic, copy) NSString *downloadName;
|
||||||
|
@property (nonatomic, copy) NSString *decryptionPassword;
|
||||||
|
@property (nonatomic, strong) SUSignatures *signatures;
|
||||||
|
@property (nonatomic, copy) NSString *relaunchPath;
|
||||||
|
@property (nonatomic, copy) NSString *installationType;
|
||||||
|
@property (nonatomic, assign) BOOL shouldRelaunch;
|
||||||
|
@property (nonatomic, assign) BOOL shouldShowUI;
|
||||||
|
|
||||||
|
@property (nonatomic) id<SUInstallerProtocol> installer;
|
||||||
|
@property (nonatomic) BOOL willCompleteInstallation;
|
||||||
|
@property (nonatomic) BOOL receivedInstallationData;
|
||||||
|
@property (nonatomic) BOOL finishedValidation;
|
||||||
|
@property (nonatomic) BOOL agentInitiatedConnection;
|
||||||
|
|
||||||
|
@property (nonatomic) dispatch_queue_t installerQueue;
|
||||||
|
@property (nonatomic) BOOL performedStage1Installation;
|
||||||
|
@property (nonatomic) BOOL performedStage2Installation;
|
||||||
|
@property (nonatomic) BOOL performedStage3Installation;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppInstaller
|
||||||
|
|
||||||
|
@synthesize xpcListener = _xpcListener;
|
||||||
|
@synthesize activeConnection = _activeConnection;
|
||||||
|
@synthesize communicator = _communicator;
|
||||||
|
@synthesize agentConnection = _agentConnection;
|
||||||
|
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
|
||||||
|
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
|
||||||
|
@synthesize terminationListener = _terminationListener;
|
||||||
|
@synthesize updateValidator = _updateValidator;
|
||||||
|
@synthesize host = _host;
|
||||||
|
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||||
|
@synthesize downloadName = _downloadName;
|
||||||
|
@synthesize decryptionPassword = _decryptionPassword;
|
||||||
|
@synthesize signatures = _signatures;
|
||||||
|
@synthesize relaunchPath = _relaunchPath;
|
||||||
|
@synthesize installationType = _installationType;
|
||||||
|
@synthesize shouldRelaunch = _shouldRelaunch;
|
||||||
|
@synthesize shouldShowUI = _shouldShowUI;
|
||||||
|
@synthesize installer = _installer;
|
||||||
|
@synthesize willCompleteInstallation = _willCompleteInstallation;
|
||||||
|
@synthesize receivedInstallationData = _receivedInstallationData;
|
||||||
|
@synthesize installerQueue = _installerQueue;
|
||||||
|
@synthesize performedStage1Installation = _performedStage1Installation;
|
||||||
|
@synthesize performedStage2Installation = _performedStage2Installation;
|
||||||
|
@synthesize performedStage3Installation = _performedStage3Installation;
|
||||||
|
@synthesize finishedValidation = _finishedValidation;
|
||||||
|
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier
|
||||||
|
{
|
||||||
|
if (!(self = [super init])) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hostBundleIdentifier = [hostBundleIdentifier copy];
|
||||||
|
|
||||||
|
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier)];
|
||||||
|
_xpcListener.delegate = self;
|
||||||
|
|
||||||
|
_agentConnection = [[AgentConnection alloc] initWithHostBundleIdentifier:hostBundleIdentifier delegate:self];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
|
||||||
|
{
|
||||||
|
if (self.activeConnection != nil) {
|
||||||
|
SULog(SULogLevelDefault, @"Rejecting multiple connections...");
|
||||||
|
[newConnection invalidate];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.activeConnection = newConnection;
|
||||||
|
|
||||||
|
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
|
||||||
|
newConnection.exportedObject = self;
|
||||||
|
|
||||||
|
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
|
||||||
|
|
||||||
|
__weak AppInstaller *weakSelf = self;
|
||||||
|
newConnection.interruptionHandler = ^{
|
||||||
|
[weakSelf.activeConnection invalidate];
|
||||||
|
};
|
||||||
|
|
||||||
|
newConnection.invalidationHandler = ^{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
AppInstaller *strongSelf = weakSelf;
|
||||||
|
if (strongSelf != nil) {
|
||||||
|
if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) {
|
||||||
|
SULog(SULogLevelError, @"Invalidation on remote port being called, and installation is not close enough to completion!");
|
||||||
|
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
}
|
||||||
|
strongSelf.communicator = nil;
|
||||||
|
strongSelf.activeConnection = nil;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
[newConnection resume];
|
||||||
|
|
||||||
|
self.communicator = newConnection.remoteObjectProxy;
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)start
|
||||||
|
{
|
||||||
|
[self.xpcListener resume];
|
||||||
|
[self.agentConnection startListener];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
if (!self.receivedInstallationData) {
|
||||||
|
SULog(SULogLevelError, @"Timeout: installation data was never received");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self.agentConnection.connected) {
|
||||||
|
SULog(SULogLevelError, @"Timeout: agent connection was never initiated");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)extractAndInstallUpdate
|
||||||
|
{
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
|
||||||
|
|
||||||
|
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
|
||||||
|
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword];
|
||||||
|
|
||||||
|
BOOL success = NO;
|
||||||
|
if (!unarchiver) {
|
||||||
|
SULog(SULogLevelError, @"Error: No valid unarchiver for %@", archivePath);
|
||||||
|
|
||||||
|
success = NO;
|
||||||
|
} else {
|
||||||
|
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
|
||||||
|
|
||||||
|
// Delta & package updates will require validation before extraction
|
||||||
|
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or DSA keys
|
||||||
|
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||||
|
|
||||||
|
if (needsPrevalidation) {
|
||||||
|
success = [self.updateValidator validateDownloadPath];
|
||||||
|
} else {
|
||||||
|
success = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
[self unarchiverDidFail];
|
||||||
|
} else {
|
||||||
|
[unarchiver
|
||||||
|
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
|
||||||
|
if (error != nil) {
|
||||||
|
[self unarchiverDidFail];
|
||||||
|
} else {
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
|
||||||
|
|
||||||
|
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath];
|
||||||
|
|
||||||
|
if (!validationSuccess) {
|
||||||
|
SULog(SULogLevelError, @"Error: update validation was a failure");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
} else {
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
|
||||||
|
|
||||||
|
self.finishedValidation = YES;
|
||||||
|
if (self.agentInitiatedConnection) {
|
||||||
|
[self retrieveProcessIdentifierAndStartInstallation];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
progressBlock:^(double progress) {
|
||||||
|
if (sizeof(progress) == sizeof(uint64_t)) {
|
||||||
|
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
|
||||||
|
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
|
||||||
|
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)unarchiverDidFail
|
||||||
|
{
|
||||||
|
// No longer need update validator until next possible extraction (eg: if initial delta update fails)
|
||||||
|
self.updateValidator = nil;
|
||||||
|
|
||||||
|
// Client could try update again with different inputs
|
||||||
|
// Eg: one common case is if a delta update fails, client may want to fall back to regular update
|
||||||
|
// We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data,
|
||||||
|
// but may as well set other fields to nil too
|
||||||
|
self.updateDirectoryPath = nil;
|
||||||
|
self.downloadName = nil;
|
||||||
|
self.decryptionPassword = nil;
|
||||||
|
self.signatures = nil;
|
||||||
|
self.relaunchPath = nil;
|
||||||
|
self.host = nil;
|
||||||
|
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:[NSData data]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)agentConnectionDidInitiate
|
||||||
|
{
|
||||||
|
self.agentInitiatedConnection = YES;
|
||||||
|
if (self.finishedValidation) {
|
||||||
|
[self retrieveProcessIdentifierAndStartInstallation];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)agentConnectionDidInvalidate
|
||||||
|
{
|
||||||
|
if (!self.finishedValidation || !self.agentInitiatedConnection) {
|
||||||
|
SULog(SULogLevelError, @"Error: Agent connection invalidated before installation began");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)retrieveProcessIdentifierAndStartInstallation
|
||||||
|
{
|
||||||
|
// We use the relaunch path for the bundle to listen for termination instead of the host path
|
||||||
|
// For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates
|
||||||
|
// Otherwise for an app, the relaunch path and host path should be identical
|
||||||
|
|
||||||
|
[self.agentConnection.agent registerApplicationBundlePath:self.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier];
|
||||||
|
[self startInstallation];
|
||||||
|
});
|
||||||
|
}];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
if (self.terminationListener == nil) {
|
||||||
|
SULog(SULogLevelError, @"Timeout error: failed to retreive process identifier from agent");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
|
||||||
|
{
|
||||||
|
if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// Mark that we have received the installation data
|
||||||
|
// Do not rely on eg: self.ipdateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
|
||||||
|
self.receivedInstallationData = YES;
|
||||||
|
|
||||||
|
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
|
||||||
|
if (installationData == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to unarchive input installation data");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *installationType = installationData.installationType;
|
||||||
|
if (!SPUValidInstallationType(installationType)) {
|
||||||
|
SULog(SULogLevelError, @"Error: Received invalid installation type: %@", installationType);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath];
|
||||||
|
|
||||||
|
NSString *bundleIdentifier = hostBundle.bundleIdentifier;
|
||||||
|
if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will be important later
|
||||||
|
if (installationData.relaunchPath == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to obtain relaunch path from installation data");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This installation path is specific to sparkle and the bundle identifier
|
||||||
|
NSString *rootCacheInstallationPath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"Installation"];
|
||||||
|
|
||||||
|
[SPULocalCacheDirectory removeOldItemsInDirectory:rootCacheInstallationPath];
|
||||||
|
|
||||||
|
NSString *cacheInstallationPath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootCacheInstallationPath];
|
||||||
|
if (cacheInstallationPath == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to create installation cache directory in %@", rootCacheInstallationPath);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the download archive to somewhere where probably only we will be touching it
|
||||||
|
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
|
||||||
|
// When this tool is ran as root, we are moving it into a directory that only root will have access to
|
||||||
|
NSURL *downloadURL = [[NSURL fileURLWithPath:installationData.updateDirectoryPath] URLByAppendingPathComponent:installationData.downloadName];
|
||||||
|
|
||||||
|
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:installationData.downloadName];
|
||||||
|
|
||||||
|
NSError *moveError = nil;
|
||||||
|
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to move download archive to new location: %@", moveError);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the downloaded archive we moved over is a regular file and not a symbolic link placed by an attacker
|
||||||
|
NSError *attributesError = nil;
|
||||||
|
NSString *downloadDestinationPath = downloadDestinationURL.path;
|
||||||
|
if (downloadDestinationPath == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to retrieve download archive path from %@", downloadDestinationURL);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSDictionary<NSString *, id> *archiveAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:downloadDestinationPath error:&attributesError];
|
||||||
|
|
||||||
|
if (archiveAttributes == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to retrieve download archive attributes from %@", downloadDestinationPath);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![(NSString *)archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) {
|
||||||
|
SULog(SULogLevelError, @"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]);
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Carry these properities separately rather than using the SUInstallationInputData object
|
||||||
|
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
|
||||||
|
self.installationType = installationType;
|
||||||
|
self.relaunchPath = installationData.relaunchPath;
|
||||||
|
self.downloadName = installationData.downloadName;
|
||||||
|
self.signatures = installationData.signatures;
|
||||||
|
self.updateDirectoryPath = cacheInstallationPath;
|
||||||
|
self.host = [[SUHost alloc] initWithBundle:hostBundle];
|
||||||
|
|
||||||
|
[self extractAndInstallUpdate];
|
||||||
|
});
|
||||||
|
} else if (identifier == SPUSentUpdateAppcastItemData) {
|
||||||
|
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
|
||||||
|
if (updateItem != nil) {
|
||||||
|
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
|
||||||
|
|
||||||
|
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
|
||||||
|
if (archivedData != nil) {
|
||||||
|
[self.agentConnection.agent registerInstallationInfoData:archivedData];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
|
||||||
|
// Because anyone can ask us to resume the installation, it may be wise to think about backwards compatibility here if IPC changes
|
||||||
|
uint8_t relaunch = *((const uint8_t *)data.bytes);
|
||||||
|
uint8_t showsUI = *((const uint8_t *)data.bytes + 1);
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
|
||||||
|
self.shouldShowUI = (BOOL)showsUI;
|
||||||
|
// Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
|
||||||
|
self.shouldRelaunch = (BOOL)relaunch;
|
||||||
|
|
||||||
|
if (self.performedStage1Installation) {
|
||||||
|
// Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch
|
||||||
|
dispatch_async(self.installerQueue, ^{
|
||||||
|
[self performStage2InstallationIfNeeded];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (identifier == SPUUpdaterAlivePong) {
|
||||||
|
self.receivedUpdaterPong = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startInstallation
|
||||||
|
{
|
||||||
|
self.willCompleteInstallation = YES;
|
||||||
|
|
||||||
|
self.installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL);
|
||||||
|
|
||||||
|
dispatch_async(self.installerQueue, ^{
|
||||||
|
NSError *installerError = nil;
|
||||||
|
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
|
||||||
|
|
||||||
|
if (installer == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to create installer instance with error: %@", installerError);
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSError *firstStageError = nil;
|
||||||
|
if (![installer performInitialInstallation:&firstStageError]) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to start installer with error: %@", firstStageError);
|
||||||
|
self.installer = nil;
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
self.installer = installer;
|
||||||
|
|
||||||
|
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||||
|
|
||||||
|
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
|
||||||
|
|
||||||
|
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
|
||||||
|
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
|
||||||
|
|
||||||
|
self.performedStage1Installation = YES;
|
||||||
|
|
||||||
|
// Stage 2 can still be run before we finish installation
|
||||||
|
// if the updater requests for it before the app is terminated
|
||||||
|
[self finishInstallationAfterHostTermination];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)performStage2InstallationIfNeeded
|
||||||
|
{
|
||||||
|
if (self.performedStage2Installation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL performedSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
|
||||||
|
if (performedSecondStage) {
|
||||||
|
self.performedStage2Installation = YES;
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
|
||||||
|
|
||||||
|
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
|
||||||
|
|
||||||
|
// Don't check if the target is already terminated, leave that to the progress agent
|
||||||
|
// We could be slightly off if there were multiple instances running
|
||||||
|
[self.agentConnection.agent sendTerminationSignal];
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently");
|
||||||
|
self.installer = nil;
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)finishInstallationAfterHostTermination
|
||||||
|
{
|
||||||
|
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
|
||||||
|
if (!success) {
|
||||||
|
SULog(SULogLevelError, @"Failed to listen for application termination");
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show our installer progress UI tool if only after a certain amount of time passes,
|
||||||
|
// and if our installer is silent (i.e, doesn't show progress on its own)
|
||||||
|
__block BOOL shouldShowUIProgress = YES;
|
||||||
|
if (self.shouldShowUI && [self.installer canInstallSilently]) {
|
||||||
|
// Ask the updater if it is still alive
|
||||||
|
// If they are, we will receive a pong response back
|
||||||
|
// Reset if we received a pong just to be on the safe side
|
||||||
|
self.receivedUpdaterPong = NO;
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
// Make sure we're still eligible for showing the installer progress
|
||||||
|
// Also if the updater process is still alive, showing the progress should not be our duty
|
||||||
|
// if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil,
|
||||||
|
// this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater
|
||||||
|
if (shouldShowUIProgress && (!self.receivedUpdaterPong || self.communicator == nil)) {
|
||||||
|
[self.agentConnection.agent showProgress];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch_async(self.installerQueue, ^{
|
||||||
|
[self performStage2InstallationIfNeeded];
|
||||||
|
|
||||||
|
if (!self.performedStage2Installation) {
|
||||||
|
// We failed and we're going to exit shortly
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used later for relaunching
|
||||||
|
// Compute this now before we set this installer property to nil
|
||||||
|
NSString *installationPath = [self.installer installationPath];
|
||||||
|
|
||||||
|
NSError *thirdStageError = nil;
|
||||||
|
if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
|
||||||
|
SULog(SULogLevelError, @"Failed to finalize installation with error: %@", thirdStageError);
|
||||||
|
|
||||||
|
self.installer = nil;
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_FAILURE];
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.performedStage3Installation = YES;
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// Make sure to stop our displayed progress before we move onto cleanup & relaunch
|
||||||
|
// This will also stop the agent from broadcasting the status info service, which we want to do before
|
||||||
|
// we relaunch the app because the relaunched app could check the service upon launch..
|
||||||
|
[self.agentConnection.agent stopProgress];
|
||||||
|
shouldShowUIProgress = NO;
|
||||||
|
|
||||||
|
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
|
||||||
|
|
||||||
|
if (self.shouldRelaunch) {
|
||||||
|
NSString *pathToRelaunch = nil;
|
||||||
|
// If the relaunch path is the same as the host bundle path, use the installation path from the installer which may be normalized
|
||||||
|
// Otherwise use the requested relaunch path in all other cases
|
||||||
|
if ([self.relaunchPath.pathComponents isEqualToArray:self.host.bundlePath.pathComponents]) {
|
||||||
|
pathToRelaunch = installationPath;
|
||||||
|
} else {
|
||||||
|
pathToRelaunch = self.relaunchPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will also signal to the agent that it will terminate soon
|
||||||
|
[self.agentConnection.agent relaunchPath:pathToRelaunch];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn))
|
||||||
|
{
|
||||||
|
// It's nice to tell the other end we're invalidating
|
||||||
|
|
||||||
|
[self.activeConnection invalidate];
|
||||||
|
self.activeConnection = nil;
|
||||||
|
|
||||||
|
[self.xpcListener invalidate];
|
||||||
|
self.xpcListener = nil;
|
||||||
|
|
||||||
|
[self.agentConnection invalidate];
|
||||||
|
self.agentConnection = nil;
|
||||||
|
|
||||||
|
if (self.updateDirectoryPath != nil) {
|
||||||
|
NSError *theError = nil;
|
||||||
|
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
|
||||||
|
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// SPUInstallationInfo.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 4/10/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class SUAppcastItem;
|
||||||
|
|
||||||
|
@interface SPUInstallationInfo : NSObject <NSSecureCoding>
|
||||||
|
|
||||||
|
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) SUAppcastItem *appcastItem;
|
||||||
|
@property (nonatomic, readonly) BOOL canSilentlyInstall;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
//
|
||||||
|
// SPUInstallationInfo.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 4/10/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SPUInstallationInfo.h"
|
||||||
|
#import "SUAppcastItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
static NSString *SUAppcastItemKey = @"SUAppcastItem";
|
||||||
|
static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall";
|
||||||
|
|
||||||
|
@implementation SPUInstallationInfo
|
||||||
|
|
||||||
|
@synthesize appcastItem = _appcastItem;
|
||||||
|
@synthesize canSilentlyInstall = _canSilentlyInstall;
|
||||||
|
|
||||||
|
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentlyInstall
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_appcastItem = appcastItem;
|
||||||
|
_canSilentlyInstall = canSilentlyInstall;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
|
||||||
|
{
|
||||||
|
SUAppcastItem *appcastItem = [decoder decodeObjectOfClass:[SUAppcastItem class] forKey:SUAppcastItemKey];
|
||||||
|
if (appcastItem == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL canSilentlyInstall = [decoder decodeBoolForKey:SUCanSilentlyInstallKey];
|
||||||
|
return [self initWithAppcastItem:appcastItem canSilentlyInstall:canSilentlyInstall];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)encodeWithCoder:(NSCoder *)coder
|
||||||
|
{
|
||||||
|
[coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
|
||||||
|
[coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)supportsSecureCoding
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// SPUInstallationInputData.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/24/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@class SUSignatures;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface SPUInstallationInputData : NSObject <NSSecureCoding>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* relaunchPath - path to application bundle to relaunch and listen for termination
|
||||||
|
* hostBundlePath - path to host bundle to update & replace
|
||||||
|
* updateDirectoryPath - path to update directory (i.e, temporary directory containing the new update archive)
|
||||||
|
* downloadName - name of update archive in update directory
|
||||||
|
* signatures - signatures for the update that came from the appcast item
|
||||||
|
* decryptionPassword - optional decryption password for dmg archives
|
||||||
|
*/
|
||||||
|
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||||
|
|
||||||
|
@property (nonatomic, copy, readonly) NSString *relaunchPath;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *downloadName;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *installationType;
|
||||||
|
@property (nonatomic, strong, readonly) SUSignatures *signatures;
|
||||||
|
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
//
|
||||||
|
// SPUInstallationInputData.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/24/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SPUInstallationInputData.h"
|
||||||
|
#import "SPUInstallationType.h"
|
||||||
|
#import "SUSignatures.h"
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
static NSString *SURelaunchPathKey = @"SURelaunchPath";
|
||||||
|
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
|
||||||
|
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
|
||||||
|
static NSString *SUDownloadNameKey = @"SUDownloadName";
|
||||||
|
static NSString *SUSignaturesKey = @"SUSignatures";
|
||||||
|
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
|
||||||
|
static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||||
|
|
||||||
|
@implementation SPUInstallationInputData
|
||||||
|
|
||||||
|
@synthesize relaunchPath = _relaunchPath;
|
||||||
|
@synthesize hostBundlePath = _hostBundlePath;
|
||||||
|
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||||
|
@synthesize downloadName = _downloadName;
|
||||||
|
@synthesize signatures = _signatures;
|
||||||
|
@synthesize decryptionPassword = _decryptionPassword;
|
||||||
|
@synthesize installationType = _installationType;
|
||||||
|
|
||||||
|
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_relaunchPath = [relaunchPath copy];
|
||||||
|
_hostBundlePath = [hostBundlePath copy];
|
||||||
|
_updateDirectoryPath = [updateDirectoryPath copy];
|
||||||
|
_downloadName = [downloadName copy];
|
||||||
|
|
||||||
|
_installationType = [installationType copy];
|
||||||
|
assert(SPUValidInstallationType(_installationType));
|
||||||
|
|
||||||
|
_signatures = signatures;
|
||||||
|
_decryptionPassword = [decryptionPassword copy];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
|
||||||
|
{
|
||||||
|
NSString *relaunchPath = [decoder decodeObjectOfClass:[NSString class] forKey:SURelaunchPathKey];
|
||||||
|
if (relaunchPath == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *hostBundlePath = [decoder decodeObjectOfClass:[NSString class] forKey:SUHostBundlePathKey];
|
||||||
|
if (hostBundlePath == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *updateDirectoryPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUUpdateDirectoryPathKey];
|
||||||
|
if (updateDirectoryPath == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *downloadName = [decoder decodeObjectOfClass:[NSString class] forKey:SUDownloadNameKey];
|
||||||
|
if (downloadName == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *installationType = [decoder decodeObjectOfClass:[NSString class] forKey:SUInstallationTypeKey];
|
||||||
|
if (!SPUValidInstallationType(installationType)) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
SUSignatures *signatures = [decoder decodeObjectOfClass:[SUSignatures class] forKey:SUSignaturesKey];
|
||||||
|
if (signatures == nil) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
|
||||||
|
|
||||||
|
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)encodeWithCoder:(NSCoder *)coder
|
||||||
|
{
|
||||||
|
[coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey];
|
||||||
|
[coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey];
|
||||||
|
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
|
||||||
|
[coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
|
||||||
|
[coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
|
||||||
|
[coder encodeObject:self.signatures forKey:SUSignaturesKey];
|
||||||
|
if (self.decryptionPassword != nil) {
|
||||||
|
[coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)supportsSecureCoding
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//
|
||||||
|
// SPUMessageTypes.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/11/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class SUHost;
|
||||||
|
|
||||||
|
extern NSString *SPUAppcastItemArchiveKey;
|
||||||
|
|
||||||
|
// Order matters; higher stages have higher values.
|
||||||
|
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
|
||||||
|
{
|
||||||
|
SPUInstallerNotStarted = 0,
|
||||||
|
SPUExtractionStarted = 1,
|
||||||
|
SPUExtractedArchiveWithProgress = 2,
|
||||||
|
SPUArchiveExtractionFailed = 3,
|
||||||
|
SPUValidationStarted = 4,
|
||||||
|
SPUInstallationStartedStage1 = 5,
|
||||||
|
SPUInstallationFinishedStage1 = 6,
|
||||||
|
SPUInstallationFinishedStage2 = 7,
|
||||||
|
SPUInstallationFinishedStage3 = 8,
|
||||||
|
SPUUpdaterAlivePing = 9
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
|
||||||
|
{
|
||||||
|
SPUInstallationData = 0,
|
||||||
|
SPUSentUpdateAppcastItemData = 1,
|
||||||
|
SPUResumeInstallationToStage2 = 2,
|
||||||
|
SPUUpdaterAlivePong = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
|
||||||
|
|
||||||
|
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||||
|
|
||||||
|
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||||
|
|
||||||
|
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
//
|
||||||
|
// SPUMessageTypes.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/11/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SPUMessageTypes.h"
|
||||||
|
#import "SUHost.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive";
|
||||||
|
|
||||||
|
// Tags added to the bundle identifier which is used as Mach service names
|
||||||
|
// These should be very short because length restrictions exist on earlier versions of macOS
|
||||||
|
#define SPARKLE_INSTALLER_TAG @"-spki"
|
||||||
|
#define SPARKLE_STATUS_TAG @"-spks"
|
||||||
|
#define SPARKLE_PROGRESS_TAG @"-spkp"
|
||||||
|
#define SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG @"-spkl"
|
||||||
|
|
||||||
|
// macOS 10.8 at least can't handle service names that are 64 characters or longer
|
||||||
|
// This was fixed some point after 10.8, but I'm not sure if it was fixed in 10.9 or 10.10 or 10.11
|
||||||
|
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
|
||||||
|
#define MAX_SERVICE_NAME_LENGTH 63u
|
||||||
|
|
||||||
|
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
|
||||||
|
{
|
||||||
|
BOOL legal;
|
||||||
|
switch (newMessageType) {
|
||||||
|
case SPUInstallerNotStarted:
|
||||||
|
legal = (oldMessageType == SPUInstallerNotStarted);
|
||||||
|
break;
|
||||||
|
case SPUExtractionStarted:
|
||||||
|
legal = (oldMessageType == SPUInstallerNotStarted);
|
||||||
|
break;
|
||||||
|
case SPUExtractedArchiveWithProgress:
|
||||||
|
case SPUArchiveExtractionFailed:
|
||||||
|
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
|
||||||
|
break;
|
||||||
|
case SPUValidationStarted:
|
||||||
|
legal = (oldMessageType == SPUExtractionStarted || oldMessageType == SPUExtractedArchiveWithProgress);
|
||||||
|
break;
|
||||||
|
case SPUInstallationStartedStage1:
|
||||||
|
legal = (oldMessageType == SPUValidationStarted);
|
||||||
|
break;
|
||||||
|
case SPUInstallationFinishedStage1:
|
||||||
|
legal = (oldMessageType == SPUInstallationStartedStage1);
|
||||||
|
break;
|
||||||
|
case SPUInstallationFinishedStage2:
|
||||||
|
legal = (oldMessageType == SPUInstallationFinishedStage1);
|
||||||
|
break;
|
||||||
|
case SPUInstallationFinishedStage3:
|
||||||
|
legal = (oldMessageType == SPUInstallationFinishedStage2);
|
||||||
|
break;
|
||||||
|
case SPUUpdaterAlivePing:
|
||||||
|
// Having this state being dependent on other installation states would make the complicate our logic
|
||||||
|
// So just always allow this type of message
|
||||||
|
legal = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return legal;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *SPUServiceNameWithTag(NSString *tagName, NSString *bundleIdentifier)
|
||||||
|
{
|
||||||
|
NSString *serviceName = [bundleIdentifier stringByAppendingString:tagName];
|
||||||
|
NSUInteger length = MIN(serviceName.length, MAX_SERVICE_NAME_LENGTH);
|
||||||
|
// If the service name is too long, cut off the beginning rather than cutting off the end
|
||||||
|
// This should lead to a more unique name
|
||||||
|
return [serviceName substringFromIndex:serviceName.length - length];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier)
|
||||||
|
{
|
||||||
|
return SPUServiceNameWithTag(SPARKLE_INSTALLER_TAG, bundleIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier)
|
||||||
|
{
|
||||||
|
return SPUServiceNameWithTag(SPARKLE_STATUS_TAG, bundleIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier)
|
||||||
|
{
|
||||||
|
return SPUServiceNameWithTag(SPARKLE_PROGRESS_TAG, bundleIdentifier);
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -14,27 +14,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <xar/xar.h>
|
#include <xar/xar.h>
|
||||||
#include <Availability.h>
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
|
||||||
#define HAS_XAR_GET_SAFE_PATH 1
|
|
||||||
#else
|
|
||||||
#define HAS_XAR_GET_SAFE_PATH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_XAR_GET_SAFE_PATH
|
|
||||||
// This is preferred over xar_get_path (which is deprecated) when it's available
|
|
||||||
// Don't use OS availability for this API
|
|
||||||
extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||||
{
|
{
|
||||||
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
||||||
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
|
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
|
||||||
const char *argv[] = { "/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation] };
|
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
|
||||||
BOOL success = (bspatch(4, argv) == 0);
|
BOOL success = (bspatch(4, argv) == 0);
|
||||||
unlink([patchFile fileSystemRepresentation]);
|
unlink([patchFile fileSystemRepresentation]);
|
||||||
return success;
|
return success;
|
||||||
@@ -99,8 +87,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
|
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
|
||||||
}
|
}
|
||||||
@@ -108,36 +94,18 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_XAR_GET_SAFE_PATH
|
|
||||||
// Reject patches that did not generate valid hierarchical xar container paths
|
|
||||||
// These will not succeed to patch using recent versions of BinaryDelta
|
|
||||||
if ((majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) || (majorDiffVersion == SUBinaryDeltaMajorVersion1 && minorDiffVersion < 2)) {
|
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"This patch version (%u.%u) is too old and potentially unsafe to apply. Please re-generate the patch using the latest version of BinaryDelta or generate_appcast. New version %u.%u patches will still be compatible with older versions of Sparkle.", majorDiffVersion, minorDiffVersion, majorDiffVersion, latestMinorVersionForMajorVersion(majorDiffVersion)] }];
|
|
||||||
}
|
|
||||||
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
|
||||||
|
|
||||||
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
||||||
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
||||||
|
|
||||||
if (!expectedBeforeHash || !expectedAfterHash) {
|
if (!expectedBeforeHash || !expectedAfterHash) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: @"Unable to find before-sha1 or after-sha1 metadata in delta. Giving up." }];
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: @"Unable to find before-sha1 or after-sha1 metadata in delta. Giving up." }];
|
||||||
}
|
}
|
||||||
@@ -153,8 +121,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
||||||
if (!beforeHash) {
|
if (!beforeHash) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -165,8 +131,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -183,8 +147,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
progressCallback(2/6.0);
|
progressCallback(2/6.0);
|
||||||
|
|
||||||
if (!removeTree(destination)) {
|
if (!removeTree(destination)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -197,8 +159,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
progressCallback(3/6.0);
|
progressCallback(3/6.0);
|
||||||
|
|
||||||
if (!copyTree(source, destination)) {
|
if (!copyTree(source, destination)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -210,7 +170,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
progressCallback(4/6.0);
|
progressCallback(4/6.0);
|
||||||
|
|
||||||
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nPatching...");
|
fprintf(stderr, "\nPatching...");
|
||||||
@@ -219,65 +179,17 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
xar_file_t file;
|
xar_file_t file;
|
||||||
xar_iter_t iter = xar_iter_new();
|
xar_iter_t iter = xar_iter_new();
|
||||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
||||||
char *pathCString;
|
NSString *path = @(xar_get_path(file));
|
||||||
#if HAS_XAR_GET_SAFE_PATH
|
|
||||||
if (xar_get_safe_path != NULL) {
|
|
||||||
pathCString = xar_get_safe_path(file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
pathCString = xar_get_path(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pathCString == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *path = @(pathCString);
|
|
||||||
if ([path.pathComponents containsObject:@".."]) {
|
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", path] }];
|
|
||||||
}
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
||||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
||||||
{
|
|
||||||
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
|
|
||||||
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
|
|
||||||
|
|
||||||
// It is OK for the directory parent to not exist if it has already been removed
|
|
||||||
if (destinationParentDirectoryAttributes != nil) {
|
|
||||||
// But if it does exist, make sure the entry in the parent directory we're looking at is good
|
|
||||||
// If it's inside a symlink, this is not good in any circumstance
|
|
||||||
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
|
|
||||||
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
|
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
|
|
||||||
}
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
|
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
|
||||||
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
|
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
|
||||||
BOOL removedFile = NO;
|
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;
|
const char *value;
|
||||||
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
||||||
if (!removeTree(destinationFilePath)) {
|
if (!removeTree(destinationFilePath)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -298,8 +210,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
||||||
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -315,8 +225,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
|
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
|
||||||
|
|
||||||
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -340,8 +248,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
|
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
|
||||||
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
||||||
if (!modifyPermissions(destinationFilePath, mode)) {
|
if (!modifyPermissions(destinationFilePath, mode)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -356,7 +262,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xar_close(x);
|
xar_close(x);
|
||||||
|
|
||||||
progressCallback(5/6.0);
|
progressCallback(5/6.0);
|
||||||
@@ -53,14 +53,15 @@
|
|||||||
|
|
||||||
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||||
{
|
{
|
||||||
SUBinaryDeltaMajorVersion1 = 1,
|
SUAzureMajorVersion = 1,
|
||||||
SUBinaryDeltaMajorVersion2 = 2
|
SUBeigeMajorVersion = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion1
|
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
|
||||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion2
|
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
|
||||||
|
|
||||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||||
|
extern NSData *hashOfFileContents(FTSENT *ent);
|
||||||
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
||||||
extern NSString *hashOfTree(NSString *path);
|
extern NSString *hashOfTree(NSString *path);
|
||||||
extern BOOL removeTree(NSString *path);
|
extern BOOL removeTree(NSString *path);
|
||||||
@@ -42,10 +42,10 @@ NSString *stringWithFileSystemRepresentation(const char *input)
|
|||||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||||
{
|
{
|
||||||
switch (majorVersion) {
|
switch (majorVersion) {
|
||||||
case SUBinaryDeltaMajorVersion1:
|
case SUAzureMajorVersion:
|
||||||
|
return 1;
|
||||||
|
case SUBeigeMajorVersion:
|
||||||
return 2;
|
return 2;
|
||||||
case SUBinaryDeltaMajorVersion2:
|
|
||||||
return 3;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -137,6 +137,15 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
|||||||
return YES;
|
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)
|
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||||
{
|
{
|
||||||
char pathBuffer[PATH_MAX] = { 0 };
|
char pathBuffer[PATH_MAX] = { 0 };
|
||||||
@@ -162,7 +171,7 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
|||||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,13 +188,8 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
|||||||
const char *relativePathBytes = [relativePath fileSystemRepresentation];
|
const char *relativePathBytes = [relativePath fileSystemRepresentation];
|
||||||
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
|
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
|
||||||
|
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
||||||
uint16_t mode = ent->fts_statp->st_mode;
|
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 type = ent->fts_info;
|
||||||
uint16_t permissions = mode & PERMISSION_FLAGS;
|
uint16_t permissions = mode & PERMISSION_FLAGS;
|
||||||
|
|
||||||
@@ -223,7 +227,8 @@ BOOL removeTree(NSString *path)
|
|||||||
|
|
||||||
BOOL copyTree(NSString *source, NSString *dest)
|
BOOL copyTree(NSString *source, NSString *dest)
|
||||||
{
|
{
|
||||||
return [[SUFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
|
// SUFileManager will be more reliable for copying items especially across network mounts
|
||||||
|
return [[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
|
BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
|
||||||
File renamed without changes.
@@ -66,23 +66,25 @@ extern int bsdiff(int argc, const char **argv);
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#define INFO_PATH_KEY @"path"
|
#define INFO_HASH_KEY @"hash"
|
||||||
#define INFO_TYPE_KEY @"type"
|
#define INFO_TYPE_KEY @"type"
|
||||||
#define INFO_PERMISSIONS_KEY @"permissions"
|
#define INFO_PERMISSIONS_KEY @"permissions"
|
||||||
#define INFO_SIZE_KEY @"size"
|
#define INFO_SIZE_KEY @"size"
|
||||||
|
|
||||||
static NSDictionary *infoForFile(FTSENT *ent)
|
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;
|
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
|
||||||
|
|
||||||
assert(ent->fts_statp != NULL);
|
assert(ent->fts_statp != NULL);
|
||||||
|
|
||||||
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
|
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
|
||||||
|
|
||||||
NSString *path = @(ent->fts_path);
|
return @{ INFO_HASH_KEY: hash,
|
||||||
assert(path != nil);
|
|
||||||
|
|
||||||
return @{ INFO_PATH_KEY: path != nil ? path : @"",
|
|
||||||
INFO_TYPE_KEY: @(ent->fts_info),
|
INFO_TYPE_KEY: @(ent->fts_info),
|
||||||
INFO_PERMISSIONS_KEY: @(permissions),
|
INFO_PERMISSIONS_KEY: @(permissions),
|
||||||
INFO_SIZE_KEY: @(size) };
|
INFO_SIZE_KEY: @(size) };
|
||||||
@@ -172,19 +174,12 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
|
||||||
if (originalInfoType != newInfoType) {
|
|
||||||
// File types are different
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
if ([(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) {
|
||||||
NSString *newPath = newInfo[INFO_PATH_KEY];
|
// this is possible if just the permissions have changed
|
||||||
|
|
||||||
// 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;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,20 +205,11 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
|
||||||
|
|
||||||
if (originalInfoType != newInfoType) {
|
|
||||||
// File types are different
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
if (![(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_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;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,52 +233,6 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
|
|||||||
return YES;
|
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)
|
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error)
|
||||||
{
|
{
|
||||||
assert(source);
|
assert(source);
|
||||||
@@ -439,12 +379,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
|
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
|
||||||
// inside an application, and since we don't preserve extended attribitutes anyway
|
// inside an application, and since we don't preserve extended attribitutes anyway
|
||||||
|
|
||||||
mode_t permissions = [(NSNumber *)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
mode_t permissions = [(NSNumber*)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||||
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
|
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
|
||||||
permissions = 0755;
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nwarning: file permissions %o of '%s' won't be preserved in the delta update (only permissions with modes 0755 and 0644 are supported).\n", permissions & PERMISSION_FLAGS, ent->fts_path);
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid file permissions after-tree on file %@ (only permissions with modes 0755 and 0644 are supported)", @(ent->fts_path)] }];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aclExists(ent)) {
|
if (aclExists(ent)) {
|
||||||
@@ -527,8 +470,8 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
|
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
|
||||||
|
|
||||||
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
|
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
|
||||||
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
|
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
|
||||||
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
|
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
|
||||||
|
|
||||||
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
|
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
|
||||||
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
|
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
|
||||||
@@ -546,14 +489,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
|
|
||||||
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
NSMutableDictionary<NSString *, NSValue *> *fileTable = [NSMutableDictionary dictionary];
|
|
||||||
|
|
||||||
for (NSString *key in keys) {
|
for (NSString *key in keys) {
|
||||||
id value = [newTreeState valueForKey:key];
|
id value = [newTreeState valueForKey:key];
|
||||||
|
|
||||||
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||||
|
|
||||||
@@ -566,9 +506,9 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
NSDictionary *originalInfo = originalTreeState[key];
|
NSDictionary *originalInfo = originalTreeState[key];
|
||||||
NSDictionary *newInfo = newTreeState[key];
|
NSDictionary *newInfo = newTreeState[key];
|
||||||
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldSkipExtracting(originalInfo, newInfo)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldSkipExtracting(originalInfo, newInfo)) {
|
||||||
if (shouldChangePermissions(originalInfo, newInfo)) {
|
if (shouldChangePermissions(originalInfo, newInfo)) {
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
||||||
|
|
||||||
@@ -578,18 +518,18 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSString *path = [destination stringByAppendingPathComponent:key];
|
NSString *path = [destination stringByAppendingPathComponent:key];
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, path);
|
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
|
|
||||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||||
} else {
|
} else {
|
||||||
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
|
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
||||||
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +543,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSNumber *permissions =
|
NSNumber *permissions =
|
||||||
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldChangePermissions(originalInfo, newInfo)) ?
|
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldChangePermissions(originalInfo, newInfo)) ?
|
||||||
newInfo[INFO_PERMISSIONS_KEY] :
|
newInfo[INFO_PERMISSIONS_KEY] :
|
||||||
nil;
|
nil;
|
||||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
||||||
@@ -630,7 +570,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, [operation relativePath], resultPath);
|
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
||||||
unlink([resultPath fileSystemRepresentation]);
|
unlink([resultPath fileSystemRepresentation]);
|
||||||
@@ -648,7 +588,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
|
|
||||||
NSFileManager *filemgr;
|
NSFileManager *filemgr;
|
||||||
filemgr = [NSFileManager defaultManager];
|
filemgr = [NSFileManager defaultManager];
|
||||||
|
|
||||||
[filemgr removeItemAtPath: patchFile error: NULL];
|
[filemgr removeItemAtPath: patchFile error: NULL];
|
||||||
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
|
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
|
||||||
{
|
{
|
||||||
@@ -30,14 +30,14 @@ static void printUsage(NSString *programName)
|
|||||||
fprintf(stderr, "%s version [<patch-file>]\n", [programName UTF8String]);
|
fprintf(stderr, "%s version [<patch-file>]\n", [programName UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
|
static BOOL runCreateCommand(NSString *programName, NSArray *args)
|
||||||
{
|
{
|
||||||
if (args.count < 3 || args.count > 5) {
|
if (args.count < 3 || args.count > 5) {
|
||||||
printUsage(programName);
|
printUsage(programName);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUInteger numberOfFlagsFound = 0;
|
NSUInteger numberOflagsFound = 0;
|
||||||
NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG];
|
NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG];
|
||||||
NSUInteger versionIndex = NSNotFound;
|
NSUInteger versionIndex = NSNotFound;
|
||||||
for (NSUInteger argumentIndex = 0; argumentIndex < args.count; ++argumentIndex) {
|
for (NSUInteger argumentIndex = 0; argumentIndex < args.count; ++argumentIndex) {
|
||||||
@@ -48,13 +48,13 @@ static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verboseIndex != NSNotFound) {
|
if (verboseIndex != NSNotFound) {
|
||||||
++numberOfFlagsFound;
|
++numberOflagsFound;
|
||||||
}
|
}
|
||||||
if (versionIndex != NSNotFound) {
|
if (versionIndex != NSNotFound) {
|
||||||
++numberOfFlagsFound;
|
++numberOflagsFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.count - numberOfFlagsFound < 3) {
|
if (args.count - numberOflagsFound < 3) {
|
||||||
printUsage(programName);
|
printUsage(programName);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
BOOL verbose = (verboseIndex != NSNotFound);
|
BOOL verbose = (verboseIndex != NSNotFound);
|
||||||
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
|
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
|
||||||
|
|
||||||
NSArray<NSString *> *versionComponents = nil;
|
NSArray *versionComponents = nil;
|
||||||
if (versionField) {
|
if (versionField) {
|
||||||
versionComponents = [versionField componentsSeparatedByString:@"="];
|
versionComponents = [versionField componentsSeparatedByString:@"="];
|
||||||
if (versionComponents.count != 2) {
|
if (versionComponents.count != 2) {
|
||||||
@@ -124,7 +124,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL runApplyCommand(NSString *programName, NSArray<NSString *> *args)
|
static BOOL runApplyCommand(NSString *programName, NSArray *args)
|
||||||
{
|
{
|
||||||
if (args.count < 3 || args.count > 4) {
|
if (args.count < 3 || args.count > 4) {
|
||||||
printUsage(programName);
|
printUsage(programName);
|
||||||
@@ -138,7 +138,7 @@ static BOOL runApplyCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray<NSString *> *fileArgs = [NSMutableArray array];
|
NSMutableArray *fileArgs = [NSMutableArray array];
|
||||||
for (NSString *argument in args) {
|
for (NSString *argument in args) {
|
||||||
if (![argument isEqualToString:VERBOSE_FLAG]) {
|
if (![argument isEqualToString:VERBOSE_FLAG]) {
|
||||||
[fileArgs addObject:argument];
|
[fileArgs addObject:argument];
|
||||||
@@ -172,7 +172,7 @@ static BOOL runApplyCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL runVersionCommand(NSString *programName, NSArray<NSString *> *args)
|
static BOOL runVersionCommand(NSString *programName, NSArray *args)
|
||||||
{
|
{
|
||||||
if (args.count > 1) {
|
if (args.count > 1) {
|
||||||
printUsage(programName);
|
printUsage(programName);
|
||||||
@@ -218,7 +218,7 @@ static BOOL runVersionCommand(NSString *programName, NSArray<NSString *> *args)
|
|||||||
int main(int __unused argc, char __unused *argv[])
|
int main(int __unused argc, char __unused *argv[])
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
|
NSArray *args = [[NSProcessInfo processInfo] arguments];
|
||||||
NSString *programName = [args[0] lastPathComponent];
|
NSString *programName = [args[0] lastPathComponent];
|
||||||
|
|
||||||
if (args.count < 2) {
|
if (args.count < 2) {
|
||||||
@@ -227,7 +227,7 @@ int main(int __unused argc, char __unused *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *command = args[1];
|
NSString *command = args[1];
|
||||||
NSArray<NSString *> *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)];
|
NSArray *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)];
|
||||||
|
|
||||||
BOOL result;
|
BOOL result;
|
||||||
if ([command isEqualToString:CREATE_COMMAND]) {
|
if ([command isEqualToString:CREATE_COMMAND]) {
|
||||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
|
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
|
||||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -28,7 +27,6 @@
|
|||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
@synthesize updateHostBundlePath = _updateHostBundlePath;
|
@synthesize updateHostBundlePath = _updateHostBundlePath;
|
||||||
@synthesize extractionDirectory = _extractionDirectory;
|
|
||||||
|
|
||||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -65,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SUFileManager *fileManager = [SUFileManager defaultManager];
|
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||||
for (NSURL *file in filesToUpdate) {
|
for (NSURL *file in filesToUpdate) {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:file error:&error]) {
|
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:file error:&error]) {
|
||||||
@@ -75,13 +73,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath
|
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
_updateHostBundlePath = [updateHostBundlePath copy];
|
_updateHostBundlePath = [updateHostBundlePath copy];
|
||||||
_extractionDirectory = [extractionDirectory copy];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -99,7 +96,7 @@
|
|||||||
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
|
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
|
||||||
{
|
{
|
||||||
NSString *sourcePath = self.updateHostBundlePath;
|
NSString *sourcePath = self.updateHostBundlePath;
|
||||||
NSString *targetPath = [self.extractionDirectory stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||||
|
|
||||||
NSError *applyDiffError = nil;
|
NSError *applyDiffError = nil;
|
||||||
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
|
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// SUCodeSigningVerifier.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Andy Matuschak on 7/5/12.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SUCODESIGNINGVERIFIER_H
|
||||||
|
#define SUCODESIGNINGVERIFIER_H
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface SUCodeSigningVerifier : NSObject
|
||||||
|
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
|
||||||
|
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError **)error;
|
||||||
|
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
@implementation SUCodeSigningVerifier
|
@implementation SUCodeSigningVerifier
|
||||||
|
|
||||||
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError *__autoreleasing *)error
|
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
OSStatus result;
|
OSStatus result;
|
||||||
SecRequirementRef requirement = NULL;
|
SecRequirementRef requirement = NULL;
|
||||||
@@ -87,7 +87,7 @@ finally:
|
|||||||
if (error) {
|
if (error) {
|
||||||
*error = nil;
|
*error = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
|
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
|
||||||
if (result != noErr) {
|
if (result != noErr) {
|
||||||
SULog(SULogLevelError, @"Failed to get static code %d", result);
|
SULog(SULogLevelError, @"Failed to get static code %d", result);
|
||||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
|
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
|
||||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -25,7 +24,6 @@
|
|||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
@synthesize decryptionPassword = _decryptionPassword;
|
@synthesize decryptionPassword = _decryptionPassword;
|
||||||
@synthesize extractionDirectory = _extractionDirectory;
|
|
||||||
|
|
||||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -37,13 +35,12 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword
|
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
_decryptionPassword = [decryptionPassword copy];
|
_decryptionPassword = [decryptionPassword copy];
|
||||||
_extractionDirectory = [extractionDirectory copy];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -59,7 +56,7 @@
|
|||||||
// Called on a non-main thread.
|
// Called on a non-main thread.
|
||||||
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier
|
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
BOOL mountedSuccessfully = NO;
|
BOOL mountedSuccessfully = NO;
|
||||||
|
|
||||||
// get a unique mount point path
|
// get a unique mount point path
|
||||||
@@ -68,7 +65,7 @@
|
|||||||
NSError *error;
|
NSError *error;
|
||||||
NSArray *contents;
|
NSArray *contents;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Using NSUUID would make creating UUIDs be done in Cocoa,
|
// Using NSUUID would make creating UUIDs be done in Cocoa,
|
||||||
// and thus managed under ARC. Sadly, the class is in 10.8 and later.
|
// and thus managed under ARC. Sadly, the class is in 10.8 and later.
|
||||||
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
||||||
@@ -81,9 +78,9 @@
|
|||||||
}
|
}
|
||||||
CFRelease(uuid);
|
CFRelease(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Note: this check does not follow symbolic links, which is what we want
|
// Note: this check does not follow symbolic links, which is what we want
|
||||||
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
|
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
|
||||||
|
|
||||||
NSData *promptData = nil;
|
NSData *promptData = nil;
|
||||||
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||||
@@ -138,8 +135,8 @@
|
|||||||
|
|
||||||
[notifier notifyProgress:0.5];
|
[notifier notifyProgress:0.5];
|
||||||
|
|
||||||
if (taskResult != 0)
|
if (taskResult != 0)
|
||||||
{
|
{
|
||||||
NSString *resultStr = output ? [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding] : nil;
|
NSString *resultStr = output ? [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding] : nil;
|
||||||
SULog(SULogLevelError, @"hdiutil failed with code: %ld data: <<%@>>", (long)taskResult, resultStr);
|
SULog(SULogLevelError, @"hdiutil failed with code: %ld data: <<%@>>", (long)taskResult, resultStr);
|
||||||
goto reportError;
|
goto reportError;
|
||||||
@@ -158,10 +155,10 @@
|
|||||||
double itemsCopied = 0;
|
double itemsCopied = 0;
|
||||||
double totalItems = [contents count];
|
double totalItems = [contents count];
|
||||||
|
|
||||||
for (NSString *item in contents)
|
for (NSString *item in contents)
|
||||||
{
|
{
|
||||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||||
NSString *toPath = [self.extractionDirectory stringByAppendingPathComponent:item];
|
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||||
|
|
||||||
// We skip any files in the DMG which are not readable.
|
// We skip any files in the DMG which are not readable.
|
||||||
if (![manager isReadableFileAtPath:fromPath]) {
|
if (![manager isReadableFileAtPath:fromPath]) {
|
||||||
@@ -170,10 +167,11 @@
|
|||||||
|
|
||||||
itemsCopied += 1.0;
|
itemsCopied += 1.0;
|
||||||
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
||||||
|
|
||||||
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||||
|
|
||||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||||
{
|
{
|
||||||
goto reportError;
|
goto reportError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,20 +14,13 @@ A guided installation allows Sparkle to download and install a package (pkg) or
|
|||||||
The installer package is installed using macOS's built-in command line installer, `/usr/sbin/installer`. No installation interface is shown to the user.
|
The installer package is installed using macOS's built-in command line installer, `/usr/sbin/installer`. No installation interface is shown to the user.
|
||||||
|
|
||||||
A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used.
|
A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used.
|
||||||
|
|
||||||
## To Do
|
|
||||||
- Replace the use of `AuthorizationExecuteWithPrivilegesAndWait`. This method remains because it is well supported and tested. Ideally a helper tool or XPC would be used.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SUInstallerProtocol.h"
|
#import "SUInstallerProtocol.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
|
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath fileOperationToolPath:(NSString *)fileOperationToolPath;
|
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// SUGuidedPackageInstaller.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Graham Miln on 14/05/2010.
|
||||||
|
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <sys/stat.h>
|
||||||
|
#import "SUGuidedPackageInstaller.h"
|
||||||
|
#import <Sparkle/SUErrors.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
@interface SUGuidedPackageInstaller ()
|
||||||
|
|
||||||
|
@property (nonatomic, readonly, copy) NSString *packagePath;
|
||||||
|
@property (nonatomic, readonly, copy) NSString *installationPath;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation SUGuidedPackageInstaller
|
||||||
|
|
||||||
|
@synthesize packagePath = _packagePath;
|
||||||
|
@synthesize installationPath = _installationPath;
|
||||||
|
|
||||||
|
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_packagePath = [packagePath copy];
|
||||||
|
_installationPath = [installationPath copy];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)__unused error
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError * __autoreleasing *)error
|
||||||
|
{
|
||||||
|
// This command *must* be run as root
|
||||||
|
NSString *installerPath = @"/usr/sbin/installer";
|
||||||
|
|
||||||
|
NSTask *task = [[NSTask alloc] init];
|
||||||
|
task.launchPath = installerPath;
|
||||||
|
task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
|
||||||
|
task.standardError = [NSPipe pipe];
|
||||||
|
task.standardOutput = [NSPipe pipe];
|
||||||
|
|
||||||
|
BOOL success = YES;
|
||||||
|
@try {
|
||||||
|
[task launch];
|
||||||
|
[task waitUntilExit];
|
||||||
|
if (task.terminationStatus != EXIT_SUCCESS) {
|
||||||
|
success = NO;
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer returned non-zero exit status (%d)", task.terminationStatus] }];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} @catch (NSException *) {
|
||||||
|
success = NO;
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Guided package installer task threw an exception"] }];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)canInstallSilently
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -7,17 +7,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SUVersionComparisonProtocol.h"
|
#import "SUInstallerProtocol.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class SUHost;
|
@class SUHost;
|
||||||
|
|
||||||
@protocol SUInstallerProtocol;
|
|
||||||
|
|
||||||
@interface SUInstaller : NSObject
|
@interface SUInstaller : NSObject
|
||||||
|
|
||||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
|
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
|
||||||
|
|
||||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
|
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
|
||||||
|
|
||||||
@@ -7,20 +7,30 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "SUInstaller.h"
|
#import "SUInstaller.h"
|
||||||
#import "SUInstallerProtocol.h"
|
|
||||||
#import "SUPlainInstaller.h"
|
#import "SUPlainInstaller.h"
|
||||||
#import "SUPackageInstaller.h"
|
#import "SUPackageInstaller.h"
|
||||||
#import "SUGuidedPackageInstaller.h"
|
#import "SUGuidedPackageInstaller.h"
|
||||||
#import "SUHost.h"
|
#import "SUHost.h"
|
||||||
|
#import "SUConstants.h"
|
||||||
#import "SULog.h"
|
#import "SULog.h"
|
||||||
#import "SUErrors.h"
|
#import <Sparkle/SUErrors.h>
|
||||||
|
#import "SPUInstallationType.h"
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
@implementation SUInstaller
|
@implementation SUInstaller
|
||||||
|
|
||||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
|
+ (BOOL)isAliasFolderAtPath:(NSString *)path
|
||||||
|
{
|
||||||
|
NSNumber *aliasFlag = nil;
|
||||||
|
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
|
||||||
|
NSNumber *directoryFlag = nil;
|
||||||
|
[[NSURL fileURLWithPath:path] getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:nil];
|
||||||
|
return aliasFlag.boolValue && directoryFlag.boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
|
||||||
{
|
{
|
||||||
NSParameterAssert(inUpdateFolder);
|
NSParameterAssert(inUpdateFolder);
|
||||||
NSParameterAssert(host);
|
NSParameterAssert(host);
|
||||||
@@ -38,34 +48,6 @@
|
|||||||
|
|
||||||
while ((currentFile = [dirEnum nextObject])) {
|
while ((currentFile = [dirEnum nextObject])) {
|
||||||
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
|
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
|
||||||
|
|
||||||
// Ignore all symbolic links and aliases
|
|
||||||
{
|
|
||||||
NSURL *currentPathURL = [NSURL fileURLWithPath:currentPath];
|
|
||||||
|
|
||||||
NSNumber *symbolicLinkFlag = nil;
|
|
||||||
[currentPathURL getResourceValue:&symbolicLinkFlag forKey:NSURLIsSymbolicLinkKey error:NULL];
|
|
||||||
if (symbolicLinkFlag.boolValue) {
|
|
||||||
// NSDirectoryEnumerator won't recurse into symlinked directories
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSNumber *aliasFlag = nil;
|
|
||||||
[currentPathURL getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:NULL];
|
|
||||||
|
|
||||||
if (aliasFlag.boolValue) {
|
|
||||||
NSNumber *directoryFlag = nil;
|
|
||||||
[currentPathURL getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:NULL];
|
|
||||||
|
|
||||||
// Some DMGs have symlinks into /Applications! That's no good!
|
|
||||||
if (directoryFlag.boolValue) {
|
|
||||||
[dirEnum skipDescendents];
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *currentFilename = [currentFile lastPathComponent];
|
NSString *currentFilename = [currentFile lastPathComponent];
|
||||||
NSString *currentExtension = [currentFile pathExtension];
|
NSString *currentExtension = [currentFile pathExtension];
|
||||||
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
|
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
|
||||||
@@ -95,6 +77,10 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some DMGs have symlinks into /Applications! That's no good!
|
||||||
|
if ([self isAliasFolderAtPath:currentPath])
|
||||||
|
[dirEnum skipDescendents];
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't have a valid path. Try to use the fallback package.
|
// We don't have a valid path. Try to use the fallback package.
|
||||||
@@ -125,7 +111,7 @@
|
|||||||
return newAppDownloadPath;
|
return newAppDownloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
|
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
BOOL isPackage = NO;
|
BOOL isPackage = NO;
|
||||||
BOOL isGuided = NO;
|
BOOL isGuided = NO;
|
||||||
@@ -138,28 +124,50 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
id <SUInstallerProtocol> installer;
|
// Make sure we find the type of installer that we were expecting to find
|
||||||
|
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
|
||||||
|
// ahead of time whether or not this installer tool should be ran as root or not
|
||||||
|
id <SUInstallerProtocol> installer = nil;
|
||||||
if (isPackage && isGuided) {
|
if (isPackage && isGuided) {
|
||||||
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath fileOperationToolPath:fileOperationToolPath];
|
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||||
} else if (isPackage) {
|
if (error != NULL) {
|
||||||
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
|
*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 {
|
}
|
||||||
NSString *normalizedInstallationPath = nil;
|
|
||||||
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
|
|
||||||
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a normalized path, we'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
|
|
||||||
// Otherwise if there's no normalized path (the more likely case), we'll just use the host bundle's path
|
|
||||||
NSString *installationPath;
|
|
||||||
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
|
|
||||||
installationPath = normalizedInstallationPath;
|
|
||||||
} else {
|
} else {
|
||||||
installationPath = host.bundlePath;
|
installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
|
||||||
|
}
|
||||||
|
} else if (isPackage) {
|
||||||
|
if (![expectedInstallationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found package installer but '%@=%@' was probably missing in the appcast item enclosure", SUAppcastAttributeInstallationType, SPUInstallationTypeInteractivePackage] }];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath installationPath:host.bundlePath];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
NSString *normalizedInstallationPath = nil;
|
||||||
|
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
|
||||||
|
normalizedInstallationPath = [self normalizedInstallationPathForHost:host];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have a normalized path, we'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
|
||||||
|
// Otherwise if there's no normalized path (the more likely case), we'll just use the host bundle's path
|
||||||
|
NSString *installationPath;
|
||||||
|
if (normalizedInstallationPath != nil && ![[NSFileManager defaultManager] fileExistsAtPath:normalizedInstallationPath]) {
|
||||||
|
installationPath = normalizedInstallationPath;
|
||||||
|
} else {
|
||||||
|
installationPath = host.bundlePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
installer = [[SUPlainInstaller alloc] initWithHost:host bundlePath:newDownloadPath installationPath:installationPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
installer = [[SUPlainInstaller alloc] initWithHost:host bundlePath:newDownloadPath installationPath:installationPath fileOperationToolPath:fileOperationToolPath];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return installer;
|
return installer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,14 +175,8 @@
|
|||||||
{
|
{
|
||||||
NSBundle *bundle = host.bundle;
|
NSBundle *bundle = host.bundle;
|
||||||
assert(bundle != nil);
|
assert(bundle != nil);
|
||||||
|
|
||||||
NSString * baseBundleName = [host objectForInfoDictionaryKey:@"SUBundleName"];
|
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
|
||||||
|
|
||||||
if (baseBundleName == nil) {
|
|
||||||
baseBundleName = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", baseBundleName, [[bundle bundlePath] pathExtension]]];
|
|
||||||
|
|
||||||
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
|
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
|
||||||
// rather than arbitrary Unicode form from Info.plist - #1017
|
// rather than arbitrary Unicode form from Info.plist - #1017
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// SUInstallerProtocol.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/12/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@protocol SUInstallerProtocol <NSObject>
|
||||||
|
|
||||||
|
// Any installation work can be done prior to user application being terminated and relaunched
|
||||||
|
// No UI should occur during this stage (i.e, do not show package installer apps, etc..)
|
||||||
|
// Should be able to be called from non-main thread
|
||||||
|
- (BOOL)performInitialInstallation:(NSError **)error;
|
||||||
|
|
||||||
|
// Any installation work after the user application has has been terminated. This is where the final installation work can be done.
|
||||||
|
// After this stage is done, the user application may be relaunched.
|
||||||
|
// Should be able to be called from non-main thread
|
||||||
|
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
|
||||||
|
|
||||||
|
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
|
||||||
|
// If this returns NO, then the installation can fail if the user did not directly request for the install to occur.
|
||||||
|
// Should be thread safe
|
||||||
|
- (BOOL)canInstallSilently;
|
||||||
|
|
||||||
|
// The destination and installation path of the bundle being updated
|
||||||
|
- (NSString *)installationPath;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -9,12 +9,11 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SUInstallerProtocol.h"
|
#import "SUInstallerProtocol.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
// This is the deprecated package installation type, aka the "interactive" package installer
|
||||||
|
// For a more supported package installation, see SUGuidedPackageInstaller
|
||||||
|
|
||||||
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
|
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
|
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import "SUPackageInstaller.h"
|
#import "SUPackageInstaller.h"
|
||||||
#import "SUConstants.h"
|
#import "SUConstants.h"
|
||||||
#import "SUErrors.h"
|
#import <Sparkle/SUErrors.h>
|
||||||
#import "SULog.h"
|
#import "SULog.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
|
|||||||
// -W = wait until the app has quit.
|
// -W = wait until the app has quit.
|
||||||
// -n = Open another instance if already open.
|
// -n = Open another instance if already open.
|
||||||
// -b = app bundle identifier
|
// -b = app bundle identifier
|
||||||
NSArray<NSString *> *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", self.packagePath];
|
NSArray *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", self.packagePath];
|
||||||
|
|
||||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||||
@try {
|
@try {
|
||||||
@@ -78,9 +78,4 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)supportsDeterminateProgress
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#import "SUPipedUnarchiver.h"
|
#import "SUPipedUnarchiver.h"
|
||||||
#import "SUUnarchiverNotifier.h"
|
#import "SUUnarchiverNotifier.h"
|
||||||
#import "SULog.h"
|
#import "SULog.h"
|
||||||
#import "SUErrors.h"
|
#import <Sparkle/SUErrors.h>
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
@@ -17,14 +17,12 @@
|
|||||||
@interface SUPipedUnarchiver ()
|
@interface SUPipedUnarchiver ()
|
||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SUPipedUnarchiver
|
@implementation SUPipedUnarchiver
|
||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
@synthesize extractionDirectory = _extractionDirectory;
|
|
||||||
|
|
||||||
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
|
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -65,12 +63,11 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory
|
- (instancetype)initWithArchivePath:(NSString *)archivePath
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
_extractionDirectory = [extractionDirectory copy];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -95,9 +92,9 @@
|
|||||||
- (void)extractArchivePipingDataToCommand:(NSString *)command arguments:(NSArray*)args notifier:(SUUnarchiverNotifier *)notifier
|
- (void)extractArchivePipingDataToCommand:(NSString *)command arguments:(NSArray*)args notifier:(SUUnarchiverNotifier *)notifier
|
||||||
{
|
{
|
||||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSString *destination = self.extractionDirectory;
|
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
|
||||||
|
|
||||||
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
||||||
|
|
||||||
@@ -108,49 +105,43 @@
|
|||||||
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
|
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
|
||||||
|
|
||||||
NSPipe *pipe = [NSPipe pipe];
|
NSPipe *pipe = [NSPipe pipe];
|
||||||
|
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
||||||
|
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
[task setStandardInput:[pipe fileHandleForReading]];
|
[task setStandardInput:[pipe fileHandleForReading]];
|
||||||
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
|
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
|
||||||
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
|
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
|
||||||
[task setLaunchPath:command];
|
[task setLaunchPath:command];
|
||||||
[task setArguments:[args arrayByAddingObject:destination]];
|
[task setArguments:[args arrayByAddingObject:destination]];
|
||||||
@try {
|
[task launch];
|
||||||
[task launch];
|
|
||||||
}
|
|
||||||
@catch (NSException *e) {
|
|
||||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!error) {
|
NSUInteger bytesRead = 0;
|
||||||
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
|
do {
|
||||||
NSUInteger bytesRead = 0;
|
NSData *data = [archiveInput readDataOfLength:256*1024];
|
||||||
do {
|
NSUInteger len = [data length];
|
||||||
NSData *data = [archiveInput readDataOfLength:256*1024];
|
if (!len) {
|
||||||
NSUInteger len = [data length];
|
break;
|
||||||
if (!len) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bytesRead += len;
|
|
||||||
[archiveOutput writeData:data];
|
|
||||||
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
|
|
||||||
}
|
}
|
||||||
while(bytesRead < expectedLength);
|
bytesRead += len;
|
||||||
|
[archiveOutput writeData:data];
|
||||||
[archiveOutput closeFile];
|
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
|
||||||
|
}
|
||||||
[task waitUntilExit];
|
while(bytesRead < expectedLength);
|
||||||
|
|
||||||
if ([task terminationStatus] == 0) {
|
[archiveOutput closeFile];
|
||||||
if (bytesRead == expectedLength) {
|
|
||||||
[notifier notifySuccess];
|
[task waitUntilExit];
|
||||||
return;
|
|
||||||
} else {
|
if ([task terminationStatus] == 0) {
|
||||||
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 (bytesRead == expectedLength) {
|
||||||
|
[notifier notifySuccess];
|
||||||
}
|
return;
|
||||||
} else {
|
} else {
|
||||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
|
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 {
|
} else {
|
||||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
|
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
|
||||||
@@ -9,9 +9,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SUInstallerProtocol.h"
|
#import "SUInstallerProtocol.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@class SUHost;
|
@class SUHost;
|
||||||
|
@protocol SUVersionComparison;
|
||||||
|
|
||||||
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
|
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
|
||||||
|
|
||||||
@@ -19,10 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param host The current (old) bundle host
|
@param host The current (old) bundle host
|
||||||
@param bundlePath The path to the new bundle that will be installed.
|
@param bundlePath The path to the new bundle that will be installed.
|
||||||
@param installationPath The path the new bundlePath will be installed to.
|
@param installationPath The path the new bundlePath will be installed to.
|
||||||
@param fileOperationToolPath The path to the file operation tool for authorized operations.
|
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath fileOperationToolPath:(NSString *)fileOperationToolPath;
|
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "SUPlainInstaller.h"
|
#import "SUPlainInstaller.h"
|
||||||
#import "SUVersionComparisonProtocol.h"
|
|
||||||
#import "SUStandardVersionComparator.h"
|
|
||||||
#import "SUFileManager.h"
|
#import "SUFileManager.h"
|
||||||
|
#import "SUConstants.h"
|
||||||
#import "SUHost.h"
|
#import "SUHost.h"
|
||||||
#import "SULog.h"
|
#import "SULog.h"
|
||||||
#import "SUErrors.h"
|
#import <Sparkle/SUErrors.h>
|
||||||
#import "SUOperatingSystem.h"
|
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||||
|
#import "SUStandardVersionComparator.h"
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
@property (nonatomic, readonly) SUHost *host;
|
@property (nonatomic, readonly) SUHost *host;
|
||||||
@property (nonatomic, copy, readonly) NSString *bundlePath;
|
@property (nonatomic, copy, readonly) NSString *bundlePath;
|
||||||
@property (nonatomic, copy, readonly) NSString *installationPath;
|
@property (nonatomic, copy, readonly) NSString *installationPath;
|
||||||
@property (nonatomic, copy, readonly) NSString *fileOperationToolPath;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -32,16 +31,14 @@
|
|||||||
@synthesize host = _host;
|
@synthesize host = _host;
|
||||||
@synthesize bundlePath = _bundlePath;
|
@synthesize bundlePath = _bundlePath;
|
||||||
@synthesize installationPath = _installationPath;
|
@synthesize installationPath = _installationPath;
|
||||||
@synthesize fileOperationToolPath = _fileOperationToolPath;
|
|
||||||
|
|
||||||
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath fileOperationToolPath:(NSString *)fileOperationToolPath
|
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_host = host;
|
_host = host;
|
||||||
_bundlePath = [bundlePath copy];
|
_bundlePath = [bundlePath copy];
|
||||||
_installationPath = [installationPath copy];
|
_installationPath = [installationPath copy];
|
||||||
_fileOperationToolPath = [fileOperationToolPath copy];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -51,18 +48,18 @@
|
|||||||
{
|
{
|
||||||
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||||
NSString *trimmedVersion = @"";
|
NSString *trimmedVersion = @"";
|
||||||
|
|
||||||
if (bundleVersion != nil) {
|
if (bundleVersion != nil) {
|
||||||
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
|
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
|
||||||
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
|
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
|
||||||
|
|
||||||
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
|
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return trimmedVersion.length > 0 ? trimmedVersion : nil;
|
return trimmedVersion.length > 0 ? trimmedVersion : nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)performInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
|
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
if (installationURL == nil || newURL == nil) {
|
if (installationURL == nil || newURL == nil) {
|
||||||
// this really shouldn't happen but just in case
|
// this really shouldn't happen but just in case
|
||||||
@@ -77,12 +74,22 @@
|
|||||||
progress(1/10.0);
|
progress(1/10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUFileManager *fileManager = [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath];
|
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||||
|
|
||||||
|
// Update the access time of our entire application before moving it into a temporary directory
|
||||||
|
// The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date
|
||||||
|
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
|
||||||
|
// before being installed
|
||||||
|
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:error]) {
|
||||||
|
SULog(SULogLevelError, @"Failed to recursively update new application's modification time before moving into temporary directory");
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a temporary directory for our new app that resides on our destination's volume
|
// Create a temporary directory for our new app that resides on our destination's volume
|
||||||
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
|
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
|
||||||
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
|
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
|
||||||
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
|
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
|
||||||
|
|
||||||
if (tempNewDirectoryURL == nil) {
|
if (tempNewDirectoryURL == nil) {
|
||||||
SULog(SULogLevelError, @"Failed to make new temp directory");
|
SULog(SULogLevelError, @"Failed to make new temp directory");
|
||||||
return NO;
|
return NO;
|
||||||
@@ -105,10 +112,7 @@
|
|||||||
progress(3/10.0);
|
progress(3/10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release our new app from quarantine, fix its owner and group IDs, and update its modification time while it's at our temporary destination
|
// Release our new app from quarantine
|
||||||
// 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 *quarantineError = nil;
|
NSError *quarantineError = nil;
|
||||||
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
|
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
|
||||||
// Not big enough of a deal to fail the entire installation
|
// Not big enough of a deal to fail the entire installation
|
||||||
@@ -128,21 +132,26 @@
|
|||||||
}
|
}
|
||||||
return NO;
|
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]) {
|
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:error]) {
|
||||||
// But this is big enough of a deal to fail
|
// 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);
|
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];
|
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (progress) {
|
if (progress) {
|
||||||
progress(5/10.0);
|
progress(5/10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:error]) {
|
NSError *touchError = nil;
|
||||||
|
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:&touchError]) {
|
||||||
// Not a fatal error, but a pretty unfortunate one
|
// Not a fatal error, but a pretty unfortunate one
|
||||||
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
|
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
|
||||||
|
SULog(SULogLevelError, @"Error: %@", touchError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress) {
|
if (progress) {
|
||||||
@@ -150,21 +159,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decide on a destination name we should use for the older app when we move it around the file system
|
// Decide on a destination name we should use for the older app when we move it around the file system
|
||||||
NSString *oldDestinationName = nil;
|
NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
|
||||||
if (SPARKLE_APPEND_VERSION_NUMBER) {
|
NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent;
|
||||||
NSString *oldBundleVersion = [self bundleVersionAppropriateForFilenameFromHost:host];
|
|
||||||
|
|
||||||
oldDestinationName = [oldURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingFormat:@" (%@)", oldBundleVersion != nil ? oldBundleVersion : @"old"];
|
|
||||||
} else {
|
|
||||||
oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *oldURLExtension = oldURL.pathExtension;
|
|
||||||
NSString *oldDestinationNameWithPathExtension = [oldDestinationName stringByAppendingPathExtension:oldURLExtension];
|
|
||||||
NSURL *oldURLDirectory = oldURL.URLByDeletingLastPathComponent;
|
|
||||||
|
|
||||||
// Create a temporary directory for our old app that resides on its volume
|
// Create a temporary directory for our old app that resides on its volume
|
||||||
NSURL *tempOldDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldURLDirectory error:error];
|
NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent;
|
||||||
|
NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil;
|
||||||
if (tempOldDirectoryURL == nil) {
|
if (tempOldDirectoryURL == nil) {
|
||||||
SULog(SULogLevelError, @"Failed to create temporary directory for old app at %@", oldURL.path);
|
SULog(SULogLevelError, @"Failed to create temporary directory for old app at %@", oldURL.path);
|
||||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||||
@@ -179,11 +179,11 @@
|
|||||||
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
|
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
|
||||||
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
|
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);
|
SULog(SULogLevelError, @"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path);
|
||||||
|
|
||||||
// Just forget about our updated app on failure
|
// Just forget about our updated app on failure
|
||||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,14 +194,14 @@
|
|||||||
// Move the new app to its final destination
|
// Move the new app to its final destination
|
||||||
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
|
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
|
||||||
SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
|
SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
|
||||||
|
|
||||||
// Forget about our updated app on failure
|
// Forget about our updated app on failure
|
||||||
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||||
|
|
||||||
// Attempt to restore our old app back the way it was on failure
|
// Attempt to restore our old app back the way it was on failure
|
||||||
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
|
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
|
||||||
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,19 +209,9 @@
|
|||||||
progress(9/10.0);
|
progress(9/10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to preserve Finder tags. Failure can be accepted without complaint as previous Sparkle versions did not do this at all
|
|
||||||
NSArray *resourceTags;
|
|
||||||
BOOL success = [oldTempURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
|
|
||||||
if (success && resourceTags.count) {
|
|
||||||
[installationURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
// From here on out, we don't really need to bring up authorization if we haven't done so prior
|
|
||||||
SUFileManager *constrainedFileManager = [fileManager fileManagerByPreservingAuthorizationRights];
|
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
[constrainedFileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
|
||||||
[constrainedFileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
|
||||||
|
|
||||||
if (progress) {
|
if (progress) {
|
||||||
progress(10/10.0);
|
progress(10/10.0);
|
||||||
@@ -233,31 +223,37 @@
|
|||||||
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
|
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
|
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
|
||||||
|
|
||||||
// Prevent malicious 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) {
|
if (!allowDowngrades) {
|
||||||
NSString *hostVersion = [self.host version];
|
NSString *hostVersion = [self.host version];
|
||||||
|
|
||||||
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
|
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
|
||||||
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
|
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
|
||||||
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||||
|
|
||||||
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
|
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
|
||||||
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
|
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
|
||||||
|
|
||||||
if (error != NULL) {
|
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];
|
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 }];
|
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error
|
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error
|
||||||
{
|
{
|
||||||
return [self performInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host fileOperationToolPath:self.fileOperationToolPath progressBlock:cb error:error];
|
// Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories.
|
||||||
|
// It must not be possible for our update to sit in temporary directories for a very long time.
|
||||||
|
return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)canInstallSilently
|
- (BOOL)canInstallSilently
|
||||||
@@ -265,9 +261,4 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)supportsDeterminateProgress
|
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// SUDSAVerifier.h
|
// SUSignatureVerifier.h
|
||||||
// Sparkle
|
// Sparkle
|
||||||
//
|
//
|
||||||
// Created by Andy Matuschak on 3/16/06.
|
// Created by Andy Matuschak on 3/16/06.
|
||||||
@@ -103,8 +103,7 @@
|
|||||||
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
|
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
|
||||||
|
|
||||||
if (edPubKey && !edSignature) {
|
if (edPubKey && !edSignature) {
|
||||||
SULog(SULogLevelError, @"The app has an EdDSA public key, but there is no EdDSA signature in the update, so the update will be rejected.");
|
SULog(SULogLevelDefault, @"There is no EdDSA signature in the update, but the app is capable of verifying them");
|
||||||
return NO;
|
|
||||||
} if (!edPubKey && edSignature) {
|
} 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");
|
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) {
|
} else if (edPubKey && edSignature) {
|
||||||
@@ -115,9 +114,12 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
|
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
|
||||||
// No need to check DSA when EdDSA verification succeeded
|
|
||||||
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
||||||
return YES;
|
if (!dsaPubKey) {
|
||||||
|
return YES;
|
||||||
|
} else {
|
||||||
|
SULog(SULogLevelDefault, @"This app has a DSA public key, so a DSA signature is required too");
|
||||||
|
}
|
||||||
} else {
|
} 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.");
|
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) {
|
if (dsaSignature) {
|
||||||
@@ -157,13 +159,13 @@
|
|||||||
__block CFErrorRef error = NULL;
|
__block CFErrorRef error = NULL;
|
||||||
|
|
||||||
BOOL (^cleanup)(void) = ^{
|
BOOL (^cleanup)(void) = ^{
|
||||||
if (group) CFRelease(group);
|
if (group) CFRelease(group);
|
||||||
if (dataReadTransform) CFRelease(dataReadTransform);
|
if (dataReadTransform) CFRelease(dataReadTransform);
|
||||||
if (dataDigestTransform) CFRelease(dataDigestTransform);
|
if (dataDigestTransform) CFRelease(dataDigestTransform);
|
||||||
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
|
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
|
||||||
if (error) CFRelease(error);
|
if (error) CFRelease(error);
|
||||||
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
|
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
|
||||||
return NO;
|
return NO;
|
||||||
};
|
};
|
||||||
|
|
||||||
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
|
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// SUStatusInfoProtocol.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 7/10/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@protocol SUStatusInfoProtocol
|
||||||
|
|
||||||
|
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply;
|
||||||
|
|
||||||
|
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUUnarchiver : NSObject
|
@interface SUUnarchiver : NSObject
|
||||||
|
|
||||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
|
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -11,27 +11,24 @@
|
|||||||
#import "SUPipedUnarchiver.h"
|
#import "SUPipedUnarchiver.h"
|
||||||
#import "SUDiskImageUnarchiver.h"
|
#import "SUDiskImageUnarchiver.h"
|
||||||
#import "SUBinaryDeltaUnarchiver.h"
|
#import "SUBinaryDeltaUnarchiver.h"
|
||||||
#import "SUFlatPackageUnarchiver.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
@implementation SUUnarchiver
|
@implementation SUUnarchiver
|
||||||
|
|
||||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
|
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
|
||||||
{
|
{
|
||||||
if ([SUPipedUnarchiver canUnarchivePath:path]) {
|
if ([SUPipedUnarchiver canUnarchivePath:path]) {
|
||||||
return [[SUPipedUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory];
|
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
|
||||||
|
|
||||||
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
|
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
|
||||||
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory decryptionPassword:decryptionPassword];
|
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
|
||||||
|
|
||||||
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
|
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
|
||||||
assert(hostPath != nil);
|
assert(hostPath != nil);
|
||||||
NSString *nonNullHostPath = hostPath;
|
NSString *nonNullHostPath = hostPath;
|
||||||
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory updateHostBundlePath:nonNullHostPath];
|
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
|
||||||
|
|
||||||
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
|
|
||||||
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path extractionDirectory:extractionDirectory];
|
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import "SUUnarchiverNotifier.h"
|
#import "SUUnarchiverNotifier.h"
|
||||||
#import "SULocalizations.h"
|
#import "SULocalizations.h"
|
||||||
#import "SUErrors.h"
|
#import <Sparkle/SUErrors.h>
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
@@ -31,8 +31,6 @@
|
|||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_completionBlock = [completionBlock copy];
|
_completionBlock = [completionBlock copy];
|
||||||
_progressBlock = [progressBlock copy];
|
_progressBlock = [progressBlock copy];
|
||||||
} else {
|
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// StatusInfo.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 7/10/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "SUStatusInfoProtocol.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface StatusInfo : NSObject <SUStatusInfoProtocol>
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier;
|
||||||
|
|
||||||
|
@property (nonatomic, nullable) NSData *installationInfoData;
|
||||||
|
|
||||||
|
- (void)startListener;
|
||||||
|
|
||||||
|
- (void)invalidate;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// StatusInfo.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 7/10/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "StatusInfo.h"
|
||||||
|
#import "SPUMessageTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
@interface StatusInfo () <NSXPCListenerDelegate>
|
||||||
|
|
||||||
|
@property (nonatomic) NSXPCListener *xpcListener;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation StatusInfo
|
||||||
|
|
||||||
|
@synthesize xpcListener = _xpcListener;
|
||||||
|
@synthesize installationInfoData = _installationInfoData;
|
||||||
|
|
||||||
|
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SPUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)];
|
||||||
|
_xpcListener.delegate = self;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startListener
|
||||||
|
{
|
||||||
|
[self.xpcListener resume];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invalidate
|
||||||
|
{
|
||||||
|
[self.xpcListener invalidate];
|
||||||
|
self.xpcListener = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
|
||||||
|
{
|
||||||
|
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)];
|
||||||
|
newConnection.exportedObject = self;
|
||||||
|
|
||||||
|
[newConnection resume];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable))reply
|
||||||
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
reply(self.installationInfoData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply
|
||||||
|
{
|
||||||
|
reply();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// TerminationListener.h
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/7/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface TerminationListener : NSObject
|
||||||
|
|
||||||
|
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) BOOL terminated;
|
||||||
|
|
||||||
|
// If the process identifier provided was nil, then the completion block will invoke immediately with a YES success
|
||||||
|
- (void)startListeningWithCompletion:(void (^)(BOOL success))completionBlock;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
//
|
||||||
|
// TerminationListener.m
|
||||||
|
// Sparkle
|
||||||
|
//
|
||||||
|
// Created by Mayur Pawashe on 3/7/16.
|
||||||
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "TerminationListener.h"
|
||||||
|
#import "SULog.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/event.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
@interface TerminationListener ()
|
||||||
|
|
||||||
|
@property (nonatomic, readonly, nullable) NSNumber *processIdentifier;
|
||||||
|
@property (nonatomic) BOOL watchedTermination;
|
||||||
|
@property (nonatomic, copy) void (^completionBlock)(BOOL);
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation TerminationListener
|
||||||
|
|
||||||
|
@synthesize completionBlock = _completionBlock;
|
||||||
|
@synthesize processIdentifier = _processIdentifier;
|
||||||
|
@synthesize watchedTermination = _watchedTermination;
|
||||||
|
|
||||||
|
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_processIdentifier = processIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)terminated
|
||||||
|
{
|
||||||
|
return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invokeCompletionWithSuccess:(BOOL)success
|
||||||
|
{
|
||||||
|
if (self.completionBlock != nil) {
|
||||||
|
self.completionBlock(success);
|
||||||
|
self.completionBlock = nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
|
||||||
|
{
|
||||||
|
self.completionBlock = completionBlock;
|
||||||
|
|
||||||
|
if (self.processIdentifier == nil) {
|
||||||
|
[self invokeCompletionWithSuccess:YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use kqueues to determine when the process will terminate
|
||||||
|
// As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10
|
||||||
|
// By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it
|
||||||
|
|
||||||
|
pid_t processIdentifier = self.processIdentifier.intValue;
|
||||||
|
int queue = kqueue();
|
||||||
|
if (queue == -1) {
|
||||||
|
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
|
||||||
|
[self invokeCompletionWithSuccess:NO];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct kevent changes;
|
||||||
|
EV_SET(&changes, processIdentifier, EVFILT_PROC, EV_ADD | EV_RECEIPT, NOTE_EXIT, 0, NULL);
|
||||||
|
|
||||||
|
if (kevent(queue, &changes, 1, &changes, 1, NULL) == -1) {
|
||||||
|
SULog(SULogLevelError, @"Failed to invoke kevent() due to error %d: %@", errno, @(strerror(errno)));
|
||||||
|
[self invokeCompletionWithSuccess:NO];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We will assume this terminationListener will never be deallocated
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wcast-qual"
|
||||||
|
CFFileDescriptorContext context = { 0, (void *)CFBridgingRetain(self), NULL, NULL, NULL };
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
CFFileDescriptorRef noteExitKQueueRef = CFFileDescriptorCreate(NULL, queue, true, noteExitKQueueCallback, &context);
|
||||||
|
if (noteExitKQueueRef == NULL) {
|
||||||
|
SULog(SULogLevelError, @"Failed to create file descriptor via CFFileDescriptorCreate()");
|
||||||
|
CFRelease((__bridge CFTypeRef)(self));
|
||||||
|
[self invokeCompletionWithSuccess:NO];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRunLoopSourceRef runLoopSource = CFFileDescriptorCreateRunLoopSource(NULL, noteExitKQueueRef, 0);
|
||||||
|
if (runLoopSource == NULL) {
|
||||||
|
SULog(SULogLevelError, @"Failed to create runLoopSource via CFFileDescriptorCreateRunLoopSource()");
|
||||||
|
CFRelease((__bridge CFTypeRef)(self));
|
||||||
|
[self invokeCompletionWithSuccess:NO];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
|
||||||
|
CFRelease(runLoopSource);
|
||||||
|
|
||||||
|
CFFileDescriptorEnableCallBacks(noteExitKQueueRef, kCFFileDescriptorReadCallBack);
|
||||||
|
|
||||||
|
// Make sure we didn't set the listener callback to a dead PID
|
||||||
|
// If we did, we could hang forever. To avoid this, we check if the process has terminated *after* we set up the callback
|
||||||
|
// If we tried to do this check before setting the callback, we could run into an issue where the process can terminate after our check
|
||||||
|
// but before setting the callback
|
||||||
|
if ([self terminated]) {
|
||||||
|
[self invokeCompletionWithSuccess:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unused callBackTypes, void *info)
|
||||||
|
{
|
||||||
|
struct kevent event;
|
||||||
|
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
|
||||||
|
|
||||||
|
TerminationListener *self = CFBridgingRelease(info);
|
||||||
|
self.watchedTermination = YES;
|
||||||
|
[self invokeCompletionWithSuccess:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "AppInstaller.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
int main(int __unused argc, const char __unused *argv[])
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
|
{
|
||||||
|
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
|
||||||
|
if (args.count != 2) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *hostBundleIdentifier = args[1];
|
||||||
|
|
||||||
|
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
|
||||||
|
[appInstaller start];
|
||||||
|
|
||||||
|
// Ignore SIGTERM because we are going to catch it ourselves
|
||||||
|
signal(SIGTERM, SIG_IGN);
|
||||||
|
|
||||||
|
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
|
||||||
|
dispatch_source_set_event_handler(sigtermSource, ^{
|
||||||
|
[appInstaller cleanupAndExitWithStatus:SIGTERM];
|
||||||
|
});
|
||||||
|
dispatch_resume(sigtermSource);
|
||||||
|
|
||||||
|
[[NSRunLoop currentRunLoop] run];
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -1,167 +1,3 @@
|
|||||||
# 1.27.3
|
|
||||||
|
|
||||||
* Create and use temp extraction directory in generate_appcast again (#2556) (Zorg)
|
|
||||||
|
|
||||||
# 1.27.2
|
|
||||||
|
|
||||||
* Extract archives in a separate directory from the input archive (#2552) (Zorg)
|
|
||||||
* Fix incorrect xz log warning in make release (#2044) (trss)
|
|
||||||
|
|
||||||
# 1.27.1
|
|
||||||
|
|
||||||
* Use px instead of pt when specifying font size to fix default font size in WebView from #1962 (regressed in 1.25.0 with WKWebView adoption) (Daniel Jalkut)
|
|
||||||
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
|
|
||||||
* Add safer handling of applying binary delta files from #1990 (Zorg)
|
|
||||||
* Don't use current date unless necessary when scheduling next update from #1991 (Zorg)
|
|
||||||
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
|
|
||||||
* Backport not hiding update window on deactivation from #2008 (Zorg)
|
|
||||||
|
|
||||||
# 1.27.0
|
|
||||||
|
|
||||||
* Deprecate not using EdDSA and skip DSA verification when possible in #1892 (Zorg)
|
|
||||||
* Pass http headers and user agent when downloading release notes from #1873 (Zorg)
|
|
||||||
* Fix project warnings from #1893 (Zorg)
|
|
||||||
* Update sample appcast from #1895 (Zorg)
|
|
||||||
* Fix appcast pubDate tag generation in different locales from #1898 (Sungbin Jo)
|
|
||||||
* Create valid xar archives for generating binary delta files from #1906 (Zorg)
|
|
||||||
* Fix a few issues with German localization from #1931 (J-rg)
|
|
||||||
* Fix issues with Russian localizations from #1947 (Konstantin Zamyakin)
|
|
||||||
* Fix issues with Czech localizations from #1943 (Vojtěch Koňařík)
|
|
||||||
* Add an automated workflow that builds and publishes official Sparkle releases (Tony Arnold, Zorg)
|
|
||||||
|
|
||||||
# 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
|
# 1.20.0
|
||||||
|
|
||||||
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
|
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// Generate Appcast Debug
|
// Generate Appcast Debug
|
||||||
|
|
||||||
#include "ConfigGenerateKeys.xcconfig"
|
#include "CommandLineTool-Shared.xcconfig"
|
||||||
#include "ConfigSwiftDebug.xcconfig"
|
#include "ConfigSwiftDebug.xcconfig"
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// Generate Appcast Release
|
// Generate Appcast Release
|
||||||
|
|
||||||
#include "ConfigGenerateKeys.xcconfig"
|
#include "CommandLineTool-Shared.xcconfig"
|
||||||
#include "ConfigSwiftRelease.xcconfig"
|
#include "ConfigSwiftRelease.xcconfig"
|
||||||
+1
-2
@@ -2,6 +2,5 @@
|
|||||||
|
|
||||||
#include "ConfigSwift.xcconfig"
|
#include "ConfigSwift.xcconfig"
|
||||||
|
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = generate_keys/Bridging-Header.h
|
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||||
PRODUCT_NAME = generate_keys
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#include "ConfigBinaryDelta.xcconfig"
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#include "ConfigBinaryDelta.xcconfig"
|
|
||||||
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
|
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
|
||||||
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
|
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
|
||||||
SPARKLE_FILEOP_TOOL_NAME = fileop
|
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
|
||||||
|
|
||||||
SPARKLE_APPEND_VERSION_NUMBER = 1
|
|
||||||
|
|
||||||
// Sparkle usually doesn't allow downgrades as they're usually accidental, but
|
// 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
|
// if your app has a downgrade function or URL handler, turn this on
|
||||||
@@ -15,34 +13,32 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
|
|||||||
// following on to always reset the name back to "MyApp":
|
// following on to always reset the name back to "MyApp":
|
||||||
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
||||||
|
|
||||||
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
SPARKLE_ICON_NAME = AppIcon
|
||||||
// These variables must have a space after the '=' too
|
|
||||||
SPARKLE_VERSION_MAJOR = 1
|
|
||||||
SPARKLE_VERSION_MINOR = 27
|
|
||||||
SPARKLE_VERSION_PATCH = 3
|
|
||||||
|
|
||||||
// This should be in SemVer format or empty, ie. "-rc.1"
|
SPARKLE_VERSION_MAJOR = 2
|
||||||
// These variables must have a space after the '=' too
|
SPARKLE_VERSION_MINOR = 0
|
||||||
SPARKLE_VERSION_SUFFIX =
|
SPARKLE_VERSION_PATCH = 0
|
||||||
// This is now a monotonically increasing ID number, even across prereleases, but let's keep this below 2.0
|
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||||
CURRENT_PROJECT_VERSION = 1.108
|
|
||||||
|
|
||||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
|
||||||
|
|
||||||
|
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO
|
ALWAYS_SEARCH_USER_PATHS = NO
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES
|
ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
||||||
ARCHS = $(ARCHS_STANDARD)
|
ARCHS = $(ARCHS_STANDARD)
|
||||||
|
// NSURLSession requirements
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.9
|
MACOSX_DEPLOYMENT_TARGET = 10.9
|
||||||
PRODUCT_NAME = ${TARGET_NAME}
|
PRODUCT_NAME = ${TARGET_NAME}
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||||
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\"
|
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
|
||||||
|
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
|
||||||
|
INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
|
||||||
|
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
|
||||||
|
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
|
||||||
|
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_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}\"
|
||||||
|
|
||||||
CODE_SIGN_IDENTITY = -
|
|
||||||
SDKROOT = macosx
|
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES
|
CLANG_ENABLE_OBJC_ARC = YES
|
||||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
@@ -65,7 +61,7 @@ CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
|
||||||
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
|
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
|
||||||
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
|
||||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES
|
CLANG_WARN_UNREACHABLE_CODE = YES
|
||||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
|
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
|
||||||
@@ -92,8 +88,11 @@ GCC_WARN_UNUSED_LABEL = YES
|
|||||||
GCC_WARN_UNUSED_PARAMETER = YES
|
GCC_WARN_UNUSED_PARAMETER = YES
|
||||||
GCC_WARN_UNUSED_VARIABLE = 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
|
// These should be removed once the conversion to ARC is complete
|
||||||
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
|
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
|
// 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 -Wno-format-non-iso $(WARNING_CFLAGS_EXTRA)
|
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments $(WARNING_CFLAGS_EXTRA)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include "ConfigCommonDebug.xcconfig"
|
||||||
|
|
||||||
|
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
|
||||||
|
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
GCC_GENERATE_TEST_COVERAGE_FILES = YES
|
||||||
|
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
// Debug only
|
// Debug only
|
||||||
|
|
||||||
|
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 1
|
||||||
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_COMMA = YES;
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
// Release only
|
// Release only
|
||||||
|
|
||||||
|
SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS = 0
|
||||||
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_COMMA = YES;
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
@@ -15,4 +17,3 @@ GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
|
|||||||
DEAD_CODE_STRIPPING = YES
|
DEAD_CODE_STRIPPING = YES
|
||||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||||
COPY_PHASE_STRIP = NO
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// Downloader
|
||||||
|
|
||||||
|
INFOPLIST_FILE = Downloader/Info.plist
|
||||||
|
WRAPPER_EXTENSION = xpc
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
|
||||||
|
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Downloader Debug
|
||||||
|
#include "ConfigDownloader.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// Fileop tool only
|
|
||||||
|
|
||||||
PRODUCT_NAME = $(SPARKLE_FILEOP_TOOL_NAME)
|
|
||||||
SKIP_INSTALL = YES
|
|
||||||
CLANG_ENABLE_MODULES = NO
|
|
||||||
@@ -7,7 +7,11 @@ WRAPPER_EXTENSION = framework
|
|||||||
FRAMEWORK_VERSION = A
|
FRAMEWORK_VERSION = A
|
||||||
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
|
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
|
||||||
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
|
|
||||||
SKIP_INSTALL = YES
|
SKIP_INSTALL = YES
|
||||||
DEFINES_MODULE = YES
|
DEFINES_MODULE = YES
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
|
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
|
||||||
|
|
||||||
|
// As long as we don't ourselves depend upon any Frameworks that are incompatible
|
||||||
|
// with Application Extensions, then we should allow frameworks that require
|
||||||
|
// compatibility to be able to link with us.
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#include "ConfigFramework.xcconfig"
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// Generate Appcast only
|
|
||||||
|
|
||||||
#include "ConfigSwift.xcconfig"
|
|
||||||
|
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = generate_appcast/Appcast-Bridging-Header.h
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
|
||||||
PRODUCT_NAME = generate_appcast
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// Generate Appcast Debug
|
|
||||||
|
|
||||||
#include "ConfigGenerateAppcast.xcconfig"
|
|
||||||
#include "ConfigSwiftDebug.xcconfig"
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// Generate Appcast Release
|
|
||||||
|
|
||||||
#include "ConfigGenerateAppcast.xcconfig"
|
|
||||||
#include "ConfigSwiftRelease.xcconfig"
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// InstallerConnection
|
||||||
|
|
||||||
|
INFOPLIST_FILE = InstallerConnection/Info.plist
|
||||||
|
WRAPPER_EXTENSION = xpc
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
|
||||||
|
PRODUCT_NAME = ${INSTALLER_CONNECTION_BUNDLE_ID}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// InstallerConnection Debug
|
||||||
|
|
||||||
|
#include "ConfigInstallerConnection.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Installer Launcher
|
||||||
|
|
||||||
|
INFOPLIST_FILE = InstallerLauncher/Info.plist
|
||||||
|
WRAPPER_EXTENSION = xpc
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
|
||||||
|
PRODUCT_NAME = ${INSTALLER_LAUNCHER_BUNDLE_ID}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Installer Launcher Debug
|
||||||
|
#include "ConfigInstallerLauncher.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Installer Progress only
|
||||||
|
|
||||||
|
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
|
||||||
|
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
|
||||||
|
SKIP_INSTALL = YES
|
||||||
|
CLANG_ENABLE_MODULES = NO
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// InstallerStatus
|
||||||
|
|
||||||
|
INFOPLIST_FILE = InstallerStatus/Info.plist
|
||||||
|
WRAPPER_EXTENSION = xpc
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
|
||||||
|
PRODUCT_NAME = ${INSTALLER_STATUS_BUNDLE_ID}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// InstallerStatus Debug
|
||||||
|
|
||||||
|
#include "ConfigInstallerStatus.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
// Relaunch Tool only
|
// Relaunch Tool only
|
||||||
|
|
||||||
INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist
|
|
||||||
PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME)
|
PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME)
|
||||||
SKIP_INSTALL = YES
|
SKIP_INSTALL = YES
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
|
||||||
CLANG_ENABLE_MODULES = NO
|
CLANG_ENABLE_MODULES = NO
|
||||||
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#include "ConfigRelaunch.xcconfig"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#include "ConfigRelaunch.xcconfig"
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// sparkle command line tool only
|
||||||
|
|
||||||
|
INFOPLIST_FILE = sparkle-cli/Info.plist
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.sparkle-cli
|
||||||
|
PRODUCT_NAME = sparkle
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks/
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
SWIFT_VERSION = 4.2
|
SWIFT_VERSION = 4.0
|
||||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// Test Application only
|
// Test Application
|
||||||
|
|
||||||
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
|
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
|
||||||
WRAPPER_EXTENSION = app
|
WRAPPER_EXTENSION = app
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME)
|
||||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
|
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
|
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
|
||||||
ENABLE_HARDENED_RUNTIME = NO
|
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
|
||||||
CODE_SIGN_IDENTITY = -
|
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
|
// Test Application Debug
|
||||||
#include "ConfigTestApp.xcconfig"
|
#include "ConfigTestApp.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Test Application Helper
|
||||||
|
|
||||||
|
INFOPLIST_FILE = TestAppHelper/Info.plist
|
||||||
|
WRAPPER_EXTENSION = xpc
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Test Application Helper Debug
|
||||||
|
#include "ConfigTestAppHelper.xcconfig"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
@@ -1 +0,0 @@
|
|||||||
#include "ConfigTestApp.xcconfig"
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
INFOPLIST_FILE = UITests/UITests-Info.plist
|
INFOPLIST_FILE = UITests/UITests-Info.plist
|
||||||
WRAPPER_EXTENSION = xctest
|
WRAPPER_EXTENSION = xctest
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||||
ENABLE_HARDENED_RUNTIME = NO
|
|
||||||
|
|
||||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
|
FRAMEWORK_SEARCH_PATHS = $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
|
||||||
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
|
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#include "ConfigUITest.xcconfig"
|
||||||
|
#include "ConfigSwiftDebug.xcconfig"
|
||||||
|
|
||||||
|
GCC_GENERATE_TEST_COVERAGE_FILES = NO
|
||||||
|
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#include "ConfigUnitTest.xcconfig"
|
||||||
|
#include "ConfigSwiftDebug.xcconfig"
|
||||||
|
|
||||||
|
GCC_GENERATE_TEST_COVERAGE_FILES = NO
|
||||||
|
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/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)
|
|
||||||
@@ -1,147 +1,56 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Tests the code signing validity of the extracted products within the provided path.
|
if [ "$ACTION" = "" ] ; then
|
||||||
# This guards against our archives being corrupt / created incorrectly.
|
# If using cocoapods, sanity check that the Podspec version matches the Sparkle version
|
||||||
function verify_code_signatures() {
|
if [ -x "$(command -v pod)" ]; then
|
||||||
verification_directory="$1"
|
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
|
||||||
if [[ -z "$verification_directory" ]]; then
|
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
|
||||||
echo "Provided verification directory does not exist" >&2
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
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}/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 -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2"
|
||||||
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"
|
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/INSTALL.markdown" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
|
|
||||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
|
||||||
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
|
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||||
cp "$CONFIGURATION_BUILD_DIR/generate_appcast" "$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 -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"
|
||||||
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.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
|
|
||||||
|
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
|
||||||
|
cp "$SRCROOT/Downloader/$DOWNLOADER_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
|
||||||
# Only copy dSYMs for Release builds, but don't check for the presence of the actual files
|
# 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
|
# because missing dSYMs in a release build SHOULD trigger a build failure
|
||||||
if [ "$CONFIGURATION" = "Release" ] ; then
|
if [ "$CONFIGURATION" = "Release" ] ; then
|
||||||
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
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_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"
|
||||||
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.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/SparkleCore.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
|
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
|
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
|
||||||
fi
|
fi
|
||||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
|
||||||
|
|
||||||
cd "$CONFIGURATION_BUILD_DIR/staging"
|
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
|
# Sorted file list groups similar files together, which improves tar compression
|
||||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
|
||||||
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"
|
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" -ne 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
|
fi
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/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
|
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/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
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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" ] || \
|
if [ -z "$SRCROOT" ] || \
|
||||||
[ -z "$BUILT_PRODUCTS_DIR" ] || \
|
[ -z "$BUILT_PRODUCTS_DIR" ] || \
|
||||||
[ -z "$INFOPLIST_PATH" ] || \
|
[ -z "$INFOPLIST_PATH" ] || \
|
||||||
[ -z "$MARKETING_VERSION" ]; then
|
[ -z "$CURRENT_PROJECT_VERSION" ]; then
|
||||||
echo "$0: Must be run from Xcode!" 1>&2
|
echo "$0: Must be run from Xcode!" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version="$MARKETING_VERSION"
|
version="$CURRENT_PROJECT_VERSION"
|
||||||
|
|
||||||
# Get version in format 1.x.x-commits-hash
|
# Get version in format 1.x.x-commits-hash
|
||||||
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
|
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
|
||||||
@@ -22,10 +22,10 @@ if [ -z "$gitversion" ] ; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove everything before the second last "-" to keep the hash part only
|
# remove everything before the first "-" to keep the hash part only
|
||||||
versionsuffix=$( echo "${gitversion}" | sed -E 's/.+((-[^.]+){2})$/\1/' )
|
versionsuffix=${gitversion#*-};
|
||||||
if [ "$versionsuffix" != "$gitversion" ]; then
|
if [ "$versionsuffix" != "$gitversion" ]; then
|
||||||
version="$version$versionsuffix"
|
version="$version $versionsuffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# and use it to set the CFBundleShortVersionString value
|
# and use it to set the CFBundleShortVersionString value
|
||||||
|
|||||||
Loaded 100 of 624 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user