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

Merge pull request #71 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2021-05-11 21:14:24 +02:00 committed by GitHub
commit 8ed403b30a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 303 additions and 25 deletions

View file

@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
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. 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.7.0 **Shipped version:** 10.7.5
## Screenshots ## Screenshots

View file

@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install
## Vue d'ensemble ## Vue d'ensemble
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. 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.7.0 **Version incluse :** 10.7.5
## Captures d'écran ## Captures d'écran

View file

@ -24,7 +24,7 @@
# 10.6.4~ynh3 # 10.6.4~ynh3
#upgrade=1 from_commit=5478712c0ca7683503bc1b50cfafe81ea508065e #upgrade=1 from_commit=5478712c0ca7683503bc1b50cfafe81ea508065e
# 10.7.0~ynh1 # 10.7.0~ynh1
upgrade=1 from_commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b #upgrade=1 from_commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 port_already_use=0

7
conf/ffmpeg.amd64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.3.2-1/jellyfin-ffmpeg_4.3.2-1-buster_amd64.deb
SOURCE_SUM=54987f4ede995e50e6662e7741df5205005b7e8d881af8145b71d319df6f0cb2
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-ffmpeg.deb

7
conf/ffmpeg.arm64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.3.2-1/jellyfin-ffmpeg_4.3.2-1-buster_arm64.deb
SOURCE_SUM=02b8ee277f428b0519036b1657873ec65c124090f605daa235de10eb7c5a381d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-ffmpeg.deb

7
conf/ffmpeg.armhf.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.3.2-1/jellyfin-ffmpeg_4.3.2-1-buster_armhf.deb
SOURCE_SUM=04e99a82aae906af6fd526bfbde22b6a8ea2b3b2bb1460561ff2c543b0963d4f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-ffmpeg.deb

7
conf/ffmpeg.src.default Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/__FFMPEG_PKG_VERSION__/jellyfin-ffmpeg___FFMPEG_PKG_VERSION__-__DEBIAN_____ARCHITECTURE__.deb
SOURCE_SUM=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/__FFMPEG_PKG_VERSION__/jellyfin-ffmpeg___FFMPEG_PKG_VERSION__-__DEBIAN_____ARCHITECTURE__.deb.sha256sum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-ffmpeg.deb

View file

@ -5,4 +5,3 @@ SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

7
conf/server.amd64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.5/jellyfin-server_10.7.5-1_amd64.deb
SOURCE_SUM=5b3c1fe15a1b701311e8b07a9b15f6d7a45e58d4e3b388bdf8e3afe9530483d5
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-server.deb

7
conf/server.arm64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.5/jellyfin-server_10.7.5-1_arm64.deb
SOURCE_SUM=01da7e3250c7b32b0090680db0199f86130171b1c7e499557f339827ffce6185
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-server.deb

7
conf/server.armhf.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.5/jellyfin-server_10.7.5-1_armhf.deb
SOURCE_SUM=2418ab32fb13217a138229aad8101876bc221375fc9b3194e6c2f2b8b7d998f4
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-server.deb

7
conf/server.src.default Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/__VERSION__/jellyfin-server___PKG_VERSION_____ARCHITECTURE__.deb
SOURCE_SUM=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/__VERSION__/jellyfin-server___PKG_VERSION_____ARCHITECTURE__.deb.sha256sum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-server.deb

7
conf/web.amd64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.5/jellyfin-web_10.7.5-1_all.deb
SOURCE_SUM=294a00e7a63c1a7f826e4da798663e872d2f2d227061b60253ac9cecd8642301
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-web.deb

7
conf/web.arm64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.5/jellyfin-web_10.7.5-1_all.deb
SOURCE_SUM=294a00e7a63c1a7f826e4da798663e872d2f2d227061b60253ac9cecd8642301
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-web.deb

7
conf/web.armhf.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.5/jellyfin-web_10.7.5-1_all.deb
SOURCE_SUM=294a00e7a63c1a7f826e4da798663e872d2f2d227061b60253ac9cecd8642301
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-web.deb

7
conf/web.src.default Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/__VERSION__/jellyfin-web___PKG_VERSION___all.deb
SOURCE_SUM=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/__VERSION__/jellyfin-web___PKG_VERSION___all.deb.sha256sum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false
SOURCE_FILENAME=jellyfin-web.deb

View file

@ -6,7 +6,7 @@
"en": "Media System that manage and stream your media.", "en": "Media System that manage and stream your media.",
"fr": "Système multimédia qui gère et diffuse vos médias." "fr": "Système multimédia qui gère et diffuse vos médias."
}, },
"version": "10.7.0~ynh2", "version": "10.7.5~ynh1",
"url": "https://github.com/jellyfin/jellyfin", "url": "https://github.com/jellyfin/jellyfin",
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"maintainer": { "maintainer": {

View file

@ -4,7 +4,13 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
pkg_version="10.7.0-1" debian=$(lsb_release --codename --short)
pkg_version="10.7.5-1"
version=$(echo "$pkg_version" | cut -d '-' -f 1)
ffmpeg_pkg_version="4.3.2-1"
architecture=$(dpkg --print-architecture)
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -54,6 +54,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="$config_path" ynh_backup --src_path="$config_path"
#================================================= #=================================================

View file

@ -72,7 +72,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=2 ynh_script_progression --message="Stopping a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
@ -127,7 +127,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" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" --timeout=15
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -40,6 +40,11 @@ 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 [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
fi
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -70,7 +75,18 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" --key="https://repo.jellyfin.org/jellyfin_team.gpg.key" --package="jellyfin=$pkg_version" # Create the temporary directory
tempdir="$(mktemp -d)"
# Download the deb files
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture"
# Install the packages
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -88,14 +104,19 @@ ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create --username=$app ynh_system_user_create --username=$app
if [ $(grep -q "^render:" /etc/group) ]; then
# Add user to render group
adduser $app render
fi
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Configuring the settings..." --weight=1 ynh_script_progression --message="Configuring the settings..." --weight=1
# Load services once to generate system.xml # Load services once to generate system.xml
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Startup complete" 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="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
# Port config # Port config
ynh_replace_string --match_string="<PublicPort>8096</PublicPort>" --replace_string="<PublicPort>$port</PublicPort>" --target_file="$config_path/network.xml" ynh_replace_string --match_string="<PublicPort>8096</PublicPort>" --replace_string="<PublicPort>$port</PublicPort>" --target_file="$config_path/network.xml"
@ -107,6 +128,10 @@ ynh_replace_string --match_string="<BaseUrl />" --replace_string="<BaseUrl>$path
# Disable Setup Wizard # Disable Setup Wizard
ynh_replace_string --match_string="<IsStartupWizardCompleted>false</IsStartupWizardCompleted>" --replace_string="<IsStartupWizardCompleted>true</IsStartupWizardCompleted>" --target_file="$config_path/system.xml" ynh_replace_string --match_string="<IsStartupWizardCompleted>false</IsStartupWizardCompleted>" --replace_string="<IsStartupWizardCompleted>true</IsStartupWizardCompleted>" --target_file="$config_path/system.xml"
# Lower logging verbosity
cp "$config_path/logging.default.json" "$config_path/logging.json"
ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" --target_file="$config_path/logging.json"
ynh_store_file_checksum --file="$config_path/network.xml" ynh_store_file_checksum --file="$config_path/network.xml"
ynh_store_file_checksum --file="$config_path/system.xml" ynh_store_file_checksum --file="$config_path/system.xml"
@ -129,6 +154,14 @@ ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files # Set permissions to app files
chown -R $app: $final_path chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
@ -142,7 +175,7 @@ yunohost service add $app --description="Jellyfin media center" --log_type="syst
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT

View file

@ -17,6 +17,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -36,8 +38,19 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies apt-get remove jellyfin-web -y
ynh_remove_app_dependencies apt-get remove jellyfin-server -y
apt-get remove jellyfin-ffmpeg -y
#=================================================
# REMOVE APP DIRECTORIES
#=================================================
ynh_script_progression --message="Removing app directories..." --weight=1
# Remove the app directory securely
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 # REMOVE NGINX CONFIGURATION
@ -47,6 +60,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_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
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -44,6 +44,11 @@ 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 [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
fi
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
@ -84,8 +89,18 @@ chown -R $app: $final_path
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7 ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies # Create the temporary directory
ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( lsb_release -c -s ) main" --package="jellyfin" --key="https://repo.jellyfin.org/debian/jellyfin_team.gpg.key" tempdir="$(mktemp -d)"
# Download the deb files
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture"
# Install the packages
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -99,7 +114,7 @@ yunohost service add $app --description="Jellyfin media center" --log_type="syst
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Startup complete" ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

82
scripts/update_version.sh Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# META HELPER FOR PACKAGE RELEASES
#=================================================
# This script is meant to be manually run by the app packagers
# to automatically update the source files.
# Edit version numbers in _common.sh before running the script.
prepare_source () {
# Declare an array to define the options of this helper.
local legacy_args=tda
local -A args_array=( [t]=template= [d]=destination= [a]=architecture= )
local template
local destination
local architecture
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local template_path
if [ -f "../conf/$template" ]; then
template_path="../conf/$template"
elif [ -f "../settings/conf/$template" ]; then
template_path="../settings/conf/$template"
elif [ -f "$template" ]; then
template_path=$template
else
ynh_die --message="The provided template $template doesn't exist"
fi
cp "$template_path" "$destination"
ynh_replace_vars --file="$destination"
local official_checksum
local official_checksum_url
local filename
local checksum
local url
# Create the temporary directory
tempdir="$(mktemp -d)"
official_checksum_url=$(grep "SOURCE_SUM=" "$destination" | cut -d "=" -f 2)
official_checksum=$(curl -L -s "${official_checksum_url}" | cut -d ' ' -f 1)
echo $official_checksum
url=$(grep "SOURCE_URL=" "$destination" | cut -d "=" -f 2)
echo $url
filename=${url##*/}
echo $filename
curl -s -4 -L $url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
ynh_secure_remove $tempdir
if [[ "$official_checksum" != "$checksum" ]]; then
echo "Downloaded file checksum ($checksum) does not match official checksum ($official_checksum)"
exit 1
else
sed -i "s/SOURCE_SUM=.*/SOURCE_SUM=${checksum}/" "$destination"
echo "$destination updated"
fi
}
architectures=("amd64" "arm64" "armhf")
for architecture in "${architectures[@]}"; do
prepare_source --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.$architecture.src" --architecture="$architecture"
prepare_source --template="../conf/web.src.default" --destination="../conf/web.$architecture.src" --architecture="$architecture"
prepare_source --template="../conf/server.src.default" --destination="../conf/server.$architecture.src" --architecture="$architecture"
done
sed -i "s#\*\*Shipped version:\*\*.*#\*\*Shipped version:\*\* ${version}#" ../README.md
sed -i "s#\*\*Version incluse :\*\*.*#\*\*Version incluse :\*\* ${version}#" ../README_fr.md
sed -i "s# \"version\": \".*# \"version\": \"${version}\~ynh1\",#" ../manifest.json
git add .
git commit ../README.md ../README_fr.md ../manifest.json ../conf/ffmpeg.*.src ../conf/web.*.src ../conf/server.*.src -m "Upgrade to v$version"

View file

@ -34,7 +34,12 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If db_name doesn't exist, create it 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
fi
# If path keys do not exist, create it
if [ -z "$config_path" ]; then if [ -z "$config_path" ]; then
config_path=/var/lib/jellyfin config_path=/var/lib/jellyfin
ynh_app_setting_set --app=$app --key=config_path --value=$config_path ynh_app_setting_set --app=$app --key=config_path --value=$config_path
@ -42,6 +47,11 @@ if [ -z "$config_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If render group exists, and system user doesn't belong to it, add it
if [ $(grep -q "^render:" /etc/group) ] && [ ! $(id -Gn $app | grep -q '\brender\b') ]; then
adduser $app render
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -75,7 +85,7 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -90,7 +100,18 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=3 ynh_script_progression --message="Upgrading dependencies..." --weight=3
ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" --key="https://repo.jellyfin.org/jellyfin_team.gpg.key" --package="jellyfin=$pkg_version" # Create the temporary directory
tempdir="$(mktemp -d)"
# Download the deb files
ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture"
ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture"
# Install the packages
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew
ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -112,8 +133,8 @@ if [ -z "/etc/jellyfin/network.xml" ]; then
ynh_backup_if_checksum_is_different --file="$config_path/system.xml" ynh_backup_if_checksum_is_different --file="$config_path/system.xml"
# Load services once to generate network.xml # Load services once to generate network.xml
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Startup complete" 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="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15
# Port config # Port config
ynh_replace_string --match_string="<PublicPort>8096</PublicPort>" --replace_string="<PublicPort>$port</PublicPort>" --target_file="$config_path/network.xml" ynh_replace_string --match_string="<PublicPort>8096</PublicPort>" --replace_string="<PublicPort>$port</PublicPort>" --target_file="$config_path/network.xml"
@ -126,6 +147,9 @@ if [ -z "/etc/jellyfin/network.xml" ]; then
ynh_store_file_checksum --file="$config_path/system.xml" ynh_store_file_checksum --file="$config_path/system.xml"
fi fi
# Lower logging verbosity
ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" --target_file="$config_path/logging.json"
#================================================= #=================================================
# INSTALL LDAP PLUGIN # INSTALL LDAP PLUGIN
#================================================= #=================================================
@ -148,6 +172,14 @@ fi
# Set permissions on app files # Set permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --non-append
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
@ -160,7 +192,7 @@ yunohost service add $app --description="Jellyfin media center" --log_type="syst
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX