Skip to content

Commit db79b8e

Browse files
authored
Merge pull request duplicati#5200 from duplicati/feature/add-missing-executables
Added executables for `SharpAESCrypt` and `Snapshots`
2 parents aaf1067 + 9d43685 commit db79b8e

File tree

14 files changed

+162
-37
lines changed

14 files changed

+162
-37
lines changed

.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@
4848
"stopAtEntry": false,
4949
"console": "internalConsole"
5050
},
51+
{
52+
"name": "Launch ConfigurationImporter executable",
53+
"type": "coreclr",
54+
"request": "launch",
55+
"preLaunchTask": "build",
56+
"program": "${workspaceFolder}/Executables/net8/Duplicati.CommandLine.ConfigurationImporter/bin/Debug/net8.0/Duplicati.CommandLine.ConfigurationImporter",
57+
"args": [],
58+
"cwd": "${workspaceFolder}",
59+
"stopAtEntry": false,
60+
"console": "internalConsole"
61+
},
5162
{
5263
"name": "Launch RecoveryTool executable",
5364
"type": "coreclr",

Duplicati.sln

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net8", "net8", "{6B46F6B1-1
109109
EndProject
110110
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Duplicati.CommandLine.AutoUpdater", "Executables\net8\Duplicati.CommandLine.AutoUpdater\Duplicati.CommandLine.AutoUpdater.csproj", "{95B7DD83-2C5A-4F1E-8EA7-39654B2B236A}"
111111
EndProject
112-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Duplicati.Service", "Executables\net8\Duplicati_Service\Duplicati.Service.csproj", "{34149709-F3ED-4FB5-A087-43EB195C948B}"
112+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Duplicati.Service", "Executables\net8\Duplicati.Service\Duplicati.Service.csproj", "{34149709-F3ED-4FB5-A087-43EB195C948B}"
113113
EndProject
114114
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Duplicati.CommandLine.BackendTester", "Executables\net8\Duplicati.CommandLine.BackendTester\Duplicati.CommandLine.BackendTester.csproj", "{2F1C0C8D-5C15-4BC0-811F-87F2C98D9790}"
115115
EndProject
@@ -148,6 +148,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.RestAPI",
148148
EndProject
149149
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Duplicati.Library.Backend.AliyunOSS", "Duplicati\Library\Backend\AliyunOSS\Duplicati.Library.Backend.AliyunOSS.csproj", "{4EB3DABC-D412-4C12-8876-41A1427A389E}"
150150
EndProject
151+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.CommandLine.SharpAESCrypt", "Executables\net8\Duplicati.CommandLine.SharpAESCrypt\Duplicati.CommandLine.SharpAESCrypt.csproj", "{FE6FD36C-E171-4599-8D55-62DA579C0864}"
152+
EndProject
153+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.CommandLine.Snapshots", "Executables\net8\Duplicati.CommandLine.Snapshots\Duplicati.CommandLine.Snapshots.csproj", "{0364E724-1929-445E-9145-90A70B01DDC0}"
154+
EndProject
151155
Global
152156
GlobalSection(SolutionConfigurationPlatforms) = preSolution
153157
Debug|Any CPU = Debug|Any CPU
@@ -414,6 +418,14 @@ Global
414418
{C1D4D665-23A3-4216-9CD1-D67AE9AAAA4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
415419
{C1D4D665-23A3-4216-9CD1-D67AE9AAAA4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
416420
{C1D4D665-23A3-4216-9CD1-D67AE9AAAA4C}.Release|Any CPU.Build.0 = Release|Any CPU
421+
{FE6FD36C-E171-4599-8D55-62DA579C0864}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
422+
{FE6FD36C-E171-4599-8D55-62DA579C0864}.Debug|Any CPU.Build.0 = Debug|Any CPU
423+
{FE6FD36C-E171-4599-8D55-62DA579C0864}.Release|Any CPU.ActiveCfg = Release|Any CPU
424+
{FE6FD36C-E171-4599-8D55-62DA579C0864}.Release|Any CPU.Build.0 = Release|Any CPU
425+
{0364E724-1929-445E-9145-90A70B01DDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
426+
{0364E724-1929-445E-9145-90A70B01DDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
427+
{0364E724-1929-445E-9145-90A70B01DDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
428+
{0364E724-1929-445E-9145-90A70B01DDC0}.Release|Any CPU.Build.0 = Release|Any CPU
417429
EndGlobalSection
418430
GlobalSection(SolutionProperties) = preSolution
419431
HideSolutionNode = FALSE
@@ -467,6 +479,8 @@ Global
467479
{0F5A1F4E-25FA-4D02-920D-CA2138498081} = {6B46F6B1-1898-49B8-ADA7-5CAF68EB77E3}
468480
{6B594D23-B629-465C-B799-70EE9E56C218} = {E1A9B303-F281-45C5-A4F6-CADD9DE3F3C4}
469481
{D19A38DD-68F1-4EF5-BF5F-8966CE0D9A5B} = {FA88A246-EF8E-46E3-90AF-539B8C0A6ADE}
482+
{FE6FD36C-E171-4599-8D55-62DA579C0864} = {6B46F6B1-1898-49B8-ADA7-5CAF68EB77E3}
483+
{0364E724-1929-445E-9145-90A70B01DDC0} = {6B46F6B1-1898-49B8-ADA7-5CAF68EB77E3}
470484
EndGlobalSection
471485
GlobalSection(ExtensibilityGlobals) = postSolution
472486
SolutionGuid = {8B40BAFE-D862-4397-9495-8F5EAF5CE80C}

Duplicati/CommandLine/ConfigurationImporter/Program.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2020
// DEALINGS IN THE SOFTWARE.
2121

22+
using Duplicati.Library.AutoUpdater;
2223
using Duplicati.Server.Serializable;
2324
using Duplicati.Server.WebServer.RESTMethods;
2425
using System;
@@ -29,26 +30,32 @@ namespace Duplicati.CommandLine.ConfigurationImporter
2930
{
3031
public static class ConfigurationImporter
3132
{
32-
private static readonly string usageString = $"Usage: {nameof(ConfigurationImporter)}.exe <configuration-file> --import-metadata=(true | false) --server-datafolder=<folder containing Duplicati-server.sqlite>";
33+
private static readonly string UsageString = $"Usage: {PackageHelper.GetExecutableName(PackageHelper.NamedExecutable.ConfigurationImporter)} <configuration-file> --import-metadata=(true | false) --server-datafolder=<folder containing Duplicati-server.sqlite>";
3334

3435
public static int Main(string[] args)
3536
{
3637
if (args.Length != 3)
3738
{
38-
throw new ArgumentException($"Incorrect number of input arguments. {ConfigurationImporter.usageString}");
39+
Console.WriteLine($"Incorrect number of input arguments.");
40+
Console.WriteLine(UsageString);
41+
return 1;
3942
}
4043

4144
string configurationFile = args[0];
4245
Dictionary<string, string> importOptions = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args.Skip(1).ToList());
4346
if (!importOptions.TryGetValue("import-metadata", out string importMetadataString))
4447
{
45-
throw new ArgumentException($"Invalid import-metadata argument. {ConfigurationImporter.usageString}");
48+
Console.WriteLine($"Missing import-metadata argument.");
49+
Console.WriteLine(UsageString);
50+
return 1;
4651
}
4752
bool importMetadata = Duplicati.Library.Utility.Utility.ParseBool(importMetadataString, false);
4853

4954
if (!importOptions.TryGetValue("server-datafolder", out string serverDatafolder))
5055
{
51-
throw new ArgumentException($"Invalid server-datafolder argument. {ConfigurationImporter.usageString}");
56+
Console.WriteLine($"Missing server-datafolder argument.");
57+
Console.WriteLine(UsageString);
58+
return 1;
5259
}
5360

5461
Dictionary<string, string> advancedOptions = new Dictionary<string, string>

Duplicati/GUI/Duplicati.GUI.TrayIcon/AvaloniaRunner.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using Avalonia;
2828
using Avalonia.Controls;
2929
using Avalonia.Controls.ApplicationLifetimes;
30+
using Avalonia.Logging;
3031
using Avalonia.Media.Imaging;
3132
using Avalonia.Platform;
3233
using Avalonia.Themes.Fluent;
@@ -98,9 +99,9 @@ protected override void Run(string[] args)
9899
builder = builder.LogToTrace();
99100
#else
100101
if (Environment.GetEnvironmentVariable("DEBUG_AVALONIA") == "1")
101-
builder = builder.LogToTrace();
102+
Logger.Sink = new ConsoleLogSink(LogEventLevel.Information);
102103
else if (Environment.GetEnvironmentVariable("DEBUG_AVALONIA") == "2")
103-
builder = builder.LogToTrace(Avalonia.Logging.LogEventLevel.Verbose);
104+
Logger.Sink = new ConsoleLogSink(LogEventLevel.Verbose);
104105
#endif
105106

106107
application = builder.Instance as AvaloniaApp;
@@ -402,4 +403,19 @@ public override void OnFrameworkInitializationCompleted()
402403
base.OnFrameworkInitializationCompleted();
403404
}
404405
}
406+
407+
internal class ConsoleLogSink(LogEventLevel minLevel) : ILogSink
408+
{
409+
private readonly LogEventLevel _minLevel = minLevel;
410+
411+
public bool IsEnabled(LogEventLevel level, string area)
412+
=> level >= _minLevel;
413+
414+
public void Log(LogEventLevel level, string area, object source, string messageTemplate)
415+
=> Log(level, area, source, messageTemplate, null);
416+
417+
public void Log(LogEventLevel level, string area, object source, string messageTemplate, params object[] propertyValues)
418+
=> Console.WriteLine($"Avalonia [{level}]: {source} {messageTemplate} {string.Join(" ", propertyValues)}");
419+
}
420+
405421
}

Duplicati/Library/AutoUpdater/PackageHelper.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,20 @@ public enum NamedExecutable
4848
/// <summary>
4949
/// The backend testing tool
5050
/// </summary>
51-
BackendTester
51+
BackendTester,
52+
/// <summary>
53+
/// The SharpAESCrypt tool
54+
/// </summary>
55+
SharpAESCrypt,
56+
/// <summary>
57+
/// The snapshot tool
58+
/// </summary>
59+
Snapshots,
60+
/// <summary>
61+
/// The configuration importer
62+
/// </summary>
63+
ConfigurationImporter
64+
5265
}
5366

5467
/// <summary>
@@ -66,8 +79,11 @@ public static string GetExecutableName(NamedExecutable exe)
6679
NamedExecutable.Server => Platform.IsClientWindows ? "Duplicati.Server.exe" : "duplicati-server",
6780
NamedExecutable.WindowsService => "Duplicati.WindowsServer.exe",
6881
NamedExecutable.BackendTool => Platform.IsClientWindows ? "Duplicati.CommandLine.BackendTool.exe" : "duplicati-backend-tool",
69-
NamedExecutable.RecoveryTool => Platform.IsClientWindows ? "Duplicati.Command.RecoveryTool.exe" : "duplicati-recovery-tool",
82+
NamedExecutable.RecoveryTool => Platform.IsClientWindows ? "Duplicati.CommandLine.RecoveryTool.exe" : "duplicati-recovery-tool",
7083
NamedExecutable.BackendTester => Platform.IsClientWindows ? "Duplicati.CommandLine.BackendTester.exe" : "duplicati-backend-tester",
84+
NamedExecutable.SharpAESCrypt => Platform.IsClientWindows ? "Duplicati.CommandLine.SharpAESCrypt.exe" : "duplicati-aescrypt",
85+
NamedExecutable.Snapshots => Platform.IsClientWindows ? "Duplicati.CommandLine.Snapshots.exe" : "duplicati-snapshots",
86+
NamedExecutable.ConfigurationImporter => Platform.IsClientWindows ? "Duplicati.CommandLine.ConfigurationImporter.exe" : "duplicati-configuration-importer",
7187
_ => throw new ArgumentException($"Named executable not known: {exe}", nameof(exe))
7288
};
7389

Duplicati/Library/Snapshots/Program.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
// Copyright (C) 2024, The Duplicati Team
2-
// https://duplicati.com, [email protected]
3-
//
4-
// Permission is hereby granted, free of charge, to any person obtaining a
5-
// copy of this software and associated documentation files (the "Software"),
6-
// to deal in the Software without restriction, including without limitation
7-
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
// and/or sell copies of the Software, and to permit persons to whom the
9-
// Software is furnished to do so, subject to the following conditions:
10-
//
11-
// The above copyright notice and this permission notice shall be included in
12-
// all copies or substantial portions of the Software.
13-
//
14-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19-
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20-
// DEALINGS IN THE SOFTWARE.
1+
// Copyright (C) 2024, The Duplicati Team
2+
// https://duplicati.com, [email protected]
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a
5+
// copy of this software and associated documentation files (the "Software"),
6+
// to deal in the Software without restriction, including without limitation
7+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
// and/or sell copies of the Software, and to permit persons to whom the
9+
// Software is furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
// DEALINGS IN THE SOFTWARE.
2121

2222
using System;
2323
using System.Collections.Generic;
24-
using System.Text;
24+
using Duplicati.Library.AutoUpdater;
2525
using Duplicati.Library.Common;
2626

2727
namespace Duplicati.Library.Snapshots
2828
{
29-
static class Program
29+
public static class Program
3030
{
3131
private static Dictionary<string, string> ExtractOptions(List<string> args)
3232
{
@@ -68,14 +68,14 @@ public static void Main(string[] _args)
6868
{
6969
List<string> args = new List<string>(_args);
7070
Dictionary<string, string> options = ExtractOptions(args);
71-
71+
7272
if (args.Count == 0)
7373
args = new List<string> { System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) };
7474

7575
if (args.Count != 1)
7676
{
77-
Console.WriteLine(@"Usage:
78-
Duplicati.Library.Snapshots.exe [test-folder]
77+
Console.WriteLine(@$"Usage:
78+
{PackageHelper.GetExecutableName(PackageHelper.NamedExecutable.Snapshots)} [test-folder]
7979
8080
Where <test-folder> is the folder where files will be locked/created etc");
8181
return;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Description>The Server SharpAESCrypt implementation</Description>
7+
<AssemblyName>Duplicati.CommandLine.SharpAESCrypt</AssemblyName>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\..\..\Duplicati\Library\Encryption\Duplicati.Library.Encryption.csproj" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Duplicati.CommandLine.SharpAESCrypt.Net8
2+
{
3+
// Wrapper class to keep code independent
4+
public static class Program
5+
{
6+
public static void Main(string[] args)
7+
=> global::SharpAESCrypt.SharpAESCrypt.CommandLineMain(args);
8+
}
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Description>The Server Snapshots implementation</Description>
7+
<AssemblyName>Duplicati.CommandLine.Snapshots</AssemblyName>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\..\..\Duplicati\Library\Snapshots\Duplicati.Library.Snapshots.csproj" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Duplicati.CommandLine.Snapshots.Net8
2+
{
3+
// Wrapper class to keep code independent
4+
public static class Program
5+
{
6+
public static void Main(string[] args)
7+
=> Duplicati.Library.Snapshots.Program.Main(args);
8+
}
9+
}

0 commit comments

Comments
 (0)