diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2014-06-29 18:48:26 +0400 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2014-06-29 18:48:26 +0400 |
commit | 5e482181d8319c301aa9d7f19fd09fae9be1f322 (patch) | |
tree | 613515cf3b543b18109f065e12f9722e1e7aa19d /BuildTools | |
parent | 915993d3877522f7e1f16f8c2c445402f0b880b1 (diff) |
Added the AutoUpdateBuilder project
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj | 71 | ||||
-rw-r--r-- | BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.sln | 62 | ||||
-rw-r--r-- | BuildTools/AutoUpdateBuilder/Program.cs | 119 | ||||
-rw-r--r-- | BuildTools/AutoUpdateBuilder/Properties/AssemblyInfo.cs | 27 |
4 files changed, 279 insertions, 0 deletions
diff --git a/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj new file mode 100644 index 000000000..5f96ddc9e --- /dev/null +++ b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{17E3EB29-87FD-4BE9-A531-8DAD8B295494}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>AutoUpdateBuilder</RootNamespace> + <AssemblyName>AutoUpdateBuilder</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + <Commandlineparameters>--input=/Users/kenneth/Udvikler/duplicati-git/Tools/SQLIteTool/obj/Debug --keyfile=/Users/kenneth/Dropbox/Privat/Duplicati-updater.key --output=/Users/kenneth/Downloads/duplicati-package --manifest=/Users/kenneth/Udvikler/duplicati-git/Updates/debug.manifest</Commandlineparameters> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\..\thirdparty\Json.NET\Newtonsoft.Json.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Program.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <ProjectReference Include="..\..\Duplicati\Library\Compression\Duplicati.Library.Compression.csproj"> + <Project>{19ECCE09-B5EB-406C-8C57-BAC66997D469}</Project> + <Name>Duplicati.Library.Compression</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\Library\Encryption\Duplicati.Library.Encryption.csproj"> + <Project>{94484FDB-2EFA-4CF0-9BE6-A561157B4F87}</Project> + <Name>Duplicati.Library.Encryption</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\Library\Interface\Duplicati.Library.Interface.csproj"> + <Project>{C5899F45-B0FF-483C-9D38-24A9FCAAB237}</Project> + <Name>Duplicati.Library.Interface</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\Library\Logging\Duplicati.Library.Logging.csproj"> + <Project>{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}</Project> + <Name>Duplicati.Library.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\Library\Utility\Duplicati.Library.Utility.csproj"> + <Project>{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}</Project> + <Name>Duplicati.Library.Utility</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\Library\AutoUpdater\Duplicati.Library.AutoUpdater.csproj"> + <Project>{7E119745-1F62-43F0-936C-F312A1912C0B}</Project> + <Name>Duplicati.Library.AutoUpdater</Name> + </ProjectReference> + <ProjectReference Include="..\..\Duplicati\License\Duplicati.License.csproj"> + <Project>{4D012CB1-4B92-47F4-89B7-BF80A73A2E99}</Project> + <Name>Duplicati.License</Name> + </ProjectReference> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.sln b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.sln new file mode 100644 index 000000000..d79f8a0a5 --- /dev/null +++ b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.sln @@ -0,0 +1,62 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoUpdateBuilder", "AutoUpdateBuilder.csproj", "{17E3EB29-87FD-4BE9-A531-8DAD8B295494}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Compression", "..\..\Duplicati\Library\Compression\Duplicati.Library.Compression.csproj", "{19ECCE09-B5EB-406C-8C57-BAC66997D469}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Utility", "..\..\Duplicati\Library\Utility\Duplicati.Library.Utility.csproj", "{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Interface", "..\..\Duplicati\Library\Interface\Duplicati.Library.Interface.csproj", "{C5899F45-B0FF-483C-9D38-24A9FCAAB237}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Logging", "..\..\Duplicati\Library\Logging\Duplicati.Library.Logging.csproj", "{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Encryption", "..\..\Duplicati\Library\Encryption\Duplicati.Library.Encryption.csproj", "{94484FDB-2EFA-4CF0-9BE6-A561157B4F87}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.AutoUpdater", "..\..\Duplicati\Library\AutoUpdater\Duplicati.Library.AutoUpdater.csproj", "{7E119745-1F62-43F0-936C-F312A1912C0B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.License", "..\..\Duplicati\License\Duplicati.License.csproj", "{4D012CB1-4B92-47F4-89B7-BF80A73A2E99}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {17E3EB29-87FD-4BE9-A531-8DAD8B295494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {17E3EB29-87FD-4BE9-A531-8DAD8B295494}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {17E3EB29-87FD-4BE9-A531-8DAD8B295494}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {17E3EB29-87FD-4BE9-A531-8DAD8B295494}.Release|Any CPU.Build.0 = Release|Any CPU
+ {19ECCE09-B5EB-406C-8C57-BAC66997D469}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {19ECCE09-B5EB-406C-8C57-BAC66997D469}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {19ECCE09-B5EB-406C-8C57-BAC66997D469}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {19ECCE09-B5EB-406C-8C57-BAC66997D469}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4D012CB1-4B92-47F4-89B7-BF80A73A2E99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4D012CB1-4B92-47F4-89B7-BF80A73A2E99}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4D012CB1-4B92-47F4-89B7-BF80A73A2E99}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4D012CB1-4B92-47F4-89B7-BF80A73A2E99}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7E119745-1F62-43F0-936C-F312A1912C0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7E119745-1F62-43F0-936C-F312A1912C0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7E119745-1F62-43F0-936C-F312A1912C0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7E119745-1F62-43F0-936C-F312A1912C0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C5899F45-B0FF-483C-9D38-24A9FCAAB237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C5899F45-B0FF-483C-9D38-24A9FCAAB237}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C5899F45-B0FF-483C-9D38-24A9FCAAB237}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C5899F45-B0FF-483C-9D38-24A9FCAAB237}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = AutoUpdateBuilder.csproj
+ EndGlobalSection
+EndGlobal
diff --git a/BuildTools/AutoUpdateBuilder/Program.cs b/BuildTools/AutoUpdateBuilder/Program.cs new file mode 100644 index 000000000..30c98720a --- /dev/null +++ b/BuildTools/AutoUpdateBuilder/Program.cs @@ -0,0 +1,119 @@ +using System;
+using System.Collections.Generic;
+
+namespace AutoUpdateBuilder
+{
+ public class Program
+ {
+ public static int Main(string[] _args)
+ {
+ var args = new List<string>(_args);
+ var opts = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args);
+
+ string inputfolder;
+ string outputfolder;
+ string keyfile;
+ string manifestfile;
+
+ opts.TryGetValue("input", out inputfolder);
+ opts.TryGetValue("output", out outputfolder);
+ opts.TryGetValue("keyfile", out keyfile);
+ opts.TryGetValue("manifest", out manifestfile);
+
+ if (string.IsNullOrWhiteSpace(inputfolder))
+ {
+ Console.WriteLine("Missing input folder");
+ return 4;
+ }
+
+ if (string.IsNullOrWhiteSpace(outputfolder))
+ {
+ Console.WriteLine("Missing output folder");
+ return 4;
+ }
+
+ if (string.IsNullOrWhiteSpace(keyfile))
+ {
+ Console.WriteLine("Missing keyfile");
+ return 4;
+ }
+
+ if (!System.IO.Directory.Exists(inputfolder))
+ {
+ Console.WriteLine("Input folder not found");
+ return 4;
+ }
+
+ Console.WriteLine("Enter keyfile passphrase");
+ string pwd = "zA8A6ZY8ejqQT9gZ"; //Console.ReadLine().Trim();
+
+ if (!System.IO.File.Exists(keyfile))
+ {
+ Console.WriteLine("Keyfile not found, creating new");
+ var newkey = System.Security.Cryptography.RSACryptoServiceProvider.Create().ToXmlString(true);
+ using (var enc = new Duplicati.Library.Encryption.AESEncryption(pwd, new Dictionary<string, string>()))
+ using (var fs = System.IO.File.OpenWrite(keyfile))
+ using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(newkey)))
+ enc.Encrypt(ms, fs);
+ }
+
+ if (!System.IO.Directory.Exists(outputfolder))
+ System.IO.Directory.CreateDirectory(outputfolder);
+
+ var privkey = (System.Security.Cryptography.RSACryptoServiceProvider)System.Security.Cryptography.RSACryptoServiceProvider.Create();
+
+ using(var enc = new Duplicati.Library.Encryption.AESEncryption(pwd, new Dictionary<string, string>()))
+ using(var ms = new System.IO.MemoryStream())
+ using(var fs = System.IO.File.OpenRead(keyfile))
+ {
+ enc.Decrypt(fs, ms);
+ ms.Position = 0;
+
+ using(var sr = new System.IO.StreamReader(ms))
+ privkey.FromXmlString(sr.ReadToEnd());
+ }
+
+ if (Duplicati.License.AutoUpdateSettings.SignKey == null || privkey.ToXmlString(false) != Duplicati.License.AutoUpdateSettings.SignKey.ToXmlString(false))
+ {
+ Console.WriteLine("The public key in the project is not the same as the public key from the file");
+ Console.WriteLine("Try setting the key to: ");
+ Console.WriteLine(privkey.ToXmlString(false));
+ return 5;
+ }
+
+ var manager = new Duplicati.Library.AutoUpdater.UpdaterManager(null, null, Duplicati.License.AutoUpdateSettings.AppName);
+
+ Duplicati.Library.AutoUpdater.UpdateInfo updateInfo;
+
+ using (var fs = System.IO.File.OpenRead(manifestfile))
+ using (var sr = new System.IO.StreamReader(fs))
+ using (var jr = new Newtonsoft.Json.JsonTextReader(sr))
+ updateInfo = new Newtonsoft.Json.JsonSerializer().Deserialize<Duplicati.Library.AutoUpdater.UpdateInfo>(jr);
+
+
+ foreach (var k in updateInfo.GetType().GetFields())
+ if (opts.ContainsKey(k.Name))
+ {
+ try
+ {
+ k.SetValue(updateInfo, opts[k.Name]);
+ }
+ catch
+ {
+ }
+ }
+
+ using (var tf = new Duplicati.Library.Utility.TempFile())
+ {
+ using (var fs = System.IO.File.OpenWrite(tf))
+ using (var tw = new System.IO.StreamWriter(fs))
+ new Newtonsoft.Json.JsonSerializer().Serialize(tw, updateInfo);
+
+ manager.CreateUpdatePackage(privkey, inputfolder, outputfolder, tf);
+ }
+
+ return 0;
+ }
+ }
+}
+
diff --git a/BuildTools/AutoUpdateBuilder/Properties/AssemblyInfo.cs b/BuildTools/AutoUpdateBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..32e6307e0 --- /dev/null +++ b/BuildTools/AutoUpdateBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("AutoUpdateBuilder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
|