mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
PluginPacker: Shell fallback for macOS/Linux
This commit is contained in:
committed by
Andrew Camilleri
parent
b1f62f74cd
commit
ff66e66f21
@@ -66,10 +66,32 @@ namespace BTCPayServer.PluginPacker
|
|||||||
File.Delete(sha256dirs);
|
File.Delete(sha256dirs);
|
||||||
}
|
}
|
||||||
await File.WriteAllTextAsync(sha256dirs, sha256sums.ToString());
|
await File.WriteAllTextAsync(sha256dirs, sha256sums.ToString());
|
||||||
|
|
||||||
|
// try Windows executable first, fall back to macOS/Linux PowerShell
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
await CreateShasums("powershell.exe", sha256dirs, outputDir);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await CreateShasums("bash", sha256dirs, outputDir);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Attempted to sign hashes with gpg but maybe powershell is not installed?\n{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"Created {outputFile}.btcpay at {directory}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task CreateShasums(string exec, string sha256dirs, string outputDir)
|
||||||
{
|
{
|
||||||
Process cmd = new();
|
Process cmd = new();
|
||||||
cmd.StartInfo.FileName = "powershell.exe";
|
cmd.StartInfo.FileName = exec;
|
||||||
cmd.StartInfo.RedirectStandardInput = true;
|
cmd.StartInfo.RedirectStandardInput = true;
|
||||||
cmd.StartInfo.RedirectStandardOutput = true;
|
cmd.StartInfo.RedirectStandardOutput = true;
|
||||||
cmd.StartInfo.CreateNoWindow = false;
|
cmd.StartInfo.CreateNoWindow = false;
|
||||||
@@ -81,14 +103,6 @@ namespace BTCPayServer.PluginPacker
|
|||||||
cmd.StandardInput.Close();
|
cmd.StandardInput.Close();
|
||||||
await cmd.WaitForExitAsync();
|
await cmd.WaitForExitAsync();
|
||||||
Console.WriteLine(await cmd.StandardOutput.ReadToEndAsync());
|
Console.WriteLine(await cmd.StandardOutput.ReadToEndAsync());
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Attempted to sign hashes with gpg but maybe powershell is not installed?\n{e.Message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine($"Created {outputFile}.btcpay at {directory}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type[] GetAllExtensionTypesFromAssembly(Assembly assembly)
|
private static Type[] GetAllExtensionTypesFromAssembly(Assembly assembly)
|
||||||
|
|||||||
Reference in New Issue
Block a user