Added options to run the update manager in a "check" mode that shows if it thinks the updated versions are modified or not

This commit is contained in:
Kenneth Skovhede
2017-10-12 11:40:40 +02:00
parent 124a5c4cf5
commit 7537bb72fc
+14 -1
View File
@@ -45,6 +45,8 @@ namespace Duplicati.Library.AutoUpdater
return 100;
}
UpdaterManager.OnError += (ex) => Console.WriteLine("Error detected: {0}", ex);
var cmd = args[0].ToLowerInvariant().Trim();
switch (cmd)
{
@@ -60,6 +62,17 @@ namespace Duplicati.Library.AutoUpdater
Console.WriteLine(string.Join(Environment.NewLine, versions.Select(x => string.Format(" {0} {1} ({2})", (x.Value.Version == UpdaterManager.SelfVersion.Version ? "*" : "-"), x.Value.Displayname, x.Value.Version))));
return 0;
}
case "verify":
{
var versions = UpdaterManager.FindInstalledVersions();
var selfdir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
if (string.Equals(Library.Utility.Utility.AppendDirSeparator(selfdir), Library.Utility.Utility.AppendDirSeparator(UpdaterManager.InstalledBaseDir)))
versions = versions.Union(new KeyValuePair<string, UpdateInfo>[] { new KeyValuePair<string, UpdateInfo>(selfdir, UpdaterManager.SelfVersion) });
Console.WriteLine(string.Join(Environment.NewLine, versions.Select(x => string.Format(" {0} {1} ({2}): {3}", (x.Value.Version == UpdaterManager.SelfVersion.Version ? "*" : "-"), x.Value.Displayname, x.Value.Version, UpdaterManager.VerifyUnpackedFolder(x.Key, x.Value) ? "Valid" : "*** Modified ***"))));
return 0;
}
case "check":
{
var update = UpdaterManager.CheckForUpdate();
@@ -105,7 +118,7 @@ namespace Duplicati.Library.AutoUpdater
private static void WriteUsage()
{
Console.WriteLine("Usage:{0}\t{1}{2} [LIST|CHECK|INSTALL|HELP]", Environment.NewLine, Duplicati.Library.Utility.Utility.IsMono ? "mono " : "", System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location));
Console.WriteLine("Usage:{0}\t{1}{2} [LIST|VERIFY|CHECK|INSTALL|HELP]", Environment.NewLine, Duplicati.Library.Utility.Utility.IsMono ? "mono " : "", System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location));
Console.WriteLine();
Console.WriteLine("Environment variables:");
Console.WriteLine();