Rename numerous debian control elements

Replace the name emby/emby-server with jellyfin everywhere.
pull/1154/head
Joshua Boniface 6 years ago
parent 20c2dcf834
commit 8fcec19936

@ -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=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

@ -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=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

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

@ -1,4 +1,4 @@
Source: emby-server
Source: jellyfin
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: 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
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
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

@ -1,12 +1,13 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: emby
Source: https://raw.githubusercontent.com/MediaBrowser/MediaBrowser/master/LICENSE.md
Upstream-Name: jellyfin
Source: https://github.com/jellyfin/jellyfin
Files: *
Copyright: 2015 Luke Pulverenti <luke.pulverenti@gmail.com>
Copyright: 2018 JellyFin Team
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

@ -1,37 +0,0 @@
#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

@ -1,24 +0,0 @@
# 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

@ -1,37 +0,0 @@
# 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"

10
debian/install vendored

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

@ -0,0 +1,37 @@
#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

@ -0,0 +1,24 @@
# 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

@ -0,0 +1,37 @@
# 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"

@ -1,6 +1,6 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: emby-server
# Provides: jellyfin
# Required-Start: $remote_fs $local_fs $network
# Required-Stop: $remote_fs $local_fs $network
# Default-Start: 2 3 4 5
@ -19,23 +19,23 @@
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
NAME=emby-server
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
# Source Jellyfin default configuration
. $DEFAULT_FILE
# Source Emby server user configuration overrides
# Source Jellyfin 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}
# Path of jellyfin binary
JELLYFINSERVER=/usr/bin/jellyfin
PIDFILE=${JELLYFIN_PIDFILE-/var/run/jellyfin.pid}
case "$1" in
start)
@ -45,7 +45,7 @@ case "$1" in
log_end_msg 0
exit 0
fi
exec $EMBYSERVER start &
exec $JELLYFINSERVER start &
sleep 2
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
log_end_msg 0
@ -74,7 +74,7 @@ case "$1" in
fi
;;
status)
status_of_proc -p $PIDFILE "$EMBYSERVER" "$NAME"
status_of_proc -p $PIDFILE "$JELLYFINSERVER" "$NAME"
exit $? # notreached due to set -e
;;
restart|force-reload)
@ -82,7 +82,7 @@ case "$1" in
$0 start || exit $?
;;
*)
echo "Usage: /etc/init.d/emby-server {start|stop|status|restart|force-reload}" >&2
echo "Usage: /etc/init.d/jellyfin {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

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

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

48
debian/postinst vendored

@ -1,45 +1,45 @@
#!/bin/bash
set -e
NAME=emby-server
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
# Source Jellyfin user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
case "$1" in
configure)
# create emby group if it does not exist
if [[ -z "$(getent group emby)" ]]; then
addgroup --quiet --system emby > /dev/null 2>&1
# create jellyfin group if it does not exist
if [[ -z "$(getent group jellyfin)" ]]; then
addgroup --quiet --system jellyfin > /dev/null 2>&1
fi
# 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
# 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
fi
# ensure $PROGRAMDATA has appropriate permissions
if [[ ! -d $PROGRAMDATA ]]; then
mkdir $PROGRAMDATA
chown -R emby:emby $PROGRAMDATA
chown -R jellyfin:jellyfin $PROGRAMDATA
fi
# ensure emby-server binary has appropriate permissions
chmod 755 /usr/bin/emby-server
# ensure jellyfin binary has appropriate permissions
chmod 755 /usr/bin/jellyfin
/usr/bin/mono --aot=full -O=all $EMBY_BIN > /dev/null 2>&1 || true
/usr/bin/mono --aot=full -O=all $JELLYFIN_BIN > /dev/null 2>&1 || true
chmod +x ${EMBY_DIR}/restart.sh > /dev/null 2>&1 || true
chmod +x ${JELLYFIN_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 emby-server.service >/dev/null || true
deb-systemd-helper unmask jellyfin.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled emby-server.service; then
if deb-systemd-helper --quiet was-enabled jellyfin.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable emby-server.service >/dev/null || true
deb-systemd-helper enable jellyfin.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 emby-server.service >/dev/null || true
deb-systemd-helper update-state jellyfin.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 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 $?
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 $?
fi
fi
exit 0

28
debian/postrm vendored

@ -1,22 +1,22 @@
#!/bin/bash
set -e
NAME=emby-server
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
# Source Jellyfin user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
PROGRAMDATA=${JELLYFIN_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/emby-server" ]] || [[ -e "/etc/init/emby-server.connf" ]]; then
update-rc.d emby-server remove >/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
fi
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper purge emby-server.service >/dev/null
deb-systemd-helper unmask emby-server.service >/dev/null
deb-systemd-helper purge jellyfin.service >/dev/null
deb-systemd-helper unmask jellyfin.service >/dev/null
fi
userdel emby > /dev/null 2>&1 || true
delgroup --quiet emby > /dev/null 2>&1 || true
userdel jellyfin > /dev/null 2>&1 || true
delgroup --quiet jellyfin > /dev/null 2>&1 || true
if [[ -d $PROGRAMDATA ]]; then
rm -rf $PROGRAMDATA
fi
[[ -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
[[ -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
;;
remove)
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper mask emby-server.service >/dev/null
deb-systemd-helper mask jellyfin.service >/dev/null
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

26
debian/preinst vendored

@ -1,22 +1,22 @@
#!/bin/bash
set -e
NAME=emby-server
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
# Source Jellyfin user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
PROGRAMDATA=${JELLYFIN_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 emby is running
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
# 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})
# if its running, let's stop it
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)
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)
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 $EMBY_PID -o pid=)" ]]; then
if [[ -n "$(ps -p $JELLYFIN_PID -o pid=)" ]]; then
echo "Could not successfully stop EmbyServer, please do so before uninstalling."
exit 1
else

28
debian/prerm vendored

@ -1,26 +1,26 @@
#!/bin/bash
set -e
NAME=emby-server
NAME=jellyfin
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
# Source Jellyfin user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
case "$1" in
remove|upgrade|deconfigure)
echo "Stopping Emby Server!"
echo "Stopping Jellyfin!"
# 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 "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "jellyfin*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && JELLYFIN_PID=$(cat ${PIDFILE})
# if its running, let's stop it
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)
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)
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 $EMBY_PID -o pid=)" ]]; then
if [[ -n "$(ps -p $JELLYFIN_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/emby-server/bin/MediaBrowser.Server.Mono.exe.so ]]; then
rm /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe.so
if [[ -f /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe.so ]]; then
rm /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe.so
fi
;;
failed-upgrade)

2
debian/restart.sh vendored

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

10
debian/rules vendored

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

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

Loading…
Cancel
Save