Merge pull request #10 from jellyfin/revert-9-debian-packaging

Revert "Debian packaging improvements"
This commit is contained in:
Joshua M. Boniface 2018-12-09 18:45:25 -05:00 committed by GitHub
commit c8c35864fe
25 changed files with 412 additions and 374 deletions

View File

@ -2,6 +2,6 @@
<configuration>
<appSettings>
<add key="DebugProgramDataPath" value="E:\Temp" />
<add key="ReleaseProgramDataPath" value="/var/lib/jellyfin/" />
<add key="ReleaseProgramDataPath" value="/var/lib/emby/" />
</appSettings>
</configuration>
</configuration>

121
debian/bin/emby-server vendored Normal file
View File

@ -0,0 +1,121 @@
#!/bin/bash
# vim:set ft=sh sw=2 sts=2 st=2 et:
# Author: HurricaneHernandez <carlos@techbyte.ca>
# Modified for CentOS/Fedora by: FC7 <casasfernando@outlook.com>
DESC=EmbyServer
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
SCRIPTNAME=/usr/bin/emby-server
# Source Emby server default configuration
. $DEFAULT_FILE
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
else
echo "${CONF_FILE} not found using default settings.";
fi
# Ensure the runas user has restart privilege to restart the service if not try to add the user to emby group. WARN on failure
if [[ "$EMBY_USER" != "emby" ]]; then
groups $EMBY_USER | grep -q emby
if [[ $? -ne 0 ]]; then
if [[ $EUID -eq 0 ]]; then
usermod -a -G emby $EMBY_USER
else
echo "WARNING: The runas user is not part of emby group and you don't have enough privileges to add it. The restart button in the GUI will probably fail."
echo "To solve this start the emby-server service using the startup scripts (systemd/sysv) or"
echo "add the runas user ($EMBY_USER) to the emby group manually and restart Emby."
fi
fi
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=$EMBY_DATA
PROGRAMDATA_OPT="-programdata $PROGRAMDATA"
# Path to store PID file
PIDFILE=$EMBY_PIDFILE
# Full path of Emby binary
EMBY_EXEC=$EMBY_BIN
# Path of emby program files
EMBY_PATH=$EMBY_DIR
# path to mono bin
MONO_EXEC=$MONO_BIN
# umask
UMASK=${UMASK:-002}
# Mono environment variables
MAGICK_HOME_ENV="MAGICK_HOME=${EMBY_PATH}"
EMBY_LIBRARY_PATH=$(find /usr/lib/emby-server/ -maxdepth 1 -mindepth 1 -type d| grep -v bin | grep -v etc | grep -v -e "/\.")
MAGICK_CODER_FILTER_PATH_ENV="MAGICK_CODER_FILTER_PATH=$(find ${EMBY_LIBRARY_PATH} -type d -name "filters" | grep EmbyMagick)"
MAGICK_CODER_MODULE_PATH_ENV="MAGICK_CODER_MODULE_PATH=$(find ${EMBY_LIBRARY_PATH} -type d -name "coders" | grep EmbyMagick)"
MONO_EXEC_ENV="$MONO_ENV ${EMBY_LIBRARY_PATH:+"LD_LIBRARY_PATH=${EMBY_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"}"
# Mono options
MONO_EXEC_OPTS=$MONO_OPTS
# restart function
RESTART_OPTS="-restartpath ${EMBY_PATH}/restart.sh"
# Emby options
EMBY_OPTS="$PROGRAMDATA_OPT $RESTART_OPTS $EMBY_ADD_OPTS"
PID_PATH=$(dirname $PIDFILE)
# Exit if the mono-sgen not installed
if [[ ! -x $MONO_EXEC ]]; then
if [[ -n "$(command -v mono-sgen)" ]]; then
MONO_EXEC=$(command -v mono-sgen)
else
MONO_EXEC=$(command -v mono)
fi
fi
# Create programdata directory if not exist and ensure the emby user can write to it
if [[ ! -d $PROGRAMDATA ]]; then
if [[ $EUID -eq 0 ]]; then
mkdir -p $PROGRAMDATA
else
echo "WARNING: $EMBY_DATA directory does not exist."
echo "To solve this, if it is an upgrade verify that \"EMBY_DATA\" is set to the correct path in /etc/emby-server.conf."
echo "You may need to locate the path of your library files and set EMBY_DATA to that path."
echo "If this is an new installation please rerun last command with elevated permissions."
fi
fi
# Set right permission for directories
DATA_CURRENT_USER=$(ls -lad $PROGRAMDATA | awk '{print $3}')
if [[ "$DATA_CURRENT_USER" != "$EMBY_USER" ]]; then
if [[ $EUID -eq 0 ]]; then
chown -R $EMBY_USER.$EMBY_GROUP $PROGRAMDATA
else
echo "WARNING: $EMBY_DATA directory does not have the correct permissions."
echo "Please rerun this script with elevated permissions."
fi
fi
case "$1" in
start)
echo $$ > $PIDFILE
exec su -s /bin/sh -c 'umask $0; exec "$1" "$@"' $EMBY_USER -- \
$UMASK env $MAGICK_HOME_ENV $MAGICK_CODER_FILTER_PATH_ENV $MAGICK_CODER_MODULE_PATH_ENV \
$MONO_EXEC_ENV $MONO_EXEC $MONO_EXEC_OPTS $EMBY_EXEC $EMBY_OPTS
;;
clear)
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
;;
*)
echo "Usage: $SCRIPTNAME {start|clear}" >&2
exit 3
;;
esac

121
debian/bin/jellyfin vendored
View File

@ -1,121 +0,0 @@
#!/bin/bash
# vim:set ft=sh sw=2 sts=2 st=2 et:
# Author: HurricaneHernandez <carlos@techbyte.ca>
# Modified for CentOS/Fedora by: FC7 <casasfernando@outlook.com>
DESC=Jellyfin
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
SCRIPTNAME=/usr/bin/jellyfin
# Source Jellyfin default configuration
. $DEFAULT_FILE
# Source Jellyfin user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
else
echo "${CONF_FILE} not found using default settings.";
fi
# Ensure the runas user has restart privilege to restart the service if not try to add the user to jellyfin group. WARN on failure
if [[ "$JELLYFIN_USER" != "jellyfin" ]]; then
groups $JELLYFIN_USER | grep -q jellyfin
if [[ $? -ne 0 ]]; then
if [[ $EUID -eq 0 ]]; then
usermod -a -G jellyfin $JELLYFIN_USER
else
echo "WARNING: The runas user is not part of jellyfin group and you don't have enough privileges to add it. The restart button in the GUI will probably fail."
echo "To solve this start the jellyfin service using the startup scripts (systemd/sysv) or"
echo "add the runas user ($JELLYFIN_USER) to the jellyfin group manually and restart Emby."
fi
fi
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=$JELLYFIN_DATA
PROGRAMDATA_OPT="-programdata $PROGRAMDATA"
# Path to store PID file
PIDFILE=$JELLYFIN_PIDFILE
# Full path of Emby binary
JELLYFIN_EXEC=$JELLYFIN_BIN
# Path of jellyfin program files
JELLYFIN_PATH=$JELLYFIN_DIR
# path to mono bin
MONO_EXEC=$MONO_BIN
# umask
UMASK=${UMASK:-002}
# Mono environment variables
MAGICK_HOME_ENV="MAGICK_HOME=${JELLYFIN_PATH}"
JELLYFIN_LIBRARY_PATH=$(find /usr/lib/jellyfin/ -maxdepth 1 -mindepth 1 -type d| grep -v bin | grep -v etc | grep -v -e "/\.")
MAGICK_CODER_FILTER_PATH_ENV="MAGICK_CODER_FILTER_PATH=$(find ${JELLYFIN_LIBRARY_PATH} -type d -name "filters" | grep EmbyMagick)"
MAGICK_CODER_MODULE_PATH_ENV="MAGICK_CODER_MODULE_PATH=$(find ${JELLYFIN_LIBRARY_PATH} -type d -name "coders" | grep EmbyMagick)"
MONO_EXEC_ENV="$MONO_ENV ${JELLYFIN_LIBRARY_PATH:+"LD_LIBRARY_PATH=${JELLYFIN_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"}"
# Mono options
MONO_EXEC_OPTS=$MONO_OPTS
# restart function
RESTART_OPTS="-restartpath ${JELLYFIN_PATH}/restart.sh"
# Emby options
JELLYFIN_OPTS="$PROGRAMDATA_OPT $RESTART_OPTS $JELLYFIN_ADD_OPTS"
PID_PATH=$(dirname $PIDFILE)
# Exit if the mono-sgen not installed
if [[ ! -x $MONO_EXEC ]]; then
if [[ -n "$(command -v mono-sgen)" ]]; then
MONO_EXEC=$(command -v mono-sgen)
else
MONO_EXEC=$(command -v mono)
fi
fi
# Create programdata directory if not exist and ensure the jellyfin user can write to it
if [[ ! -d $PROGRAMDATA ]]; then
if [[ $EUID -eq 0 ]]; then
mkdir -p $PROGRAMDATA
else
echo "WARNING: $JELLYFIN_DATA directory does not exist."
echo "To solve this, if it is an upgrade verify that \"JELLYFIN_DATA\" is set to the correct path in /etc/jellyfin.conf."
echo "You may need to locate the path of your library files and set JELLYFIN_DATA to that path."
echo "If this is an new installation please rerun last command with elevated permissions."
fi
fi
# Set right permission for directories
DATA_CURRENT_USER=$(ls -lad $PROGRAMDATA | awk '{print $3}')
if [[ "$DATA_CURRENT_USER" != "$JELLYFIN_USER" ]]; then
if [[ $EUID -eq 0 ]]; then
chown -R $JELLYFIN_USER.$JELLYFIN_GROUP $PROGRAMDATA
else
echo "WARNING: $JELLYFIN_DATA directory does not have the correct permissions."
echo "Please rerun this script with elevated permissions."
fi
fi
case "$1" in
start)
echo $$ > $PIDFILE
exec su -s /bin/sh -c 'umask $0; exec "$1" "$@"' $JELLYFIN_USER -- \
$UMASK env $MAGICK_HOME_ENV $MAGICK_CODER_FILTER_PATH_ENV $MAGICK_CODER_MODULE_PATH_ENV \
$MONO_EXEC_ENV $MONO_EXEC $MONO_EXEC_OPTS $JELLYFIN_EXEC $JELLYFIN_OPTS
;;
clear)
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
;;
*)
echo "Usage: $SCRIPTNAME {start|clear}" >&2
exit 3
;;
esac

6
debian/changelog vendored
View File

@ -1,9 +1,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

10
debian/control vendored
View File

@ -1,4 +1,4 @@
Source: jellyfin
Source: emby-server
Section: misc
Priority: optional
Maintainer: Vasily <just.one.man@yandex.ru>
@ -7,10 +7,10 @@ Build-Depends: debhelper (>= 9),
libc6-dev
Standards-Version: 3.9.4
Package: jellyfin
Replaces: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
Breaks: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
Conflicts: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
Package: emby-server
Replaces: mediabrowser, emby, emby-server-beta, emby-server-dev
Breaks: mediabrowser, emby, emby-server-beta, emby-server-dev
Conflicts: mediabrowser, emby, emby-server-beta, emby-server-dev
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, at, libsqlite3-0, dotnet-runtime-2.1
Description: Emby Server is a home media server.

7
debian/copyright vendored
View File

@ -1,13 +1,12 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: jellyfin
Source: https://github.com/jellyfin/jellyfin
Upstream-Name: emby
Source: https://raw.githubusercontent.com/MediaBrowser/MediaBrowser/master/LICENSE.md
Files: *
Copyright: 2018 JellyFin Team
Copyright: 2015 Luke Pulverenti <luke.pulverenti@gmail.com>
License: GPL-2.0+
Files: debian/*
Copyright: 2018 Joshua Boniface <joshua@boniface.me>
Copyright: 2014 Carlos Hernandez <carlos@techbyte.ca>
License: GPL-2.0+

37
debian/emby vendored Normal file
View File

@ -0,0 +1,37 @@
#Allow emby group to start, stop and restart itself
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service emby-server restart, /usr/sbin/service emby-server restart
Cmnd_Alias STARTSERVER_SYSV = /sbin/service emby-server start, /usr/sbin/service emby-server start
Cmnd_Alias STOPSERVER_SYSV = /sbin/service emby-server stop, /usr/sbin/service emby-server stop
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart emby-server, /bin/systemctl restart emby-server
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start emby-server, /bin/systemctl start emby-server
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop emby-server, /bin/systemctl stop emby-server
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/emby-server restart
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/emby-server start
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/emby-server stop
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
%emby ALL=(ALL) NOPASSWD: STARTSERVER_INITD
%emby ALL=(ALL) NOPASSWD: STOPSERVER_INITD
Defaults!RESTARTSERVER_SYSV !requiretty
Defaults!STARTSERVER_SYSV !requiretty
Defaults!STOPSERVER_SYSV !requiretty
Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
Defaults!RESTARTSERVER_INITD !requiretty
Defaults!STARTSERVER_INITD !requiretty
Defaults!STOPSERVER_INITD !requiretty
#Allow the server to mount iso images
%emby ALL=(ALL) NOPASSWD: /bin/mount
%emby ALL=(ALL) NOPASSWD: /bin/umount
Defaults:%emby !requiretty

24
debian/emby-server.conf vendored Normal file
View File

@ -0,0 +1,24 @@
# Override defaults for emby initscript
# sourced by /etc/init.d/emby-server and /usr/bin/emby-server
# installed at /etc/emby-server.conf by the maintainer scripts
#
# This is a POSIX shell fragment
#
## To change the defaults add any of the following settings below the comments
##
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server 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 EMBY_USER=username
## otherwise default emby is used

37
debian/emby-server.emby-server.default vendored Normal file
View File

@ -0,0 +1,37 @@
# Defaults for emby initscript
# sourced by /etc/init.d/emby-server and /usr/lib/emby-server/emby-server.sh
# installed at /etc/default/emby-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
## Don't edit this file
## Edit user configuration in /etc/emby-server.conf to change
##
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server 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 EMBY_USER=username to /etc/emby-server.conf
## otherwise default emby is used
EMBY_USER="emby"
EMBY_GROUP="emby"
EMBY_DIR="/usr/lib/emby-server"
EMBY_BIN="/usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe"
EMBY_DATA="/var/lib/emby-server"
EMBY_PIDFILE="/var/run/emby-server.pid"
EMBY_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"
UMASK="002"

88
debian/emby-server.emby-server.init vendored Normal file
View File

@ -0,0 +1,88 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: emby-server
# Required-Start: $remote_fs $local_fs $network
# Required-Stop: $remote_fs $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Emby
# Description: starts instance of Emby
### END INIT INFO
# chkconfig: 2345 20 80
#The above indicates that the script should be started in levels 2, 3, 4, and 5, #that its start priority should be 20, and that its stop priority should be 80.
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
. $DEFAULT_FILE
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
else
echo "${CONF_FILE} not found using default settings.";
fi
# Path of emby binary
EMBYSERVER=/usr/bin/emby-server
PIDFILE=${EMBY_PIDFILE-/var/run/emby-server.pid}
case "$1" in
start)
log_daemon_msg "Starting $NAME daemon"
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
log_daemon_msg "apparently already running"
log_end_msg 0
exit 0
fi
exec $EMBYSERVER start &
sleep 2
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $NAME daemon"
if [[ ! -s $PIDFILE ]] || [[ -z "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
log_success_msg "apparently already stopped"
log_end_msg 0
exit 0
fi
PID=$(cat $PIDFILE)
CPIDS=$(pgrep -P $PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
sleep 2
if [[ -z "$(ps -p $PID -o pid=)" ]]; then
rm -rf $PIDFILE
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p $PIDFILE "$EMBYSERVER" "$NAME"
exit $? # notreached due to set -e
;;
restart|force-reload)
$0 stop || exit $?
$0 start || exit $?
;;
*)
echo "Usage: /etc/init.d/emby-server {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

12
debian/emby-server.emby-server.service vendored Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Emby Media Server
After=network.target
[Service]
ExecStart=/usr/bin/emby-server start
Restart=on-abort
TimeoutSec=20
ExecStopPost=/usr/bin/emby-server clear
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,4 @@
description "jellyfin daemon"
description "emby-server daemon"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
@ -15,6 +15,9 @@ script
# Log file
logger -t "$0" "DEBUG: `set`"
exec /usr/bin/jellyfin start
exec /usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll
exec /usr/bin/emby-server start
end script
post-stop script
exec /usr/bin/emby-server clear
end script

10
debian/install vendored
View File

@ -1,5 +1,5 @@
usr/lib/jellyfin usr/lib/
debian/jellyfin.conf etc/
debian/jellyfin-sudoers etc/sudoers.d/
debian/bin/jellyfin usr/bin/
debian/restart.sh usr/lib/jellyfin
usr/lib/emby-server usr/lib/
debian/emby-server.conf etc/
debian/emby etc/sudoers.d/
debian/bin/emby-server usr/bin/
debian/restart.sh usr/lib/emby-server

View File

@ -1,37 +0,0 @@
#Allow jellyfin group to start, stop and restart itself
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service jellyfin restart, /usr/sbin/service jellyfin restart
Cmnd_Alias STARTSERVER_SYSV = /sbin/service jellyfin start, /usr/sbin/service jellyfin start
Cmnd_Alias STOPSERVER_SYSV = /sbin/service jellyfin stop, /usr/sbin/service jellyfin stop
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/jellyfin restart
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_INITD
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_INITD
Defaults!RESTARTSERVER_SYSV !requiretty
Defaults!STARTSERVER_SYSV !requiretty
Defaults!STOPSERVER_SYSV !requiretty
Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
Defaults!RESTARTSERVER_INITD !requiretty
Defaults!STARTSERVER_INITD !requiretty
Defaults!STOPSERVER_INITD !requiretty
#Allow the server to mount iso images
%jellyfin ALL=(ALL) NOPASSWD: /bin/mount
%jellyfin ALL=(ALL) NOPASSWD: /bin/umount
Defaults:%jellyfin !requiretty

24
debian/jellyfin.conf vendored
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 Emby under, the default is jellyfin
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Emby user belongs
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Emby 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 Emby 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

View File

@ -1,37 +0,0 @@
# Defaults for jellyfin initscript
# sourced by /etc/init.d/jellyfin and /usr/lib/jellyfin/jellyfin.sh
# installed at /etc/default/jellyfin by the maintainer scripts
#
# This is a POSIX shell fragment
#
## Don't edit this file
## Edit user configuration in /etc/jellyfin.conf to change
##
## JELLYFIN_USER= #$JELLYFIN_USER, username to run Emby under, the default is jellyfin
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Emby user belongs
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Emby 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 Emby 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"
JELLYFIN_GROUP="jellyfin"
JELLYFIN_DIR="/usr/lib/jellyfin"
JELLYFIN_BIN="/usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe"
JELLYFIN_DATA="/var/lib/jellyfin"
JELLYFIN_PIDFILE="/var/run/jellyfin.pid"
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"
UMASK="002"

44
debian/jellyfin.init vendored
View File

@ -1,44 +0,0 @@
### BEGIN INIT INFO
# Provides: Emby Server
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Emby Server
# Description: Runs Emby Server
### END INIT INFO
# Carry out specific functions when asked to by the system
pid=`ps -fA|grep dotnet|grep EmbyServer|awk '{print $2}'| tr -d '\n'`
case "$1" in
start)
if [ "$pid" == "" ]; then
echo "Starting Emby..."
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
else
echo "Emby already running"
fi
;;
stop)
if [ "$pid" != "" ]; then
echo "Stopping Emby..."
kill $pid
sleep 2
else
echo "Emby not running"
fi
;;
status)
if [ "$pid" != "" ]; then
echo "Emby running as $pid"
ps -f $pid
else
echo "Emby is not running"
fi
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -1,12 +0,0 @@
[Unit]
Description=Jellyfin Media Server
After=network.target
[Service]
User=jellyfin
ExecStart=/usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll
Restart=on-abort
TimeoutSec=20
[Install]
WantedBy=multi-user.target

48
debian/postinst vendored
View File

@ -1,45 +1,45 @@
#!/bin/bash
set -e
NAME=jellyfin
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Jellyfin user configuration overrides
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
case "$1" in
configure)
# create jellyfin group if it does not exist
if [[ -z "$(getent group jellyfin)" ]]; then
addgroup --quiet --system jellyfin > /dev/null 2>&1
# create emby group if it does not exist
if [[ -z "$(getent group emby)" ]]; then
addgroup --quiet --system emby > /dev/null 2>&1
fi
# create jellyfin user if it does not exist
if [[ -z "$(getent passwd jellyfin)" ]]; then
adduser --system --ingroup jellyfin --shell /bin/false jellyfin --no-create-home --home ${PROGRAMDATA} \
--gecos "Jellyfin default user" > /dev/null 2>&1
# create emby user if it does not exist
if [[ -z "$(getent passwd emby)" ]]; then
adduser --system --ingroup emby --shell /bin/false emby --no-create-home --home ${PROGRAMDATA} \
--gecos "Emby Server default user" > /dev/null 2>&1
fi
# ensure $PROGRAMDATA has appropriate permissions
if [[ ! -d $PROGRAMDATA ]]; then
mkdir $PROGRAMDATA
chown -R jellyfin:jellyfin $PROGRAMDATA
chown -R emby:emby $PROGRAMDATA
fi
# ensure jellyfin binary has appropriate permissions
chmod 755 /usr/bin/jellyfin
# ensure emby-server binary has appropriate permissions
chmod 755 /usr/bin/emby-server
/usr/bin/mono --aot=full -O=all $JELLYFIN_BIN > /dev/null 2>&1 || true
/usr/bin/mono --aot=full -O=all $EMBY_BIN > /dev/null 2>&1 || true
chmod +x ${JELLYFIN_DIR}/restart.sh > /dev/null 2>&1 || true
chmod +x ${EMBY_DIR}/restart.sh > /dev/null 2>&1 || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
@ -54,16 +54,16 @@ esac
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
# Manual init script handling
deb-systemd-helper unmask jellyfin.service >/dev/null || true
deb-systemd-helper unmask emby-server.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled jellyfin.service; then
if deb-systemd-helper --quiet was-enabled emby-server.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable jellyfin.service >/dev/null || true
deb-systemd-helper enable emby-server.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state jellyfin.service >/dev/null || true
deb-systemd-helper update-state emby-server.service >/dev/null || true
fi
fi
@ -72,10 +72,10 @@ fi
if [[ "$1" == "configure" ]] || [[ "$1" == "abort-upgrade" ]]; then
if [[ -d "/run/systemd/systemd" ]]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start jellyfin >/dev/null || true
elif [[ -x "/etc/init.d/jellyfin" ]] || [[ -e "/etc/init/jellyfin.conf" ]]; then
update-rc.d jellyfin defaults >/dev/null
invoke-rc.d jellyfin start || exit $?
deb-systemd-invoke start emby-server >/dev/null || true
elif [[ -x "/etc/init.d/emby-server" ]] || [[ -e "/etc/init/emby-server.conf" ]]; then
update-rc.d emby-server defaults >/dev/null
invoke-rc.d emby-server start || exit $?
fi
fi
exit 0

28
debian/postrm vendored
View File

@ -1,22 +1,22 @@
#!/bin/bash
set -e
NAME=jellyfin
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Jellyfin user configuration overrides
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@ -28,27 +28,27 @@ case "$1" in
purge)
echo PURGE | debconf-communicate $NAME > /dev/null 2>&1 || true
if [[ -x "/etc/init.d/jellyfin" ]] || [[ -e "/etc/init/jellyfin.connf" ]]; then
update-rc.d jellyfin remove >/dev/null 2>&1 || true
if [[ -x "/etc/init.d/emby-server" ]] || [[ -e "/etc/init/emby-server.connf" ]]; then
update-rc.d emby-server remove >/dev/null 2>&1 || true
fi
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper purge jellyfin.service >/dev/null
deb-systemd-helper unmask jellyfin.service >/dev/null
deb-systemd-helper purge emby-server.service >/dev/null
deb-systemd-helper unmask emby-server.service >/dev/null
fi
userdel jellyfin > /dev/null 2>&1 || true
delgroup --quiet jellyfin > /dev/null 2>&1 || true
userdel emby > /dev/null 2>&1 || true
delgroup --quiet emby > /dev/null 2>&1 || true
if [[ -d $PROGRAMDATA ]]; then
rm -rf $PROGRAMDATA
fi
[[ -f /usr/bin/jellyfin ]] && rm /usr/bin/jellyfin
[[ -f /etc/sudoers.d/jellyfin-sudoers ]] && rm /etc/sudoers.d/jellyfin-sudoers
[[ -d /var/lib/jellyfin ]] && rm -rf /var/lib/jellyfin
[[ -f /usr/bin/emby-server ]] && rm /usr/bin/emby-server
[[ -f /etc/sudoers.d/emby ]] && rm /etc/sudoers.d/emby
[[ -d /var/lib/emby-server ]] && rm -rf /var/lib/emby-server
;;
remove)
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper mask jellyfin.service >/dev/null
deb-systemd-helper mask emby-server.service >/dev/null
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

26
debian/preinst vendored
View File

@ -1,22 +1,22 @@
#!/bin/bash
set -e
NAME=jellyfin
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Jellyfin user configuration overrides
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@ -32,21 +32,21 @@ case "$1" in
elif [ -x "/etc/init.d/${NAME}" ] || [ -e "/etc/init/${NAME}.conf" ]; then
invoke-rc.d ${NAME} stop > /dev/null 2>&1 || true
fi
# try and figure out if jellyfin is running
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "jellyfin*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && JELLYFIN_PID=$(cat ${PIDFILE})
# try and figure out if emby is running
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
# if its running, let's stop it
if [[ -n "$JELLYFIN_PID" ]]; then
echo "Stopping Jellyfin!"
# if jellyfin is still running, kill it
if [[ -n "$(ps -p $JELLYFIN_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $JELLYFIN_PID)
if [[ -n "$EMBY_PID" ]]; then
echo "Stopping Emby Server!"
# if emby is still running, kill it
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $EMBY_PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
fi
sleep 1
# if it's still running, show error
if [[ -n "$(ps -p $JELLYFIN_PID -o pid=)" ]]; then
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
echo "Could not successfully stop EmbyServer, please do so before uninstalling."
exit 1
else

28
debian/prerm vendored
View File

@ -1,26 +1,26 @@
#!/bin/bash
set -e
NAME=jellyfin
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Jellyfin user configuration overrides
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
case "$1" in
remove|upgrade|deconfigure)
echo "Stopping Jellyfin!"
echo "Stopping Emby Server!"
# try graceful termination;
if [[ -d /run/systemd/system ]]; then
deb-systemd-invoke stop ${NAME}.service > /dev/null 2>&1 || true
@ -28,27 +28,27 @@ case "$1" in
invoke-rc.d ${NAME} stop > /dev/null 2>&1 || true
fi
# Ensure that it is shutdown
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "jellyfin*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && JELLYFIN_PID=$(cat ${PIDFILE})
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
# if its running, let's stop it
if [[ -n "$JELLYFIN_PID" ]]; then
# if jellyfin is still running, kill it
if [[ -n "$(ps -p $JELLYFIN_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $JELLYFIN_PID)
if [[ -n "$EMBY_PID" ]]; then
# if emby is still running, kill it
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $EMBY_PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
fi
sleep 1
# if it's still running, show error
if [[ -n "$(ps -p $JELLYFIN_PID -o pid=)" ]]; then
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
echo "Could not successfully stop EmbyServer, please do so before uninstalling."
exit 1
else
[[ -f $PIDFILE ]] && rm $PIDFILE
fi
fi
if [[ -f /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe.so ]]; then
rm /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe.so
if [[ -f /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe.so ]]; then
rm /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe.so
fi
;;
failed-upgrade)

2
debian/restart.sh vendored
View File

@ -1,6 +1,6 @@
#!/bin/bash
NAME=jellyfin
NAME=emby-server
restart_cmds=("s6-svc -t /var/run/s6/services/${NAME}" \
"systemctl restart ${NAME}" \

10
debian/rules vendored
View File

@ -14,11 +14,9 @@ override_dh_auto_test:
override_dh_clistrip:
override_dh_auto_build:
git submodule init
git submodule update
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 build --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/emby-server/bin'
dotnet publish --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/emby-server/bin'
override_dh_auto_clean:
dotnet clean --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln || true
rm -rf '$(CURDIR)/usr/lib/jellyfin'
dotnet clean --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln
rm -rf '$(CURDIR)/usr/lib/emby-server'

View File

@ -1,3 +1,3 @@
# This is an override for the following lintian errors:
jellyfin source: license-problem-md5sum-non-free-file Emby.Drawing/ImageMagick/fonts/webdings.ttf*
jellyfin source: source-is-missing
emby-server source: license-problem-md5sum-non-free-file Emby.Drawing/ImageMagick/fonts/webdings.ttf*
emby-server source: source-is-missing