aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs5
-rw-r--r--Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs65
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs20
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs30
-rw-r--r--Jellyfin.Server/CoreAppHost.cs4
-rw-r--r--Jellyfin.Server/PowerManagement.cs23
-rw-r--r--Jellyfin.Server/Program.cs32
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs18
-rw-r--r--MediaBrowser.Model/System/IPowerManagement.cs11
-rw-r--r--debian/changelog23
-rw-r--r--debian/conf/jellyfin8
-rw-r--r--debian/conf/logging.json29
-rw-r--r--debian/control3
-rw-r--r--debian/install1
-rw-r--r--debian/jellyfin.service2
-rw-r--r--debian/postinst29
-rw-r--r--debian/postrm29
-rw-r--r--debian/preinst20
-rw-r--r--debian/prerm12
-rw-r--r--debian/source/options1
21 files changed, 156 insertions, 211 deletions
diff --git a/.gitignore b/.gitignore
index 9bbfd9b74..befba5a20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -247,6 +247,8 @@ MediaBrowser.WebDashboard/dashboard-ui/.idea/
#########################
debian/.debhelper/
+debian/*.debhelper
+debian/debhelper-build-stamp
debian/files
debian/jellyfin.substvars
debian/jellyfin/
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 9b9c6146f..950ae10c7 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -369,7 +369,6 @@ namespace Emby.Server.Implementations
public StartupOptions StartupOptions { get; private set; }
- internal IPowerManagement PowerManagement { get; private set; }
internal IImageEncoder ImageEncoder { get; private set; }
protected IProcessFactory ProcessFactory { get; private set; }
@@ -391,7 +390,6 @@ namespace Emby.Server.Implementations
ILoggerFactory loggerFactory,
StartupOptions options,
IFileSystem fileSystem,
- IPowerManagement powerManagement,
IEnvironmentInfo environmentInfo,
IImageEncoder imageEncoder,
ISystemEvents systemEvents,
@@ -417,7 +415,6 @@ namespace Emby.Server.Implementations
Logger = LoggerFactory.CreateLogger("App");
StartupOptions = options;
- PowerManagement = powerManagement;
ImageEncoder = imageEncoder;
@@ -857,8 +854,6 @@ namespace Emby.Server.Implementations
SocketFactory = new SocketFactory(LoggerFactory.CreateLogger("SocketFactory"));
RegisterSingleInstance(SocketFactory);
- RegisterSingleInstance(PowerManagement);
-
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LoggerFactory, FileSystemManager, CryptographyProvider);
RegisterSingleInstance(SecurityManager);
diff --git a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs b/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs
deleted file mode 100644
index a6dadcef0..000000000
--- a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using MediaBrowser.Controller;
-using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Controller.Session;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Linq;
-using MediaBrowser.Model.System;
-using MediaBrowser.Model.Threading;
-
-namespace Emby.Server.Implementations.EntryPoints
-{
- public class KeepServerAwake : IServerEntryPoint
- {
- private readonly ISessionManager _sessionManager;
- private readonly ILogger _logger;
- private ITimer _timer;
- private readonly IServerApplicationHost _appHost;
- private readonly ITimerFactory _timerFactory;
- private readonly IPowerManagement _powerManagement;
-
- public KeepServerAwake(ISessionManager sessionManager, ILogger logger, IServerApplicationHost appHost, ITimerFactory timerFactory, IPowerManagement powerManagement)
- {
- _sessionManager = sessionManager;
- _logger = logger;
- _appHost = appHost;
- _timerFactory = timerFactory;
- _powerManagement = powerManagement;
- }
-
- public void Run()
- {
- _timer = _timerFactory.Create(OnTimerCallback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
- }
-
- private void OnTimerCallback(object state)
- {
- var now = DateTime.UtcNow;
-
- try
- {
- if (_sessionManager.Sessions.Any(i => (now - i.LastActivityDate).TotalMinutes < 15))
- {
- _powerManagement.PreventSystemStandby();
- }
- else
- {
- _powerManagement.AllowSystemStandby();
- }
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error resetting system standby timer");
- }
- }
-
- public void Dispose()
- {
- if (_timer != null)
- {
- _timer.Dispose();
- _timer = null;
- }
- }
- }
-}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 59f9fe86f..81a47bfea 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -75,7 +75,23 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private readonly IStreamHelper _streamHelper;
- public EmbyTV(IServerApplicationHost appHost, IStreamHelper streamHelper, IMediaSourceManager mediaSourceManager, IAssemblyInfo assemblyInfo, ILogger logger, IJsonSerializer jsonSerializer, IPowerManagement powerManagement, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IMediaEncoder mediaEncoder, ITimerFactory timerFactory, IProcessFactory processFactory, ISystemEvents systemEvents)
+ public EmbyTV(IServerApplicationHost appHost,
+ IStreamHelper streamHelper,
+ IMediaSourceManager mediaSourceManager,
+ IAssemblyInfo assemblyInfo,
+ ILogger logger,
+ IJsonSerializer jsonSerializer,
+ IHttpClient httpClient,
+ IServerConfigurationManager config,
+ ILiveTvManager liveTvManager,
+ IFileSystem fileSystem,
+ ILibraryManager libraryManager,
+ ILibraryMonitor libraryMonitor,
+ IProviderManager providerManager,
+ IMediaEncoder mediaEncoder,
+ ITimerFactory timerFactory,
+ IProcessFactory processFactory,
+ ISystemEvents systemEvents)
{
Current = this;
@@ -97,7 +113,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_streamHelper = streamHelper;
_seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
- _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory, powerManagement);
+ _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory);
_timerProvider.TimerFired += _timerProvider_TimerFired;
_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index 76a044c02..e4ab34770 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -9,7 +9,6 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Threading;
-using MediaBrowser.Model.System;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
@@ -20,14 +19,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public event EventHandler<GenericEventArgs<TimerInfo>> TimerFired;
private readonly ITimerFactory _timerFactory;
- private readonly IPowerManagement _powerManagement;
- public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory, IPowerManagement powerManagement)
+ public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory)
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
{
_logger = logger1;
_timerFactory = timerFactory;
- _powerManagement = powerManagement;
}
public void RestartTimers()
@@ -36,7 +33,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var item in GetAll().ToList())
{
- AddOrUpdateSystemTimer(item, false);
+ AddOrUpdateSystemTimer(item);
}
}
@@ -59,7 +56,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public override void Update(TimerInfo item)
{
base.Update(item);
- AddOrUpdateSystemTimer(item, false);
+ AddOrUpdateSystemTimer(item);
}
public void AddOrUpdate(TimerInfo item, bool resetTimer)
@@ -90,7 +87,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
base.Add(item);
- AddOrUpdateSystemTimer(item, true);
+ AddOrUpdateSystemTimer(item);
}
private bool ShouldStartTimer(TimerInfo item)
@@ -104,7 +101,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return true;
}
- private void AddOrUpdateSystemTimer(TimerInfo item, bool scheduleSystemWakeTimer)
+ private void AddOrUpdateSystemTimer(TimerInfo item)
{
StopTimer(item);
@@ -124,23 +121,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var dueTime = startDate - now;
StartTimer(item, dueTime);
-
- if (scheduleSystemWakeTimer && dueTime >= TimeSpan.FromMinutes(15))
- {
- ScheduleSystemWakeTimer(startDate, item.Name);
- }
- }
-
- private void ScheduleSystemWakeTimer(DateTime startDate, string displayName)
- {
- try
- {
- _powerManagement.ScheduleWake(startDate.AddMinutes(-5), displayName);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error scheduling wake timer");
- }
}
private void StartTimer(TimerInfo item, TimeSpan dueTime)
diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs
index b54634387..64e03f22e 100644
--- a/Jellyfin.Server/CoreAppHost.cs
+++ b/Jellyfin.Server/CoreAppHost.cs
@@ -11,8 +11,8 @@ namespace Jellyfin.Server
{
public class CoreAppHost : ApplicationHost
{
- public CoreAppHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager)
- : base(applicationPaths, loggerFactory, options, fileSystem, powerManagement, environmentInfo, imageEncoder, systemEvents, networkManager)
+ public CoreAppHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, StartupOptions options, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager)
+ : base(applicationPaths, loggerFactory, options, fileSystem, environmentInfo, imageEncoder, systemEvents, networkManager)
{
}
diff --git a/Jellyfin.Server/PowerManagement.cs b/Jellyfin.Server/PowerManagement.cs
deleted file mode 100644
index c27c51893..000000000
--- a/Jellyfin.Server/PowerManagement.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using MediaBrowser.Model.System;
-
-namespace Jellyfin.Server.Native
-{
- public class PowerManagement : IPowerManagement
- {
- public void PreventSystemStandby()
- {
-
- }
-
- public void AllowSystemStandby()
- {
-
- }
-
- public void ScheduleWake(DateTime wakeTimeUtc, string displayName)
- {
-
- }
- }
-}
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 03fdacb26..d74315755 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -13,7 +13,6 @@ using Emby.Server.Implementations;
using Emby.Server.Implementations.EnvironmentInfo;
using Emby.Server.Implementations.IO;
using Emby.Server.Implementations.Networking;
-using Jellyfin.Server.Native;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Drawing;
@@ -47,6 +46,8 @@ namespace Jellyfin.Server
}
ServerApplicationPaths appPaths = createApplicationPaths(options);
+ // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
+ Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath);
await createLogger(appPaths);
_loggerFactory = new SerilogLoggerFactory();
_logger = _loggerFactory.CreateLogger("Main");
@@ -71,7 +72,6 @@ namespace Jellyfin.Server
_loggerFactory,
options,
fileSystem,
- new PowerManagement(),
environmentInfo,
new NullImageEncoder(),
new SystemEvents(_loggerFactory.CreateLogger("SystemEvents")),
@@ -140,23 +140,8 @@ namespace Jellyfin.Server
}
else
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- configDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
- }
- else
- {
- // $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored.
- configDir = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");
- // If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config should be used.
- if (string.IsNullOrEmpty(configDir))
- {
- configDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share");
- }
- }
- configDir = Path.Combine(configDir, "jellyfin");
- // Ensure the dir exists
- Directory.CreateDirectory(configDir);
+ // Let BaseApplicationPaths set up the default value
+ configDir = null;
}
}
@@ -169,12 +154,9 @@ namespace Jellyfin.Server
}
else
{
- logDir = Path.Combine(programDataPath, "logs");
- // Ensure the dir exists
- Directory.CreateDirectory(logDir);
+ // Let BaseApplicationPaths set up the default value
+ logDir = null;
}
- // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
- Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir);
}
string appPath = AppContext.BaseDirectory;
@@ -274,7 +256,7 @@ namespace Jellyfin.Server
}
}
- public static void Shutdown()
+ public static void Shutdown()
{
ApplicationTaskCompletionSource.SetResult(true);
}
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 28e75bf55..fa6502bda 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -590,6 +590,22 @@ namespace MediaBrowser.Api.Playback
}
/// <summary>
+ /// Parses query parameters as StreamOptions
+ /// <summary>
+ /// <param name="request">The stream request.</param>
+ private void ParseStreamOptions(StreamRequest request)
+ {
+ foreach (var param in Request.QueryString) {
+ if (Char.IsLower(param.Name[0])) {
+ // This was probably not parsed initially and should be a StreamOptions
+ // TODO: This should be incorporated either in the lower framework for parsing requests
+ // or the generated URL should correctly serialize it
+ request.StreamOptions[param.Name] = param.Value;
+ }
+ }
+ }
+
+ /// <summary>
/// Parses the dlna headers.
/// </summary>
/// <param name="request">The request.</param>
@@ -667,6 +683,8 @@ namespace MediaBrowser.Api.Playback
ParseParams(request);
}
+ ParseStreamOptions(request);
+
var url = Request.PathInfo;
if (string.IsNullOrEmpty(request.AudioCodec))
diff --git a/MediaBrowser.Model/System/IPowerManagement.cs b/MediaBrowser.Model/System/IPowerManagement.cs
deleted file mode 100644
index 03907568c..000000000
--- a/MediaBrowser.Model/System/IPowerManagement.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.System
-{
- public interface IPowerManagement
- {
- void PreventSystemStandby();
- void AllowSystemStandby();
- void ScheduleWake(DateTime wakeTimeUtc, string displayName);
- }
-}
diff --git a/debian/changelog b/debian/changelog
index 9dc21d467..61223e725 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+jellyfin (10.0.0-1) unstable; urgency=medium
+
+ * The first Jellyfin release under our new versioning scheme
+ * Numerous bugfixes and code readability improvements
+ * Updated logging configuration, including flag for it and configdir
+ * Updated theming including logo
+ * Dozens of other improvements as documented in GitHub pull request #419
+
+ -- Joshua Boniface <joshua@boniface.me> Sat, 05 Jan 2019 15:39:25 -0500
+
jellyfin (3.5.2-5) unstable; urgency=medium
* Fully GPL'd release - remove tainted code from MediaBrowser.Common
@@ -34,16 +44,3 @@ jellyfin (3.5.2) unstable; urgency=medium
* Rename from emby-server on version 3.5.2
-- Joshua Boniface <joshua@boniface.me> Sun, 9 Dec 2018 15:20:58 -0400
-
-emby-server (3.5.2-unlocked) unstable; urgency=medium
-
- * Taking changes from upstream 3.5.2, beautifying some JS files
-
- -- Vasily <just.one.man@yandex.ru> Mon, 22 Oct 2018 03:45:13 +0400
-
-emby-server (3.4.1.18-unlocked) unstable; urgency=medium
-
- * Hard fork of Emby 3.4.1.18 including premium unlock
-
- -- Joshua Boniface <joshua@boniface.me> Thu, 9 Aug 2018 00:33:19 -0400
-
diff --git a/debian/conf/jellyfin b/debian/conf/jellyfin
index fb00e7f65..861865aae 100644
--- a/debian/conf/jellyfin
+++ b/debian/conf/jellyfin
@@ -15,8 +15,10 @@
# General options
#
-# Data directory
-JELLYFIN_DATA="/var/lib/jellyfin"
+# Program directories
+JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
+JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
+JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
# Restart script for in-app server control
JELLYFIN_RESTART_SCRIPT="/usr/lib/jellyfin/restart.sh"
# Additional options for the binary
@@ -29,4 +31,4 @@ JELLYFIN_ADD_OPTS=""
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
-JELLYFIN_ARGS="-programdata $JELLYFIN_DATA -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
+JELLYFIN_ARGS="-programdata $JELLYFIN_DATA_DIRECTORY -configdir $JELLYFIN_CONFIG_DIRECTORY -logdir $JELLYFIN_LOG_DIRECTORY -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
diff --git a/debian/conf/logging.json b/debian/conf/logging.json
new file mode 100644
index 000000000..5d98484cd
--- /dev/null
+++ b/debian/conf/logging.json
@@ -0,0 +1,29 @@
+{
+ "Serilog": {
+ "MinimumLevel": "Information",
+ "WriteTo": [
+ { "Name": "Console",
+ "Args": {
+ "outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "Async",
+ "Args": {
+ "configure": [
+ {
+ "Name": "File",
+ "Args": {
+ "path": "%JELLYFIN_LOG_DIR%//jellyfin.log",
+ "fileSizeLimitBytes": 10485700,
+ "rollOnFileSizeLimit": true,
+ "retainedFileCountLimit": 10,
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message}{NewLine}{Exception}"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/debian/control b/debian/control
index 13c62c806..74bebeaf1 100644
--- a/debian/control
+++ b/debian/control
@@ -9,6 +9,9 @@ Build-Depends: debhelper (>= 9),
libfontconfig1-dev,
libfreetype6-dev
Standards-Version: 3.9.4
+Homepage: https://jellyfin.media/
+Vcs-Git: https://github.org/jellyfin/jellyfin.git
+Vcs-Browser: https://github.org/jellyfin/jellyfin
Package: jellyfin
Replaces: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
diff --git a/debian/install b/debian/install
index bc26f9f09..adaff7b26 100644
--- a/debian/install
+++ b/debian/install
@@ -1,5 +1,6 @@
usr/lib/jellyfin usr/lib/
debian/conf/jellyfin etc/default/
+debian/conf/logging.json etc/jellyfin/
debian/conf/jellyfin.service.conf etc/systemd/system/jellyfin.service.d/
debian/bin/jellyfin-sudoers etc/sudoers.d/
debian/bin/restart.sh usr/lib/jellyfin/
diff --git a/debian/jellyfin.service b/debian/jellyfin.service
index 4c3739909..c17422029 100644
--- a/debian/jellyfin.service
+++ b/debian/jellyfin.service
@@ -6,7 +6,7 @@ After = network.target
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
-ExecStart = /usr/bin/jellyfin -programdata ${JELLYFIN_DATA} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
+ExecStart = /usr/bin/jellyfin -programdata ${JELLYFIN_DATA_DIRECTORY} -configdir ${JELLYFIN_CONFIG_DIRECTORY} -logdir ${JELLYFIN_LOG_DIRECTORY} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
Restart = on-failure
TimeoutSec = 15
diff --git a/debian/postinst b/debian/postinst
index 502bba342..3690d20ba 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -2,7 +2,6 @@
set -e
NAME=jellyfin
-CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
@@ -10,13 +9,10 @@ if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
-# Source Jellyfin user configuration overrides
-if [[ -f $CONF_FILE ]]; then
- . $CONF_FILE
-fi
-
-# Data directory where Jellyfin database, cache and logs are stored
-PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
+# Data directories for program data (cache, db), configs, and logs
+PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
+CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
+LOGDATA=${JELLYFIN_LOG_DIRECTORY-/var/log/$NAME}
case "$1" in
configure)
@@ -29,13 +25,24 @@ case "$1" in
adduser --system --ingroup jellyfin --shell /bin/false jellyfin --no-create-home --home ${PROGRAMDATA} \
--gecos "Jellyfin default user" > /dev/null 2>&1
fi
- # ensure $PROGRAMDATA has appropriate permissions
+ # ensure $PROGRAMDATA exists
if [[ ! -d $PROGRAMDATA ]]; then
mkdir $PROGRAMDATA
- chown -R jellyfin:jellyfin $PROGRAMDATA
fi
+ # ensure $CONFIGDATA exists
+ if [[ ! -d $CONFIGDATA ]]; then
+ mkdir $CONFIGDATA
+ fi
+ # ensure $LOGDATA exists
+ if [[ ! -d $LOGDATA ]]; then
+ mkdir $LOGDATA
+ fi
+ # Ensure permissions are correct on all config directories
+ chown -R jellyfin:jellyfin $PROGRAMDATA
+ chown -R jellyfin:jellyfin $CONFIGDATA
+ chown -R jellyfin:jellyfin $LOGDATA
- chmod +x ${JELLYFIN_DIR}/restart.sh > /dev/null 2>&1 || true
+ chmod +x /usr/lib/jellyfin/restart.sh > /dev/null 2>&1 || true
# Install jellyfin symlink into /usr/bin
ln -sf /usr/lib/jellyfin/bin/jellyfin /usr/bin/jellyfin
diff --git a/debian/postrm b/debian/postrm
index 852841b16..690f5d587 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -2,7 +2,6 @@
set -e
NAME=jellyfin
-CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
@@ -10,13 +9,10 @@ if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
-# Source Jellyfin user configuration overrides
-if [[ -f $CONF_FILE ]]; then
- . $CONF_FILE
-fi
-
-# Data directory where Jellyfin database, cache and logs are stored
-PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
+# Data directories for program data (cache, db), configs, and logs
+PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
+CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
+LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@@ -37,14 +33,29 @@ case "$1" in
deb-systemd-helper unmask jellyfin.service >/dev/null
fi
+ # Remove user and group
userdel jellyfin > /dev/null 2>&1 || true
delgroup --quiet jellyfin > /dev/null 2>&1 || true
+ # Remove config dir
+ if [[ -d $CONFIGDATA ]]; then
+ rm -rf $CONFIGDATA
+ fi
+ # Remove log dir
+ if [[ -d $LOGDATA ]]; then
+ rm -rf $LOGDATA
+ fi
+ # Remove program data dir
if [[ -d $PROGRAMDATA ]]; then
rm -rf $PROGRAMDATA
fi
+ # Remove binary symlink
[[ -f /usr/bin/jellyfin ]] && rm /usr/bin/jellyfin
+ # Remove sudoers config
[[ -f /etc/sudoers.d/jellyfin-sudoers ]] && rm /etc/sudoers.d/jellyfin-sudoers
- [[ -d /var/lib/jellyfin ]] && rm -rf /var/lib/jellyfin
+ # Remove anything at the default locations; catches situations where the user moved the defaults
+ [[ -e /etc/jellyfin ]] && rm -rf /etc/jellyfin
+ [[ -e /var/log/jellyfin ]] && rm -rf /var/log/jellyfin
+ [[ -e /var/lib/jellyfin ]] && rm -rf /var/lib/jellyfin
;;
remove)
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
diff --git a/debian/preinst b/debian/preinst
index 2ce29a0cf..0063e0e63 100644
--- a/debian/preinst
+++ b/debian/preinst
@@ -2,7 +2,6 @@
set -e
NAME=jellyfin
-CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
@@ -10,13 +9,10 @@ if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
-# Source Jellyfin user configuration overrides
-if [[ -f $CONF_FILE ]]; then
- . $CONF_FILE
-fi
-
-# Data directory where Jellyfin database, cache and logs are stored
-PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
+# Data directories for program data (cache, db), configs, and logs
+PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
+CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
+LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@@ -57,6 +53,14 @@ case "$1" in
# Clean up old Emby cruft that can break the user's system
[[ -f /etc/sudoers.d/emby ]] && rm -f /etc/sudoers.d/emby
+ # If we have existing config or log dirs in /var/lib/jellyfin, move them into the right place
+ if [[ -d $PROGRAMDATA/config ]]; then
+ mv $PROGRAMDATA/config $CONFIGDATA
+ fi
+ if [[ -d $PROGRAMDATA/logs ]]; then
+ mv $PROGRAMDATA/logs $LOGDATA
+ fi
+
;;
abort-upgrade)
;;
diff --git a/debian/prerm b/debian/prerm
index 3cdffed79..4770c03c4 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -2,7 +2,6 @@
set -e
NAME=jellyfin
-CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
@@ -10,13 +9,10 @@ if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
-# Source Jellyfin user configuration overrides
-if [[ -f $CONF_FILE ]]; then
- . $CONF_FILE
-fi
-
-# Data directory where Jellyfin database, cache and logs are stored
-PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
+# Data directories for program data (cache, db), configs, and logs
+PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
+CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
+LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
case "$1" in
remove|upgrade|deconfigure)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 000000000..45bef4764
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1 @@
+tar-ignore = ".git*"