Merge pull request #116 from joshuaboniface/debian-packaging

Debian initscript improvements
This commit is contained in:
Joshua M. Boniface 2018-12-12 20:39:48 -05:00 committed by GitHub
commit b2651c89b6
8 changed files with 50 additions and 66 deletions

57
debian/conf/jellyfin vendored
View File

@ -1,37 +1,36 @@
# Defaults for jellyfin initscript # Jellyfin default configuration options
# sourced by /etc/init.d/jellyfin and /usr/lib/jellyfin/jellyfin.sh
# installed at /etc/default/jellyfin by the maintainer scripts # Use this file to override the default configurations; add additional
# options with JELLYFIN_ADD_OPTS.
# Under systemd, use
# /etc/systemd/system/jellyfin.service.d/jellyfin.service.conf
# to override the user or this config file's location.
# #
# This is a POSIX shell fragment # This is a POSIX shell fragment
# #
## Don't edit this file #
## Edit user configuration in /etc/jellyfin.conf to change # General options
## #
## JELLYFIN_USER= #$JELLYFIN_USER, username to run Jellyfin under, the default is jellyfin
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Jellyfin user belongs
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Jellyfin program files the default is /usr/lib/jellyfin
## JELLYFIN_BIN= #$JELLYFIN_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe
## JELLYFIN_DATA= #$JELLYFIN_DATA, the location of Jellyfin data, cache, logs, the default is /var/lib/jellyfin
## JELLYFIN_PIDFILE= #$JELLYFIN_PIDFILE, the location of jellyfin.pid, the default is /var/run/jellyfin/jellyfin.pid
## JELLYFIN_ADD_OPTS= #$JELLYFIN_ADD_OPTS, additional options to pass to the Jellyfin executable, beyond ffmpeg, ffprobe and restart
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
##
## EXAMPLE if want to run as different user
## add JELLYFIN_USER=username to /etc/jellyfin.conf
## otherwise default jellyfin is used
JELLYFIN_USER="jellyfin" # Path to the jellyfin.dll executable
JELLYFIN_GROUP="jellyfin" JELLYFIN_EXE="/usr/lib/jellyfin/bin/jellyfin.dll"
JELLYFIN_DIR="/usr/lib/jellyfin" # Data directory
JELLYFIN_BIN="/usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe"
JELLYFIN_DATA="/var/lib/jellyfin" JELLYFIN_DATA="/var/lib/jellyfin"
JELLYFIN_PIDFILE="/var/run/jellyfin.pid" # Restart script for in-app server control
JELLYFIN_RESTART_SCRIPT="/usr/lib/jellyfin/restart.sh"
# Additional options for the binary
JELLYFIN_ADD_OPTS="" JELLYFIN_ADD_OPTS=""
MONO_BIN="/usr/bin/mono-sgen"
MONO_OPTS="--optimize=all" #
MONO_ENV="MONO_THREADS_PER_CPU=250 MONO_GC_PARAMS=nursery-size=128m" # SysV init/Upstart options
UMASK="002" #
# Application username
JELLYFIN_USER="jellyfin"
# .NET Core runtime binary
JELLYFIN_DOTNET="/usr/bin/dotnet"
# Full application command
JELLYFIN_COMMAND="$JELLYFIN_EXE -programdata $JELLYFIN_DATA -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"

View File

@ -1,24 +0,0 @@
# Override defaults for jellyfin initscript
# sourced by /etc/init.d/jellyfin and /usr/bin/jellyfin
# installed at /etc/jellyfin.conf by the maintainer scripts
#
# This is a POSIX shell fragment
#
## To change the defaults add any of the following settings below the comments
##
## JELLYFIN_USER= #$JELLYFIN_USER, username to run Jellyfin under, the default is jellyfin
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Jellyfin user belongs
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Jellyfin program files the default is /usr/lib/jellyfin
## JELLYFIN_BIN= #$JELLYFIN_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe
## JELLYFIN_DATA= #$JELLYFIN_DATA, the location of Jellyfin data, cache, logs, the default is /var/lib/jellyfin
## JELLYFIN_PIDFILE= #$JELLYFIN_PIDFILE, the location of jellyfin.pid, the default is /var/run/jellyfin/jellyfin.pid
## JELLYFIN_ADD_OPTS= #$JELLYFIN_ADD_OPTS, additional options to pass to the Jellyfin executable, beyond ffmpeg, ffprobe and restart
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
##
## EXAMPLE if want to run as different user
## add JELLYFIN_USER=username
## otherwise default jellyfin is used

7
debian/conf/jellyfin.service.conf vendored Normal file
View File

@ -0,0 +1,7 @@
# Jellyfin systemd configuration options
# Use this file to override the user or environment file location.
[Service]
#User = jellyfin
#EnvironmentFile = /etc/default/jellyfin

2
debian/install vendored
View File

@ -1,5 +1,5 @@
usr/lib/jellyfin usr/lib/ usr/lib/jellyfin usr/lib/
debian/conf/jellyfin.conf etc/
debian/conf/jellyfin etc/default/ debian/conf/jellyfin etc/default/
debian/conf/jellyfin.service.conf etc/systemd/system/jellyfin.service.d/
debian/bin/jellyfin-sudoers etc/sudoers.d/ debian/bin/jellyfin-sudoers etc/sudoers.d/
debian/bin/restart.sh usr/lib/jellyfin/ debian/bin/restart.sh usr/lib/jellyfin/

View File

@ -9,13 +9,14 @@
### END INIT INFO ### END INIT INFO
# Carry out specific functions when asked to by the system # Carry out specific functions when asked to by the system
pid=`ps -fA|grep dotnet|grep JellyfinServer|awk '{print $2}'| tr -d '\n'` pid=`ps -fA|grep dotnet|grep jellyfin|awk '{print $2}'| tr -d '\n'`
case "$1" in case "$1" in
start) start)
if [ "$pid" == "" ]; then if [ "$pid" == "" ]; then
echo "Starting Jellyfin..." echo "Starting Jellyfin..."
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 & . /etc/default/jellyfin
nohup su -u $JELLYFIN_USER -c $JELLYFIN_DOTNET $JELLYFIN_COMMAND
else else
echo "Jellyfin already running" echo "Jellyfin already running"
fi fi

View File

@ -1,12 +1,14 @@
[Unit] [Unit]
Description=Jellyfin Media Server Description = Jellyfin Media Server
After=network.target After = network.target
[Service] [Service]
User=jellyfin Type = simple
ExecStart=/usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll EnvironmentFile = /etc/default/jellyfin
Restart=on-abort User = jellyfin
TimeoutSec=20 ExecStart = /usr/bin/dotnet ${JELLYFIN_EXE} -programdata ${JELLYFIN_DATA} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
Restart = on-abort
TimeoutSec = 20
[Install] [Install]
WantedBy=multi-user.target WantedBy = multi-user.target

View File

@ -15,6 +15,6 @@ script
# Log file # Log file
logger -t "$0" "DEBUG: `set`" logger -t "$0" "DEBUG: `set`"
exec /usr/bin/jellyfin start . /etc/default/jellyfin
exec /usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll exec su -u $JELLYFIN_USER -c $JELLYFIN_DOTNET $JELLYFIN_COMMAND
end script end script

1
debian/rules vendored
View File

@ -15,7 +15,6 @@ override_dh_auto_test:
override_dh_clistrip: override_dh_clistrip:
override_dh_auto_build: override_dh_auto_build:
dotnet build --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/jellyfin/bin'
dotnet publish --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/jellyfin/bin' dotnet publish --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/jellyfin/bin'
override_dh_auto_clean: override_dh_auto_clean: