diff --git a/README.md b/README.md index 6a0507f..c269223 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## 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. -**Shipped version:** 10.7.0 +**Shipped version:** 10.7.5 ## Screenshots diff --git a/README_fr.md b/README_fr.md index ad701cb..66a499a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,15 +3,15 @@ [![Niveau d'intégration](https://dash.yunohost.org/integration/jellyfin.svg)](https://dash.yunohost.org/appci/app/jellyfin) ![](https://ci-apps.yunohost.org/ci/badges/jellyfin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/jellyfin.maintain.svg) [![Installer Jellyfin avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jellyfin) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer Jellyfin rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* ## 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 diff --git a/check_process b/check_process index e0d7b4c..54286f7 100644 --- a/check_process +++ b/check_process @@ -24,7 +24,7 @@ # 10.6.4~ynh3 #upgrade=1 from_commit=5478712c0ca7683503bc1b50cfafe81ea508065e # 10.7.0~ynh1 - upgrade=1 from_commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b + #upgrade=1 from_commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b backup_restore=1 multi_instance=0 port_already_use=0 diff --git a/conf/ffmpeg.amd64.src b/conf/ffmpeg.amd64.src new file mode 100644 index 0000000..ad97f50 --- /dev/null +++ b/conf/ffmpeg.amd64.src @@ -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 diff --git a/conf/ffmpeg.arm64.src b/conf/ffmpeg.arm64.src new file mode 100644 index 0000000..3c73ae5 --- /dev/null +++ b/conf/ffmpeg.arm64.src @@ -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 diff --git a/conf/ffmpeg.armhf.src b/conf/ffmpeg.armhf.src new file mode 100644 index 0000000..aabbb53 --- /dev/null +++ b/conf/ffmpeg.armhf.src @@ -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 diff --git a/conf/ffmpeg.src.default b/conf/ffmpeg.src.default new file mode 100644 index 0000000..4976a6c --- /dev/null +++ b/conf/ffmpeg.src.default @@ -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 diff --git a/conf/ldap.src b/conf/ldap.src index 7ddae3c..618a43c 100644 --- a/conf/ldap.src +++ b/conf/ldap.src @@ -5,4 +5,3 @@ SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false SOURCE_FILENAME= SOURCE_EXTRACT=true - diff --git a/conf/server.amd64.src b/conf/server.amd64.src new file mode 100644 index 0000000..3086fbd --- /dev/null +++ b/conf/server.amd64.src @@ -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 diff --git a/conf/server.arm64.src b/conf/server.arm64.src new file mode 100644 index 0000000..bb301db --- /dev/null +++ b/conf/server.arm64.src @@ -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 diff --git a/conf/server.armhf.src b/conf/server.armhf.src new file mode 100644 index 0000000..40dd98b --- /dev/null +++ b/conf/server.armhf.src @@ -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 diff --git a/conf/server.src.default b/conf/server.src.default new file mode 100644 index 0000000..fa7d4ba --- /dev/null +++ b/conf/server.src.default @@ -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 diff --git a/conf/web.amd64.src b/conf/web.amd64.src new file mode 100644 index 0000000..29a3b50 --- /dev/null +++ b/conf/web.amd64.src @@ -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 diff --git a/conf/web.arm64.src b/conf/web.arm64.src new file mode 100644 index 0000000..29a3b50 --- /dev/null +++ b/conf/web.arm64.src @@ -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 diff --git a/conf/web.armhf.src b/conf/web.armhf.src new file mode 100644 index 0000000..29a3b50 --- /dev/null +++ b/conf/web.armhf.src @@ -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 diff --git a/conf/web.src.default b/conf/web.src.default new file mode 100644 index 0000000..9a3a1fc --- /dev/null +++ b/conf/web.src.default @@ -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 diff --git a/manifest.json b/manifest.json index 0989818..e7d4bdc 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Media System that manage and stream your media.", "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", "license": "GPL-2.0-only", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index c0e6516..429ccc7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,13 @@ # 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 diff --git a/scripts/backup b/scripts/backup index a1138ab..0df06ee 100644 --- a/scripts/backup +++ b/scripts/backup @@ -54,6 +54,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP VARIOUS FILES #================================================= +ynh_backup --src_path="/etc/logrotate.d/$app" + +#================================================= +# BACKUP VARIOUS FILES +#================================================= + ynh_backup --src_path="$config_path" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 6012a83..b802be2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -72,7 +72,7 @@ fi #================================================= 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 @@ -127,7 +127,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" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" --timeout=15 #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index ff83a92..556ef08 100644 --- a/scripts/install +++ b/scripts/install @@ -40,6 +40,11 @@ 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 +fi + # Register (book) web path 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_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 @@ -88,14 +104,19 @@ ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user 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 #================================================= ynh_script_progression --message="Configuring the settings..." --weight=1 # 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="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" +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" --timeout=15 # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" @@ -107,6 +128,10 @@ ynh_replace_string --match_string="" --replace_string="$path # Disable Setup Wizard ynh_replace_string --match_string="false" --replace_string="true" --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/system.xml" @@ -129,6 +154,14 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files 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 #================================================= @@ -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 # 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 diff --git a/scripts/remove b/scripts/remove index 435c9ad..acf5d08 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,6 +17,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME 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 @@ -36,8 +38,19 @@ fi #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 -# Remove metapackage and its dependencies -ynh_remove_app_dependencies +apt-get remove jellyfin-web -y +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 @@ -47,6 +60,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # 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 + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index ecf73cc..5971618 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,6 +44,11 @@ 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 +fi + #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -84,8 +89,18 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Define and install dependencies -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" +# 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-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 @@ -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_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 diff --git a/scripts/update_version.sh b/scripts/update_version.sh new file mode 100755 index 0000000..041b954 --- /dev/null +++ b/scripts/update_version.sh @@ -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" diff --git a/scripts/upgrade b/scripts/upgrade index 78983c1..39ebbe5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,7 +34,12 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= 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 config_path=/var/lib/jellyfin 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 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 if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -75,7 +85,7 @@ ynh_abort_if_errors #================================================= 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 @@ -90,7 +100,18 @@ ynh_add_nginx_config #================================================= 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 @@ -112,8 +133,8 @@ if [ -z "/etc/jellyfin/network.xml" ]; then ynh_backup_if_checksum_is_different --file="$config_path/system.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="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" + 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" --timeout=15 # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --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" fi +# Lower logging verbosity +ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" --target_file="$config_path/logging.json" + #================================================= # INSTALL LDAP PLUGIN #================================================= @@ -148,6 +172,14 @@ fi # Set permissions on app files 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 #================================================= @@ -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_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