Skip to content

Commit

Permalink
Also sign executables during recursive codesign
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Nov 21, 2024
1 parent 7012cb7 commit 010d169
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion admin/osx/mac-crafter/Sources/Utils/Codesign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func isAppExtension(_ path: String) -> Bool {
path.hasSuffix(".appex")
}

func isExecutable(_ path: String) -> Bool {
FileManager.default.isExecutableFile(atPath: path)
}

func codesign(identity: String, path: String, options: String = defaultCodesignOptions) throws {
print("Code-signing \(path)...")
let command = "codesign -s \"\(identity)\" \(options) \"\(path)\""
Expand All @@ -53,7 +57,10 @@ func recursivelyCodesign(
}

for case let enumeratedItem as String in pathEnumerator {
guard isLibrary(enumeratedItem) || isAppExtension(enumeratedItem) else { continue }
guard isLibrary(enumeratedItem) ||
isAppExtension(enumeratedItem) ||
isExecutable(enumeratedItem)
else { continue }
try codesign(identity: identity, path: "\(path)/\(enumeratedItem)")
}
}
Expand Down

0 comments on commit 010d169

Please sign in to comment.