1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jellyfin_ynh.git synced 2024-09-03 19:26:29 +02:00

Merge branch 'example' into 10.8.1-fixed

This commit is contained in:
yalh76 2022-07-20 09:59:19 +02:00
commit c35ffb59b6
14 changed files with 354 additions and 344 deletions

View file

@ -15,7 +15,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Media System that manage and stream your media.
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.
**Shipped version:** 10.8.1~ynh1

View file

@ -15,7 +15,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble
Système multimédia qui gère et diffuse vos médias.
Jellyfin vous permet de collecter, gérer et diffuser vos médias. Exécutez le serveur Jellyfin sur votre système et accédez au principal système de divertissement à logiciel libre.
**Version incluse :** 10.8.1~ynh1

View file

@ -1,12 +1,9 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
admin="john"
discovery=1
; Checks
pkg_linter=1
@ -16,6 +13,8 @@
setup_private=1
setup_public=1
upgrade=1
# 10.8.0~ynh1
upgrade=1 from_commit=384dcd2ff1dbf4b0085edb7f12e4d15f00508e2b
backup_restore=1
multi_instance=0
port_already_use=0
@ -23,6 +22,3 @@
;;; Options
Email=
Notification=none
;;; Upgrade options
# ; commit=
# name=

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Jellyfin vous permet de collecter, gérer et diffuser vos médias. Exécutez le serveur Jellyfin sur votre système et accédez au principal système de divertissement à logiciel libre.

View file

@ -27,14 +27,14 @@
}
],
"requirements": {
"yunohost": ">=4.3"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -45,10 +45,6 @@
"example": "/jellyfin",
"default": "/jellyfin"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
@ -58,6 +54,10 @@
"fr": "Jellyfin a son propre système de connexion, vous devriez la laisser publique pour permettre la connexion de clients externes (app mobile, etc.)."
}
},
{
"name": "admin",
"type": "user"
},
{
"name": "discovery",
"type": "boolean",

View file

@ -11,8 +11,6 @@ version=$(echo "$pkg_version" | cut -d '-' -f 1)
ffmpeg_pkg_version="5.0.1-8"
ldap_pkg_version="16.0.0.0"
architecture=$(dpkg --print-architecture)
discovery_service_port=1900
discovery_client_port=7359
@ -48,7 +46,7 @@ case "$debian" in
bullseye) ffmpeg_deps+=( libvpx6 libx264-160 libx265-192 ) ;;
*) echo "Unknown release: $debian" >&2; exit 1 ;;
esac
case "$architecture" in
case "$YNH_ARCH" in
arm64) : ;;
armhf) : ;;
*) ffmpeg_deps+=( libdrm-intel1 libopencl1 ) ;;
@ -64,15 +62,15 @@ pkg_dependencies="${ffmpeg_deps[*]} ${jellyfin_deps[*]}"
install_jellyfin_packages() {
# In case of a new version, the url change from
# https://repo.jellyfin.org/releases/server/debian/versions/stable/server/X.X.X/jellyfin-server_X.X.X-1_$architecture.deb to
# https://repo.jellyfin.org/archive/debian/stable/X.X.X/server/jellyfin-server_X.X.X-1_$architecture.deb
# https://repo.jellyfin.org/releases/server/debian/versions/stable/server/X.X.X/jellyfin-server_X.X.X-1_$YNH_ARCH.deb to
# https://repo.jellyfin.org/archive/debian/stable/X.X.X/server/jellyfin-server_X.X.X-1_$YNH_ARCH.deb
for pkg in web server; do
src_url=$(grep 'SOURCE_URL=' "$YNH_APP_BASEDIR/conf/$pkg.$debian.$architecture.src" | cut -d= -f2-)
src_url=$(grep 'SOURCE_URL=' "$YNH_APP_BASEDIR/conf/$pkg.$debian.$YNH_ARCH.src" | cut -d= -f2-)
if ! curl --output /dev/null --silent --head --fail "$src_url"; then
ynh_replace_string \
--match_string="releases/server/debian/versions/stable/$pkg/$version/" \
--replace_string="archive/debian/stable/$version/$pkg/" \
--target_file="$YNH_APP_BASEDIR/conf/$pkg.$debian.$architecture.src"
--target_file="$YNH_APP_BASEDIR/conf/$pkg.$debian.$YNH_ARCH.src"
fi
done
@ -80,24 +78,24 @@ install_jellyfin_packages() {
tempdir="$(mktemp -d)"
# Download the deb files
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$debian.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="server.$debian.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="web.$debian.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$debian.$YNH_ARCH"
ynh_setup_source --dest_dir=$tempdir --source_id="server.$debian.$YNH_ARCH"
ynh_setup_source --dest_dir=$tempdir --source_id="web.$debian.$YNH_ARCH"
# Install the packages
ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-web.deb
ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-ffmpeg5.deb
ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-server.deb
ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-web.deb
rm -rf "$tempdir"
ynh_secure_remove --file="$tempdir"
# The doc says it should be called only once,
# but the code says multiple calls are supported.
# Also, they're already installed so that should be quasi instantaneous.
ynh_install_app_dependencies \
jellyfin-web="$pkg_version" \
jellyfin-ffmpeg5="$ffmpeg_pkg_version-$debian" \
jellyfin-server="$pkg_version" \
jellyfin-web="$pkg_version"
jellyfin-server="$pkg_version"
}
#=================================================

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -21,9 +21,6 @@ new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get --app="$app" --key=port)
config_path=$(ynh_app_setting_get --app="$app" --key=config_path)
#=================================================
# LOAD SETTINGS
#=================================================
@ -32,14 +29,19 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app="$app" --key=port)
config_path=$(ynh_app_setting_get --app="$app" --key=config_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=10
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -127,7 +129,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" --timeout=15
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15
#=================================================
# RELOAD NGINX

View file

@ -25,8 +25,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
discovery=$YNH_APP_ARG_DISCOVERY
app=$YNH_APP_INSTANCE_NAME
@ -41,9 +41,8 @@ config_path=/etc/jellyfin
test ! -e "$final_path" || ynh_die --message="There is already a directory: $final_path "
test ! -e "$config_path" || ynh_die --message="There is already a directory: $config_path "
architecture=$(dpkg --print-architecture)
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
fi
# Register (book) web path
@ -78,7 +77,7 @@ discovery_client=$discovery
if [ $discovery -eq 1 ]; then
ynh_script_progression --message="Configuring firewall..." --weight=1
# Open port 1900 for service auto-discovery
# Open port $discovery_service_port for service auto-discovery
if ynh_port_available --port=$discovery_service_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
else
@ -86,7 +85,7 @@ if [ $discovery -eq 1 ]; then
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
fi
# Open port 7359 for client auto-discovery
# Open port $discovery_client_port for client auto-discovery
if ynh_port_available --port=$discovery_client_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
else
@ -112,14 +111,6 @@ ynh_script_progression --message="Installing packages..." --weight=1
install_jellyfin_packages
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=6
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -134,12 +125,22 @@ if grep -q "^render:" /etc/group; then
fi
#=================================================
# MODIFY A CONFIG FILE
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=6
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_print_info --message="Waiting 30s to let Jellyfin fully start a first time..."
sleep 30
ynh_script_progression --message="Configuring the settings..." --weight=1
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
@ -156,6 +157,15 @@ ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --so
mkdir -p /var/lib/jellyfin/plugins/configurations/
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
@ -168,15 +178,6 @@ ynh_multimedia_addaccess $app
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# SETUP LOGROTATE
#=================================================

View file

@ -35,11 +35,28 @@ then
yunohost service remove $app
fi
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
@ -52,46 +69,34 @@ dpkg --remove jellyfin-server
dpkg --remove jellyfin-ffmpeg5
#=================================================
# REMOVE APP DIRECTORIES
# CLOSE A PORT
#=================================================
ynh_script_progression --message="Removing app directories..." --weight=1
# Remove the app directory securely
if [[ $discovery_service -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_service_port$"
then
ynh_script_progression --message="Closing port $discovery_service_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_service_port
fi
if [[ $discovery_client -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_client_port$"
then
ynh_script_progression --message="Closing port $discovery_client_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_client_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file="$config_path"
ynh_secure_remove --file="/etc/systemd/system/jellyfin.service.d"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# CLOSE A PORT
#=================================================
if [[ $discovery_service -eq 1 ]] && yunohost firewall list | grep -q "\- 1900$"
then
ynh_script_progression --message="Closing port 1900..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP 1900
fi
if [[ $discovery_client -eq 1 ]] && yunohost firewall list | grep -q "\- 7359$"
then
ynh_script_progression --message="Closing port 7359..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP 7359
fi
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -43,13 +43,25 @@ test ! -d $final_path \
test ! -d $config_path \
|| ynh_die --message="There is already a directory: $config_path "
architecture=$(dpkg --print-architecture)
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
fi
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
if grep -q "^render:" /etc/group; then
# Add user to render group
adduser $app render
fi
#=================================================
# OPEN PORTS
#=================================================
@ -60,7 +72,7 @@ discovery_client=$discovery
if [ $discovery -eq 1 ]; then
ynh_script_progression --message="Configuring firewall..." --weight=1
# Open port 1900 for service auto-discovery
# Open port $discovery_service_port for service auto-discovery
if ynh_port_available --port=$discovery_service_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
else
@ -68,7 +80,7 @@ if [ $discovery -eq 1 ]; then
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
fi
# Open port 7359 for client auto-discovery
# Open port $discovery_client_port for client auto-discovery
if ynh_port_available --port=$discovery_client_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
else
@ -80,13 +92,6 @@ fi
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -96,14 +101,6 @@ ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$config_path"
ynh_restore_file --origin_path="/etc/default/jellyfin" --not_mandatory
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -121,6 +118,32 @@ ynh_script_progression --message="Reinstalling packages..." --weight=7
install_jellyfin_packages
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=2
# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir
# Allow Jellyfin to write into these directories
ynh_multimedia_addaccess $app
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -129,6 +152,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" --not_mandatory
systemctl enable jellyfin.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -142,22 +172,6 @@ needed_ports=()
# Integrate service and require to expose the ports if needed
yunohost service add $app --description="Jellyfin media center" ${needed_ports:+--needs_exposed_ports} "${needed_ports[@]}"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# START SYSTEMD SERVICE
#=================================================
@ -165,16 +179,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=2
# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir
# Allow Jellyfin to write into these directories
ynh_multimedia_addaccess $app
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -30,14 +30,37 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
architecture=$(dpkg --print-architecture)
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
fi
# If path keys do not exist, create them
@ -77,33 +100,13 @@ if [ ! -f "/etc/logrotate.d/$app" ]; then
ynh_use_logrotate
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# OPEN PORTS
#=================================================
discovery_service=$discovery
discovery_client=$discovery
if [ $discovery -eq 1 ]; then
ynh_script_progression --message="Configuring firewall..." --weight=1
# Open port 1900 for service auto-discovery
# Open port $discovery_service_port for service auto-discovery
if ynh_port_available --port=$discovery_service_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
else
@ -111,7 +114,7 @@ if [ $discovery -eq 1 ]; then
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
fi
# Open port 7359 for client auto-discovery
# Open port $discovery_client_port for client auto-discovery
if ynh_port_available --port=$discovery_client_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
else
@ -123,13 +126,32 @@ fi
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
if grep -q "^render:" /etc/group; then
# Add user to render group
adduser $app render
fi
#=================================================
# STOP SYSTEMD SERVICE
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# UPGRADE PACKAGES
#=================================================
ynh_script_progression --message="Upgrading packages..." --weight=3
install_jellyfin_packages
#=================================================
# NGINX CONFIGURATION
@ -140,31 +162,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
# SPECIFIC UPGRADE
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies
# UPDATE A CONFIG FILE
#=================================================
# UPGRADE packages
#=================================================
ynh_script_progression --message="Upgrading packages..." --weight=3
install_jellyfin_packages
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Setting up configuration files..." --weight=2
ynh_script_progression --message="Updating a configuration file..." --weight=2
# TODO: investigate if we can avoid overriding system.xml
#ynh_add_config --template="system.xml" --destination="$config_path/system.xml"
@ -180,6 +182,14 @@ ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --so
mkdir -p /var/lib/jellyfin/plugins/configurations/
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
@ -192,20 +202,12 @@ ynh_multimedia_addaccess $app
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R $app: $final_path
chown -R $app: $config_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage application logfile(s)
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================