src_prepare-overlay/www-servers/jellyfin-bin/files/jellyfin
Maciej Barć 9fdae24d79
www-servers/jellyfin-bin: init: untabify
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Maciej Barć <xgqt@protonmail.com>
2020-09-21 19:35:45 +02:00

78 lines
2.3 KiB
Plaintext
Executable File

#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Foundation
# Distributed under the terms of the GNU General Public Licence v2
name=jellyfin
cfgfile="/etc/conf.d/${name}"
command="/usr/lib/${name}/bin/${name}"
command_user="${JELLYFIN_USER}"
command_background="yes"
pidfile="/run/${name}.pid"
depend() {
need net
}
start_pre() {
echo "Running with:"
echo " JELLYFIN_ARGS=${JELLYFIN_ARGS}"
echo " JELLYFIN_CACHE_DIR=${JELLYFIN_CACHE_DIR}"
echo " JELLYFIN_CONFIG_DIR=${JELLYFIN_CONFIG_DIR}"
echo " JELLYFIN_DATA_DIR=${JELLYFIN_DATA_DIR}"
echo " JELLYFIN_FFMPEG_OPT=${JELLYFIN_FFMPEG_OPT}"
echo " JELLYFIN_LOG_DIR=${JELLYFIN_LOG_DIR}"
echo " JELLYFIN_NOWEBAPP_OPT=${JELLYFIN_NOWEBAPP_OPT}"
echo " JELLYFIN_RESTART_OPT=${JELLYFIN_RESTART_OPT}"
echo " JELLYFIN_SERVICE_OPT=${JELLYFIN_SERVICE_OPT}"
echo " JELLYFIN_USER=${JELLYFIN_USER}"
echo " JELLYFIN_WEB_OPT=${JELLYFIN_WEB_OPT}"
mkdir -p ${JELLYFIN_CACHE_DIR}
mkdir -p ${JELLYFIN_CONFIG_DIR}
mkdir -p ${JELLYFIN_DATA_DIR}
mkdir -p ${JELLYFIN_LOG_DIR}
chown -R ${command_user}:${command_user} ${JELLYFIN_CACHE_DIR}
chown -R ${command_user}:${command_user} ${JELLYFIN_CONFIG_DIR}
chown -R ${command_user}:${command_user} ${JELLYFIN_DATA_DIR}
chown -R ${command_user}:${command_user} ${JELLYFIN_LOG_DIR}
}
start() {
ebegin "Starting ${name}"
env JELLYFIN_CACHE_DIR=${JELLYFIN_CACHE_DIR} \
JELLYFIN_CONFIG_DIR=${JELLYFIN_CONFIG_DIR} \
JELLYFIN_DATA_DIR=${JELLYFIN_DATA_DIR} \
JELLYFIN_LOG_DIR=${JELLYFIN_LOG_DIR} \
start-stop-daemon --start --exec ${command} \
--background \
--pidfile ${pidfile} \
--user ${command_user} \
--make-pidfile \
-- ${JELLYFIN_ARGS}
eend $?
}
stop() {
ebegin "Stopping ${name}"
env JELLYFIN_CACHE_DIR=${JELLYFIN_CACHE_DIR} \
JELLYFIN_CONFIG_DIR=${JELLYFIN_CONFIG_DIR} \
JELLYFIN_DATA_DIR=${JELLYFIN_DATA_DIR} \
JELLYFIN_LOG_DIR=${JELLYFIN_LOG_DIR} \
start-stop-daemon --stop --exec ${command} \
--pidfile ${pidfile} \
--user ${command_user} \
-- ${JELLYFIN_ARGS}
eend $?
}