Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Sign bundle instead of individual mach-o files
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Jun 20, 2022
1 parent 072e47f commit 6abdeb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/Squirrel.CommandLine/OSX/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,8 @@ private static void Pack(PackOptions options)

// code signing all mach-o binaries
if (SquirrelRuntimeInfo.IsOSX && !String.IsNullOrEmpty(options.signAppIdentity) && !String.IsNullOrEmpty(options.notaryProfile)) {
var machoFiles = Directory.EnumerateFiles(appBundlePath, "*", SearchOption.AllDirectories)
.Where(f => PlatformUtil.IsMachOImage(f))
.ToArray();

HelperExe.CodeSign(options.signAppIdentity, options.signEntitlements, machoFiles);
HelperExe.CodeSign(options.signAppIdentity, options.signEntitlements, new []{ appBundlePath });
HelperExe.AssessCodeSign(appBundlePath);

// notarize and staple the .app before creating a Squirrel release
HelperExe.CreateDittoZip(appBundlePath, zipPath);
Expand Down
19 changes: 16 additions & 3 deletions src/Squirrel.CommandLine/OSX/HelperExe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public static void CodeSign(string identity, string entitlements, string[] files
"--options", "runtime",
"--entitlements", entitlements
};

args.AddRange(files);

Log.Info($"Preparing to codesign {files.Length} Mach-O files...");
Log.Info($"Preparing to codesign package...");

InvokeAndThrowIfNonZero("codesign", args, null);
Console.WriteLine(InvokeAndThrowIfNonZero("codesign", args, null));

Log.Info("codesign completed successfully");
}
Expand Down Expand Up @@ -135,6 +135,7 @@ public static void CreateDittoZip(string folder, string outputZip)
var args = new List<string> {
"-c",
"-k",
"--rsrc",
"--keepParent",
"--sequesterRsrc",
folder,
Expand All @@ -144,5 +145,17 @@ public static void CreateDittoZip(string folder, string outputZip)
Log.Info($"Creating ditto bundle '{outputZip}'");
InvokeAndThrowIfNonZero("ditto", args, null);
}

[SupportedOSPlatform("osx")]
public static void AssessCodeSign(string filePath)
{
var args = new List<string> {
"--assess",
"-vvvv",
filePath
};

Console.WriteLine(InvokeAndThrowIfNonZero("spctl", args, null));
}
}
}

0 comments on commit 6abdeb1

Please sign in to comment.