mirror of
https://github.com/Jackett/Jackett
synced 2025-01-01 04:38:20 +00:00
Add variants to the updater
This commit is contained in:
parent
fa71356666
commit
a90ed2601a
3 changed files with 122 additions and 1 deletions
|
@ -32,6 +32,7 @@ namespace Jackett.Common.Services
|
||||||
ITrayLockService lockService;
|
ITrayLockService lockService;
|
||||||
private ServerConfig serverConfig;
|
private ServerConfig serverConfig;
|
||||||
bool forceupdatecheck = false;
|
bool forceupdatecheck = false;
|
||||||
|
Variants.JackettVariant variant = Variants.JackettVariant.NotFound;
|
||||||
|
|
||||||
public UpdateService(Logger l, WebClient c, IConfigurationService cfg, ITrayLockService ls, ServerConfig sc)
|
public UpdateService(Logger l, WebClient c, IConfigurationService cfg, ITrayLockService ls, ServerConfig sc)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +89,11 @@ namespace Jackett.Common.Services
|
||||||
logger.Info($"Skipping update check as it is disabled.");
|
logger.Info($"Skipping update check as it is disabled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variants variants = new Variants();
|
||||||
|
variant = variants.GetVariant();
|
||||||
|
logger.Info("Jackett variant: " + variant.ToString());
|
||||||
|
|
||||||
if (DotNetCoreUtil.IsRunningOnDotNetCore)
|
if (DotNetCoreUtil.IsRunningOnDotNetCore)
|
||||||
{
|
{
|
||||||
logger.Info($"Skipping update check as running Jackett on .NET Core is still in preview. Updates must be performed manually at this time.");
|
logger.Info($"Skipping update check as running Jackett on .NET Core is still in preview. Updates must be performed manually at this time.");
|
||||||
|
@ -223,7 +229,9 @@ namespace Jackett.Common.Services
|
||||||
|
|
||||||
private async Task<string> DownloadRelease(List<Asset> assets, bool isWindows, string version)
|
private async Task<string> DownloadRelease(List<Asset> assets, bool isWindows, string version)
|
||||||
{
|
{
|
||||||
var targetAsset = assets.Where(a => isWindows ? a.Browser_download_url.EndsWith(".zip", StringComparison.OrdinalIgnoreCase) : a.Browser_download_url.EndsWith(".gz", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
Variants variants = new Variants();
|
||||||
|
string artifactFileName = variants.GetArtifactFileName(variant);
|
||||||
|
Asset targetAsset = assets.Where(a => a.Browser_download_url.EndsWith(artifactFileName, StringComparison.OrdinalIgnoreCase) && artifactFileName.Length > 0).FirstOrDefault();
|
||||||
|
|
||||||
if (targetAsset == null)
|
if (targetAsset == null)
|
||||||
{
|
{
|
||||||
|
|
110
src/Jackett.Common/Utils/Variants.cs
Normal file
110
src/Jackett.Common/Utils/Variants.cs
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Jackett.Common.Utils
|
||||||
|
{
|
||||||
|
public class Variants
|
||||||
|
{
|
||||||
|
public enum JackettVariant
|
||||||
|
{
|
||||||
|
NotFound,
|
||||||
|
FullFrameworkWindows,
|
||||||
|
Mono,
|
||||||
|
CoreWindows,
|
||||||
|
CoreMacOs,
|
||||||
|
CoreLinuxAmd64,
|
||||||
|
CoreLinuxArm32,
|
||||||
|
CoreLinuxArm64
|
||||||
|
}
|
||||||
|
|
||||||
|
public JackettVariant GetVariant()
|
||||||
|
{
|
||||||
|
if (DotNetCoreUtil.IsRunningOnDotNetCore)
|
||||||
|
{
|
||||||
|
//Dot Net Core
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return JackettVariant.CoreWindows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
{
|
||||||
|
return JackettVariant.CoreMacOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
||||||
|
{
|
||||||
|
return JackettVariant.CoreLinuxAmd64;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
||||||
|
{
|
||||||
|
return JackettVariant.CoreLinuxArm32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
|
{
|
||||||
|
return JackettVariant.CoreLinuxArm64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Full framework
|
||||||
|
|
||||||
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
|
{
|
||||||
|
return JackettVariant.FullFrameworkWindows;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return JackettVariant.Mono;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return JackettVariant.NotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GetArtifactFileName(JackettVariant variant)
|
||||||
|
{
|
||||||
|
switch (variant)
|
||||||
|
{
|
||||||
|
case JackettVariant.FullFrameworkWindows:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.Windows.zip";
|
||||||
|
}
|
||||||
|
case JackettVariant.Mono:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.Mono.tar.gz";
|
||||||
|
}
|
||||||
|
case JackettVariant.CoreWindows:
|
||||||
|
{
|
||||||
|
return ""; //Not implemented yet
|
||||||
|
}
|
||||||
|
case JackettVariant.CoreMacOs:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.macOS.tar.gz";
|
||||||
|
}
|
||||||
|
case JackettVariant.CoreLinuxAmd64:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.LinuxAMD64.tar.gz";
|
||||||
|
}
|
||||||
|
case JackettVariant.CoreLinuxArm32:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.LinuxARM32.tar.gz";
|
||||||
|
}
|
||||||
|
case JackettVariant.CoreLinuxArm64:
|
||||||
|
{
|
||||||
|
return "Jackett.Binaries.LinuxARM64.tar.gz";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -91,6 +91,9 @@ namespace Jackett.Server.Services
|
||||||
var runtimedir = RuntimeEnvironment.GetRuntimeDirectory();
|
var runtimedir = RuntimeEnvironment.GetRuntimeDirectory();
|
||||||
logger.Info("Environment version: " + Environment.Version.ToString() + " (" + runtimedir + ")");
|
logger.Info("Environment version: " + Environment.Version.ToString() + " (" + runtimedir + ")");
|
||||||
logger.Info("OS version: " + Environment.OSVersion.ToString() + (Environment.Is64BitOperatingSystem ? " (64bit OS)" : "") + (Environment.Is64BitProcess ? " (64bit process)" : ""));
|
logger.Info("OS version: " + Environment.OSVersion.ToString() + (Environment.Is64BitOperatingSystem ? " (64bit OS)" : "") + (Environment.Is64BitProcess ? " (64bit process)" : ""));
|
||||||
|
Variants variants = new Variants();
|
||||||
|
Variants.JackettVariant variant = variants.GetVariant();
|
||||||
|
logger.Info("Jackett variant: " + variant.ToString());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue