Skip to content

Commit c9b5fbb

Browse files
authored
Merge pull request #9298 from nextcloud/bugfix/signing
Implement signing for Sparkle Installer and Autoupdate
2 parents b97a3d9 + d61e04c commit c9b5fbb

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

admin/osx/mac-crafter/Sources/Utils/Signer.swift

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,42 @@ enum Signer: Signing {
159159
await sign(at: location, with: codeSignIdentity, entitlements: nil)
160160
}
161161

162+
///
163+
/// Find and sign the Sparkle Installer inside the Sparkle framework.
164+
///
165+
/// This needs explicit treatment because codesign does not automatically sign it when signing the upstream framework bundle.
166+
///
167+
private static func signSparkleInstaller(in bundle: URL, with codeSignIdentity: String) async {
168+
let location = bundle
169+
.appendingPathComponent("Contents")
170+
.appendingPathComponent("Frameworks")
171+
.appendingPathComponent("Sparkle.framework")
172+
.appendingPathComponent("Versions")
173+
.appendingPathComponent("B")
174+
.appendingPathComponent("XPCServices")
175+
.appendingPathComponent("Installer")
176+
.appendingPathExtension("xpc")
177+
178+
await sign(at: location, with: codeSignIdentity, entitlements: nil)
179+
}
180+
181+
///
182+
/// Find and sign the Sparkle autoupdate inside the Sparkle framework.
183+
///
184+
/// This needs explicit treatment because codesign does not automatically sign it when signing the upstream framework bundle.
185+
///
186+
private static func signSparkleAutoupdate(in bundle: URL, with codeSignIdentity: String) async {
187+
let location = bundle
188+
.appendingPathComponent("Contents")
189+
.appendingPathComponent("Frameworks")
190+
.appendingPathComponent("Sparkle.framework")
191+
.appendingPathComponent("Versions")
192+
.appendingPathComponent("B")
193+
.appendingPathComponent("Autoupdate")
194+
195+
await sign(at: location, with: codeSignIdentity, entitlements: nil)
196+
}
197+
162198
///
163199
/// Find and sign the Sparkle updater app inside the Sparkle framework.
164200
///
@@ -234,6 +270,8 @@ enum Signer: Signing {
234270
await signQtWebEngineProcessApp(in: location, with: codeSignIdentity)
235271
await signSparkleDownloader(in: location, with: codeSignIdentity)
236272
await signSparkleUpdaterApp(in: location, with: codeSignIdentity)
273+
await signSparkleInstaller(in: location, with: codeSignIdentity)
274+
await signSparkleAutoupdate(in: location, with: codeSignIdentity)
237275

238276
let frameworksInsideMainBundle = try findFrameworks(at: location)
239277

0 commit comments

Comments
 (0)