mac-crafter: Only attempt sparkle codesign if it exists in the app bundle
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 5 Dec 2024 07:50:16 +0000 (15:50 +0800)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 9 Dec 2024 08:10:16 +0000 (08:10 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Utils/Codesign.swift

index 4b2341274c0b3b7d87492052c5de11a9fd2de73b..b511f0a443e27750a143c4107564e3aba0e54050 100644 (file)
@@ -123,14 +123,21 @@ func codesignClientAppBundle(
     // Multiple components of the app will now have the get-task-allow entitlements.
     // We need to strip these out manually.
 
-    print("Code-signing Sparkle autoupdater app (without entitlements)...")
     let sparkleFrameworkPath = "\(frameworksPath)/Sparkle.framework"
-    try recursivelyCodesign(path: "\(sparkleFrameworkPath)/Resources/Autoupdate.app",
-                            identity: codeSignIdentity,
-                            options: "--timestamp --force --verbose=4 --options runtime --deep")
+    if FileManager.default.fileExists(atPath: "\(sparkleFrameworkPath)/Resources/Autoupdate.app") {
+        print("Code-signing Sparkle autoupdater app (without entitlements)...")
 
-    print("Re-codesigning Sparkle library...")
-    try codesign(identity: codeSignIdentity, path: "\(sparkleFrameworkPath)/Sparkle")
+        try recursivelyCodesign(
+            path: "\(sparkleFrameworkPath)/Resources/Autoupdate.app",
+            identity: codeSignIdentity,
+            options: "--timestamp --force --verbose=4 --options runtime --deep"
+        )
+
+        print("Re-codesigning Sparkle library...")
+        try codesign(identity: codeSignIdentity, path: "\(sparkleFrameworkPath)/Sparkle")
+    } else {
+        print("Build does not have Sparkle, skipping.")
+    }
 
     print("Code-signing app extensions (removing get-task-allow entitlements)...")
     let fm = FileManager.default