Merge branch 'dev' into reformat

# Conflicts:
#	Emby.Server.Implementations/ApplicationHost.cs
#	Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
#	Emby.Server.Implementations/LiveTv/LiveTvManager.cs
#	Emby.Server.Implementations/Security/MBLicenseFile.cs
#	Emby.Server.Implementations/Security/PluginSecurityManager.cs
#	Emby.Server.Implementations/Security/RegRecord.cs
#	MediaBrowser.Api/PluginService.cs
#	MediaBrowser.Api/System/SystemService.cs
#	MediaBrowser.Common/Security/IRequiresRegistration.cs
#	MediaBrowser.Common/Security/ISecurityManager.cs
#	MediaBrowser.Common/Security/PaymentRequiredException.cs
#	MediaBrowser.Model/Entities/MBRegistrationRecord.cs
#	MediaBrowser.Model/Entities/PluginSecurityInfo.cs
#	deployment/win-generic/build-jellyfin.ps1
This commit is contained in:
Erwin de Haan
2019-01-15 17:34:39 +01:00
95 changed files with 1137 additions and 892 deletions

8
deployment/README.md Normal file
View File

@@ -0,0 +1,8 @@
# Build scripts
All `build.sh` and `package.sh` scripts are for *nix platforms (or WSL on Windows 10).
After running both, check the `*/pkg-dist/` folders for the archives and packages.
`build_all.sh` will invoke every build and package script.
Use `collect_all.sh` to copy all artifact to one directory for easy uploading.

21
deployment/clean.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
# Execute every clean.sh scripts in every folder.
echo "Running for platforms '$@'."
for directory in */ ; do
platform=`basename "${directory}"`
if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then
echo "Processing ${platform}"
pushd "$platform"
if [ -f clean.sh ]; then
echo ./clean.sh
fi
popd
else
echo "Skipping $platform."
fi
done
rm -rf ./collect-dist

20
deployment/collect_all.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
source common.build.sh
VERSION=`get_version ..`
COLLECT_DIR="./collect-dist"
mkdir -p ./collect-dist
DIRS=`find . -type d -name "pkg-dist"`
while read directory
do
echo "Collecting everything from '$directory'.."
PLATFORM=$(basename "$(dirname "$directory")")
# Copy all artifacts with extensions tar.gz, deb, exe, zip, rpm and add the platform name to resolve any duplicates.
find $directory \( -name "jellyfin*.tar.gz" -o -name "jellyfin*.deb" -o -name "jellyfin*.rpm" -o -name "jellyfin*.zip" -o -name "jellyfin*.exe" \) -exec sh -c 'cp "$1" "'${COLLECT_DIR}'/jellyfin_'${PLATFORM}'_${1#*jellyfin}"' _ {} \;
done <<< "${DIRS}"

108
deployment/common.build.sh Executable file
View File

@@ -0,0 +1,108 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
DEFAULT_BUILD_CONTEXT="../.."
DEFAULT_ROOT="."
DEFAULT_DOTNETRUNTIME="framework"
DEFAULT_CONFIG="Release"
DEFAULT_OUTPUT_DIR="dist/jellyfin-git"
DEFAULT_PKG_DIR="pkg-dist"
DEFAULT_DOCKERFILE="Dockerfile"
DEFAULT_IMAGE_TAG="jellyfin:"`git rev-parse --abbrev-ref HEAD`
# Run a build
build_jellyfin()
(
ROOT=${1-$DEFAULT_ROOT}
CONFIG=${2-$DEFAULT_CONFIG}
DOTNETRUNTIME=${3-$DEFAULT_DOTNETRUNTIME}
OUTPUT_DIR=${4-$DEFAULT_OUTPUT_DIR}
echo -e "${CYAN}Building jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}"
if [[ $DOTNETRUNTIME == 'framework' ]]; then
dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}"
else
dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}" --self-contained --runtime ${DOTNETRUNTIME}
fi
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}[DONE] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}"
else
echo -e "${RED}[FAIL] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' FAILED.${NC}"
fi
)
# Run a docker
build_jellyfin_docker()
(
BUILD_CONTEXT=${1-$DEFAULT_BUILD_CONTEXT}
DOCKERFILE=${2-$DEFAULT_DOCKERFILE}
IMAGE_TAG=${3-$DEFAULT_IMAGE_TAG}
echo -e "${CYAN}Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}'.${NC}"
docker build -t ${IMAGE_TAG} -f ${DOCKERFILE} ${BUILD_CONTEXT}
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}[DONE] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' complete.${NC}"
else
echo -e "${RED}[FAIL] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' FAILED.${NC}"
fi
)
# Clean a build
clean_jellyfin()
(
local ROOT=${1-$DEFAULT_ROOT}
local CONFIG=${2-$DEFAULT_CONFIG}
local OUTPUT_DIR=${3-$DEFAULT_OUTPUT_DIR}
local PKG_DIR=${4-$DEFAULT_PKG_DIR}
echo -e "${CYAN}Cleaning jellyfin in '${ROOT}'' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}"
echo -e "${CYAN}Deleting '${OUTPUT_DIR}'${NC}"
rm -rf "$OUTPUT_DIR"
echo -e "${CYAN}Deleting '${PKG_DIR}'${NC}"
rm -rf "$PKG_DIR"
dotnet clean "${ROOT}" -maxcpucount:1 --configuration ${CONFIG}
local EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}[DONE] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}"
else
echo -e "${RED}[FAIL] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' failed.${NC}"
fi
)
# Parse the version from the AssemblyVersion
get_version()
(
local ROOT=${1-$DEFAULT_ROOT}
grep "AssemblyVersion" ${ROOT}/SharedVersion.cs | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' | sed -E 's/.0$//'
)
# Packages the output folder into an archive.
package_portable()
(
local ROOT=${1-$DEFAULT_ROOT}
local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR}
local PKG_DIR=${3-$DEFAULT_PKG_DIR}
# Package portable build result
if [ -d ${OUTPUT_DIR} ]; then
echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}"
mkdir -p ${PKG_DIR}
tar -zcvf "${PKG_DIR}/`basename "${OUTPUT_DIR}"`.portable.tar.gz" -C "`dirname "${OUTPUT_DIR}"`" "`basename "${OUTPUT_DIR}"`"
local EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}[DONE] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' complete.${NC}"
else
echo -e "${RED}[FAIL] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' FAILED.${NC}"
fi
else
echo -e "${RED}[FAIL] Build artifacts do not exist for ${OUTPUT_DIR}. Run build.sh first.${NC}"
fi
)

View File

@@ -0,0 +1,23 @@
FROM debian:9
ARG SOURCEDIR=/repo
ENV DEB_BUILD_OPTIONS=noddebs
# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
RUN apt-get update \
&& apt-get install -y apt-transport-https debhelper gnupg wget devscripts \
&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \
&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
&& chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
&& apt-get update
WORKDIR ${SOURCEDIR}
COPY . .
COPY ./deployment/debian-package-x64/pkg-src ./debian
RUN yes | mk-build-deps -i debian/control \
&& dpkg-buildpackage -us -uc
WORKDIR /

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
# Build a Jellyfin .deb file with Docker on Linux
# Places the output .deb file in the parent directory
package_temporary_dir="`pwd`/pkg-dist-tmp"
output_dir="`pwd`/pkg-dist"
current_user="`whoami`"
image_name="jellyfin-debuild"
cleanup() {
set +o errexit
docker image rm $image_name --force
rm -rf "$package_temporary_dir"
}
trap cleanup EXIT INT
docker build ../.. -t "$image_name" -f ./Dockerfile --build-arg SOURCEDIR="/jellyfin-${VERSION}"
mkdir -p "$package_temporary_dir"
mkdir -p "$output_dir"
docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find / -maxdepth 1 -type f -name "jellyfin*" -exec mv {} /temp \;'
chown -R "$current_user" "$package_temporary_dir" \
|| sudo chown -R "$current_user" "$package_temporary_dir"
mv "$package_temporary_dir"/* "$output_dir"

View File

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

View File

@@ -0,0 +1,18 @@
#!/bin/bash
NAME=jellyfin
restart_cmds=("s6-svc -t /var/run/s6/services/${NAME}" \
"systemctl restart ${NAME}" \
"service ${NAME} restart" \
"/etc/init.d/${NAME} restart")
for restart_cmd in "${restart_cmds[@]}"; do
cmd=$(echo "$restart_cmd" | awk '{print $1}')
cmd_loc=$(command -v ${cmd})
if [[ -n "$cmd_loc" ]]; then
restart_cmd=$(echo "$restart_cmd" | sed -e "s%${cmd}%${cmd_loc}%")
echo "sleep 2; sudo $restart_cmd > /dev/null 2>&1" | at now > /dev/null 2>&1
exit 0
fi
done

View File

@@ -0,0 +1,59 @@
jellyfin (10.0.1-1) unstable; urgency=medium
* Hotfix release, corrects several small bugs from 10.0.0
* #512: Fix CONTRIBUTORS.md formatting
* #501: Fix regression in integer divisions in latest movies category
* #498: Change contributing link in settings to readthedocs.io
* #493: Remove unused values.txt resource
* #491: Fix userprofile.js crash
* #519: Fix the DecodeJfif function to get proper image sizes
* #486: Add NuGet package info to plugin projects
-- Joshua Boniface <joshua@boniface.me> Tue, 08 Jan 2019 20:06:01 -0500
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
* Several code cleanups and tweaks
-- Joshua Boniface <joshua@boniface.me> Fri, 28 Dec 2018 10:26:30 -0500
jellyfin (3.5.2-4) unstable; urgency=medium
* Correct manifest.json bug and vdpau
-- Joshua Boniface <joshua@boniface.me> Thu, 20 Dec 2018 18:31:43 -0500
jellyfin (3.5.2-3) unstable; urgency=medium
* Correct several bugs in 3.5.2-2 packaging
-- Joshua Boniface <joshua@boniface.me> Sat, 15 Dec 2018 18:17:32 -0500
jellyfin (3.5.2-2) unstable; urgency=medium
* Major code updates related to rebranding and cleanup
-- Joshua Boniface <joshua@boniface.me> Fri, 14 Dec 2018 00:07:46 -0500
jellyfin (3.5.2-1) unstable; urgency=medium
* Add ffmpeg dependency and cleanup work
-- Joshua Boniface <joshua@boniface.me> Tue, 11 Dec 2018 20:55:32 -0500
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

View File

@@ -0,0 +1 @@
8

View File

@@ -0,0 +1,34 @@
# Jellyfin default configuration options
# 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
#
#
# General options
#
# 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
JELLYFIN_ADD_OPTS=""
#
# SysV init/Upstart options
#
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
JELLYFIN_ARGS="-programdata $JELLYFIN_DATA_DIRECTORY -configdir $JELLYFIN_CONFIG_DIRECTORY -logdir $JELLYFIN_LOG_DIRECTORY -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"

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

View File

@@ -0,0 +1,30 @@
{
"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}"
}
}
]
}
}
]
}
}

View File

@@ -0,0 +1,23 @@
Source: jellyfin
Section: misc
Priority: optional
Maintainer: Jellyfin Team <team@jellyfin.org>
Build-Depends: debhelper (>= 9),
dotnet-sdk-2.2,
libc6-dev,
libcurl4-openssl-dev,
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
Breaks: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
Conflicts: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
Architecture: any
Depends: at, libsqlite3-0, ffmpeg, libfontconfig1, libfreetype6, libssl1.0.0 | libssl1.0.2
Description: Jellyfin is a home media server.
It is built on top of other popular open source technologies such as Service Stack, jQuery, jQuery mobile, and Mono. It features a REST-based api with built-in documentation to facilitate client development. We also have client libraries for our api to enable rapid development.

View File

@@ -0,0 +1,29 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: jellyfin
Source: https://github.com/jellyfin/jellyfin
Files: *
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+
License: GPL-2.0+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

View File

@@ -0,0 +1,6 @@
[DEFAULT]
pristine-tar = False
cleaner = fakeroot debian/rules clean
[import-orig]
filter = [ ".git*", ".hg*", ".vs*", ".vscode*" ]

View File

@@ -0,0 +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/

View File

@@ -0,0 +1,49 @@
### BEGIN INIT INFO
# Provides: Jellyfin Media Server
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jellyfin Media Server
# Description: Runs Jellyfin Server
### END INIT INFO
# Carry out specific functions when asked to by the system
pidfile="/var/run/jellyfin.pid"
pid=`cat $pidfile`
case "$1" in
start)
if [ "$pid" == "" ]; then
echo "Starting Jellyfin..."
. /etc/default/jellyfin
nohup su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
echo ?? > $pidfile
else
echo "Jellyfin already running"
fi
;;
stop)
if [ "$pid" != "" ]; then
echo "Stopping Jellyfin..."
kill $pid
sleep 2
rm -f $pidfile
else
echo "Jellyfin not running"
fi
;;
status)
if [ "$pid" != "" ]; then
echo "Jellyfin running as $pid"
ps -f $pid
else
echo "Jellyfin is not running"
fi
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@@ -0,0 +1,14 @@
[Unit]
Description = Jellyfin Media Server
After = network.target
[Service]
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
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
[Install]
WantedBy = multi-user.target

View File

@@ -0,0 +1,20 @@
description "jellyfin daemon"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
console log
respawn
respawn limit 10 5
kill timeout 20
script
set -x
echo "Starting $UPSTART_JOB"
# Log file
logger -t "$0" "DEBUG: `set`"
. /etc/default/jellyfin
exec su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
end script

View File

@@ -0,0 +1 @@
[type: gettext/rfc822deb] templates

View File

@@ -0,0 +1,57 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: jellyfin-server\n"
"Report-Msgid-Bugs-To: jellyfin-server@packages.debian.org\n"
"POT-Creation-Date: 2015-06-12 20:51-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: note
#. Description
#: ../templates:1001
msgid "Jellyfin permission info:"
msgstr ""
#. Type: note
#. Description
#: ../templates:1001
msgid ""
"Jellyfin by default runs under a user named \"jellyfin\". Please ensure that the "
"user jellyfin has read and write access to any folders you wish to add to your "
"library. Otherwise please run jellyfin under a different user."
msgstr ""
#. Type: string
#. Description
#: ../templates:2001
msgid "Username to run Jellyfin as:"
msgstr ""
#. Type: string
#. Description
#: ../templates:2001
msgid "The user that jellyfin will run as."
msgstr ""
#. Type: note
#. Description
#: ../templates:3001
msgid "Jellyfin still running"
msgstr ""
#. Type: note
#. Description
#: ../templates:3001
msgid "Jellyfin is currently running. Please close it and try again."
msgstr ""

View File

@@ -0,0 +1,87 @@
#!/bin/bash
set -e
NAME=jellyfin
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# 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)
# create jellyfin group if it does not exist
if [[ -z "$(getent group jellyfin)" ]]; then
addgroup --quiet --system jellyfin > /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
fi
# ensure $PROGRAMDATA exists
if [[ ! -d $PROGRAMDATA ]]; then
mkdir $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 /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
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
# Manual init script handling
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 jellyfin.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
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
fi
fi
# End automatically added section
# Automatically added by dh_installinit
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 $?
fi
fi
exit 0

View File

@@ -0,0 +1,75 @@
#!/bin/bash
set -e
NAME=jellyfin
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# 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.
if [[ -d /run/systemd/system ]] ; then
systemctl --system daemon-reload >/dev/null || true
fi
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
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
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
# 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
deb-systemd-helper mask jellyfin.service >/dev/null
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View File

@@ -0,0 +1,74 @@
#!/bin/bash
set -e
NAME=jellyfin
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# 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.
if [[ -d /run/systemd/system ]] ; then
systemctl --system daemon-reload >/dev/null || true
fi
case "$1" in
install|upgrade)
# try graceful termination;
if [[ -d /run/systemd/system ]]; then
deb-systemd-invoke stop ${NAME}.service > /dev/null 2>&1 || true
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})
# 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)
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
echo "Could not successfully stop JellyfinServer, please do so before uninstalling."
exit 1
else
[[ -f $PIDFILE ]] && rm $PIDFILE
fi
fi
# 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)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View File

@@ -0,0 +1,60 @@
#!/bin/bash
set -e
NAME=jellyfin
DEFAULT_FILE=/etc/default/${NAME}
# Source Jellyfin default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# 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)
echo "Stopping Jellyfin!"
# try graceful termination;
if [[ -d /run/systemd/system ]]; then
deb-systemd-invoke stop ${NAME}.service > /dev/null 2>&1 || true
elif [ -x "/etc/init.d/${NAME}" ] || [ -e "/etc/init/${NAME}.conf" ]; then
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})
# 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)
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
echo "Could not successfully stop Jellyfin, 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
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View File

@@ -0,0 +1,23 @@
#! /usr/bin/make -f
CONFIG := Release
TERM := xterm
SHELL := /bin/bash
DOTNETRUNTIME := debian-x64
export DH_VERBOSE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
%:
dh $@
# disable "make check"
override_dh_auto_test:
# disable stripping debugging symbols
override_dh_clistrip:
override_dh_auto_build:
dotnet publish --configuration $(CONFIG) --output='$(CURDIR)/usr/lib/jellyfin/bin' --self-contained --runtime $(DOTNETRUNTIME) Jellyfin.Server
override_dh_auto_clean:
dotnet clean -maxcpucount:1 --configuration $(CONFIG) Jellyfin.Server || true
rm -rf '$(CURDIR)/usr'

View File

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

View File

@@ -0,0 +1 @@
1.0

View File

@@ -0,0 +1,11 @@
tar-ignore='.git*'
tar-ignore='**/.git'
tar-ignore='**/.hg'
tar-ignore='**/.vs'
tar-ignore='**/.vscode'
tar-ignore='deployment'
tar-ignore='**/bin'
tar-ignore='**/obj'
tar-ignore='**/.nuget'
tar-ignore='*.deb'
tar-ignore='ThirdParty'

7
deployment/debian-x64/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release debian-x64 `pwd`/dist/jellyfin_${VERSION}

7
deployment/debian-x64/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}

12
deployment/docker/build.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin_docker ../.. ../../Dockerfile jellyfin:amd64-${VERSION}
build_jellyfin_docker ../.. ../../Dockerfile.arm jellyfin:arm-${VERSION}
#build_jellyfin_docker ../.. ../../Dockerfile.arm64v8 jellyfin:arm64v8-${VERSION}
#build_jellyfin_docker ../.. ../../Dockerfile.arm32v7 jellyfin:arm32v7-${VERSION}

12
deployment/docker/package.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
docker manifest create jellyfin:${VERSION} jellyfin:amd64-${VERSION} jellyfin:arm32v7-${VERSION} jellyfin:arm64v8-${VERSION}
docker manifest annotate jellyfin:amd64-${VERSION} --os linux --arch amd64
#docker manifest annotate jellyfin:arm32v7-${VERSION} --os linux --arch arm --variant armv7
#docker manifest annotate jellyfin:arm64v8-${VERSION} --os linux --arch arm64 --variant armv8
#TODO publish.sh - docker manifest push jellyfin:${VERSION}

View File

@@ -0,0 +1,15 @@
FROM fedora:29
ARG HOME=/build
RUN mkdir /build && \
dnf install -y @buildsys-build rpmdevtools dnf-plugins-core && \
dnf copr enable -y @dotnet-sig/dotnet && \
rpmdev-setuptree
WORKDIR /build/rpmbuild
COPY ./deployment/fedora-package-x64/pkg-src/jellyfin.spec SPECS
COPY ./deployment/fedora-package-x64/pkg-src/ SOURCES
RUN spectool -g -R SPECS/jellyfin.spec && \
rpmbuild -bs SPECS/jellyfin.spec && \
dnf build-dep -y SRPMS/jellyfin-*.src.rpm && \
rpmbuild -bb SPECS/jellyfin.spec;

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env sh
source ../common.build.sh
VERSION=`get_version ../..`
# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
# Build a Jellyfin .rpm file with Docker on Linux
# Places the output .rpm file in the parent directory
set -o errexit
set -o xtrace
set -o nounset
package_temporary_dir="`pwd`/pkg-dist-tmp"
output_dir="`pwd`/pkg-dist"
pkg_src_dir="`pwd`/pkg-src"
current_user="`whoami`"
image_name="jellyfin-rpmbuild"
cleanup() {
set +o errexit
docker image rm $image_name --force
rm -rf "$package_temporary_dir"
rm -rf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz"
}
trap cleanup EXIT INT
GNU_TAR=1
mkdir -p "$package_temporary_dir"
echo "Bundling all sources for RPM build."
tar \
--transform "s,^\.,jellyfin-${VERSION}" \
--exclude='.git*' \
--exclude='**/.git' \
--exclude='**/.hg' \
--exclude='**/.vs' \
--exclude='**/.vscode' \
--exclude='deployment' \
--exclude='**/bin' \
--exclude='**/obj' \
--exclude='**/.nuget' \
--exclude='*.deb' \
--exclude='*.rpm' \
-Jcvf \
"$package_temporary_dir/jellyfin-${VERSION}.tar.xz" \
-C "../.." \
./ || true && GNU_TAR=0
if [ $GNU_TAR -eq 0 ]; then
echo "The installed tar binary did not support --transform. Using workaround."
mkdir -p "$package_temporary_dir/jellyfin-${VERSION}"
# Not GNU tar
tar \
--exclude='.git*' \
--exclude='**/.git' \
--exclude='**/.hg' \
--exclude='**/.vs' \
--exclude='**/.vscode' \
--exclude='deployment' \
--exclude='**/bin' \
--exclude='**/obj' \
--exclude='**/.nuget' \
--exclude='*.deb' \
--exclude='*.rpm' \
-zcf \
"$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" \
-C "../.." \
./
echo "Extracting filtered package."
tar -xzf "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" -C "$package_temporary_dir/jellyfin-${VERSION}"
echo "Removing filtered package."
rm "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz"
echo "Repackaging package into final tarball."
tar -zcf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" -C "$package_temporary_dir" "jellyfin-${VERSION}"
fi
docker build ../.. -t "$image_name" -f ./Dockerfile
mkdir -p "$output_dir"
docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find /build/rpmbuild -maxdepth 3 -type f -name "jellyfin*.rpm" -exec mv {} /temp \;'
chown -R "$current_user" "$package_temporary_dir" \
|| sudo chown -R "$current_user" "$package_temporary_dir"
mv "$package_temporary_dir"/*.rpm "$output_dir"

View File

@@ -0,0 +1,3 @@
*.rpm
*.zip
*.tar.gz

View File

@@ -0,0 +1,43 @@
# Jellyfin RPM
## Build Fedora Package with docker
Change into this directory `cd rpm-package`
Run the build script `./build-fedora-rpm.sh`.
Resulting RPM and src.rpm will be in `../../jellyfin-*.rpm`
## ffmpeg
The RPM package for Fedora/CentOS requires some additional repositories as ffmpeg is not in the main repositories.
```shell
# ffmpeg from RPMfusion free
# Fedora
$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
# CentOS 7
$ sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
```
## ISO mounting
To allow Jellyfin to mount/umount ISO files uncomment these two lines in `/etc/sudoers.d/jellyfin-sudoers`
```
# %jellyfin ALL=(ALL) NOPASSWD: /bin/mount
# %jellyfin ALL=(ALL) NOPASSWD: /bin/umount
```
## Building with dotnet
Jellyfin is build with `--self-contained` so no dotnet required for runtime.
```shell
# dotnet required for building the RPM
# Fedora
$ sudo dnf copr enable @dotnet-sig/dotnet
# CentOS
$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
```
## TODO
- [ ] OpenSUSE

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Jellyfin</short>
<description>The Free Software Media System.</description>
<port protocol="tcp" port="8096"/>
<port protocol="tcp" port="8920"/>
<port protocol="udp" port="1900"/>
<port protocol="udp" port="7359"/>
</service>

View File

@@ -0,0 +1,27 @@
# Jellyfin default configuration options
# Use this file to override the default configurations; add additional
# options with JELLYFIN_ADD_OPTS.
# To override the user or this config file's location, use
# /etc/systemd/system/jellyfin.service.d/override.conf
#
# This is a POSIX shell fragment
#
#
# General options
#
# Tell jellyfin wich ffmpeg/ffprobe to use
# JELLYFIN_FFMPEG="-ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe"
# Program directories
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
# In-App service control
JELLYFIN_RESTART_OPT="-restartpath /usr/libexec/jellyfin/restart.sh"
# Additional options for the binary
JELLYFIN_ADD_OPTS=""

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/sysconfig/jellyfin

View File

@@ -0,0 +1,15 @@
[Unit]
After=network.target
Description=Jellyfin is a free software media system that puts you in control of managing and streaming your media.
[Service]
EnvironmentFile=/etc/sysconfig/jellyfin
WorkingDirectory=/var/lib/jellyfin
ExecStart=/usr/bin/jellyfin -programdata ${JELLYFIN_DATA_DIRECTORY} -configdir ${JELLYFIN_CONFIG_DIRECTORY} -logdir ${JELLYFIN_LOG_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
TimeoutSec=15
Restart=on-failure
User=jellyfin
Group=jellyfin
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,139 @@
%global debug_package %{nil}
# jellyfin tag to package
%global gittag v10.0.1
# Taglib-sharp commit of the submodule since github archive doesn't include submodules
%global taglib_commit ee5ab21742b71fd1b87ee24895582327e9e04776
%global taglib_shortcommit %(c=%{taglib_commit}; echo ${c:0:7})
AutoReq: no
Name: jellyfin
Version: 10.0.1
Release: 1%{?dist}
Summary: The Free Software Media Browser
License: GPLv2
URL: https://jellyfin.media
Source0: %{name}-%{version}.tar.gz
Source1: jellyfin.service
Source2: jellyfin.env
Source3: jellyfin.sudoers
Source4: restart.sh
Source5: jellyfin.override.conf
Source6: jellyfin-firewalld.xml
%{?systemd_requires}
BuildRequires: systemd
Requires(pre): shadow-utils
BuildRequires: libcurl-devel, fontconfig-devel, freetype-devel, openssl-devel, glibc-devel, libicu-devel
Requires: libcurl, fontconfig, freetype, openssl, glibc libicu
# Requirements not packaged in main repos
# COPR @dotnet-sig/dotnet
BuildRequires: dotnet-sdk-2.2
# RPMfusion free
Requires: ffmpeg
# For the update-db-paths.sh script to fix emby paths to jellyfin
%{?fedora:Recommends: sqlite}
# Fedora has openssl1.1 which is incompatible with dotnet
%{?fedora:Requires: compat-openssl10}
# Disable Automatic Dependency Processing for Centos
%{?el7:AutoReqProv: no}
%description
Jellyfin is a free software media system that puts you in control of managing and streaming your media.
%prep
%autosetup -n %{name}-%{version}
%build
%install
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime fedora-x64 Jellyfin.Server
%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
%{__install} -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
%{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/%{name}/logging.json
%{__mkdir} -p %{buildroot}%{_bindir}
tee %{buildroot}%{_bindir}/jellyfin << EOF
#!/bin/sh
exec %{_libdir}/%{name}/%{name} \${@}
EOF
%{__mkdir} -p %{buildroot}%{_sharedstatedir}/jellyfin
%{__mkdir} -p %{buildroot}%{_sysconfdir}/%{name}
%{__mkdir} -p %{buildroot}%{_var}/log/jellyfin
%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%{__install} -D -m 0600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/%{name}-sudoers
%{__install} -D -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{name}/restart.sh
%{__install} -D -m 0644 %{SOURCE6} %{buildroot}%{_prefix}/lib/firewalld/service/%{name}.xml
%files
%{_libdir}/%{name}/jellyfin-web/*
%attr(755,root,root) %{_bindir}/%{name}
%{_libdir}/%{name}/*.json
%{_libdir}/%{name}/*.pdb
%{_libdir}/%{name}/*.dll
%{_libdir}/%{name}/*.so
%{_libdir}/%{name}/*.a
%{_libdir}/%{name}/createdump
# Needs 755 else only root can run it since binary build by dotnet is 722
%attr(755,root,root) %{_libdir}/%{name}/jellyfin
%{_libdir}/%{name}/sosdocsunix.txt
%{_unitdir}/%{name}.service
%{_libexecdir}/%{name}/restart.sh
%{_prefix}/lib/firewalld/service/%{name}.xml
%attr(755,jellyfin,jellyfin) %dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/sudoers.d/%{name}-sudoers
%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
%config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/%{name}/logging.json
%attr(-,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
%attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin
%if 0%{?fedora}
%license LICENSE
%else
%{_datadir}/licenses/%{name}/LICENSE
%endif
%pre
getent group jellyfin >/dev/null || groupadd -r jellyfin
getent passwd jellyfin >/dev/null || \
useradd -r -g jellyfin -d %{_sharedstatedir}/jellyfin -s /sbin/nologin \
-c "Jellyfin default user" jellyfin
exit 0
%post
# Move existing configuration to /etc/jellyfin and symlink config to /etc/jellyfin
if [ $1 -gt 1 ] ; then
service_state=$(systemctl is-active jellyfin.service)
if [ "${service_state}" = "active" ]; then
systemctl stop jellyfin.service
fi
if [ ! -L %{_sharedstatedir}/%{name}/config ]; then
mv %{_sharedstatedir}/%{name}/config/* %{_sysconfdir}/%{name}/
rmdir %{_sharedstatedir}/%{name}/config
ln -sf %{_sysconfdir}/%{name} %{_sharedstatedir}/%{name}/config
fi
if [ ! -L %{_sharedstatedir}/%{name}/logs ]; then
mv %{_sharedstatedir}/%{name}/logs/* %{_var}/log/jellyfin
rmdir %{_sharedstatedir}/%{name}/logs
ln -sf %{_var}/log/jellyfin %{_sharedstatedir}/%{name}/logs
fi
if [ "${service_state}" = "active" ]; then
systemctl start jellyfin.service
fi
fi
%systemd_post jellyfin.service
%preun
%systemd_preun jellyfin.service
%postun
%systemd_postun_with_restart jellyfin.service
%changelog
* Fri Jan 11 2019 Thomas Büttner <thomas@vergesslicher.tech> - 10.0.2-1
- TODO Changelog for 10.0.2

View File

@@ -0,0 +1,19 @@
# Allow jellyfin group to start, stop and restart itself
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
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
# Uncomment to allow the server to mount iso images
# %jellyfin ALL=(ALL) NOPASSWD: /bin/mount
# %jellyfin ALL=(ALL) NOPASSWD: /bin/umount
Defaults:%jellyfin !requiretty

View File

@@ -0,0 +1,6 @@
#!/bin/sh
NAME=jellyfin
restart_cmd="/usr/bin/systemctl restart ${NAME}"
echo "sleep 2; sudo $restart_cmd > /dev/null 2>&1" | at now > /dev/null 2>&1
exit 0

8
deployment/framework/build.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
#Magic word framework will create a non self contained build
build_jellyfin ../../Jellyfin.Server Release framework `pwd`/dist/jellyfin_${VERSION}

7
deployment/framework/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}

7
deployment/linux-x64/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release linux-x64 `pwd`/dist/jellyfin_${VERSION}

7
deployment/linux-x64/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}

34
deployment/make.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
git submodule update --init --recursive
pushd ../Jellyfin.Versioning
./update-version
popd
#TODO enabled proper flag parsing for enabling and disabling building, signing, packaging and publishing
# Execute all build.sh, package.sh, sign.sh and publish.sh scripts in every folder. In that order. Script should check for artifacts themselves.
echo "Running for platforms '$@'."
for directory in */ ; do
platform=`basename "${directory}"`
if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then
echo "Processing ${platform}"
pushd "$platform"
if [ -f build.sh ]; then
./build.sh
fi
if [ -f package.sh ]; then
./package.sh
fi
if [ -f sign.sh ]; then
./sign.sh
fi
if [ -f publish.sh ]; then
./publish.sh
fi
popd
else
echo "Skipping $platform."
fi
done

7
deployment/osx-x64/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release osx-x64 `pwd`/dist/jellyfin_${VERSION}

7
deployment/osx-x64/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

7
deployment/osx-x64/package.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}

7
deployment/ubuntu-x64/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release ubuntu-x64 `pwd`/dist/jellyfin_${VERSION}

7
deployment/ubuntu-x64/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}

View File

@@ -0,0 +1,15 @@
# docker-templates
### Installation:
Open unRaid GUI (at least unRaid 6.5)
Click on the Docker tab
Add the following line under "Template Repositories"
https://github.com/jellyfin/jellyfin/blob/master/deployment/unraid/docker-templates
Click save than click on Add Container and select jellyfin.
Adjust to your paths to your liking and off you go!

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Containers>
<TemplateURL>https://raw.githubusercontent.com/jellyfin/jellyfin/deployment/unraid/docker-templates/jellyfin.xml</TemplateURL>
<Beta>False</Beta>
<Category>MediaApp:Video MediaApp:Music MediaApp:Photos MediaServer:Video MediaServer:Music MediaServer:Photos</Category>
<Name>JellyFin</Name>
<Description>
JellyFin is The Free Software Media Browser Converted By Community Applications Always verify this template (and values) against the dockerhub support page for the container!![br][br]
You can add as many mount points as needed for recordings, movies ,etc. [br][br]
[b][span style='color: #E80000;']Directions:[/span][/b][br]
[b]/config[/b] : this is where Jellyfin will store it's databases and configuration.[br][br]
[b]Port[/b] : This is the default port for Jellyfin. (Will add ssl port later)[br][br]
[b]Media[/b] : This is the mounting point of your media. When you access it in Jellyfin it will be /media or whatever you chose for a mount point
[b]Tip:[/b] You can add more volume mappings if you wish Jellyfin has access to it.
</Description>
<Overview>
Jellyfin Server is a home media server built on top of other popular open source technologies such as Service Stack, jQuery, jQuery mobile, and Mono and will remain completely free!
</Overview>
<Support>https://www.reddit.com/r/jellyfin/</Support>
<Registry>https://hub.docker.com/r/jellyfin/jellyfin/</Registry>
<GitHub>https://github.com/jellyfin/jellyfin/></GitHub>
<Repository>jellyfin/jellyfin</Repository>
<Project>https://jellyfin.media/</Project>
<BindTime>true</BindTime>
<Privileged>false</Privileged>
<Networking>
<Mode>host</Mode>
<Publish>
<Port>
<HostPort>8096</HostPort>
<ContainerPort>8096</ContainerPort>
<Protocol>tcp</Protocol>
</Port>
</Publish>
</Networking>
<Data>
<Volume>
<HostDir>/mnt/cache/appdata/config</HostDir>
<ContainerDir>/config</ContainerDir>
<Mode>rw</Mode>
</Volume>
<Volume>
<HostDir>/mnt/user</HostDir>
<ContainerDir>/media</ContainerDir>
<Mode>rw</Mode>
</Volume>
</Data>
<WebUI>http://[IP]:[PORT:8096]/</WebUI>
<Icon>https://raw.githubusercontent.com/binhex/docker-templates/master/binhex/images/emby-icon.png</Icon>
<ExtraParams></ExtraParams>
</Containers>

View File

@@ -0,0 +1,110 @@
[CmdletBinding()]
param(
[switch]$InstallFFMPEG,
[switch]$InstallNSSM,
[switch]$GenerateZip,
[string]$InstallLocation = "$Env:AppData/Jellyfin-Server/",
[ValidateSet('Debug','Release')][string]$BuildType = 'Release',
[ValidateSet('Quiet','Minimal', 'Normal')][string]$DotNetVerbosity = 'Minimal',
[ValidateSet('win','win7', 'win8','win81','win10')][string]$WindowsVersion = 'win',
[ValidateSet('x64','x86', 'arm', 'arm64')][string]$Architecture = 'x64'
)
#PowershellCore and *nix check to make determine which temp dir to use.
if(($PSVersionTable.PSEdition -eq 'Core') -and (-not $IsWindows)){
$TempDir = mktemp -d
}else{
$TempDir = $env:Temp
}
function Build-JellyFin {
if(($Architecture -eq 'arm64') -and ($WindowsVersion -ne 'win10')){
Write-Error "arm64 only supported with Windows10 Version"
exit
}
if(($Architecture -eq 'arm') -and ($WindowsVersion -notin @('win10','win81','win8'))){
Write-Error "arm only supported with Windows 8 or higher"
exit
}
dotnet publish -c $BuildType -r "$windowsversion-$Architecture" MediaBrowser.sln -o $InstallLocation -v $DotNetVerbosity
}
function Install-FFMPEG {
param(
[string]$InstallLocation,
[string]$Architecture
)
Write-Verbose "Checking Architecture"
if($Architecture -notin @('x86','x64')){
Write-Warning "No builds available for your selected architecture of $Architecture"
Write-Warning "FFMPEG will not be installed"
}elseif($Architecture -eq 'x64'){
Write-Verbose "Downloading 64 bit FFMPEG"
Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1-win64-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
}else{
Write-Verbose "Downloading 32 bit FFMPEG"
Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.1-win32-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
}
Expand-Archive "$tempdir/fmmpeg.zip" -DestinationPath "$tempdir/ffmpeg/" | Write-Verbose
if($Architecture -eq 'x64'){
Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win64-static/bin" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
}
}else{
Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win32-static/bin" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
}
}
Remove-Item "$tempdir/ffmpeg/" -Recurse -Force -ErrorAction Continue | Write-Verbose
Remove-Item "$tempdir/fmmpeg.zip" -Force -ErrorAction Continue | Write-Verbose
}
function Install-NSSM {
param(
[string]$InstallLocation,
[string]$Architecture
)
Write-Verbose "Checking Architecture"
if($Architecture -notin @('x86','x64')){
Write-Warning "No builds available for your selected architecture of $Architecture"
Write-Warning "NSSM will not be installed"
}else{
Write-Verbose "Downloading NSSM"
Invoke-WebRequest -Uri https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip -UseBasicParsing -OutFile "$tempdir/nssm.zip" | Write-Verbose
}
Expand-Archive "$tempdir/nssm.zip" -DestinationPath "$tempdir/nssm/" | Write-Verbose
if($Architecture -eq 'x64'){
Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win64" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
}
}else{
Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win32" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
}
}
Remove-Item "$tempdir/nssm/" -Recurse -Force -ErrorAction Continue | Write-Verbose
Remove-Item "$tempdir/nssm.zip" -Force -ErrorAction Continue | Write-Verbose
}
Write-Verbose "Starting Build Process: Selected Environment is $WindowsVersion-$Architecture"
Build-JellyFin
if($InstallFFMPEG.IsPresent -or ($InstallFFMPEG -eq $true)){
Write-Verbose "Starting FFMPEG Install"
Install-FFMPEG $InstallLocation $Architecture
}
if($InstallNSSM.IsPresent -or ($InstallNSSM -eq $true)){
Write-Verbose "Starting NSSM Install"
Install-NSSM $InstallLocation $Architecture
}
Copy-Item .\install-jellyfin.ps1 $InstallLocation\install-jellyfin.ps1
Copy-Item .\install.bat $InstallLocation\install.bat
if($GenerateZip.IsPresent -or ($GenerateZip -eq $true)){
Compress-Archive -Path $InstallLocation -DestinationPath "$InstallLocation/jellyfin.zip" -Force
}
Write-Verbose "Finished"

View File

@@ -0,0 +1,460 @@
[CmdletBinding()]
param(
[Switch]$Quiet,
[Switch]$InstallAsService,
[pscredential]$ServiceUser,
[switch]$CreateDesktopShorcut,
[switch]$LaunchJellyfin,
[switch]$MigrateEmbyLibrary,
[string]$InstallLocation,
[string]$EmbyLibraryLocation,
[string]$JellyfinLibraryLocation
)
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
Install-Jellyfin
#>
#This doesn't need to be used by default anymore, but I am keeping it in as a function for future use.
function Elevate-Window {
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
# We are running "as Administrator" - so change the title and background color to indicate this
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
$Host.UI.RawUI.BackgroundColor = "DarkBlue"
clear-host
}
else
{
# We are not running "as Administrator" - so relaunch as administrator
# Create a new process object that starts PowerShell
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
# Specify the current script path and name as a parameter
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
# Indicate that the process should be elevated
$newProcess.Verb = "runas";
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
# Exit from the current, unelevated, process
exit
}
}
#FIXME The install methods should be a function that takes all the params, the quiet flag should be a paramset
if($Quiet.IsPresent -or $Quiet -eq $true){
if([string]::IsNullOrEmpty($JellyfinLibraryLocation)){
$Script:JellyfinDataDir = "$env:AppData\jellyfin\"
}else{
$Script:JellyfinDataDir = $JellyfinLibraryLocation
}
if([string]::IsNullOrEmpty($InstallLocation)){
$Script:DefaultJellyfinInstallDirectory = "$env:Appdata\jellyfin\"
}else{
$Script:DefaultJellyfinInstallDirectory = $InstallLocation
}
if([string]::IsNullOrEmpty($EmbyLibraryLocation)){
$Script:defaultEmbyDataDir = "$env:Appdata\Emby-Server\data\"
}else{
$Script:defaultEmbyDataDir = $EmbyLibraryLocation
}
if($InstallAsService.IsPresent -or $InstallAsService -eq $true){
$Script:InstallAsService = $true
}else{$Script:InstallAsService = $false}
if($null -eq $ServiceUser){
$Script:InstallServiceAsUser = $false
}else{
$Script:InstallServiceAsUser = $true
$Script:UserCredentials = $ServiceUser
$Script:JellyfinDataDir = "C:\Users\$($Script:UserCredentials.UserName)\Appdata\Roaming\jellyfin\"}
if($CreateDesktopShorcut.IsPresent -or $CreateDesktopShorcut -eq $true) {$Script:CreateShortcut = $true}else{$Script:CreateShortcut = $false}
if($MigrateEmbyLibrary.IsPresent -or $MigrateEmbyLibrary -eq $true){$Script:MigrateLibrary = $true}else{$Script:MigrateLibrary = $false}
if($LaunchJellyfin.IsPresent -or $LaunchJellyfin -eq $true){$Script:StartJellyfin = $true}else{$Script:StartJellyfin = $false}
if(-not (Test-Path $Script:DefaultJellyfinInstallDirectory)){
mkdir $Script:DefaultJellyfinInstallDirectory
}
Copy-Item -Path $PSScriptRoot/* -DestinationPath "$Script:DefaultJellyfinInstallDirectory/" -Force -Recurse
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
#&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin ObjectName $Script:UserCredentials.UserName $Script:UserCredentials.GetNetworkCredential().Password
#Set-Service -Name Jellyfin -Credential $Script:UserCredentials
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}
}
if($Script:MigrateLibrary){
Copy-Item -Path $Script:defaultEmbyDataDir/config -Destination $Script:JellyfinDataDir -force -Recurse
Copy-Item -Path $Script:defaultEmbyDataDir/cache -Destination $Script:JellyfinDataDir -force -Recurse
Copy-Item -Path $Script:defaultEmbyDataDir/data -Destination $Script:JellyfinDataDir -force -Recurse
Copy-Item -Path $Script:defaultEmbyDataDir/metadata -Destination $Script:JellyfinDataDir -force -Recurse
Copy-Item -Path $Script:defaultEmbyDataDir/root -Destination $Script:JellyfinDataDir -force -Recurse
}
if($Script:CreateShortcut){
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Jellyfin.lnk")
$Shortcut.TargetPath = "$Script:DefaultJellyfinInstallDirectory\jellyfin.exe"
$Shortcut.Save()
}
if($Script:StartJellyfin){
if($Script:InstallAsService){
Get-Service Jellyfin | Start-Service
}else{
Start-Process -FilePath $Script:DefaultJellyfinInstallDirectory\jellyfin.exe -PassThru
}
}
}else{
}
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$Script:JellyFinDataDir = "$env:AppData\jellyfin\"
$Script:DefaultJellyfinInstallDirectory = "$env:Appdata\jellyfin\"
$Script:defaultEmbyDataDir = "$env:Appdata\Emby-Server\"
$Script:InstallAsService = $False
$Script:InstallServiceAsUser = $false
$Script:CreateShortcut = $false
$Script:MigrateLibrary = $false
$Script:StartJellyfin = $false
function InstallJellyfin {
Write-Host "Install as service: $Script:InstallAsService"
Write-Host "Install as serviceuser: $Script:InstallServiceAsUser"
Write-Host "Create Shortcut: $Script:CreateShortcut"
Write-Host "MigrateLibrary: $Script:MigrateLibrary"
$GUIElementsCollection | ForEach-Object {
$_.Enabled = $false
}
Write-Host "Making Jellyfin directory"
$ProgressBar.Minimum = 1
$ProgressBar.Maximum = 100
$ProgressBar.Value = 1
if($Script:DefaultJellyfinInstallDirectory -ne $InstallLocationBox.Text){
Write-Host "Custom Install Location Chosen: $($InstallLocationBox.Text)"
$Script:DefaultJellyfinInstallDirectory = $InstallLocationBox.Text
}
if($Script:JellyfinDataDir -ne $CustomLibraryBox.Text){
Write-Host "Custom Library Location Chosen: $($CustomLibraryBox.Text)"
$Script:JellyfinDataDir = $CustomLibraryBox.Text
}
if(-not (Test-Path $Script:DefaultJellyfinInstallDirectory)){
mkdir $Script:DefaultJellyfinInstallDirectory
}
Write-Host "Copying Jellyfin Data"
$progressbar.Value = 10
Copy-Item -Path $PSScriptRoot/* -Destination $Script:DefaultJellyfinInstallDirectory/ -Force -Recurse
Write-Host "Finished Copying"
$ProgressBar.Value = 50
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
Write-Host "Installing Service as user $($Script:UserCredentials.UserName)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
Write-Host "Installing Service as LocalSystem"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}
}
$progressbar.Value = 60
if($Script:MigrateLibrary){
if($Script:defaultEmbyDataDir -ne $LibraryLocationBox.Text){
Write-Host "Custom location defined for emby library: $($LibraryLocationBox.Text)"
$Script:defaultEmbyDataDir = $LibraryLocationBox.Text
}
Write-Host "Copying emby library from $Script:defaultEmbyDataDir to $Script:JellyFinDataDir"
Write-Host "This could take a while depending on the size of your library. Please be patient"
Write-Host "Copying config"
Copy-Item -Path $Script:defaultEmbyDataDir/config -Destination $Script:JellyfinDataDir -force -Recurse
Write-Host "Copying cache"
Copy-Item -Path $Script:defaultEmbyDataDir/cache -Destination $Script:JellyfinDataDir -force -Recurse
Write-Host "Copying data"
Copy-Item -Path $Script:defaultEmbyDataDir/data -Destination $Script:JellyfinDataDir -force -Recurse
Write-Host "Copying metadata"
Copy-Item -Path $Script:defaultEmbyDataDir/metadata -Destination $Script:JellyfinDataDir -force -Recurse
Write-Host "Copying root dir"
Copy-Item -Path $Script:defaultEmbyDataDir/root -Destination $Script:JellyfinDataDir -force -Recurse
}
$progressbar.Value = 80
if($Script:CreateShortcut){
Write-Host "Creating Shortcut"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Jellyfin.lnk")
$Shortcut.TargetPath = "$Script:DefaultJellyfinInstallDirectory\jellyfin.exe"
$Shortcut.Save()
}
$ProgressBar.Value = 90
if($Script:StartJellyfin){
if($Script:InstallAsService){
Write-Host "Starting Jellyfin Service"
Get-Service Jellyfin | Start-Service
}else{
Write-Host "Starting Jellyfin"
Start-Process -FilePath $Script:DefaultJellyfinInstallDirectory\jellyfin.exe -PassThru
}
}
$progressbar.Value = 100
Write-Host Finished
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Operation Completed",0,"Done",0x1)
$InstallForm.Close()
}
function ServiceBoxCheckChanged {
if($InstallAsServiceCheck.Checked){
$Script:InstallAsService = $true
$ServiceUserLabel.Visible = $true
$ServiceUserLabel.Enabled = $true
$ServiceUserBox.Visible = $true
$ServiceUserBox.Enabled = $true
}else{
$Script:InstallAsService = $false
$ServiceUserLabel.Visible = $false
$ServiceUserLabel.Enabled = $false
$ServiceUserBox.Visible = $false
$ServiceUserBox.Enabled = $false
}
}
function UserSelect {
if($ServiceUserBox.Text -eq 'Local System')
{
$Script:InstallServiceAsUser = $false
$Script:UserCredentials = $null
$ServiceUserBox.Items.RemoveAt(1)
$ServiceUserBox.Items.Add("Custom User")
}elseif($ServiceUserBox.Text -eq 'Custom User'){
$Script:InstallServiceAsUser = $true
$Script:UserCredentials = Get-Credential -Message "Please enter the credentials of the user you with to run Jellyfin Service as" -UserName $env:USERNAME
$ServiceUserBox.Items[1] = "$($Script:UserCredentials.UserName)"
}
}
function CreateShortcutBoxCheckChanged {
if($CreateShortcutCheck.Checked){
$Script:CreateShortcut = $true
}else{
$Script:CreateShortcut = $False
}
}
function StartJellyFinBoxCheckChanged {
if($StartProgramCheck.Checked){
$Script:StartJellyfin = $true
}else{
$Script:StartJellyfin = $false
}
}
function CustomLibraryCheckChanged {
if($CustomLibraryCheck.Checked){
$Script:UseCustomLibrary = $true
$CustomLibraryBox.Enabled = $true
}else{
$Script:UseCustomLibrary = $false
$CustomLibraryBox.Enabled = $false
}
}
function MigrateLibraryCheckboxChanged {
if($MigrateLibraryCheck.Checked){
$Script:MigrateLibrary = $true
$LibraryMigrationLabel.Visible = $true
$LibraryMigrationLabel.Enabled = $true
$LibraryLocationBox.Visible = $true
$LibraryLocationBox.Enabled = $true
}else{
$Script:MigrateLibrary = $false
$LibraryMigrationLabel.Visible = $false
$LibraryMigrationLabel.Enabled = $false
$LibraryLocationBox.Visible = $false
$LibraryLocationBox.Enabled = $false
}
}
#region begin GUI{
$InstallForm = New-Object system.Windows.Forms.Form
$InstallForm.ClientSize = '320,240'
$InstallForm.text = "Terrible Jellyfin Installer"
$InstallForm.TopMost = $false
$GUIElementsCollection = @()
$InstallButton = New-Object system.Windows.Forms.Button
$InstallButton.text = "Install"
$InstallButton.width = 60
$InstallButton.height = 30
$InstallButton.location = New-Object System.Drawing.Point(5,5)
$InstallButton.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $InstallButton
$ProgressBar = New-Object system.Windows.Forms.ProgressBar
$ProgressBar.width = 245
$ProgressBar.height = 30
$ProgressBar.location = New-Object System.Drawing.Point(70,5)
$InstallLocationLabel = New-Object system.Windows.Forms.Label
$InstallLocationLabel.text = "Install Location"
$InstallLocationLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
$InstallLocationLabel.AutoSize = $true
$InstallLocationLabel.width = 100
$InstallLocationLabel.height = 20
$InstallLocationLabel.location = New-Object System.Drawing.Point(5,50)
$InstallLocationLabel.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $InstallLocationLabel
$InstallLocationBox = New-Object system.Windows.Forms.TextBox
$InstallLocationBox.multiline = $false
$InstallLocationBox.width = 205
$InstallLocationBox.height = 20
$InstallLocationBox.location = New-Object System.Drawing.Point(110,50)
$InstallLocationBox.Text = $Script:DefaultJellyfinInstallDirectory
$InstallLocationBox.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $InstallLocationBox
$CustomLibraryCheck = New-Object system.Windows.Forms.CheckBox
$CustomLibraryCheck.text = "Custom Library Location:"
$CustomLibraryCheck.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
$CustomLibraryCheck.AutoSize = $false
$CustomLibraryCheck.width = 180
$CustomLibraryCheck.height = 20
$CustomLibraryCheck.location = New-Object System.Drawing.Point(5,75)
$CustomLibraryCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $CustomLibraryCheck
$CustomLibraryBox = New-Object system.Windows.Forms.TextBox
$CustomLibraryBox.multiline = $false
$CustomLibraryBox.width = 130
$CustomLibraryBox.height = 20
$CustomLibraryBox.location = New-Object System.Drawing.Point(185,75)
$CustomLibraryBox.Text = $Script:JellyFinDataDir
$CustomLibraryBox.Font = 'Microsoft Sans Serif,10'
$CustomLibraryBox.Enabled = $false
$GUIElementsCollection += $CustomLibraryBox
$InstallAsServiceCheck = New-Object system.Windows.Forms.CheckBox
$InstallAsServiceCheck.text = "Install as Service"
$InstallAsServiceCheck.AutoSize = $false
$InstallAsServiceCheck.width = 140
$InstallAsServiceCheck.height = 20
$InstallAsServiceCheck.location = New-Object System.Drawing.Point(5,125)
$InstallAsServiceCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $InstallAsServiceCheck
$ServiceUserLabel = New-Object system.Windows.Forms.Label
$ServiceUserLabel.text = "Run Service As:"
$ServiceUserLabel.AutoSize = $true
$ServiceUserLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
$ServiceUserLabel.width = 100
$ServiceUserLabel.height = 20
$ServiceUserLabel.location = New-Object System.Drawing.Point(15,145)
$ServiceUserLabel.Font = 'Microsoft Sans Serif,10'
$ServiceUserLabel.Visible = $false
$ServiceUserLabel.Enabled = $false
$GUIElementsCollection += $ServiceUserLabel
$ServiceUserBox = New-Object system.Windows.Forms.ComboBox
$ServiceUserBox.text = "Run Service As"
$ServiceUserBox.width = 195
$ServiceUserBox.height = 20
@('Local System','Custom User') | ForEach-Object {[void] $ServiceUserBox.Items.Add($_)}
$ServiceUserBox.location = New-Object System.Drawing.Point(120,145)
$ServiceUserBox.Font = 'Microsoft Sans Serif,10'
$ServiceUserBox.Visible = $false
$ServiceUserBox.Enabled = $false
$ServiceUserBox.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList
$GUIElementsCollection += $ServiceUserBox
$MigrateLibraryCheck = New-Object system.Windows.Forms.CheckBox
$MigrateLibraryCheck.text = "Import Emby Library"
$MigrateLibraryCheck.AutoSize = $false
$MigrateLibraryCheck.width = 160
$MigrateLibraryCheck.height = 20
$MigrateLibraryCheck.location = New-Object System.Drawing.Point(5,170)
$MigrateLibraryCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $MigrateLibraryCheck
$LibraryMigrationLabel = New-Object system.Windows.Forms.Label
$LibraryMigrationLabel.text = "Emby Library Path"
$LibraryMigrationLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
$LibraryMigrationLabel.AutoSize = $false
$LibraryMigrationLabel.width = 120
$LibraryMigrationLabel.height = 20
$LibraryMigrationLabel.location = New-Object System.Drawing.Point(15,190)
$LibraryMigrationLabel.Font = 'Microsoft Sans Serif,10'
$LibraryMigrationLabel.Visible = $false
$LibraryMigrationLabel.Enabled = $false
$GUIElementsCollection += $LibraryMigrationLabel
$LibraryLocationBox = New-Object system.Windows.Forms.TextBox
$LibraryLocationBox.multiline = $false
$LibraryLocationBox.width = 175
$LibraryLocationBox.height = 20
$LibraryLocationBox.location = New-Object System.Drawing.Point(140,190)
$LibraryLocationBox.Text = $Script:defaultEmbyDataDir
$LibraryLocationBox.Font = 'Microsoft Sans Serif,10'
$LibraryLocationBox.Visible = $false
$LibraryLocationBox.Enabled = $false
$GUIElementsCollection += $LibraryLocationBox
$CreateShortcutCheck = New-Object system.Windows.Forms.CheckBox
$CreateShortcutCheck.text = "Desktop Shortcut"
$CreateShortcutCheck.AutoSize = $false
$CreateShortcutCheck.width = 150
$CreateShortcutCheck.height = 20
$CreateShortcutCheck.location = New-Object System.Drawing.Point(5,215)
$CreateShortcutCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $CreateShortcutCheck
$StartProgramCheck = New-Object system.Windows.Forms.CheckBox
$StartProgramCheck.text = "Start Jellyfin"
$StartProgramCheck.AutoSize = $false
$StartProgramCheck.width = 160
$StartProgramCheck.height = 20
$StartProgramCheck.location = New-Object System.Drawing.Point(160,215)
$StartProgramCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $StartProgramCheck
$InstallForm.controls.AddRange($GUIElementsCollection)
$InstallForm.Controls.Add($ProgressBar)
#region gui events {
$InstallButton.Add_Click({ InstallJellyfin })
$CustomLibraryCheck.Add_CheckedChanged({CustomLibraryCheckChanged})
$InstallAsServiceCheck.Add_CheckedChanged({ServiceBoxCheckChanged})
$ServiceUserBox.Add_SelectedValueChanged({ UserSelect })
$MigrateLibraryCheck.Add_CheckedChanged({MigrateLibraryCheckboxChanged})
$CreateShortcutCheck.Add_CheckedChanged({CreateShortcutBoxCheckChanged})
$StartProgramCheck.Add_CheckedChanged({StartJellyFinBoxCheckChanged})
#endregion events }
#endregion GUI }
[void]$InstallForm.ShowDialog()

View File

@@ -0,0 +1 @@
powershell.exe -executionpolicy Bypass -file install-jellyfin.ps1

7
deployment/win-x64/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release win-x64 `pwd`/dist/jellyfin_${VERSION}

7
deployment/win-x64/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

9
deployment/win-x64/package.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
#TODO setup and maybe change above code to produce the Windows native zip format.

7
deployment/win-x86/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
build_jellyfin ../../Jellyfin.Server Release win-x86 `pwd`/dist/jellyfin_${VERSION}

7
deployment/win-x86/clean.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

9
deployment/win-x86/package.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
source ../common.build.sh
VERSION=`get_version ../..`
package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
#TODO setup and maybe change above code to produce the Windows native zip format.