diff --git a/debian/bin/jellyfin b/debian/bin/jellyfin deleted file mode 100644 index 7083e017a0..0000000000 --- a/debian/bin/jellyfin +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# vim:set ft=sh sw=2 sts=2 st=2 et: -# Author: HurricaneHernandez -# Modified for CentOS/Fedora by: FC7 - -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 Jellyfin." - fi - fi -fi - -# Data directory where Jellyfin database, cache and logs are stored -PROGRAMDATA=$JELLYFIN_DATA -PROGRAMDATA_OPT="-programdata $PROGRAMDATA" - -# Path to store PID file -PIDFILE=$JELLYFIN_PIDFILE - -# Full path of Jellyfin 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" - -# Jellyfin 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 diff --git a/debian/install b/debian/install index c7f77b79c4..ad5c511552 100644 --- a/debian/install +++ b/debian/install @@ -1,5 +1,4 @@ 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