Skip to content

Commit

Permalink
multimedia/jellyfin: Add port
Browse files Browse the repository at this point in the history
Jellyfin is the volunteer-built media solution that
puts you in control of your media.
Stream to any device from your own server, with no strings attached.

Your media, your server, your way.

WWW: https://jellyfin.org/

Maintainer becomes submitter.  Already maintainer of other ports.

Port installs binaries downloaded from a website without any
local compilation.  The submitter has done the same for numerous
previous ports due to difficulties in locally building .NET based
ports.  See PR for some discussion.

PR:		269754
Approved by:	flo (mentor)
Differential Revision: https://reviews.freebsd.org/D38861
  • Loading branch information
mvanbaak authored and clausecker committed Mar 3, 2023
1 parent a709d3f commit 92747e0
Show file tree
Hide file tree
Showing 9 changed files with 2,192 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GIDs
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ opensearch:*:855:
# free: 865
# free: 866
# free: 867
# free: 868
jellyfin:*:868:
keyd:*:869:
buildbot:*:870:
# free: 871
Expand Down
2 changes: 1 addition & 1 deletion UIDs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ opensearch:*:855:855::0:0:opensearch user:/nonexistent:/usr/sbin/nologin
# free: 865
# free: 866
# free: 867
# free: 868
jellyfin:*:868:868::0:0:Jellyfin:/nonexistent:/usr/sbin/nologin
keyd:*:869:869::0:0:Key remapping daemon for evdev:/nonexistent:/usr/sbin/nologin
buildbot:*:870:870::0:0:Buildbot user:/var/db/buildbot:/usr/sbin/nologin
archiva:*:871:871::0:0:Apache Archiva Daemon:/nonexistent:/usr/sbin/nologin
Expand Down
1 change: 1 addition & 0 deletions multimedia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
SUBDIR += hypnotix
SUBDIR += intel-media-sdk
SUBDIR += iso2mkv
SUBDIR += jellyfin
SUBDIR += jmref
SUBDIR += kaffeine
SUBDIR += kamoso
Expand Down
56 changes: 56 additions & 0 deletions multimedia/jellyfin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
PORTNAME= jellyfin
DISTVERSION= 10.8.9
CATEGORIES= multimedia
MASTER_SITES= https://github.com/Thefrank/jellyfin-server-freebsd/releases/download/v${DISTVERSION}/
DISTFILES= jellyfin-combined_${DISTVERSION}_freebsd-${ARCH}.tar.gz \
libSkiaSharp.so
EXTRACT_ONLY= jellyfin-combined_${DISTVERSION}_freebsd-${ARCH}.tar.gz

MAINTAINER= michiel@vanbaak.eu
COMMENT= Jellyfin Server Component with WebUI
WWW= https://jellyfin.org/

LICENSE= BSD3CLAUSE GPLv2
LICENSE_COMB= multi

ONLY_FOR_ARCHS= amd64

LIB_DEPENDS+= libfontconfig.so:x11-fonts/fontconfig
RUN_DEPENDS= ca_root_nss>0:security/ca_root_nss \
ffmpeg>0:multimedia/ffmpeg \
icu>0:devel/icu \
krb5>0:security/krb5 \
libinotify>0:devel/libinotify \
libunwind>0:devel/libunwind \
mediainfo>0:multimedia/mediainfo \
openssl>0:security/openssl \
sqlite3>0:databases/sqlite3

USE_RC_SUBR= jellyfin

NO_BUILD= YES

SUB_FILES= jellyfin pkg-message
SUB_LIST= DATADIR=${LOCALBASE}/jellyfin \
GROUPS=${GROUPS} \
USERS=${USERS}

NO_WRKSUBDIR= YES
WRKSRC= ${WRKDIR}/jf

USERS= jellyfin
GROUPS= jellyfin

.include <bsd.port.options.mk>

do-install:
cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}/${LOCALBASE}/jellyfin "! ( -type f -name *\.so -or -type f -name "jellyfin" )"
cd ${WRKSRC} && ${COPYTREE_BIN} . ${STAGEDIR}/${LOCALBASE}/jellyfin " -type f -name "jellyfin" "
${INSTALL_DATA} ${DISTDIR}/libSkiaSharp.so ${STAGEDIR}/${LOCALBASE}/jellyfin && ${INSTALL_DATA} ${WRKSRC}/*.so ${STAGEDIR}/${LOCALBASE}/jellyfin

#This can be done one of a number ways including: symlink, a .config override (using dllmap), or libmap.
post-install:
@${ECHO_CMD} "libe_sqlite3.so libsqlite3.so" \
>${STAGEDIR}${PREFIX}/etc/libmap.d/jellyfin.conf

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions multimedia/jellyfin/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TIMESTAMP = 1677009100
SHA256 (jellyfin-combined_10.8.9_freebsd-amd64.tar.gz) = e1171e511d74566874a9824236125d50dfc2ff464dcee29573bd990056729c58
SIZE (jellyfin-combined_10.8.9_freebsd-amd64.tar.gz) = 70424803
SHA256 (libSkiaSharp.so) = dbcf1e116bda5a6d0a1865d353de769aed936cd89e22f7db921613e5cbedaccf
SIZE (libSkiaSharp.so) = 7555664
72 changes: 72 additions & 0 deletions multimedia/jellyfin/files/jellyfin.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

# PROVIDE: jellyfin
# REQUIRE: LOGIN network
# KEYWORD: shutdown
#
# extraargs typically can remain unset
# extraargs accepts as string any of:
# --nowebclient Indicates that the web server should not host the web client.
# -w, --webdir Path to the Jellyfin web UI resources. Defaults to ./jellyfin-web
# -c, --configdir Path to use for configuration data (user settings and pictures).
# -l, --logdir Path to use for writing log files. Defaults to $datadir/log
# --ffmpeg Path to external FFmpeg executable to use. Defaults to PATH.
# --published-server-url Jellyfin Server URL to publish via auto discover process
#
#
# variable definitions
# jellyfin_exec_dir Path to the actual jellyfin binary Defaults to %%DATADIR%%
# jellyfin_data_dir Path to use for the data folder (database files, etc.) Defaults to /var/db/jellyfin
# jellyfin_cache_dir Path to use for caching. Defaults to /var/cache/jellyfin
# jellyfin_pid_dir Path to use for the pid file. Defaults to /var/run/jellyfin

. /etc/rc.subr
name=jellyfin
rcvar=jellyfin_enable
load_rc_config $name

: ${jellyfin_enable:=NO}
: ${jellyfin_user:="jellyfin"}
: ${jellyfin_group:="jellyfin"}
: ${jellyfin_extraargs:=""}
: ${jellyfin_exec_dir:="%%DATADIR%%"}
: ${jellyfin_data_dir:="/var/db/jellyfin"}
: ${jellyfin_cache_dir:="/var/cache/jellyfin"}
: ${jellyfin_pid_dir:="/var/run/jellyfin"}

pidfile="${jellyfin_pid_dir}/${name}_daemon.pid"
pidfile_child="${jellyfin_pid_dir}/${name}_child.pid"
command="/usr/sbin/daemon"


start_precmd=${name}_precmd
jellyfin_precmd() {
if [ ! -d ${jellyfin_exec_dir} ]; then
install -d -o ${jellyfin_user} -g ${jellyfin_group} ${jellyfin_exec_dir}
fi

if [ ! -d ${jellyfin_data_dir} ]; then
install -d -o ${jellyfin_user} -g ${jellyfin_group} ${jellyfin_data_dir}
fi

if [ ! -d ${jellyfin_cache_dir} ]; then
install -d -o ${jellyfin_user} -g ${jellyfin_group} ${jellyfin_cache_dir}
fi

if [ ! -d ${jellyfin_pid_dir} ]; then
install -d -o ${jellyfin_user} -g ${jellyfin_group} ${jellyfin_pid_dir}
fi

# .NET 6+ use dual mode sockets to avoid the separate AF handling.
# disable .NET use of V6 if no ipv6 is configured.
# See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259194#c17
ifconfig | grep -q inet6
if [ $? == 1 ]; then
export DOTNET_SYSTEM_NET_DISABLEIPV6=1
fi

rc_flags="-r -f -p ${pidfile_child} -P ${pidfile} ${jellyfin_exec_dir}/jellyfin --datadir ${jellyfin_data_dir} --cachedir ${jellyfin_cache_dir} ${jellyfin_extraargs} >> /dev/null 2>&1 ${rc_flags}"
}

run_rc_command "$1"

53 changes: 53 additions & 0 deletions multimedia/jellyfin/files/pkg-message.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{ type: install
message: <<EOM

jellyfin relies on Microsoft dotNET5+ SDK to be built
Microsoft does not have an official version of dotNET for FreeBSD

This package was built with an UNOFFICIAL UNSUPPORTED version of dotNET
If this is something that you do not want, remove this package with
"pkg remove jellyfin"

This package installs a service file.
Enable it with "sysrc jellyfin_enable=TRUE"
Start it with "service jellyfin start".

The service file uses daemon to restart jellyfin if it crashes.
The service file will also change the permissions so that the updater works.
If this behavior is unwanted you will need to edit the RC file manually and
remove the daemon and/or the permissions changes.

If you are running this in a jail please set "allow_mlock=1" or similar
for this jail otherwise the program will fail to start.

dotNET does not work well inside jails that are missing either a) VNET or
b) ip6=inherit. The service file will try workaround any user misconfiguration
but is not perfect.

EOM
}
{ type: upgrade
message: <<EOM

Those upgrading, as a reminder:

This package installs a service file.
Enable it with "sysrc jellyfin_enable=TRUE"
Start it with "service jellyfin start".

The service file uses daemon to restart jellyfin if it crashes.
The service file will also change the permissions so that the updater works.
If this behavior is unwanted you will need to edit the RC file manually and
remove the daemon and/or the permissions changes.

If you are running this in a jail please set "allow_mlock=1" or similar
for this jail otherwise the program will fail to start.

dotNET does not work well inside jails that are missing either a) VNET or
b) ip6=inherit. The service file will try workaround any user misconfiguration
but is not perfect.

EOM
}
]
5 changes: 5 additions & 0 deletions multimedia/jellyfin/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Jellyfin is the volunteer-built media solution that
puts you in control of your media.
Stream to any device from your own server, with no strings attached.

Your media, your server, your way.

0 comments on commit 92747e0

Please sign in to comment.