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:
commit
c35ffb59b6
14 changed files with 354 additions and 344 deletions
|
@ -15,7 +15,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
## Overview
|
## 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
|
**Shipped version:** 10.8.1~ynh1
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
|
|
||||||
## Vue d'ensemble
|
## 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
|
**Version incluse :** 10.8.1~ynh1
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# See here for more information
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
|
||||||
|
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/path"
|
||||||
admin="john"
|
|
||||||
is_public=1
|
is_public=1
|
||||||
|
admin="john"
|
||||||
discovery=1
|
discovery=1
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
@ -16,6 +13,8 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
# 10.8.0~ynh1
|
||||||
|
upgrade=1 from_commit=384dcd2ff1dbf4b0085edb7f12e4d15f00508e2b
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -23,6 +22,3 @@
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
|
||||||
# ; commit=
|
|
||||||
# name=
|
|
||||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal 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
1
doc/DESCRIPTION_fr.md
Normal 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.
|
|
@ -17,8 +17,8 @@
|
||||||
},
|
},
|
||||||
"license": "GPL-2.0-only",
|
"license": "GPL-2.0-only",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "tituspijean",
|
"name": "tituspijean",
|
||||||
"email": "tituspijean@outlook.com"
|
"email": "tituspijean@outlook.com"
|
||||||
},
|
},
|
||||||
"previous_maintainers": [
|
"previous_maintainers": [
|
||||||
{
|
{
|
||||||
|
@ -27,14 +27,14 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">=4.3"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx"
|
"nginx"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
|
@ -45,10 +45,6 @@
|
||||||
"example": "/jellyfin",
|
"example": "/jellyfin",
|
||||||
"default": "/jellyfin"
|
"default": "/jellyfin"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"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.)."
|
"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",
|
"name": "discovery",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
|
@ -11,47 +11,45 @@ version=$(echo "$pkg_version" | cut -d '-' -f 1)
|
||||||
ffmpeg_pkg_version="5.0.1-8"
|
ffmpeg_pkg_version="5.0.1-8"
|
||||||
ldap_pkg_version="16.0.0.0"
|
ldap_pkg_version="16.0.0.0"
|
||||||
|
|
||||||
architecture=$(dpkg --print-architecture)
|
|
||||||
|
|
||||||
discovery_service_port=1900
|
discovery_service_port=1900
|
||||||
discovery_client_port=7359
|
discovery_client_port=7359
|
||||||
|
|
||||||
ffmpeg_deps=(
|
ffmpeg_deps=(
|
||||||
libass9
|
libass9
|
||||||
libbluray2
|
libbluray2
|
||||||
libc6
|
libc6
|
||||||
libdrm2
|
libdrm2
|
||||||
libfontconfig1
|
libfontconfig1
|
||||||
libfreetype6
|
libfreetype6
|
||||||
libfribidi0
|
libfribidi0
|
||||||
libgcc1
|
libgcc1
|
||||||
libgmp10
|
libgmp10
|
||||||
libgnutls30
|
libgnutls30
|
||||||
libllvm11
|
libllvm11
|
||||||
libmp3lame0
|
libmp3lame0
|
||||||
libopus0
|
libopus0
|
||||||
libstdc++6
|
libstdc++6
|
||||||
libtheora0
|
libtheora0
|
||||||
libvdpau1
|
libvdpau1
|
||||||
libvorbis0a
|
libvorbis0a
|
||||||
libvorbisenc2
|
libvorbisenc2
|
||||||
libwebp6
|
libwebp6
|
||||||
libwebpmux3
|
libwebpmux3
|
||||||
libx11-6
|
libx11-6
|
||||||
libxcb-randr0
|
libxcb-randr0
|
||||||
libzvbi0
|
libzvbi0
|
||||||
zlib1g
|
zlib1g
|
||||||
)
|
)
|
||||||
|
|
||||||
case "$debian" in
|
case "$debian" in
|
||||||
buster) ffmpeg_deps+=( libvpx5 libx264-155 libx265-165 ) ;;
|
buster) ffmpeg_deps+=( libvpx5 libx264-155 libx265-165 ) ;;
|
||||||
bullseye) ffmpeg_deps+=( libvpx6 libx264-160 libx265-192 ) ;;
|
bullseye) ffmpeg_deps+=( libvpx6 libx264-160 libx265-192 ) ;;
|
||||||
*) echo "Unknown release: $debian" >&2; exit 1 ;;
|
*) echo "Unknown release: $debian" >&2; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
case "$architecture" in
|
case "$YNH_ARCH" in
|
||||||
arm64) : ;;
|
arm64) : ;;
|
||||||
armhf) : ;;
|
armhf) : ;;
|
||||||
*) ffmpeg_deps+=( libdrm-intel1 libopencl1 ) ;;
|
*) ffmpeg_deps+=( libdrm-intel1 libopencl1 ) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
jellyfin_deps=(at libsqlite3-0 libfontconfig1 libfreetype6 libssl1.1)
|
jellyfin_deps=(at libsqlite3-0 libfontconfig1 libfreetype6 libssl1.1)
|
||||||
|
@ -63,41 +61,41 @@ pkg_dependencies="${ffmpeg_deps[*]} ${jellyfin_deps[*]}"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
install_jellyfin_packages() {
|
install_jellyfin_packages() {
|
||||||
# In case of a new version, the url change from
|
# 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/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_$architecture.deb
|
# 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
|
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
|
if ! curl --output /dev/null --silent --head --fail "$src_url"; then
|
||||||
ynh_replace_string \
|
ynh_replace_string \
|
||||||
--match_string="releases/server/debian/versions/stable/$pkg/$version/" \
|
--match_string="releases/server/debian/versions/stable/$pkg/$version/" \
|
||||||
--replace_string="archive/debian/stable/$version/$pkg/" \
|
--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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create the temporary directory
|
# Create the temporary directory
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
# Download the deb files
|
# Download the deb files
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$debian.$architecture"
|
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$debian.$YNH_ARCH"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id="server.$debian.$architecture"
|
ynh_setup_source --dest_dir=$tempdir --source_id="server.$debian.$YNH_ARCH"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id="web.$debian.$architecture"
|
ynh_setup_source --dest_dir=$tempdir --source_id="web.$debian.$YNH_ARCH"
|
||||||
|
|
||||||
# Install the packages
|
# Install the packages
|
||||||
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-web.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-ffmpeg5.deb
|
||||||
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-server.deb
|
||||||
|
|
||||||
rm -rf "$tempdir"
|
ynh_secure_remove --file="$tempdir"
|
||||||
|
|
||||||
# The doc says it should be called only once,
|
# The doc says it should be called only once,
|
||||||
# but the code says multiple calls are supported.
|
# but the code says multiple calls are supported.
|
||||||
# Also, they're already installed so that should be quasi instantaneous.
|
# Also, they're already installed so that should be quasi instantaneous.
|
||||||
ynh_install_app_dependencies \
|
ynh_install_app_dependencies \
|
||||||
jellyfin-ffmpeg5="$ffmpeg_pkg_version-$debian" \
|
jellyfin-web="$pkg_version" \
|
||||||
jellyfin-server="$pkg_version" \
|
jellyfin-ffmpeg5="$ffmpeg_pkg_version-$debian" \
|
||||||
jellyfin-web="$pkg_version"
|
jellyfin-server="$pkg_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
|
@ -21,9 +21,6 @@ new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
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
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -32,14 +29,19 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
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
|
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
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
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.
|
# 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"
|
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_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
|
# RELOAD NGINX
|
||||||
|
|
|
@ -25,8 +25,8 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
discovery=$YNH_APP_ARG_DISCOVERY
|
discovery=$YNH_APP_ARG_DISCOVERY
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
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 "$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 "
|
test ! -e "$config_path" || ynh_die --message="There is already a directory: $config_path "
|
||||||
|
|
||||||
architecture=$(dpkg --print-architecture)
|
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
|
||||||
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
|
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
|
||||||
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
|
@ -76,23 +75,23 @@ discovery_service=$discovery
|
||||||
discovery_client=$discovery
|
discovery_client=$discovery
|
||||||
|
|
||||||
if [ $discovery -eq 1 ]; then
|
if [ $discovery -eq 1 ]; then
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
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
|
if ynh_port_available --port=$discovery_service_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
||||||
else
|
else
|
||||||
discovery_service=0
|
discovery_service=0
|
||||||
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
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
|
if ynh_port_available --port=$discovery_client_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
||||||
else
|
else
|
||||||
discovery_client=0
|
discovery_client=0
|
||||||
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
||||||
|
@ -112,14 +111,6 @@ ynh_script_progression --message="Installing packages..." --weight=1
|
||||||
|
|
||||||
install_jellyfin_packages
|
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
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -134,12 +125,22 @@ if grep -q "^render:" /etc/group; then
|
||||||
fi
|
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..."
|
ynh_print_info --message="Waiting 30s to let Jellyfin fully start a first time..."
|
||||||
sleep 30
|
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
|
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/
|
mkdir -p /var/lib/jellyfin/plugins/configurations/
|
||||||
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
|
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
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -168,15 +178,6 @@ ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# 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
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -35,11 +35,28 @@ then
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
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
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=3
|
ynh_script_progression --message="Removing dependencies..." --weight=3
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,46 +69,34 @@ dpkg --remove jellyfin-server
|
||||||
dpkg --remove jellyfin-ffmpeg5
|
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="$final_path"
|
||||||
ynh_secure_remove --file="$config_path"
|
ynh_secure_remove --file="$config_path"
|
||||||
ynh_secure_remove --file="/etc/systemd/system/jellyfin.service.d"
|
ynh_secure_remove --file="/etc/systemd/system/jellyfin.service.d"
|
||||||
|
|
||||||
#=================================================
|
# Remove the log files
|
||||||
# REMOVE NGINX CONFIGURATION
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
124
scripts/restore
124
scripts/restore
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -43,13 +43,25 @@ test ! -d $final_path \
|
||||||
test ! -d $config_path \
|
test ! -d $config_path \
|
||||||
|| ynh_die --message="There is already a directory: $config_path "
|
|| ynh_die --message="There is already a directory: $config_path "
|
||||||
|
|
||||||
architecture=$(dpkg --print-architecture)
|
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
|
||||||
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
|
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
|
||||||
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# 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
|
# OPEN PORTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -58,35 +70,28 @@ discovery_service=$discovery
|
||||||
discovery_client=$discovery
|
discovery_client=$discovery
|
||||||
|
|
||||||
if [ $discovery -eq 1 ]; then
|
if [ $discovery -eq 1 ]; then
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
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
|
if ynh_port_available --port=$discovery_service_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
||||||
else
|
else
|
||||||
discovery_service=0
|
discovery_service=0
|
||||||
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
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
|
if ynh_port_available --port=$discovery_client_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
||||||
else
|
else
|
||||||
discovery_client=0
|
discovery_client=0
|
||||||
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
||||||
ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client
|
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
|
# 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="$config_path"
|
||||||
ynh_restore_file --origin_path="/etc/default/jellyfin" --not_mandatory
|
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
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -121,6 +118,32 @@ ynh_script_progression --message="Reinstalling packages..." --weight=7
|
||||||
|
|
||||||
install_jellyfin_packages
|
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
|
# 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
|
ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" --not_mandatory
|
||||||
systemctl enable jellyfin.service --quiet
|
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
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -142,22 +172,6 @@ needed_ports=()
|
||||||
# Integrate service and require to expose the ports if needed
|
# 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[@]}"
|
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
|
# 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
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -12,76 +12,76 @@ source /usr/share/yunohost/helpers
|
||||||
# Edit version numbers in _common.sh before running the script.
|
# Edit version numbers in _common.sh before running the script.
|
||||||
|
|
||||||
prepare_source () {
|
prepare_source () {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=tda
|
local legacy_args=tda
|
||||||
local -A args_array=( [t]=template= [d]=destination= [a]=architecture= )
|
local -A args_array=( [t]=template= [d]=destination= [a]=architecture= )
|
||||||
local template
|
local template
|
||||||
local destination
|
local destination
|
||||||
local architecture
|
local architecture
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
local template_path
|
local template_path
|
||||||
|
|
||||||
if [ -f "../conf/$template" ]; then
|
if [ -f "../conf/$template" ]; then
|
||||||
template_path="../conf/$template"
|
template_path="../conf/$template"
|
||||||
elif [ -f "../settings/conf/$template" ]; then
|
elif [ -f "../settings/conf/$template" ]; then
|
||||||
template_path="../settings/conf/$template"
|
template_path="../settings/conf/$template"
|
||||||
elif [ -f "$template" ]; then
|
elif [ -f "$template" ]; then
|
||||||
template_path=$template
|
template_path=$template
|
||||||
else
|
else
|
||||||
ynh_die --message="The provided template $template doesn't exist"
|
ynh_die --message="The provided template $template doesn't exist"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp "$template_path" "$destination"
|
cp "$template_path" "$destination"
|
||||||
|
|
||||||
ynh_replace_vars --file="$destination"
|
ynh_replace_vars --file="$destination"
|
||||||
|
|
||||||
local official_checksum
|
local official_checksum
|
||||||
local official_checksum_url
|
local official_checksum_url
|
||||||
local filename
|
local filename
|
||||||
local checksum
|
local checksum
|
||||||
local url
|
local url
|
||||||
|
|
||||||
# Create the temporary directory
|
# Create the temporary directory
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
url=$(grep "SOURCE_URL=" "$destination" | cut -d "=" -f 2)
|
url=$(grep "SOURCE_URL=" "$destination" | cut -d "=" -f 2)
|
||||||
echo $url
|
echo $url
|
||||||
filename=${url##*/}
|
filename=${url##*/}
|
||||||
echo $filename
|
echo $filename
|
||||||
curl -s -4 -L $url -o "$tempdir/$filename"
|
curl -s -4 -L $url -o "$tempdir/$filename"
|
||||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||||
|
|
||||||
ynh_secure_remove $tempdir
|
ynh_secure_remove $tempdir
|
||||||
|
|
||||||
official_checksum_url=$(grep "SOURCE_SUM=" "$destination" | cut -d "=" -f 2)
|
official_checksum_url=$(grep "SOURCE_SUM=" "$destination" | cut -d "=" -f 2)
|
||||||
if [[ "$official_checksum_url" != "none" ]]; then
|
if [[ "$official_checksum_url" != "none" ]]; then
|
||||||
official_checksum=$(curl -L -s "${official_checksum_url}" | cut -d ' ' -f 1)
|
official_checksum=$(curl -L -s "${official_checksum_url}" | cut -d ' ' -f 1)
|
||||||
echo $official_checksum
|
echo $official_checksum
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$official_checksum_url" != "none" && "$official_checksum" != "$checksum" ]]; then
|
if [[ "$official_checksum_url" != "none" && "$official_checksum" != "$checksum" ]]; then
|
||||||
echo "Downloaded file checksum ($checksum) does not match official checksum ($official_checksum)"
|
echo "Downloaded file checksum ($checksum) does not match official checksum ($official_checksum)"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
sed -i "s/SOURCE_SUM=.*/SOURCE_SUM=${checksum}/" "$destination"
|
sed -i "s/SOURCE_SUM=.*/SOURCE_SUM=${checksum}/" "$destination"
|
||||||
echo "$destination updated"
|
echo "$destination updated"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
debians=("buster" "bullseye")
|
debians=("buster" "bullseye")
|
||||||
architectures=("amd64" "arm64" "armhf")
|
architectures=("amd64" "arm64" "armhf")
|
||||||
for debian in "${debians[@]}"; do
|
for debian in "${debians[@]}"; do
|
||||||
for architecture in "${architectures[@]}"; do
|
for architecture in "${architectures[@]}"; do
|
||||||
prepare_source --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.$debian.$architecture.src" --architecture="$architecture"
|
prepare_source --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.$debian.$architecture.src" --architecture="$architecture"
|
||||||
prepare_source --template="../conf/web.src.default" --destination="../conf/web.$debian.$architecture.src" --architecture="$architecture"
|
prepare_source --template="../conf/web.src.default" --destination="../conf/web.$debian.$architecture.src" --architecture="$architecture"
|
||||||
prepare_source --template="../conf/server.src.default" --destination="../conf/server.$debian.$architecture.src" --architecture="$architecture"
|
prepare_source --template="../conf/server.src.default" --destination="../conf/server.$debian.$architecture.src" --architecture="$architecture"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
prepare_source --template="../conf/ldap.src.default" --destination="../conf/ldap.src"
|
prepare_source --template="../conf/ldap.src.default" --destination="../conf/ldap.src"
|
||||||
|
|
||||||
sed -i "s# \"version\": \".*# \"version\": \"${version}\~ynh1\",#" ../manifest.json
|
sed -i "s# \"version\": \".*# \"version\": \"${version}\~ynh1\",#" ../manifest.json
|
||||||
|
|
||||||
git add _common.sh ../manifest.json ../conf/ffmpeg.*.src ../conf/web.*.src ../conf/server.*.src ../conf/ldap.src
|
git add _common.sh ../manifest.json ../conf/ffmpeg.*.src ../conf/web.*.src ../conf/server.*.src ../conf/ldap.src
|
||||||
git commit -m "Upgrade to v$version"
|
git commit -m "Upgrade to v$version"
|
||||||
|
|
154
scripts/upgrade
154
scripts/upgrade
|
@ -30,14 +30,37 @@ ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
architecture=$(dpkg --print-architecture)
|
if [[ ! "$YNH_ARCH" =~ ^(amd64|arm64|armhf)$ ]]; then
|
||||||
if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
|
ynh_die "Jellyfin is not compatible with your architecture, $YNH_ARCH, which is neither amd64, arm64, or armhf." 1
|
||||||
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If path keys do not exist, create them
|
# If path keys do not exist, create them
|
||||||
|
@ -73,63 +96,62 @@ if [ -z "$discovery" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "/etc/logrotate.d/$app" ]; then
|
if [ ! -f "/etc/logrotate.d/$app" ]; then
|
||||||
# Fix possibly missing file due to buggy restore:
|
# Fix possibly missing file due to buggy restore:
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
fi
|
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_service=$discovery
|
||||||
discovery_client=$discovery
|
discovery_client=$discovery
|
||||||
|
|
||||||
if [ $discovery -eq 1 ]; then
|
if [ $discovery -eq 1 ]; then
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
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
|
if ynh_port_available --port=$discovery_service_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
|
||||||
else
|
else
|
||||||
discovery_service=0
|
discovery_service=0
|
||||||
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
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
|
if ynh_port_available --port=$discovery_client_port; then
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
|
||||||
else
|
else
|
||||||
discovery_client=0
|
discovery_client=0
|
||||||
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
|
||||||
ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client
|
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
|
# NGINX CONFIGURATION
|
||||||
|
@ -140,31 +162,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
# UPDATE A CONFIG FILE
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE packages
|
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
# TODO: investigate if we can avoid overriding system.xml
|
# TODO: investigate if we can avoid overriding system.xml
|
||||||
#ynh_add_config --template="system.xml" --destination="$config_path/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/
|
mkdir -p /var/lib/jellyfin/plugins/configurations/
|
||||||
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
|
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
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -192,20 +202,12 @@ ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
chown -R $app: $config_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# 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
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue