From 76fbf012ea2115b85de61139fdf732605c41350c Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 11 Sep 2024 21:54:49 +0800 Subject: [PATCH] Add convenience method to save the entitlements of a bundle to a file as XML Signed-off-by: Claudio Cambra --- admin/osx/mac-crafter/Sources/Utils/Codesign.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index 16da33eb36..027d99c32c 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -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( at clientAppDir: String, withCodeSignIdentity codeSignIdentity: String ) throws {