Enable self-contained binary mode (#160)
* Build self-contained Debian linux-x64 binary * Update initscripts to use self-contained binary The binary is declared in the units intentionally rather than using the variable extrapolation from before, to avoid confusion since these can't really be moved reasonably. * With combined binary name, use pgrep instead * Remove dotnet-runtime dependency * Move the compiled scb to usr/bin * Update binary location for upstart/systemd * Move binary path; fix pidfile handling * Entirely remove the temporary usr/ dir * Don't move the compiled binary * Create /usr/bin symlink * Use the variable here * Update architecture to any * Add libcurl4-openssl build dependency * Update the build Dockerfile to install builddeps
This commit is contained in:
parent
72f7e7b954
commit
a73d255f51
|
@ -2,20 +2,20 @@ FROM debian:9
|
||||||
|
|
||||||
# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
|
# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y apt-transport-https debhelper gnupg wget \
|
&& 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 \
|
&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
|
||||||
&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
|
&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
|
||||||
&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \
|
&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \
|
||||||
&& mv prod.list /etc/apt/sources.list.d/microsoft-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/trusted.gpg.d/microsoft.asc.gpg \
|
||||||
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
|
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
|
||||||
&& apt-get update \
|
&& apt-get update
|
||||||
&& apt-get install -y dotnet-sdk-2.2
|
|
||||||
|
|
||||||
WORKDIR /repo
|
WORKDIR /repo
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN dpkg-buildpackage -us -uc \
|
RUN yes|mk-build-deps -i \
|
||||||
|
&& dpkg-buildpackage -us -uc \
|
||||||
&& mkdir /dist \
|
&& mkdir /dist \
|
||||||
&& mv /jellyfin*deb /dist
|
&& mv /jellyfin*deb /dist
|
||||||
|
|
||||||
|
|
6
debian/conf/jellyfin
vendored
6
debian/conf/jellyfin
vendored
|
@ -15,8 +15,6 @@
|
||||||
# General options
|
# General options
|
||||||
#
|
#
|
||||||
|
|
||||||
# Path to the jellyfin.dll executable
|
|
||||||
JELLYFIN_EXE="/usr/lib/jellyfin/bin/jellyfin.dll"
|
|
||||||
# Data directory
|
# Data directory
|
||||||
JELLYFIN_DATA="/var/lib/jellyfin"
|
JELLYFIN_DATA="/var/lib/jellyfin"
|
||||||
# Restart script for in-app server control
|
# Restart script for in-app server control
|
||||||
|
@ -30,7 +28,5 @@ JELLYFIN_ADD_OPTS=""
|
||||||
|
|
||||||
# Application username
|
# Application username
|
||||||
JELLYFIN_USER="jellyfin"
|
JELLYFIN_USER="jellyfin"
|
||||||
# .NET Core runtime binary
|
|
||||||
JELLYFIN_DOTNET="/usr/bin/dotnet"
|
|
||||||
# Full application command
|
# Full application command
|
||||||
JELLYFIN_COMMAND="$JELLYFIN_EXE -programdata $JELLYFIN_DATA -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
|
JELLYFIN_ARGS="-programdata $JELLYFIN_DATA -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
|
||||||
|
|
7
debian/control
vendored
7
debian/control
vendored
|
@ -4,14 +4,15 @@ Priority: optional
|
||||||
Maintainer: Vasily <just.one.man@yandex.ru>
|
Maintainer: Vasily <just.one.man@yandex.ru>
|
||||||
Build-Depends: debhelper (>= 9),
|
Build-Depends: debhelper (>= 9),
|
||||||
dotnet-sdk-2.2,
|
dotnet-sdk-2.2,
|
||||||
libc6-dev
|
libc6-dev,
|
||||||
|
libcurl4-openssl-dev
|
||||||
Standards-Version: 3.9.4
|
Standards-Version: 3.9.4
|
||||||
|
|
||||||
Package: jellyfin
|
Package: jellyfin
|
||||||
Replaces: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
|
Replaces: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
|
||||||
Breaks: 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
|
Conflicts: mediabrowser, emby, emby-server-beta, jellyfin-dev, emby-server
|
||||||
Architecture: all
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, at, libsqlite3-0, dotnet-runtime-2.2, ffmpeg
|
Depends: ${shlibs:Depends}, ${misc:Depends}, at, libsqlite3-0, ffmpeg
|
||||||
Description: Jellyfin is a home media server.
|
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.
|
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.
|
||||||
|
|
8
debian/jellyfin.init
vendored
8
debian/jellyfin.init
vendored
|
@ -9,14 +9,17 @@
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
# Carry out specific functions when asked to by the system
|
# Carry out specific functions when asked to by the system
|
||||||
pid=`ps -fA|grep dotnet|grep jellyfin|awk '{print $2}'| tr -d '\n'`
|
|
||||||
|
pidfile="/var/run/jellyfin.pid"
|
||||||
|
pid=`cat $pidfile`
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ "$pid" == "" ]; then
|
if [ "$pid" == "" ]; then
|
||||||
echo "Starting Jellyfin..."
|
echo "Starting Jellyfin..."
|
||||||
. /etc/default/jellyfin
|
. /etc/default/jellyfin
|
||||||
nohup su -u $JELLYFIN_USER -c $JELLYFIN_DOTNET $JELLYFIN_COMMAND
|
nohup su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
|
||||||
|
echo ?? > $pidfile
|
||||||
else
|
else
|
||||||
echo "Jellyfin already running"
|
echo "Jellyfin already running"
|
||||||
fi
|
fi
|
||||||
|
@ -26,6 +29,7 @@ case "$1" in
|
||||||
echo "Stopping Jellyfin..."
|
echo "Stopping Jellyfin..."
|
||||||
kill $pid
|
kill $pid
|
||||||
sleep 2
|
sleep 2
|
||||||
|
rm -f $pidfile
|
||||||
else
|
else
|
||||||
echo "Jellyfin not running"
|
echo "Jellyfin not running"
|
||||||
fi
|
fi
|
||||||
|
|
2
debian/jellyfin.service
vendored
2
debian/jellyfin.service
vendored
|
@ -6,7 +6,7 @@ After = network.target
|
||||||
Type = simple
|
Type = simple
|
||||||
EnvironmentFile = /etc/default/jellyfin
|
EnvironmentFile = /etc/default/jellyfin
|
||||||
User = jellyfin
|
User = jellyfin
|
||||||
ExecStart = /usr/bin/dotnet ${JELLYFIN_EXE} -programdata ${JELLYFIN_DATA} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
|
ExecStart = /usr/bin/jellyfin -programdata ${JELLYFIN_DATA} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
|
||||||
Restart = on-abort
|
Restart = on-abort
|
||||||
TimeoutSec = 20
|
TimeoutSec = 20
|
||||||
|
|
||||||
|
|
2
debian/jellyfin.upstart
vendored
2
debian/jellyfin.upstart
vendored
|
@ -16,5 +16,5 @@ script
|
||||||
# Log file
|
# Log file
|
||||||
logger -t "$0" "DEBUG: `set`"
|
logger -t "$0" "DEBUG: `set`"
|
||||||
. /etc/default/jellyfin
|
. /etc/default/jellyfin
|
||||||
exec su -u $JELLYFIN_USER -c $JELLYFIN_DOTNET $JELLYFIN_COMMAND
|
exec su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
|
||||||
end script
|
end script
|
||||||
|
|
3
debian/postinst
vendored
3
debian/postinst
vendored
|
@ -37,6 +37,9 @@ case "$1" in
|
||||||
|
|
||||||
chmod +x ${JELLYFIN_DIR}/restart.sh > /dev/null 2>&1 || true
|
chmod +x ${JELLYFIN_DIR}/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)
|
abort-upgrade|abort-remove|abort-deconfigure)
|
||||||
;;
|
;;
|
||||||
|
|
4
debian/rules
vendored
4
debian/rules
vendored
|
@ -15,8 +15,8 @@ override_dh_auto_test:
|
||||||
override_dh_clistrip:
|
override_dh_clistrip:
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
dotnet publish --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/jellyfin/bin'
|
dotnet publish --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln --output='$(CURDIR)/usr/lib/jellyfin/bin' --self-contained --runtime linux-x64
|
||||||
|
|
||||||
override_dh_auto_clean:
|
override_dh_auto_clean:
|
||||||
dotnet clean -maxcpucount:1 --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln || true
|
dotnet clean -maxcpucount:1 --configuration $(CONFIG) $(CURDIR)/MediaBrowser.sln || true
|
||||||
rm -rf '$(CURDIR)/usr/lib/jellyfin'
|
rm -rf '$(CURDIR)/usr'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user