Add -onlybinaries switch to Packager
MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -11,38 +11,20 @@ using System.Threading.Tasks;
namespace WalletWasabi.Packager
{
- internal class Program
- {
- private static void Main(string[] args)
+ public class Program
{
// 0. Dump Client version (or else wrong .msi will be created) - Helpers.Constants.ClientVersion
// 1. Publish with Packager.
// 2. Build WIX project with Release and x64 configuration.
// 3. Sign with Packager, set restore true so the password won't be kept.
- var doPublish = true;
- var doSign = false;
- var doRestoreThisFile = false;
- var pfxPassword = "dontcommit";
-
- string pfxPath = "C:\\digicert.pfx";
- string packagerProjectDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\"));
- string solutionDirectory = Path.GetFullPath(Path.Combine(packagerProjectDirectory, "..\\"));
- string guiProjectDirectory = Path.GetFullPath(Path.Combine(solutionDirectory, "WalletWasabi.Gui\\"));
- string libraryProjectDirectory = Path.GetFullPath(Path.Combine(solutionDirectory, "WalletWasabi\\"));
- string wixProjectDirectory = Path.GetFullPath(Path.Combine(solutionDirectory, "WalletWasabi.WindowsInstaller\\"));
- string binDistDirectory = Path.GetFullPath(Path.Combine(guiProjectDirectory, "bin\\dist"));
- Console.WriteLine($"{nameof(solutionDirectory)}:\t\t{solutionDirectory}");
- Console.WriteLine($"{nameof(packagerProjectDirectory)}:\t{packagerProjectDirectory}");
- Console.WriteLine($"{nameof(guiProjectDirectory)}:\t\t{guiProjectDirectory}");
- Console.WriteLine($"{nameof(libraryProjectDirectory)}:\t\t{libraryProjectDirectory}");
- Console.WriteLine($"{nameof(wixProjectDirectory)}:\t\t{wixProjectDirectory}");
- Console.WriteLine($"{nameof(binDistDirectory)}:\t\t{binDistDirectory}");
-
- string versionPrefix = Helpers.Constants.ClientVersion.ToString();
- string executableName = "wassabee";
- Console.WriteLine();
- Console.WriteLine($"{nameof(versionPrefix)}:\t\t\t{versionPrefix}");
- Console.WriteLine($"{nameof(executableName)}:\t\t\t{executableName}");
+
+ public const bool DoPublish = true;
+ public const bool DoSign = false;
+ public const bool DoRestoreProgramCs = false;
+ public const string PfxPassword = "dontcommit";
+
+ public const string PfxPath = "C:\\digicert.pfx";
+ public const string ExecutableName = "wassabee";
// https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog
// BOTTLENECKS:
@@ -51,40 +33,186 @@ namespace WalletWasabi.Packager
// Avalonia - win7-32, linux-64, osx-64
// We'll only support x64, if someone complains, we can come back to it.
// For 32 bit Windows there needs to be a lot of WIX configuration to be done.
- var targets = new List<string>
+ public static string[] Targets = new[]
{
"win7-x64",
"linux-x64",
"osx-x64"
};
+
+ public static string PackagerProjectDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\"));
+ public static string SolutionDirectory = Path.GetFullPath(Path.Combine(PackagerProjectDirectory, "..\\"));
+ public static string GuiProjectDirectory = Path.GetFullPath(Path.Combine(SolutionDirectory, "WalletWasabi.Gui\\"));
+ public static string LibraryProjectDirectory = Path.GetFullPath(Path.Combine(SolutionDirectory, "WalletWasabi\\"));
+ public static string WixProjectDirectory = Path.GetFullPath(Path.Combine(SolutionDirectory, "WalletWasabi.WindowsInstaller\\"));
+ public static string BinDistDirectory = Path.GetFullPath(Path.Combine(GuiProjectDirectory, "bin\\dist"));
+
+ public static string VersionPrefix = Helpers.Constants.ClientVersion.ToString();
+
+ public static bool OnlyBinaries;
+
+ private static void Main(string[] args)
+ {
+ // Only binaries mode is for deterministic builds.
+ OnlyBinaries = IsOnlyBinariesMode(args);
+ ReportStatus();
+
+ if (DoPublish || OnlyBinaries)
+ {
+ Publish();
+ if (OnlyBinaries)
+ {
+ IoHelpers.OpenFolderInFileExplorer(BinDistDirectory);
+ }
+ }
+
+ if (DoSign && !OnlyBinaries)
+ {
+ Sign();
+ }
+
+ if (DoRestoreProgramCs && !OnlyBinaries)
+ {
+ RestoreProgramCs();
+ }
+ }
+
+ private static void ReportStatus()
+ {
+ if (OnlyBinaries)
+ {
+ Console.WriteLine($"I'll only generate binaries and disregard all other options.");
+ }
+ Console.WriteLine($"{nameof(VersionPrefix)}:\t\t\t{VersionPrefix}");
+ Console.WriteLine($"{nameof(ExecutableName)}:\t\t\t{ExecutableName}");
+
Console.WriteLine();
- Console.Write($"{nameof(targets)}:\t\t\t");
- targets.ForEach(x =>
+ Console.Write($"{nameof(Targets)}:\t\t\t");
+ foreach (var target in Targets)
{
- if (targets.Last() != x)
+ if (Targets.Last() != target)
{
- Console.Write($"{x}, ");
+ Console.Write($"{target}, ");
}
else
{
- Console.Write(x);
+ Console.Write(target);
+ }
}
- });
Console.WriteLine();
+ }
+
+ private static bool IsOnlyBinariesMode(string[] args)
+ {
+ bool onlyBinaries = false;
+ if (args.Any())
+ {
+ if (args[0].Trim().TrimStart('-').Equals("onlybinaries", StringComparison.OrdinalIgnoreCase))
+ {
+ onlyBinaries = true;
+ }
+ }
+
+ return onlyBinaries;
+ }
+
+ private static void RestoreProgramCs()
+ {
+ var psiRestoreThisFile = new ProcessStartInfo
+ {
+ FileName = "cmd",
+ RedirectStandardInput = true,
+ WorkingDirectory = PackagerProjectDirectory
+ };
+ using (var restoreThisFileProcess = Process.Start(psiRestoreThisFile))
+ {
+ restoreThisFileProcess.StandardInput.WriteLine($"git checkout -- Program.cs && exit");
+ restoreThisFileProcess.WaitForExit();
+ }
+ }
- if (doPublish)
+ private static void Sign()
+ {
+ foreach (string target in Targets)
{
- if (Directory.Exists(binDistDirectory))
+ if (target.StartsWith("win", StringComparison.OrdinalIgnoreCase))
{
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(binDistDirectory).GetAwaiter().GetResult();
- Console.WriteLine($"Deleted {binDistDirectory}");
+ string publishedFolder = Path.Combine(BinDistDirectory, target);
+
+ Console.WriteLine("Move created .msi");
+ var msiPath = Path.Combine(WixProjectDirectory, @"bin\Release\Wasabi.msi");
+ if (!File.Exists(msiPath))
+ {
+ throw new Exception(".msi doesn't exist. Expected path: Wasabi.msi.");
+ }
+ var msiFileName = Path.GetFileNameWithoutExtension(msiPath);
+ var newMsiPath = Path.Combine(BinDistDirectory, $"{msiFileName}-{VersionPrefix}.msi");
+ File.Move(msiPath, newMsiPath);
+
+ // Sign code with digicert.
+ var psiSigntool = new ProcessStartInfo
+ {
+ FileName = "cmd",
+ RedirectStandardInput = true,
+ WorkingDirectory = BinDistDirectory
+ };
+ using (var signToolProcess = Process.Start(psiSigntool))
+ {
+ signToolProcess.StandardInput.WriteLine($"signtool sign /d \"Wasabi Wallet\" /f \"{PfxPath}\" /p {PfxPassword} /t http://timestamp.digicert.com /a \"{newMsiPath}\" && exit");
+ signToolProcess.WaitForExit();
+ }
+
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
+ Console.WriteLine($"Deleted {publishedFolder}");
+ }
+ }
+
+ Console.WriteLine("Signing final files...");
+ var finalFiles = Directory.GetFiles(BinDistDirectory);
+
+ foreach (var finalFile in finalFiles)
+ {
+ var psiSignProcess = new ProcessStartInfo
+ {
+ FileName = "cmd",
+ RedirectStandardInput = true,
+ WorkingDirectory = BinDistDirectory
+ };
+ using (var signProcess = Process.Start(psiSignProcess))
+ {
+ signProcess.StandardInput.WriteLine($"gpg --armor --detach-sign {finalFile} && exit");
+ signProcess.WaitForExit();
+ }
+
+ var psiRestoreHeat = new ProcessStartInfo
+ {
+ FileName = "cmd",
+ RedirectStandardInput = true,
+ WorkingDirectory = WixProjectDirectory
+ };
+ using (var restoreHeatProcess = Process.Start(psiRestoreHeat))
+ {
+ restoreHeatProcess.StandardInput.WriteLine($"git checkout -- ComponentsGenerated.wxs && exit");
+ restoreHeatProcess.WaitForExit();
+ }
+ }
+
+ IoHelpers.OpenFolderInFileExplorer(BinDistDirectory);
+ }
+
+ private static void Publish()
+ {
+ if (Directory.Exists(BinDistDirectory))
+ {
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(BinDistDirectory).GetAwaiter().GetResult();
+ Console.WriteLine($"Deleted {BinDistDirectory}");
}
var psiBuild = new ProcessStartInfo
{
FileName = "cmd",
RedirectStandardInput = true,
- WorkingDirectory = guiProjectDirectory
+ WorkingDirectory = GuiProjectDirectory
};
using (var pBuild = Process.Start(psiBuild))
{
@@ -92,8 +220,8 @@ namespace WalletWasabi.Packager
pBuild.WaitForExit();
}
- var guiBinReleaseDirectory = Path.GetFullPath(Path.Combine(guiProjectDirectory, "bin\\Release"));
- var libraryBinReleaseDirectory = Path.GetFullPath(Path.Combine(libraryProjectDirectory, "bin\\Release"));
+ var guiBinReleaseDirectory = Path.GetFullPath(Path.Combine(GuiProjectDirectory, "bin\\Release"));
+ var libraryBinReleaseDirectory = Path.GetFullPath(Path.Combine(LibraryProjectDirectory, "bin\\Release"));
if (Directory.Exists(guiBinReleaseDirectory))
{
IoHelpers.DeleteRecursivelyWithMagicDustAsync(guiBinReleaseDirectory).GetAwaiter().GetResult();
@@ -105,20 +233,11 @@ namespace WalletWasabi.Packager
Console.WriteLine($"Deleted {libraryBinReleaseDirectory}");
}
- foreach (string target in targets)
- {
- string currentBinDistDirectory;
- string publishedFolder = Path.Combine(binDistDirectory, target);
- string macWasabiAppDir = Path.Combine(publishedFolder, "Wasabi Wallet.App"); // This should be lowercase .app, but MAC will prevent people from upgrading if we change it.
- string macContentsDir = Path.Combine(macWasabiAppDir, "Contents");
- if (target.StartsWith("osx"))
+ foreach (string target in Targets)
{
- currentBinDistDirectory = Path.GetFullPath(Path.Combine(macContentsDir, "MacOS"));
- }
- else
- {
- currentBinDistDirectory = publishedFolder;
- }
+ string publishedFolder = Path.Combine(BinDistDirectory, target);
+ string currentBinDistDirectory = publishedFolder;
+
Console.WriteLine();
Console.WriteLine($"{nameof(currentBinDistDirectory)}:\t{currentBinDistDirectory}");
@@ -133,7 +252,7 @@ namespace WalletWasabi.Packager
{
FileName = "dotnet",
Arguments = $"clean",
- WorkingDirectory = guiProjectDirectory
+ WorkingDirectory = GuiProjectDirectory
};
using (var pClean = Process.Start(psiClean))
{
@@ -169,8 +288,8 @@ namespace WalletWasabi.Packager
var psiPublish = new ProcessStartInfo
{
FileName = "dotnet",
- Arguments = $"publish --configuration Release --force --output \"{currentBinDistDirectory}\" --self-contained true --runtime \"{target}\" /p:VersionPrefix={versionPrefix} --disable-parallel --no-cache /p:DebugType=none /p:DebugSymbols=false /p:ErrorReport=none /p:DocumentationFile=\"\" /p:Deterministic=true",
- WorkingDirectory = guiProjectDirectory
+ Arguments = $"publish --configuration Release --force --output \"{currentBinDistDirectory}\" --self-contained true --runtime \"{target}\" /p:VersionPrefix={VersionPrefix} --disable-parallel --no-cache /p:DebugType=none /p:DebugSymbols=false /p:ErrorReport=none /p:DocumentationFile=\"\" /p:Deterministic=true",
+ WorkingDirectory = GuiProjectDirectory
};
using (var pPublish = Process.Start(psiPublish))
{
@@ -209,16 +328,16 @@ namespace WalletWasabi.Packager
if (target.StartsWith("win"))
{
oldExecutablePath = Path.Combine(currentBinDistDirectory, "WalletWasabi.Gui.exe");
- newExecutablePath = Path.Combine(currentBinDistDirectory, $"{executableName}.exe");
+ newExecutablePath = Path.Combine(currentBinDistDirectory, $"{ExecutableName}.exe");
}
else // Linux & OSX
{
oldExecutablePath = Path.Combine(currentBinDistDirectory, "WalletWasabi.Gui");
- newExecutablePath = Path.Combine(currentBinDistDirectory, executableName);
+ newExecutablePath = Path.Combine(currentBinDistDirectory, ExecutableName);
}
File.Move(oldExecutablePath, newExecutablePath);
- long installedSizeKb = DirSize(new DirectoryInfo(publishedFolder)) / 1000;
+ long installedSizeKb = Tools.DirSize(new DirectoryInfo(publishedFolder)) / 1000;
if (target.StartsWith("win"))
{
@@ -233,25 +352,42 @@ namespace WalletWasabi.Packager
pEditbin.WaitForExit();
}
- var icoPath = Path.Combine(guiProjectDirectory, "Assets", "WasabiLogo.ico");
+ var icoPath = Path.Combine(GuiProjectDirectory, "Assets", "WasabiLogo.ico");
var psiRcedit = new ProcessStartInfo
{
FileName = "rcedit",
- Arguments = $"\"{newExecutablePath}\" --set-icon \"{icoPath}\" --set-file-version \"{versionPrefix}\" --set-product-version \"{versionPrefix}\" --set-version-string \"LegalCopyright\" \"MIT\" --set-version-string \"CompanyName\" \"zkSNACKs\" --set-version-string \"FileDescription\" \"Privacy focused, ZeroLink compliant Bitcoin wallet.\" --set-version-string \"ProductName\" \"Wasabi Wallet\"",
+ Arguments = $"\"{newExecutablePath}\" --set-icon \"{icoPath}\" --set-file-version \"{VersionPrefix}\" --set-product-version \"{VersionPrefix}\" --set-version-string \"LegalCopyright\" \"MIT\" --set-version-string \"CompanyName\" \"zkSNACKs\" --set-version-string \"FileDescription\" \"Privacy focused, ZeroLink compliant Bitcoin wallet.\" --set-version-string \"ProductName\" \"Wasabi Wallet\"",
WorkingDirectory = currentBinDistDirectory
};
using (var pRcedit = Process.Start(psiRcedit))
{
pRcedit.WaitForExit();
}
+
+ // IF IT'S IN ONLYBINARIES MODE DON'T DO ANYTHING FANCY PACKAGING AFTER THIS!!!
+ if (OnlyBinaries) continue; // In Windows build at this moment it doesn't matter though.
}
else if (target.StartsWith("osx"))
{
+ // IF IT'S IN ONLYBINARIES MODE DON'T DO ANYTHING FANCY PACKAGING AFTER THIS!!!
+ if (OnlyBinaries) continue;
+
+ var tempName = Path.Combine(BinDistDirectory, $"temp-{target}");
+ Directory.Move(currentBinDistDirectory, tempName);
+ currentBinDistDirectory = tempName;
+
+ string macWasabiAppDir = Path.Combine(publishedFolder, "Wasabi Wallet.App"); // This should be lowercase .app, but MAC will prevent people from upgrading if we change it.
+ string macContentsDir = Path.Combine(macWasabiAppDir, "Contents");
+ string newName = Path.GetFullPath(Path.Combine(macContentsDir, "MacOS"));
+ Directory.CreateDirectory(macContentsDir);
+ Directory.Move(currentBinDistDirectory, newName);
+ currentBinDistDirectory = newName;
+
string resourcesDir = Path.Combine(macContentsDir, "Resources");
string infoFilePath = Path.Combine(macContentsDir, "Info.plist");
Directory.CreateDirectory(resourcesDir);
- var iconpath = Path.Combine(guiProjectDirectory, "Assets", "WasabiLogo.icns");
+ var iconpath = Path.Combine(GuiProjectDirectory, "Assets", "WasabiLogo.icns");
File.Copy(iconpath, Path.Combine(resourcesDir, "WasabiLogo.icns"));
string infoContent = $@"<?xml version=""1.0"" encoding=""UTF-8""?>
@@ -273,13 +409,13 @@ namespace WalletWasabi.Packager
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>{versionPrefix}</string>
+ <string>{VersionPrefix}</string>
<key>CFBundleVersion</key>
- <string>{versionPrefix}</string>
+ <string>{VersionPrefix}</string>
<key>CFBundleExecutable</key>
- <string>{executableName}</string>
+ <string>{ExecutableName}</string>
<key>CFBundleName</key>
<string>Wasabi Wallet</string>
@@ -316,19 +452,19 @@ namespace WalletWasabi.Packager
}
//how to generate .DS_Store file - https://github.com/zkSNACKs/WalletWasabi/pull/928/commits/e38ed672dee25f6e45a3eb16584887cc6d48c4e6
- var dmgContentDir = Path.Combine(packagerProjectDirectory, "Content", "Osx");
+ var dmgContentDir = Path.Combine(PackagerProjectDirectory, "Content", "Osx");
IoHelpers.CopyFilesRecursively(new DirectoryInfo(dmgContentDir), new DirectoryInfo(publishedFolder));
var psiGenIsoImage = new ProcessStartInfo
{
FileName = "cmd",
RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
+ WorkingDirectory = BinDistDirectory
};
string uncompressedDmgFileName = $"Wasabi-uncompressed.dmg";
- string uncompressedDmgFilePath = Path.Combine(binDistDirectory, uncompressedDmgFileName);
- string dmgFileName = $"Wasabi-{versionPrefix}.dmg";
+ string uncompressedDmgFilePath = Path.Combine(BinDistDirectory, uncompressedDmgFileName);
+ string dmgFileName = $"Wasabi-{VersionPrefix}.dmg";
using (var genIsoImageProcess = Process.Start(psiGenIsoImage))
{
// http://www.nathancoulson.com/proj_cross_tools.php
@@ -354,7 +490,7 @@ namespace WalletWasabi.Packager
{
FileName = "cmd",
RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
+ WorkingDirectory = BinDistDirectory
};
using (var dmgProcess = Process.Start(psiDmg))
{
@@ -380,13 +516,16 @@ namespace WalletWasabi.Packager
}
else if (target.StartsWith("linux"))
{
+ // IF IT'S IN ONLYBINARIES MODE DON'T DO ANYTHING FANCY PACKAGING AFTER THIS!!!
+ if (OnlyBinaries) continue;
+
Console.WriteLine("Create Linux .tar.gz");
if (!Directory.Exists(publishedFolder))
{
throw new Exception($"{publishedFolder} doesn't exist.");
}
- var newFolderName = $"WasabiLinux-{versionPrefix}";
- var newFolderPath = Path.Combine(binDistDirectory, newFolderName);
+ var newFolderName = $"WasabiLinux-{VersionPrefix}";
+ var newFolderPath = Path.Combine(BinDistDirectory, newFolderName);
Directory.Move(publishedFolder, newFolderPath);
publishedFolder = newFolderPath;
@@ -394,7 +533,7 @@ namespace WalletWasabi.Packager
{
FileName = "cmd",
RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
+ WorkingDirectory = BinDistDirectory
};
using (var tarProcess = Process.Start(psiTar))
{
@@ -405,26 +544,26 @@ namespace WalletWasabi.Packager
Console.WriteLine("Create Linux .deb");
var debFolderRelativePath = "deb";
- var debFolderPath = Path.Combine(binDistDirectory, debFolderRelativePath);
+ var debFolderPath = Path.Combine(BinDistDirectory, debFolderRelativePath);
var linuxUsrLocalBinFolder = "/usr/local/bin/";
var debUsrLocalBinFolderRelativePath = Path.Combine(debFolderRelativePath, "usr", "local", "bin");
- var debUsrLocalBinFolderPath = Path.Combine(binDistDirectory, debUsrLocalBinFolderRelativePath);
+ var debUsrLocalBinFolderPath = Path.Combine(BinDistDirectory, debUsrLocalBinFolderRelativePath);
Directory.CreateDirectory(debUsrLocalBinFolderPath);
var debUsrAppFolderRelativePath = Path.Combine(debFolderRelativePath, "usr", "share", "applications");
- var debUsrAppFolderPath = Path.Combine(binDistDirectory, debUsrAppFolderRelativePath);
+ var debUsrAppFolderPath = Path.Combine(BinDistDirectory, debUsrAppFolderRelativePath);
Directory.CreateDirectory(debUsrAppFolderPath);
var debUsrShareIconsFolderRelativePath = Path.Combine(debFolderRelativePath, "usr", "share", "icons", "hicolor");
- var debUsrShareIconsFolderPath = Path.Combine(binDistDirectory, debUsrShareIconsFolderRelativePath);
+ var debUsrShareIconsFolderPath = Path.Combine(BinDistDirectory, debUsrShareIconsFolderRelativePath);
var debianFolderRelativePath = Path.Combine(debFolderRelativePath, "DEBIAN");
- var debianFolderPath = Path.Combine(binDistDirectory, debianFolderRelativePath);
+ var debianFolderPath = Path.Combine(BinDistDirectory, debianFolderRelativePath);
Directory.CreateDirectory(debianFolderPath);
newFolderName = "wasabiwallet";
- var linuxWasabiWalletFolder = LinuxPathCombine(linuxUsrLocalBinFolder, newFolderName);
+ var linuxWasabiWalletFolder = Tools.LinuxPathCombine(linuxUsrLocalBinFolder, newFolderName);
var newFolderRelativePath = Path.Combine(debUsrLocalBinFolderRelativePath, newFolderName);
- newFolderPath = Path.Combine(binDistDirectory, newFolderRelativePath);
+ newFolderPath = Path.Combine(BinDistDirectory, newFolderRelativePath);
Directory.Move(publishedFolder, newFolderPath);
- var assetsFolder = Path.Combine(guiProjectDirectory, "Assets");
+ var assetsFolder = Path.Combine(GuiProjectDirectory, "Assets");
var assetsInfo = new DirectoryInfo(assetsFolder);
foreach (var file in assetsInfo.EnumerateFiles())
@@ -434,17 +573,17 @@ namespace WalletWasabi.Packager
{
string destFolder = Path.Combine(debUsrShareIconsFolderPath, $"{size}x{size}", "apps");
Directory.CreateDirectory(destFolder);
- file.CopyTo(Path.Combine(destFolder, $"{executableName}.png"));
+ file.CopyTo(Path.Combine(destFolder, $"{ExecutableName}.png"));
}
}
var controlFilePath = Path.Combine(debianFolderPath, "control");
// License format doesn't yet work, but should work in the future, it's work in progress: https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/435183
- var controlFileContent = $"Package: {executableName}\n" +
+ var controlFileContent = $"Package: {ExecutableName}\n" +
$"Priority: optional\n" +
$"Section: utils\n" +
$"Maintainer: nopara73 <adam.ficsor73@gmail.com>\n" +
- $"Version: {versionPrefix}\n" +
+ $"Version: {VersionPrefix}\n" +
$"Homepage: http://wasabiwallet.io\n" +
$"Vcs-Git: git://github.com/zkSNACKs/WalletWasabi.git\n" +
$"Vcs-Browser: https://github.com/zkSNACKs/WalletWasabi\n" +
@@ -456,35 +595,35 @@ namespace WalletWasabi.Packager
File.WriteAllText(controlFilePath, controlFileContent, Encoding.ASCII);
- var desktopFilePath = Path.Combine(debUsrAppFolderPath, $"{executableName}.desktop");
+ var desktopFilePath = Path.Combine(debUsrAppFolderPath, $"{ExecutableName}.desktop");
var desktopFileContent = $"[Desktop Entry]\n" +
$"Type=Application\n" +
$"Name=Wasabi Wallet\n" +
$"GenericName=Bitcoin Wallet\n" +
$"Comment=Privacy focused Bitcoin wallet.\n" +
- $"Icon={executableName}\n" +
+ $"Icon={ExecutableName}\n" +
$"Terminal=false\n" +
- $"Exec={executableName}\n" +
+ $"Exec={ExecutableName}\n" +
$"Categories=Office;Finance;\n" +
$"Keywords=bitcoin;wallet;crypto;blockchain;wasabi;privacy;anon;awesome;qwe;asd;\n";
File.WriteAllText(desktopFilePath, desktopFileContent, Encoding.ASCII);
- var wasabiStarterScriptPath = Path.Combine(debUsrLocalBinFolderPath, $"{executableName}");
+ var wasabiStarterScriptPath = Path.Combine(debUsrLocalBinFolderPath, $"{ExecutableName}");
var wasabiStarterScriptContent = $"#!/bin/sh\n" +
- $"{ linuxWasabiWalletFolder.TrimEnd('/')}/./{executableName}\n";
+ $"{ linuxWasabiWalletFolder.TrimEnd('/')}/./{ExecutableName}\n";
File.WriteAllText(wasabiStarterScriptPath, wasabiStarterScriptContent, Encoding.ASCII);
- string debExeLinuxPath = LinuxPathCombine(newFolderRelativePath, executableName);
- string debDestopFileLinuxPath = LinuxPathCombine(debUsrAppFolderRelativePath, $"{executableName}.desktop");
- var wasabiStarterScriptLinuxPath = LinuxPathCombine(debUsrLocalBinFolderRelativePath, $"{executableName}");
+ string debExeLinuxPath = Tools.LinuxPathCombine(newFolderRelativePath, ExecutableName);
+ string debDestopFileLinuxPath = Tools.LinuxPathCombine(debUsrAppFolderRelativePath, $"{ExecutableName}.desktop");
+ var wasabiStarterScriptLinuxPath = Tools.LinuxPathCombine(debUsrLocalBinFolderRelativePath, $"{ExecutableName}");
var psi = new ProcessStartInfo
{
FileName = "wsl",
- Arguments = $"cd ~ && sudo umount /mnt/c && sudo mount -t drvfs C: /mnt/c -o metadata && cd /mnt/c/Users/user/Desktop/WalletWasabi/WalletWasabi.Gui/bin/dist && sudo chmod +x {debExeLinuxPath} && sudo chmod +x {wasabiStarterScriptLinuxPath} && sudo chmod -R 0644 {debDestopFileLinuxPath} && sudo chmod -R 0775 {LinuxPath(debianFolderRelativePath)} && dpkg --build {LinuxPath(debFolderRelativePath)} $(pwd)",
+ Arguments = $"cd ~ && sudo umount /mnt/c && sudo mount -t drvfs C: /mnt/c -o metadata && cd /mnt/c/Users/user/Desktop/WalletWasabi/WalletWasabi.Gui/bin/dist && sudo chmod +x {debExeLinuxPath} && sudo chmod +x {wasabiStarterScriptLinuxPath} && sudo chmod -R 0644 {debDestopFileLinuxPath} && sudo chmod -R 0775 {Tools.LinuxPath(debianFolderRelativePath)} && dpkg --build {Tools.LinuxPath(debFolderRelativePath)} $(pwd)",
RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
+ WorkingDirectory = BinDistDirectory
};
using (var p = Process.Start(psi))
@@ -494,8 +633,8 @@ namespace WalletWasabi.Packager
IoHelpers.DeleteRecursivelyWithMagicDustAsync(debFolderPath).GetAwaiter().GetResult();
- string oldDeb = Path.Combine(binDistDirectory, $"{executableName}_{versionPrefix}_amd64.deb");
- string newDeb = Path.Combine(binDistDirectory, $"Wasabi-{versionPrefix}.deb");
+ string oldDeb = Path.Combine(BinDistDirectory, $"{ExecutableName}_{VersionPrefix}_amd64.deb");
+ string newDeb = Path.Combine(BinDistDirectory, $"Wasabi-{VersionPrefix}.deb");
File.Move(oldDeb, newDeb);
IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
@@ -503,119 +642,5 @@ namespace WalletWasabi.Packager
}
}
}
-
- if (doSign is true)
- {
- foreach (string target in targets)
- {
- if (target.StartsWith("win", StringComparison.OrdinalIgnoreCase))
- {
- string publishedFolder = Path.Combine(binDistDirectory, target);
-
- Console.WriteLine("Move created .msi");
- var msiPath = Path.Combine(wixProjectDirectory, @"bin\Release\Wasabi.msi");
- if (!File.Exists(msiPath))
- {
- throw new Exception(".msi doesn't exist. Expected path: Wasabi.msi.");
- }
- var msiFileName = Path.GetFileNameWithoutExtension(msiPath);
- var newMsiPath = Path.Combine(binDistDirectory, $"{msiFileName}-{versionPrefix}.msi");
- File.Move(msiPath, newMsiPath);
-
- // Sign code with digicert.
- var psiSigntool = new ProcessStartInfo
- {
- FileName = "cmd",
- RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
- };
- using (var signToolProcess = Process.Start(psiSigntool))
- {
- signToolProcess.StandardInput.WriteLine($"signtool sign /d \"Wasabi Wallet\" /f \"{pfxPath}\" /p {pfxPassword} /t http://timestamp.digicert.com /a \"{newMsiPath}\" && exit");
- signToolProcess.WaitForExit();
- }
-
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
- Console.WriteLine($"Deleted {publishedFolder}");
- }
- }
-
- Console.WriteLine("Signing final files...");
- var finalFiles = Directory.GetFiles(binDistDirectory);
-
- foreach (var finalFile in finalFiles)
- {
- var psiSignProcess = new ProcessStartInfo
- {
- FileName = "cmd",
- RedirectStandardInput = true,
- WorkingDirectory = binDistDirectory
- };
- using (var signProcess = Process.Start(psiSignProcess))
- {
- signProcess.StandardInput.WriteLine($"gpg --armor --detach-sign {finalFile} && exit");
- signProcess.WaitForExit();
- }
-
- var psiRestoreHeat = new ProcessStartInfo
- {
- FileName = "cmd",
- RedirectStandardInput = true,
- WorkingDirectory = wixProjectDirectory
- };
- using (var restoreHeatProcess = Process.Start(psiRestoreHeat))
- {
- restoreHeatProcess.StandardInput.WriteLine($"git checkout -- ComponentsGenerated.wxs && exit");
- restoreHeatProcess.WaitForExit();
- }
-
- if (doRestoreThisFile)
- {
- var psiRestoreThisFile = new ProcessStartInfo
- {
- FileName = "cmd",
- RedirectStandardInput = true,
- WorkingDirectory = packagerProjectDirectory
- };
- using (var restoreThisFileProcess = Process.Start(psiRestoreThisFile))
- {
- restoreThisFileProcess.StandardInput.WriteLine($"git checkout -- Program.cs && exit");
- restoreThisFileProcess.WaitForExit();
- }
- }
- }
-
- IoHelpers.OpenFolderInFileExplorer(binDistDirectory);
- return; // No need for readkey here.
- }
- }
-
- private static string LinuxPathCombine(params string[] paths)
- {
- return LinuxPath(Path.Combine(paths));
- }
-
- private static string LinuxPath(string path)
- {
- return path.Replace(@"\", @"/");
- }
-
- public static long DirSize(DirectoryInfo d)
- {
- long size = 0;
- // Add file sizes.
- FileInfo[] fis = d.GetFiles();
- foreach (FileInfo fi in fis)
- {
- size += fi.Length;
- }
- // Add subdirectory sizes.
- DirectoryInfo[] dis = d.GetDirectories();
- foreach (DirectoryInfo di in dis)
- {
- size += DirSize(di);
- }
- return size;
- }
}
}

MODIFY
WalletWasabi.Packager/Tools.cs
WalletWasabi.Packager/Tools.cs
@@ -47,5 +47,33 @@ namespace WalletWasabi.Packager
File.Delete(sosDocsUnixFilePath);
}
}
+
+ public static string LinuxPathCombine(params string[] paths)
+ {
+ return LinuxPath(Path.Combine(paths));
+ }
+
+ public static string LinuxPath(string path)
+ {
+ return path.Replace(@"\", @"/");
+ }
+
+ public static long DirSize(DirectoryInfo d)
+ {
+ long size = 0;
+ // Add file sizes.
+ FileInfo[] fis = d.GetFiles();
+ foreach (FileInfo fi in fis)
+ {
+ size += fi.Length;
+ }
+ // Add subdirectory sizes.
+ DirectoryInfo[] dis = d.GetDirectories();
+ foreach (DirectoryInfo di in dis)
+ {
+ size += DirSize(di);
+ }
+ return size;
+ }
}
}

Add -onlybinaries switch to Packager