|
|
@ -52,7 +52,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
|
|
|
|
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
|
|
|
|
|
|
|
|
|
|
|
|
c.WriteLine("Looking for updates now");
|
|
|
|
c.WriteLine("Looking for updates now");
|
|
|
|
var updates = await OmbiService.GetUpdates(branch);
|
|
|
|
var updates = await OmbiService.GetUpdates(branch);
|
|
|
|
c.WriteLine("Updates: {0}", updates);
|
|
|
|
c.WriteLine("Updates: {0}", updates);
|
|
|
@ -68,6 +68,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
var proce = RuntimeInformation.ProcessArchitecture;
|
|
|
|
var proce = RuntimeInformation.ProcessArchitecture;
|
|
|
|
|
|
|
|
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "OS Information: {0} {1}", desc, proce);
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "OS Information: {0} {1}", desc, proce);
|
|
|
|
|
|
|
|
c.WriteLine("OS Information: {0} {1}", desc, proce);
|
|
|
|
Download download;
|
|
|
|
Download download;
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -113,10 +114,14 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.WriteLine("Found the download! {0}", download.Name);
|
|
|
|
|
|
|
|
c.WriteLine("URL {0}", download.Url);
|
|
|
|
|
|
|
|
|
|
|
|
// Download it
|
|
|
|
// Download it
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Downloading the file {0} from {1}", download.Name, download.Url);
|
|
|
|
Logger.LogInformation(LoggingEvents.Updater, "Downloading the file {0} from {1}", download.Name, download.Url);
|
|
|
|
var extension = download.Name.Split('.').Last();
|
|
|
|
var extension = download.Name.Split('.').Last();
|
|
|
|
var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
|
|
|
|
var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
|
|
|
|
|
|
|
|
c.WriteLine("Zip Dir: {0}", zipDir);
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (File.Exists(zipDir))
|
|
|
|
if (File.Exists(zipDir))
|
|
|
@ -124,20 +129,25 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
File.Delete(zipDir);
|
|
|
|
File.Delete(zipDir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.WriteLine("Starting Download");
|
|
|
|
await DownloadAsync(download.Url, zipDir);
|
|
|
|
await DownloadAsync(download.Url, zipDir);
|
|
|
|
|
|
|
|
c.WriteLine("Finished Download");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
c.WriteLine("Error when downloading");
|
|
|
|
|
|
|
|
c.WriteLine(e.Message);
|
|
|
|
Logger.LogError(LoggingEvents.Updater, e, "Error when downloading the zip");
|
|
|
|
Logger.LogError(LoggingEvents.Updater, e, "Error when downloading the zip");
|
|
|
|
throw;
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c.WriteLine("Clearing out Temp Path");
|
|
|
|
var tempPath = Path.Combine(currentLocation, "TempUpdate");
|
|
|
|
var tempPath = Path.Combine(currentLocation, "TempUpdate");
|
|
|
|
if (Directory.Exists(tempPath))
|
|
|
|
if (Directory.Exists(tempPath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Directory.Delete(tempPath, true);
|
|
|
|
Directory.Delete(tempPath, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Extract it
|
|
|
|
// Extract it
|
|
|
|
|
|
|
|
c.WriteLine("Extracting ZIP");
|
|
|
|
using (var files = ZipFile.OpenRead(zipDir))
|
|
|
|
using (var files = ZipFile.OpenRead(zipDir))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Temp Path
|
|
|
|
// Temp Path
|
|
|
@ -153,7 +163,8 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
|
|
|
|
entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c.WriteLine("Finished Extracting files");
|
|
|
|
|
|
|
|
c.WriteLine("Starting the Ombi.Updater process");
|
|
|
|
// There must be an update
|
|
|
|
// There must be an update
|
|
|
|
var start = new ProcessStartInfo
|
|
|
|
var start = new ProcessStartInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -166,6 +177,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|
|
|
{
|
|
|
|
{
|
|
|
|
proc.Start();
|
|
|
|
proc.Start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c.WriteLine("Bye bye");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|