notarize x64 and arm64 files from removable drive and copy back the dmg after done
MODIFY
WalletWasabi.Packager/MacSignTools.cs
WalletWasabi.Packager/MacSignTools.cs
@@ -13,23 +13,43 @@ public static class MacSignTools
{
public static void Sign()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- throw new NotSupportedException("This signing method is only valid on macOS!");
- }
+ //if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ //{
+ // throw new NotSupportedException("This signing method is only valid on macOS!");
+ //}
Console.WriteLine("Phase: finding the zip file on desktop which contains the compiled binaries from Windows.");
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+ string removableDriveFolder = Tools.GetSingleUsbDrive();
+
+ var srcZipFileNamePattern = "WasabiToNotarize-*";
+ var files = Directory.GetFiles(removableDriveFolder, srcZipFileNamePattern);
+ if (files.Length != 2)
+ {
+ throw new InvalidDataException($"{srcZipFileNamePattern} file missing or there are more! There must be exactly two!");
+ }
- var srcZipFileNamePattern = "Wasabi-macOS-*.zip";
- var files = Directory.GetFiles(desktopPath, srcZipFileNamePattern); // Example: Wasabi-macOS-1.1.10.2.zip
- if (files.Length != 1)
+ string? appleId = null;
+ string? password = null;
+ do
{
- throw new InvalidDataException($"{srcZipFileNamePattern} file missing or there are more on Desktop! There must be exactly one!");
+ Console.WriteLine("Enter appleId (email):");
+ appleId = Console.ReadLine();
}
- var zipPath = files[0];
- var versionPrefix = zipPath.Split('-')[^1].TrimEnd(".zip", StringComparison.InvariantCultureIgnoreCase); // Example: "/Users/user/Desktop/Wasabi-unsigned-1.1.10.2.zip".
+ while (string.IsNullOrWhiteSpace(appleId));
+
+ do
+ {
+ Console.WriteLine("Enter password:");
+ password = Console.ReadLine();
+ }
+ while (string.IsNullOrWhiteSpace(password));
+
+ foreach (var zipPath in files)
+ {
+ var zipFile = Path.GetFileName(zipPath);
+ var versionPrefix = Path.GetFileNameWithoutExtension(zipPath).Split('-')[1]; // Example: "WasabiToNotarize-2.0.0.0-arm64.zip or WasabiToNotarize-2.0.0.0.zip ".
var workingDir = Path.Combine(desktopPath, "wasabiTemp");
var dmgPath = Path.Combine(workingDir, "dmg");
var unzippedPath = Path.Combine(workingDir, "unzipped");
@@ -40,7 +60,7 @@ public static class MacSignTools
var appResPath = Path.Combine(appContentsPath, "Resources");
var appFrameworksPath = Path.Combine(appContentsPath, "Frameworks");
var infoFilePath = Path.Combine(appContentsPath, "Info.plist");
- var dmgFileName = $"Wasabi-{versionPrefix}.dmg";
+ var dmgFileName = zipFile.Replace("WasabiToNotarize", "Wasabi");
var dmgFilePath = Path.Combine(workingDir, dmgFileName);
var dmgUnzippedFilePath = Path.Combine(workingDir, $"Wasabi.tmp.dmg");
var appNotarizeFilePath = Path.Combine(workingDir, $"Wasabi-{versionPrefix}.zip");
@@ -53,22 +73,6 @@ public static class MacSignTools
Console.WriteLine("Phase: creating the working directory.");
- string? appleId = null;
- string? password = null;
- do
- {
- Console.WriteLine("Enter appleId (email):");
- appleId = Console.ReadLine();
- }
- while (string.IsNullOrWhiteSpace(appleId));
-
- do
- {
- Console.WriteLine("Enter password:");
- password = Console.ReadLine();
- }
- while (string.IsNullOrWhiteSpace(password));
-
if (Directory.Exists(workingDir))
{
DeleteWithChmod(workingDir);
@@ -304,6 +308,10 @@ public static class MacSignTools
DeleteWithChmod(workingDir);
Console.WriteLine("Phase: finish.");
+
+ var toRemovableFilePath = Path.Combine(removableDriveFolder, Path.GetFileName(desktopDmgFilePath));
+ File.Move(desktopDmgFilePath, toRemovableFilePath, true);
+ }
}
private static Process WaitProcessToFinish(Process? process, string processName)

MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -37,7 +37,8 @@ public static class Program
{
"win7-x64",
"linux-x64",
- "osx-x64"
+ "osx-x64",
+ "osx-arm64"
};
private static string VersionPrefix = Constants.ClientVersion.Revision == 0 ? Constants.ClientVersion.ToString(3) : Constants.ClientVersion.ToString();
@@ -341,10 +342,30 @@ public static class Program
continue;
}
- ZipFile.CreateFromDirectory(currentBinDistDirectory, Path.Combine(BinDistDirectory, $"Wasabi-macOS-{VersionPrefix}.zip"));
+ // Only add postfix to the final package if arm64, otherwise nothing.
+ var postfix = target.Contains("arm64") ? "-arm64" : "";
+
+ // After notarization this will be the filename of the dmg file.
+ var zipFileName = $"WasabiToNotarize-{deterministicFileNameTag}{postfix}.zip";
+ var zipFilePath = Path.Combine(BinDistDirectory, zipFileName);
+
+ ZipFile.CreateFromDirectory(currentBinDistDirectory, zipFilePath);
await IoHelpers.TryDeleteDirectoryAsync(currentBinDistDirectory).ConfigureAwait(false);
Console.WriteLine($"Deleted {currentBinDistDirectory}");
+
+ try
+ {
+ var drive = Tools.GetSingleUsbDrive();
+ var targetFilePath = Path.Combine(drive, zipFileName);
+
+ Console.WriteLine($"Trying to move unsigned zip file to removable ('{targetFilePath}').");
+ File.Move(zipFilePath, targetFilePath, overwrite: true);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"There was an error during copying the file to removable: '{ex.Message}'");
+ }
}
else if (target.StartsWith("linux"))
{

MODIFY
WalletWasabi.Packager/Tools.cs
WalletWasabi.Packager/Tools.cs
using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
namespace WalletWasabi.Packager;
@@ -71,4 +73,19 @@ public static class Tools
}
return size;
}
+
+ public static string GetSingleUsbDrive()
+ {
+ IEnumerable<DriveInfo> driveList;
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ driveList = DriveInfo.GetDrives().Where(d => d.Name.Contains("USB")).ToArray();
+ }
+ else
+ {
+ driveList = DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Removable);
+ }
+
+ return driveList.Single().Name;
+ }
}

notarize x64 and arm64 files from removable drive and copy back the dmg after done