mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-31 12:00:06 -07:00
First pass at the auto updater, inital tests on windows seem good!
This commit is contained in:
parent
d59f940b10
commit
1647717915
4 changed files with 36 additions and 16 deletions
|
@ -21,7 +21,7 @@ namespace Ombi.Schedule
|
|||
{
|
||||
RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly);
|
||||
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
||||
//RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Hourly);
|
||||
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Minutely);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using Microsoft.Extensions.Options;
|
|||
using Ombi.Api.Service;
|
||||
using Ombi.Api.Service.Models;
|
||||
using Ombi.Helpers;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace Ombi.Schedule.Ombi
|
||||
{
|
||||
|
@ -92,23 +93,41 @@ namespace Ombi.Schedule.Ombi
|
|||
return;
|
||||
}
|
||||
}
|
||||
if(download == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Download it
|
||||
await DownloadAsync(download.Url, Path.Combine(currentLocation, "Ombi.zip"));
|
||||
var extension = download.Name.Split('.').Last();
|
||||
var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
|
||||
await DownloadAsync(download.Url, zipDir);
|
||||
|
||||
var tempPath = Path.Combine(currentLocation, "TempUpdate");
|
||||
// Extract it
|
||||
using (var files = ZipFile.OpenRead(zipDir))
|
||||
{
|
||||
foreach (var entry in files.Entries)
|
||||
{
|
||||
// Temp Path
|
||||
Directory.CreateDirectory(tempPath);
|
||||
|
||||
entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
|
||||
}
|
||||
}
|
||||
|
||||
// There must be an update
|
||||
//var start = new ProcessStartInfo
|
||||
//{
|
||||
// UseShellExecute = false,
|
||||
// CreateNoWindow = true,
|
||||
// FileName = "Ombi.Updater.exe",
|
||||
// Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
|
||||
//};
|
||||
//using (var proc = new Process { StartInfo = start })
|
||||
//{
|
||||
// proc.Start();
|
||||
//}
|
||||
var start = new ProcessStartInfo
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
FileName = "Ombi.Updater",
|
||||
Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " +extension ,
|
||||
};
|
||||
using (var proc = new Process { StartInfo = start })
|
||||
{
|
||||
proc.Start();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace Ombi.Updater
|
|||
var start = new ProcessStartInfo
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
FileName = Path.Combine(options.ApplicationPath,"Ombi.exe")
|
||||
FileName = Path.Combine(options.ApplicationPath,"Ombi.exe"),
|
||||
WorkingDirectory = options.ApplicationPath
|
||||
};
|
||||
using (var proc = new Process { StartInfo = start })
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"Ombi.Updater": {
|
||||
"commandName": "Project"
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "C:\\Users\\Jamie\\Desktop\\Test\\"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue