mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Merge pull request #7548 from nextcloud/bugfix/mac-crafter-woes-pt-100000
Only sign main executable at end (mac-crafter)
This commit is contained in:
commit
bd23f5e3b3
1 changed files with 9 additions and 3 deletions
|
@ -60,7 +60,8 @@ func codesign(identity: String, path: String, options: String = defaultCodesignO
|
||||||
func recursivelyCodesign(
|
func recursivelyCodesign(
|
||||||
path: String,
|
path: String,
|
||||||
identity: String,
|
identity: String,
|
||||||
options: String = defaultCodesignOptions
|
options: String = defaultCodesignOptions,
|
||||||
|
skip: [String] = []
|
||||||
) throws {
|
) throws {
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
guard let pathEnumerator = fm.enumerator(atPath: path) else {
|
guard let pathEnumerator = fm.enumerator(atPath: path) else {
|
||||||
|
@ -71,6 +72,10 @@ func recursivelyCodesign(
|
||||||
|
|
||||||
for case let enumeratedItem as String in pathEnumerator {
|
for case let enumeratedItem as String in pathEnumerator {
|
||||||
let enumeratedItemPath = "\(path)/\(enumeratedItem)"
|
let enumeratedItemPath = "\(path)/\(enumeratedItem)"
|
||||||
|
guard !skip.contains(enumeratedItemPath) else {
|
||||||
|
print("Skipping \(enumeratedItemPath)...")
|
||||||
|
continue
|
||||||
|
}
|
||||||
let isExecutableFile = try isExecutable(enumeratedItemPath)
|
let isExecutableFile = try isExecutable(enumeratedItemPath)
|
||||||
guard isLibrary(enumeratedItem) || isAppExtension(enumeratedItem) || isExecutableFile else {
|
guard isLibrary(enumeratedItem) || isAppExtension(enumeratedItem) || isExecutableFile else {
|
||||||
continue
|
continue
|
||||||
|
@ -147,7 +152,6 @@ func codesignClientAppBundle(
|
||||||
// Now we do the final codesign bit
|
// Now we do the final codesign bit
|
||||||
let binariesDir = "\(clientContentsDir)/MacOS"
|
let binariesDir = "\(clientContentsDir)/MacOS"
|
||||||
print("Code-signing Nextcloud Desktop Client binaries...")
|
print("Code-signing Nextcloud Desktop Client binaries...")
|
||||||
try recursivelyCodesign(path: binariesDir, identity: codeSignIdentity)
|
|
||||||
|
|
||||||
guard let appName = clientAppDir.components(separatedBy: "/").last, clientAppDir.hasSuffix(".app") else {
|
guard let appName = clientAppDir.components(separatedBy: "/").last, clientAppDir.hasSuffix(".app") else {
|
||||||
throw AppBundleSigningError.couldNotEnumerate("Failed to determine main executable name.")
|
throw AppBundleSigningError.couldNotEnumerate("Failed to determine main executable name.")
|
||||||
|
@ -155,5 +159,7 @@ func codesignClientAppBundle(
|
||||||
|
|
||||||
// Sign the main executable last
|
// Sign the main executable last
|
||||||
let mainExecutableName = String(appName.dropLast(".app".count))
|
let mainExecutableName = String(appName.dropLast(".app".count))
|
||||||
try codesign(identity: codeSignIdentity, path: "\(binariesDir)/\(mainExecutableName)")
|
let mainExecutablePath = "\(binariesDir)/\(mainExecutableName)"
|
||||||
|
try recursivelyCodesign(path: binariesDir, identity: codeSignIdentity, skip: [mainExecutablePath])
|
||||||
|
try codesign(identity: codeSignIdentity, path: mainExecutablePath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue