Add convenience method to save the entitlements of a bundle to a file as XML

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-09-11 21:54:49 +08:00
parent e1df119bf3
commit 76fbf012ea
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -56,6 +56,13 @@ func recursivelyCodesign(path: String, identity: String) throws {
} }
} }
func saveCodesignEntitlements(target: String, path: String) throws {
let command = "codesign -d --entitlements \(path) --xml \(target)"
guard shell(command) == 0 else {
throw CodeSigningError.failedToCodeSign("Failed to save entitlements for \(target).")
}
}
func codesignClientAppBundle( func codesignClientAppBundle(
at clientAppDir: String, withCodeSignIdentity codeSignIdentity: String at clientAppDir: String, withCodeSignIdentity codeSignIdentity: String
) throws { ) throws {