mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
remove self update capability from service
This commit is contained in:
parent
65f78ea5ad
commit
4a030a70a9
@ -67,7 +67,13 @@ namespace MediaBrowser.Model.System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
||||||
public bool CanSelfRestart { get; set; }
|
public bool CanSelfRestart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance can self update.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
|
public bool CanSelfUpdate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets plugin assemblies that failed to load.
|
/// Gets or sets plugin assemblies that failed to load.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Server.Mono\Networking\NetworkManager.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.ServerApplication\ApplicationHost.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="MediaBrowser.Server.Implementations\HttpServer\HttpServer.cs" Line="1" Column="1" />
|
<File FileName="MediaBrowser.Server.Implementations\HttpServer\HttpServer.cs" Line="1" Column="1" />
|
||||||
<File FileName="MediaBrowser.Server.Mono\FFMpeg\FFMpegDownloader.cs" Line="1" Column="1" />
|
<File FileName="MediaBrowser.Server.Mono\FFMpeg\FFMpegDownloader.cs" Line="1" Column="1" />
|
||||||
<File FileName="MediaBrowser.Server.Mono\Networking\NetworkManager.cs" Line="28" Column="9" />
|
<File FileName="MediaBrowser.Server.Mono\Networking\NetworkManager.cs" Line="28" Column="9" />
|
||||||
|
<File FileName="MediaBrowser.ServerApplication\ApplicationHost.cs" Line="525" Column="50" />
|
||||||
|
<File FileName="MediaBrowser.Server.Mono\Native\NativeApp.cs" Line="24" Column="4" />
|
||||||
|
<File FileName="MediaBrowser.Server.Mono\Program.cs" Line="105" Column="17" />
|
||||||
</Files>
|
</Files>
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
|
@ -21,6 +21,30 @@ namespace MediaBrowser.ServerApplication.Native
|
|||||||
public static void Restart()
|
public static void Restart()
|
||||||
{
|
{
|
||||||
MainClass.Restart ();
|
MainClass.Restart ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this instance [can self restart].
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
||||||
|
public static bool CanSelfRestart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return MainClass.CanSelfRestart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance can self update.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
|
public static bool CanSelfUpdate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return MainClass.CanSelfUpdate;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,30 @@ namespace MediaBrowser.Server.Mono
|
|||||||
return new ServerApplicationPaths();
|
return new ServerApplicationPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this instance [can self restart].
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
||||||
|
public static bool CanSelfRestart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance can self update.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
|
public static bool CanSelfUpdate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager)
|
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager)
|
||||||
{
|
{
|
||||||
// TODO: Show splash here
|
// TODO: Show splash here
|
||||||
|
@ -530,7 +530,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return NativeApp.CanSelfUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +603,8 @@ namespace MediaBrowser.ServerApplication
|
|||||||
MacAddress = GetMacAddress(),
|
MacAddress = GetMacAddress(),
|
||||||
HttpServerPortNumber = ServerConfigurationManager.Configuration.HttpServerPortNumber,
|
HttpServerPortNumber = ServerConfigurationManager.Configuration.HttpServerPortNumber,
|
||||||
OperatingSystem = Environment.OSVersion.ToString(),
|
OperatingSystem = Environment.OSVersion.ToString(),
|
||||||
CanSelfRestart = CanSelfRestart
|
CanSelfRestart = CanSelfRestart,
|
||||||
|
CanSelfUpdate = CanSelfUpdate
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
|
||||||
private static bool IsAlreadyRunning(Process currentProcess)
|
private static bool IsAlreadyRunning(Process currentProcess)
|
||||||
{
|
{
|
||||||
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
|
var runningPath = currentProcess.MainModule.FileName;
|
||||||
|
|
||||||
var duplicate = Process.GetProcesses().FirstOrDefault(i =>
|
var duplicate = Process.GetProcesses().FirstOrDefault(i =>
|
||||||
{
|
{
|
||||||
@ -151,13 +151,11 @@ namespace MediaBrowser.ServerApplication
|
|||||||
{
|
{
|
||||||
if (runAsService)
|
if (runAsService)
|
||||||
{
|
{
|
||||||
#if (RELEASE)
|
|
||||||
var systemPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
var systemPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
||||||
|
|
||||||
var programDataPath = Path.GetDirectoryName(systemPath);
|
var programDataPath = Path.GetDirectoryName(systemPath);
|
||||||
|
|
||||||
return new ServerApplicationPaths(programDataPath);
|
return new ServerApplicationPaths(programDataPath);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ServerApplicationPaths();
|
return new ServerApplicationPaths();
|
||||||
@ -171,7 +169,19 @@ namespace MediaBrowser.ServerApplication
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return true;
|
return !_isRunningAsService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance can self update.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
|
public static bool CanSelfUpdate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return !_isRunningAsService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +198,9 @@ namespace MediaBrowser.ServerApplication
|
|||||||
logger.Info("Server: {0}", Environment.MachineName);
|
logger.Info("Server: {0}", Environment.MachineName);
|
||||||
logger.Info("Operating system: {0}", Environment.OSVersion.ToString());
|
logger.Info("Operating system: {0}", Environment.OSVersion.ToString());
|
||||||
logger.Info("Program data path: {0}", appPaths.ProgramDataPath);
|
logger.Info("Program data path: {0}", appPaths.ProgramDataPath);
|
||||||
|
|
||||||
|
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
|
logger.Info("Executable: {0}", runningPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -276,11 +289,6 @@ namespace MediaBrowser.ServerApplication
|
|||||||
{
|
{
|
||||||
ManagedInstallerClass.InstallHelper(new[] { runningPath });
|
ManagedInstallerClass.InstallHelper(new[] { runningPath });
|
||||||
|
|
||||||
using (var process = Process.Start("cmd.exe", "/c sc failure " + BackgroundService.Name + " reset= 0 actions= restart/1000/restart/1000/restart/60000"))
|
|
||||||
{
|
|
||||||
process.WaitForExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Info("Service installation succeeded");
|
logger.Info("Service installation succeeded");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -458,19 +466,11 @@ namespace MediaBrowser.ServerApplication
|
|||||||
|
|
||||||
if (!_isRunningAsService)
|
if (!_isRunningAsService)
|
||||||
{
|
{
|
||||||
_logger.Info("Starting server application");
|
_logger.Info("Executing windows forms restart");
|
||||||
RestartWindowsApplication();
|
System.Windows.Forms.Application.Restart();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Info("Calling Enviornment.Exit to tell Windows to restart the server.");
|
|
||||||
Environment.Exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RestartWindowsApplication()
|
ShutdownWindowsApplication();
|
||||||
{
|
}
|
||||||
System.Windows.Forms.Application.Restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ShutdownWindowsApplication()
|
private static void ShutdownWindowsApplication()
|
||||||
|
@ -33,5 +33,17 @@ namespace MediaBrowser.ServerApplication.Native
|
|||||||
return MainStartup.CanSelfRestart;
|
return MainStartup.CanSelfRestart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance can self update.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
|
public static bool CanSelfUpdate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return MainStartup.CanSelfUpdate;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user