mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-19 11:59:02 -07:00
a73d255f51
* 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
81 lines
2.5 KiB
Bash
81 lines
2.5 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
NAME=jellyfin
|
|
CONF_FILE=/etc/${NAME}.conf
|
|
DEFAULT_FILE=/etc/default/${NAME}
|
|
|
|
# Source Jellyfin default configuration
|
|
if [[ -f $DEFAULT_FILE ]]; then
|
|
. $DEFAULT_FILE
|
|
fi
|
|
|
|
# Source Jellyfin user configuration overrides
|
|
if [[ -f $CONF_FILE ]]; then
|
|
. $CONF_FILE
|
|
fi
|
|
|
|
# Data directory where Jellyfin database, cache and logs are stored
|
|
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$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 has appropriate permissions
|
|
if [[ ! -d $PROGRAMDATA ]]; then
|
|
mkdir $PROGRAMDATA
|
|
chown -R jellyfin:jellyfin $PROGRAMDATA
|
|
fi
|
|
|
|
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)
|
|
;;
|
|
*)
|
|
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
|