From 2c3a176a501b22027716fca693cd430420401e25 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 19 Oct 2020 23:06:48 +0200 Subject: [PATCH 01/80] Fixing and overhaul of the app * Relying on the repository instead of deb sources * Overhaul to meet packaging standards * Removal of helpers that have been integrated in YunoHost --- conf/jellyfin-ffmpeg-amd64.src | 7 -- conf/jellyfin-ffmpeg-arm64.src | 7 -- conf/jellyfin-ffmpeg-armhf.src | 7 -- conf/jellyfin-server-amd64.src | 7 -- conf/jellyfin-server-arm64.src | 7 -- conf/jellyfin-server-armhf.src | 7 -- conf/jellyfin-web.src | 7 -- conf/nginx.conf | 37 +++---- scripts/_common.sh | 111 -------------------- scripts/backup | 30 +++--- scripts/install | 172 +++++++++++++++++-------------- scripts/remove | 67 ++++-------- scripts/restore | 30 ++++-- scripts/upgrade | 183 +++++++++++++++++++++++---------- 14 files changed, 299 insertions(+), 380 deletions(-) delete mode 100644 conf/jellyfin-ffmpeg-amd64.src delete mode 100644 conf/jellyfin-ffmpeg-arm64.src delete mode 100644 conf/jellyfin-ffmpeg-armhf.src delete mode 100644 conf/jellyfin-server-amd64.src delete mode 100644 conf/jellyfin-server-arm64.src delete mode 100644 conf/jellyfin-server-armhf.src delete mode 100644 conf/jellyfin-web.src diff --git a/conf/jellyfin-ffmpeg-amd64.src b/conf/jellyfin-ffmpeg-amd64.src deleted file mode 100644 index da5090c..0000000 --- a/conf/jellyfin-ffmpeg-amd64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v4.2.1-7/jellyfin-ffmpeg_4.2.1-7-stretch_amd64.deb -SOURCE_SUM=04ed00a1121832fe7c32f78fe9cbbebb0a36ef37c9e2689a75b55efa31ec2b73d670ddcb613d01b14721f3db98e409eca208ee425f4853b343155f06906e6e08 -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-ffmpeg.deb diff --git a/conf/jellyfin-ffmpeg-arm64.src b/conf/jellyfin-ffmpeg-arm64.src deleted file mode 100644 index 0b25190..0000000 --- a/conf/jellyfin-ffmpeg-arm64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/jellyfin_ynh/releases/download/10.6.0/jellyfin-ffmpeg_4.3.1-1-stretch_arm64.deb -SOURCE_SUM=17ca53a20ab0668f2d5762f0a183c6bcf192cc901e3223e670d7f5c9d7d0c6c7da432f0cdb2fe98108f84d4cb3ac775f84cf5816b8d43d2080a280dab8ba6c32 -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-ffmpeg.deb diff --git a/conf/jellyfin-ffmpeg-armhf.src b/conf/jellyfin-ffmpeg-armhf.src deleted file mode 100644 index d2d00a5..0000000 --- a/conf/jellyfin-ffmpeg-armhf.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.2.1-2/jellyfin-ffmpeg_4.2.1-2-stretch_armhf.deb -SOURCE_SUM=a08a4e0db96e05e4382c5c9bba435d658ba4a8a368dba9c06e816bf7ce4bbeee01481aa92919aceaf1f0c1a337356c8c1e1136c8f5b04e05edbe1a9e883df88c -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-ffmpeg.deb diff --git a/conf/jellyfin-server-amd64.src b/conf/jellyfin-server-amd64.src deleted file mode 100644 index 7c909a6..0000000 --- a/conf/jellyfin-server-amd64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/jellyfin_ynh/releases/download/10.6.4/jellyfin-server_10.6.4-1_amd64.deb -SOURCE_SUM=0600b2f3434db5397f95ed560e9d28a3a69515c7039ccda1066c86ea5a3f6e8dbbc3ecc67584d58193535d009c6c8f66da06515b78cd50ae0c0061dd265f188d -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-server.deb diff --git a/conf/jellyfin-server-arm64.src b/conf/jellyfin-server-arm64.src deleted file mode 100644 index 179d372..0000000 --- a/conf/jellyfin-server-arm64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/jellyfin_ynh/releases/download/10.6.4/jellyfin-server_10.6.4-1_arm64.deb -SOURCE_SUM=cc3889a8ed6928f27fd09013db781007ffe73a04120101ce0d21d223ebae4f61cb2524723b9c54a04dbf8e421f60c0f89d43aaf4b97eec042d7f4e0ca76f3db4 -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-server.deb diff --git a/conf/jellyfin-server-armhf.src b/conf/jellyfin-server-armhf.src deleted file mode 100644 index 1c9df65..0000000 --- a/conf/jellyfin-server-armhf.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/jellyfin_ynh/releases/download/10.6.4/jellyfin-server_10.6.4-1_armhf.deb -SOURCE_SUM=ab3ca726582101094cfc3e770c5281aa7f64396bdf86ac8ae2ce7cfa7fcc30e3ec8f6b46c9852bdd51450722638c2846d584d21dc3ee9abd512b0101b44c514d -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-server.deb diff --git a/conf/jellyfin-web.src b/conf/jellyfin-web.src deleted file mode 100644 index ea4b101..0000000 --- a/conf/jellyfin-web.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/jellyfin_ynh/releases/download/10.6.4/jellyfin-web_10.6.4-1_all.deb -SOURCE_SUM=834368480c942f32171967b0895972f75aa3d77c2a2fb131f67b81fd8dee438b8a00c48dd0901aa3e12d0fa369176e06f9a8662046086f43b94ff6c7ef41a591 -SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=jellyfin-web.deb diff --git a/conf/nginx.conf b/conf/nginx.conf index 53e98bb..b1f2ab0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,26 +1,21 @@ -######## -## Jellyfin +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { - location /jellyfin { - return 302 $scheme://$host/jellyfin/; - } - - location __PATH__/ { - # Proxy main Jellyfin traffic - # The / at the end is significant. - proxy_pass http://127.0.0.1:__PORT____PATH__/; - proxy_pass_request_headers on; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $http_connection; - # Force usage of https if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; + rewrite ^ https://$server_name$request_uri? permanent; } + + proxy_pass http://127.0.0.1:__PORT____PATH__/; + proxy_pass_request_headers on; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/scripts/_common.sh b/scripts/_common.sh index 0f53f77..a9bf588 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,112 +1 @@ #!/bin/bash - -# ============================================================================= -# YUNOHOST 2.7 FORTHCOMING HELPERS -# ============================================================================= - -# Create a dedicated nginx config -# -# usage: ynh_add_nginx_config -ynh_add_nginx_config () { - finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalnginxconf" - sudo cp ../conf/nginx.conf "$finalnginxconf" - - # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. - # Substitute in a nginx config file only if the variable is not empty - if test -n "${path_url:-}"; then - ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf" - fi - if test -n "${domain:-}"; then - ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf" - fi - if test -n "${port:-}"; then - ynh_replace_string "__PORT__" "$port" "$finalnginxconf" - fi - if test -n "${app:-}"; then - ynh_replace_string "__NAME__" "$app" "$finalnginxconf" - fi - if test -n "${final_path:-}"; then - ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf" - fi - ynh_store_file_checksum "$finalnginxconf" - - sudo systemctl reload nginx -} - -# Remove the dedicated nginx config -# -# usage: ynh_remove_nginx_config -ynh_remove_nginx_config () { - ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" - sudo systemctl reload nginx -} - -# Create a dedicated php-fpm config -# -# usage: ynh_add_fpm_config -ynh_add_fpm_config () { - finalphpconf="/etc/php5/fpm/pool.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalphpconf" - sudo cp ../conf/php-fpm.conf "$finalphpconf" - ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf" - ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf" - ynh_replace_string "__USER__" "$app" "$finalphpconf" - sudo chown root: "$finalphpconf" - ynh_store_file_checksum "$finalphpconf" - - if [ -e "../conf/php-fpm.ini" ] - then - finalphpini="/etc/php5/fpm/conf.d/20-$app.ini" - ynh_backup_if_checksum_is_different "$finalphpini" - sudo cp ../conf/php-fpm.ini "$finalphpini" - sudo chown root: "$finalphpini" - ynh_store_file_checksum "$finalphpini" - fi - - sudo systemctl reload php5-fpm -} - -# Remove the dedicated php-fpm config -# -# usage: ynh_remove_fpm_config -ynh_remove_fpm_config () { - ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf" - ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1 - sudo systemctl reload php5-fpm -} - -# Create a dedicated systemd config -# -# usage: ynh_add_systemd_config -ynh_add_systemd_config () { - finalsystemdconf="/etc/systemd/system/$app.service" - ynh_backup_if_checksum_is_different "$finalsystemdconf" - sudo cp ../conf/systemd.service "$finalsystemdconf" - - # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. - # Substitute in a nginx config file only if the variable is not empty - if test -n "${final_path:-}"; then - ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf" - fi - if test -n "${app:-}"; then - ynh_replace_string "__APP__" "$app" "$finalsystemdconf" - fi - ynh_store_file_checksum "$finalsystemdconf" - - sudo chown root: "$finalsystemdconf" - sudo systemctl enable $app - sudo systemctl daemon-reload -} - -# Remove the dedicated systemd config -# -# usage: ynh_remove_systemd_config -ynh_remove_systemd_config () { - finalsystemdconf="/etc/systemd/system/$app.service" - if [ -e "$finalsystemdconf" ]; then - sudo systemctl stop $app - sudo systemctl disable $app - ynh_secure_remove "$finalsystemdconf" - fi -} diff --git a/scripts/backup b/scripts/backup index 13ce93d..fc5dcba 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,46 +32,44 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path) domain=$(ynh_app_setting_get --app="$app" --key=domain) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_print_info --message="Declaring files to be backed up..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" +### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs +### to be backuped and not an actual copy of any file. The actual backup that +### creates and fill the archive with the files happens in the core after this +### script is called. Hence ynh_backups calls takes basically 0 seconds to run. #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 ynh_backup --src_path="$final_path" +ynh_backup --src_path="/var/lib/jellyfin" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= -ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1 ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 56a164c..9effa07 100644 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,6 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -# Retrieve arguments domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC @@ -44,33 +43,54 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +### About --weight and --time +### ynh_script_progression will show to your final users the progression of each scripts. +### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script. +### --time is a packager option, it will show you the execution time since the previous call. +### This option should be removed before releasing your app. +### Use the execution time, given by --time, to estimate the weight of a step. +### A common way to do it is to set a weight equal to the execution time in second +1. +### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. +ynh_script_progression --message="Validating installation parameters..." --time --weight=1 ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +final_path=/etc/jellyfin +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path "$path_url") - -# Check web path availability -ynh_webpath_available "$domain" "$path_url" # Register (book) web path -ynh_webpath_register "$app" "$domain" "$path_url" +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_script_progression --message="Storing installation settings..." --time --weight=1 + +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=is_public --value=$is_public + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# FIND AND OPEN A PORT +#================================================= +ynh_script_progression --message="Configuring firewall..." --time --weight=1 + +### Use these lines if you have to open a port for the application +### `ynh_find_port` will find the first available port starting from the given port. +### If you're not using these lines: +### - Remove the section "CLOSE A PORT" in the remove script + +# Find an available port +port=$(ynh_find_port --port=8095) +ynh_app_setting_set --app=$app --key=port --value=$port -ynh_app_setting_set "$app" domain "$domain" -ynh_app_setting_set "$app" path "$path_url" -ynh_app_setting_set "$app" is_public "$is_public" #================================================= # INSTALL DEPENDENCIES #================================================= - -ynh_print_info "Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." --time --weight=1 ### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. ### Those deb packages will be installed as dependencies of this package. @@ -79,75 +99,25 @@ ynh_print_info "Installing dependencies..." ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script -ynh_install_app_dependencies at libass5 libbluray1 libdrm2 libmp3lame0 libopus0 libtheora0 libva-drm1 libva-x11-1 libva1 libvdpau1 libvorbis0a libvorbisenc2 libx264-148 libx265-95 libzvbi0 libwebpmux2 - -#================================================= -# FIND AND OPEN A PORT -#================================================= - -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - -# Find a free port -port=$(ynh_find_port 8096) -# Open this port -yunohost firewall allow --no-upnp TCP "$port" 2>&1 -ynh_app_setting_set "$app" port "$port" - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -ynh_app_setting_set "$app" final_path "$final_path" - -# Download, check integrity, uncompress and patch the source from jellyfin-ffmpeg-[arch].src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-ffmpeg-amd64" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-ffmpeg-arm64" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-ffmpeg-armhf" ;; - *) ynh_die "Unknown arch" ;; -esac - -# Download, check integrity, uncompress and patch the source from jellyfin-server-[arch].src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-server-amd64" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-server-arm64" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-server-armhf" ;; - *) ynh_die "Unknown arch" ;; -esac - -# Download, check integrity, uncompress and patch the source from jellyfin-web.src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-web" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-web" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-web" ;; - *) ynh_die "Unknown arch" ;; -esac - -#============================================== -# INSTALL JELLYFIN -#============================================== - -dpkg --install "$final_path"/jellyfin-ffmpeg.deb -dpkg --install "$final_path"/jellyfin-server.deb -dpkg --install "$final_path"/jellyfin-web.deb -rm "$final_path"/*.deb +#ynh_add_app_dependencies --package="at libass5 libbluray1 libdrm2 libmp3lame0 libopus0 libtheora0 libva-drm1 libva-x11-1 libva1 libvdpau1 libvorbis0a libvorbisenc2 libx264-148 libx265-95 libzvbi0 libwebpmux2" +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" #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +### `ynh_add_nginx_config` will use the file conf/nginx.conf # Create a dedicated nginx config ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Configuring system user..." --time --weight=1 # Create a system user -ynh_system_user_create "$app" +ynh_system_user_create --username=$app #================================================= # MODIFY A CONFIG FILE @@ -177,7 +147,7 @@ ynh_replace_string --match_string="8096/dev/null 2>&1 +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_print_info "Removing $app service" - yunohost service remove "$app" + ynh_script_progression --message="Removing $app service integration..." --time --weight=1 + yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info "Stopping and removing the systemd service" +ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,74 +44,51 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info "Removing dependencies" +ynh_script_progression --message="Removing dependencies..." --time --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies -apt-get remove -y jellyfin-web jellyfin-server jellyfin-ffmpeg + #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." --time --weight=1 # Remove the app directory securely -ynh_secure_remove "$final_path" -ynh_secure_remove "/etc/jellyfin" -ynh_secure_remove "/var/lib/jellyfin" +ynh_secure_remove --file="$final_path" +ynh_secure_remove --file="/etc/jellyfin" +ynh_secure_remove --file="/var/lib/jellyfin" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_print_info "Removing logrotate configuration" - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # CLOSE A PORT #================================================= if yunohost firewall list | grep -q "\- $port$" then - ynh_print_info "Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP "$port" + ynh_script_progression --message="Closing port $port..." --time --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $port fi -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a cron file -ynh_secure_remove "/etc/cron.d/$app" - -# Remove a directory securely -ynh_secure_remove "/etc/$app/" - -# Remove the log files -ynh_secure_remove "/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 # Delete a system user -ynh_system_user_delete "$app" +ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --time --last diff --git a/scripts/restore b/scripts/restore index 824ea41..e6a7127 100644 --- a/scripts/restore +++ b/scripts/restore @@ -41,6 +41,8 @@ ynh_webpath_available --domain="$domain" --path_url="$path_url" \ || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d "$final_path" \ || ynh_die --message="There is already a directory: $final_path " + test ! -d "/var/lib/jellyfin" \ + 43 || ynh_die --message="There is already a directory: /var/lib/jellyfin " #================================================= # STANDARD RESTORATION STEPS @@ -56,6 +58,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="/var/lib/jellyfin" #================================================= # RECREATE THE DEDICATED USER @@ -70,38 +73,53 @@ ynh_system_user_create --username="$app" #================================================= # Restore permissions on app files -#chown -R root: $final_path -chown -R jellyfin:jellyfin "$plugins_path" +chown -R $app: $final_path +chown -R $app: /var/lib/jellyfin #================================================= # SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 + +# 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" + #================================================= # RESTORE SYSTEMD #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable "$app".service +systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add "$app" --description "Jellyfin media system" --log "/var/log/$app/$app.log" +yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --time --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 807c15a..8d1212a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,77 +1,154 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 -# See comments in install script app=$YNH_APP_INSTANCE_NAME final_path=/opt/yunohost/$app -# Source YunoHost helpers -source /usr/share/yunohost/helpers - -# Stop jellyfin service -systemctl stop jellyfin - #================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# CHECK VERSION #================================================= -ynh_app_setting_set "$app" final_path "$final_path" +### This helper will compare the version of the currently installed app and the version of the upstream package. +### $upgrade_type can have 2 different values +### - UPGRADE_APP if the upstream app version has changed +### - UPGRADE_PACKAGE if only the YunoHost package has changed +### ynh_check_app_version_changed will stop the upgrade if the app is up to date. +### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. +upgrade_type=$(ynh_check_app_version_changed) -# Download, check integrity, uncompress and patch the source from jellyfin-ffmpeg-[arch].src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-ffmpeg-amd64" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-ffmpeg-arm64" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-ffmpeg-armhf" ;; - *) ynh_die "Unknown arch" ;; -esac +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 -# Download, check integrity, uncompress and patch the source from jellyfin-server-[arch].src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-server-amd64" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-server-arm64" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-server-armhf" ;; - *) ynh_die "Unknown arch" ;; -esac +# 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 -# Download, check integrity, uncompress and patch the source from jellyfin-web.src -case $(uname -m) in - x86_64) ynh_setup_source "$final_path" "jellyfin-web" ;; - aarch64) ynh_setup_source "$final_path" "jellyfin-web" ;; - armv7l) ynh_setup_source "$final_path" "jellyfin-web" ;; - *) ynh_die "Unknown arch" ;; -esac +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 -#============================================== -# INSTALL JELLYFIN -#============================================== - -dpkg --install "$final_path"/jellyfin-ffmpeg.deb -dpkg --install "$final_path"/jellyfin-server.deb -dpkg --install "$final_path"/jellyfin-web.deb -rm "$final_path"/*.deb +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 # Create a dedicated nginx config -#ynh_add_nginx_config +ynh_add_nginx_config #================================================= -# UPGRADE CONFIG +# UPGRADE DEPENDENCIES #================================================= -#cp -a ../conf/loolwsd.xml /etc/loolwsd -#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml" -#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml" -#systemctl restart loolwsd +ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 -# If app is public, add url to SSOWat conf as skipped_uris -#if [[ $is_public -eq 1 ]]; then - # See install script -# ynh_app_setting_set "$app" unprotected_uris "/" -#fi +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" -# Start jellyfin service -systemctl start jellyfin +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 + +# Create a dedicated systemd config +ynh_add_systemd_config + +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +#ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" + +#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" + +# Recalculate and store the checksum of the file for the next upgrade. +#ynh_store_file_checksum --file="$final_path/CONFIG_FILE" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R $app: $final_path +chown -R $app: /var/lib/jellyfin + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 + +yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + # unprotected_uris allows SSO credentials to be passed anyway + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +fi + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Upgrade of $app completed" --time --last From a570cc92503a81dac22b818909eb4a4614a59cc4 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 15:41:23 +0200 Subject: [PATCH 02/80] [enh] specify version to install --- scripts/_common.sh | 2 ++ scripts/install | 3 +-- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a9bf588..bd66acb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1 +1,3 @@ #!/bin/bash + +pkg_version="10.6.4-1" diff --git a/scripts/install b/scripts/install index 9effa07..b333097 100644 --- a/scripts/install +++ b/scripts/install @@ -99,8 +99,7 @@ ynh_script_progression --message="Installing dependencies..." --time --weight=1 ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script -#ynh_add_app_dependencies --package="at libass5 libbluray1 libdrm2 libmp3lame0 libopus0 libtheora0 libva-drm1 libva-x11-1 libva1 libvdpau1 libvorbis0a libvorbisenc2 libx264-148 libx265-95 libzvbi0 libwebpmux2" -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" +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" #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 8d1212a..539f202 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,7 +65,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 -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" +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 DEDICATED USER From f0e7da167f1c28971b77c3cf2d7ea23db015903e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 20 Oct 2020 15:43:04 +0200 Subject: [PATCH 03/80] Fix manifest --- manifest.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index bf09819..7f25ce7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "The free software media system that puts you in control of managing and streaming your media.", "fr": "Le système multimédia libre qui vous donne le contrôle pour gérer et diffuser vos médias." }, - "version": "10.6.4", + "version": "10.6.4~ynh1", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0", "maintainer": { @@ -14,7 +14,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 3.8.1" }, "multi_instance": false, "services": [ @@ -30,7 +30,6 @@ }, "example": "example.com" }, - { "name": "path", "type": "path", @@ -41,15 +40,14 @@ "example": "/jellyfin", "default": "/jellyfin" }, - { "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public site ?", + "en": "Is it a public site?", "fr": "Est-ce un site public ?" }, - "default": "true" + "default": true } ] } From 77737e524a975c5532e249e0fb220433950576bc Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 15:44:09 +0200 Subject: [PATCH 04/80] [fix] multiple install should not be tested --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 0cbeae3..7a9ead4 100644 --- a/check_process +++ b/check_process @@ -20,7 +20,7 @@ setup_public=1 upgrade=1 backup_restore=1 - multi_instance=1 + multi_instance=0 incorrect_path=1 port_already_use=0 change_url=0 From ebfbffadec3f46aecf9ddd20765970229cb587c0 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 15:46:56 +0200 Subject: [PATCH 05/80] [fix] missing final_path definition --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b333097..7a5e505 100644 --- a/scripts/install +++ b/scripts/install @@ -68,6 +68,7 @@ ynh_script_progression --message="Storing installation settings..." --time --wei ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= @@ -86,7 +87,6 @@ ynh_script_progression --message="Configuring firewall..." --time --weight=1 port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= From 77ef3e7dea602354a2d6e403d79a07ba5384d2f8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 20 Oct 2020 15:54:54 +0200 Subject: [PATCH 06/80] Update README.md --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1fb072b..63bd219 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,66 @@ -# Jellyfin app for YunoHost -Jellyfin Server +# Jellyfin for YunoHost + +[![Integration level](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) +[![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jellyfin) + +## 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.6.4 -- [Yunohost project](https://yunohost.org) -- [Jellyfin website](https://github.com/jellyfin/jellyfin) +## Screenshots -![](https://www.ostechnix.com/wp-content/uploads/2019/03/jellyfin-logo-720x340.png) +![](https://jellyfin.org/images/screenshots/movie_full.png) +## Demo -[![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jellyfin) +* [Official demo](Link to a demo site for this app.) +## Configuration -### Installing guide +How to configure this app: From an admin panel, a plain file with SSH, or any other way. - App can be installed by YunoHost **admin web-interface** or by **running following command**: +## Documentation - $ sudo yunohost app install https://github.com/YunoHost-Apps/jellyfin_ynh + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. - -### Upgrade this package: +## YunoHost specific features - $ sudo yunohost app upgrade jellyfin -u https://github.com/YunoHost-Apps/jellyfin_ynh +#### Multi-user support + + * Are LDAP and HTTP auth supported? + * Can the app be used by multiple users? + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jellyfin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jellyfin/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jellyfin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jellyfin/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/jellyfin_ynh/issues + * App website: https://jellyfin.org/ + * Upstream app repository: https://github.com/jellyfin/jellyfin + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug +or +sudo yunohost app upgrade jellyfin -u https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug +``` From c05a696e448fcb5b00c23cfc5e4ae73379d79265 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 15:56:19 +0200 Subject: [PATCH 07/80] [fix] retrieve actual final_path --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 539f202..bbfde78 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME -final_path=/opt/yunohost/$app +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK VERSION From 7fe8416fefdcf12873036c5aec5b579bf7fb8f2e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 16:41:39 +0200 Subject: [PATCH 08/80] [fix] install logrotate --- scripts/install | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/install b/scripts/install index 7a5e505..1c2c6d3 100644 --- a/scripts/install +++ b/scripts/install @@ -162,6 +162,22 @@ ynh_replace_string --match_string="8096 Date: Tue, 20 Oct 2020 17:18:25 +0200 Subject: [PATCH 09/80] [fix] backup of service --- scripts/backup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index fc5dcba..a2f5465 100644 --- a/scripts/backup +++ b/scripts/backup @@ -66,7 +66,8 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/lib/systemd/system/jellyfin.service" +ynh_backup --src_path="/etc/systemd/system/jellyfin.service.d" #================================================= # END OF SCRIPT From 60ea6960f74f52852c93f8ad28235be0eaba7baf Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 17:48:40 +0200 Subject: [PATCH 10/80] [fix] fix upgrade and restore --- scripts/restore | 4 ++-- scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index e6a7127..57c95b0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -41,8 +41,8 @@ ynh_webpath_available --domain="$domain" --path_url="$path_url" \ || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d "$final_path" \ || ynh_die --message="There is already a directory: $final_path " - test ! -d "/var/lib/jellyfin" \ - 43 || ynh_die --message="There is already a directory: /var/lib/jellyfin " +test ! -d "/var/lib/jellyfin" \ + || ynh_die --message="There is already a directory: /var/lib/jellyfin " #================================================= # STANDARD RESTORATION STEPS diff --git a/scripts/upgrade b/scripts/upgrade index bbfde78..744dc15 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= From bc55561049f558cdbc9a75cea1b70eded4e0c8f4 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 17:58:06 +0200 Subject: [PATCH 11/80] Expand check_process scope --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 7a9ead4..867eda5 100644 --- a/check_process +++ b/check_process @@ -6,14 +6,14 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/" (PATH) + path="/path" (PATH) is_public=1 (PUBLIC|public=1|private=0) # password="pass" # nextclouddomain="domain.tld" port="9980" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=0 + setup_sub_dir=1 setup_root=1 setup_nourl=0 setup_private=0 From cedae0e38fe34863507295f3a006f2a8ecf59eea Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 20 Oct 2020 22:24:34 +0200 Subject: [PATCH 12/80] [fix] restore systemd, load port in upgrade --- scripts/restore | 3 ++- scripts/upgrade | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 57c95b0..012a214 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,7 +91,8 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( l #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" +ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" systemctl enable $app.service #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 744dc15..ee3523c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION From fc68b3455d7ce0a4292951d082d83b7b54acbe9c Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 21 Oct 2020 11:12:20 +0200 Subject: [PATCH 13/80] [fix] no need to upgrade systemd conf --- scripts/upgrade | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ee3523c..6fa60d2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,14 +78,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # MODIFY A CONFIG FILE #================================================= From 1f2ef3f92d5f8d45ba413ec0eaab8a0b1b8e2798 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 23 Oct 2020 11:41:51 +0200 Subject: [PATCH 14/80] [fix] load is_public in upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 6fa60d2..3703bd8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,6 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) From 821d487c6788052f1014d1465b280aa5051f782a Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 28 Oct 2020 19:07:49 +0100 Subject: [PATCH 15/80] [add] sleep time to let the service start --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 1c2c6d3..5784f80 100644 --- a/scripts/install +++ b/scripts/install @@ -209,6 +209,7 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +sleep 5 #================================================= # SETUP SSOWAT From 66e31179e3187b9a327b14974e63fb8ef5dee058 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 29 Oct 2020 10:34:27 +0100 Subject: [PATCH 16/80] [enh] check /var/lib availability, comments cleanup --- scripts/install | 21 +++------------------ scripts/upgrade | 13 ------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/scripts/install b/scripts/install index 5784f80..66eab6f 100644 --- a/scripts/install +++ b/scripts/install @@ -56,7 +56,8 @@ ynh_script_progression --message="Validating installation parameters..." --time ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/etc/jellyfin -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +test ! -e "$final_path" || ynh_die --message="There is already a directory: $final_path " +test ! -e "/var/lib/jellyfin" || ynh_die --message="There is already a directory: /var/lib/jellyfin " # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -78,11 +79,6 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= ynh_script_progression --message="Configuring firewall..." --time --weight=1 -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - # Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port @@ -131,23 +127,12 @@ systemctl stop jellyfin # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml" -# BaseUrl +# BaseUrl config ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/system.xml" # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - -# Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum "/etc/jellyfin/system.xml" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3703bd8..20c50cd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,19 +79,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -#ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" - -#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - -# Recalculate and store the checksum of the file for the next upgrade. -#ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= From e264caff51f34b4e043b76022678e70e31702dd3 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 29 Oct 2020 11:53:40 +0100 Subject: [PATCH 17/80] [enh] Setting the weights for script progression indicators --- scripts/backup | 2 +- scripts/install | 24 ++++++++++++------------ scripts/remove | 16 ++++++++-------- scripts/restore | 20 ++++++++++---------- scripts/upgrade | 24 ++++++++++++------------ 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/scripts/backup b/scripts/backup index a2f5465..c0119b2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/install b/scripts/install index 66eab6f..0f935d2 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ app=$YNH_APP_INSTANCE_NAME ### Use the execution time, given by --time, to estimate the weight of a step. ### A common way to do it is to set a weight equal to the execution time in second +1. ### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" @@ -65,7 +65,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -77,7 +77,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --time --weight=1 +ynh_script_progression --message="Configuring firewall..." --weight=1 # Find an available port port=$(ynh_find_port --port=8095) @@ -86,7 +86,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=1 ### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. ### Those deb packages will be installed as dependencies of this package. @@ -100,7 +100,7 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/$( awk -F'= #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring nginx web server..." --weight=6 ### `ynh_add_nginx_config` will use the file conf/nginx.conf # Create a dedicated nginx config @@ -109,7 +109,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create --username=$app @@ -150,7 +150,7 @@ chown -R $app: /var/lib/jellyfin #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=2 ### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. ### Use this helper only if there is effectively a log file for this app. @@ -166,7 +166,7 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ### `yunohost service add` integrates a service in YunoHost. It then gets ### displayed in the admin interface and through the others `yunohost service` commands. @@ -182,7 +182,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ### `ynh_systemd_action` is used to start a systemd service for an app. ### Only needed if you have configure a systemd service @@ -199,7 +199,7 @@ sleep 5 #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --time --weight=2 # Make app public if necessary if [ $is_public -eq 1 ] @@ -211,7 +211,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload @@ -219,4 +219,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index b502cba..aabec9d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -29,14 +29,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --time --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=3 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,7 +44,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -52,7 +52,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=12 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -62,7 +62,7 @@ ynh_secure_remove --file="/var/lib/jellyfin" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -73,7 +73,7 @@ ynh_remove_nginx_config if yunohost firewall list | grep -q "\- $port$" then - ynh_script_progression --message="Closing port $port..." --time --weight=1 + ynh_script_progression --message="Closing port $port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow TCP $port fi @@ -82,7 +82,7 @@ fi #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=2 # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 012a214..e0fee5c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -35,7 +35,7 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=2 ynh_webpath_available --domain="$domain" --path_url="$path_url" \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -55,7 +55,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="/var/lib/jellyfin" @@ -63,7 +63,7 @@ ynh_restore_file --origin_path="/var/lib/jellyfin" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username="$app" @@ -81,7 +81,7 @@ chown -R $app: /var/lib/jellyfin #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +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" @@ -89,7 +89,7 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( l #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" @@ -98,14 +98,14 @@ systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" @@ -120,7 +120,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -128,4 +128,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 20c50cd..af726ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) @@ -36,7 +36,7 @@ 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)..." --time --weight=1 +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 @@ -52,14 +52,14 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -67,14 +67,14 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +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 DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +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 @@ -92,7 +92,7 @@ chown -R $app: /var/lib/jellyfin #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -100,21 +100,21 @@ ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] @@ -126,7 +126,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -134,4 +134,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last From c70b60ece08992c70797bb654527dbb29a735a59 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 29 Oct 2020 11:59:28 +0100 Subject: [PATCH 18/80] [enh] add publicness explanation --- manifest.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 7f25ce7..05be5fc 100644 --- a/manifest.json +++ b/manifest.json @@ -44,10 +44,14 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public site?", - "fr": "Est-ce un site public ?" + "en": "Is it a public app?", + "fr": "Est-ce une app publique ?" }, - "default": true + "default": true, + "help": { + "en": "Jellyfin has its own login system, you should make it public to let external clients access it (mobile app, 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.)." + } } ] } From 63e023d2326e6876af017efc3fdb0d4d354a711d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 17:04:29 +0100 Subject: [PATCH 19/80] No need to close port since it was never opened --- scripts/remove | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/remove b/scripts/remove index aabec9d..5ea9661 100644 --- a/scripts/remove +++ b/scripts/remove @@ -67,16 +67,6 @@ ynh_script_progression --message="Removing nginx web server configuration..." -- # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # GENERIC FINALIZATION #================================================= From dafd95a8b2e5e21a61bd58894d61b6b315e27f57 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 17:07:47 +0100 Subject: [PATCH 20/80] Comments cleanup --- scripts/install | 57 ------------------------------------------------- scripts/upgrade | 6 ------ 2 files changed, 63 deletions(-) diff --git a/scripts/install b/scripts/install index 0f935d2..b6283d6 100644 --- a/scripts/install +++ b/scripts/install @@ -28,33 +28,13 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -### About --weight and --time -### ynh_script_progression will show to your final users the progression of each scripts. -### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script. -### --time is a packager option, it will show you the execution time since the previous call. -### This option should be removed before releasing your app. -### Use the execution time, given by --time, to estimate the weight of a step. -### A common way to do it is to set a weight equal to the execution time in second +1. -### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. ynh_script_progression --message="Validating installation parameters..." --weight=1 -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/etc/jellyfin test ! -e "$final_path" || ynh_die --message="There is already a directory: $final_path " test ! -e "/var/lib/jellyfin" || ynh_die --message="There is already a directory: /var/lib/jellyfin " @@ -88,13 +68,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - 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" #================================================= @@ -102,7 +75,6 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/$( awk -F'= #================================================= ynh_script_progression --message="Configuring nginx web server..." --weight=6 -### `ynh_add_nginx_config` will use the file conf/nginx.conf # Create a dedicated nginx config ynh_add_nginx_config @@ -139,10 +111,6 @@ ynh_replace_string --match_string="8096 Date: Sun, 8 Nov 2020 17:17:44 +0100 Subject: [PATCH 21/80] Remove extra --time --- scripts/install | 2 +- scripts/remove | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index b6283d6..6dd3a56 100644 --- a/scripts/install +++ b/scripts/install @@ -142,7 +142,7 @@ sleep 5 #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=2 +ynh_script_progression --message="Configuring SSOwat..." --weight=2 # Make app public if necessary if [ $is_public -eq 1 ] diff --git a/scripts/remove b/scripts/remove index 5ea9661..f4aaac5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -81,4 +81,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last From 0952eeac47b8e1cbb655023289a288bf1e3409c7 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 17:20:10 +0100 Subject: [PATCH 22/80] Fix license identifier --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 05be5fc..6475faa 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "10.6.4~ynh1", "url": "https://github.com/jellyfin/jellyfin", - "license": "GPL-2.0", + "license": "GPL-2.0-only", "maintainer": { "name": "liberodark", "email": "liberodark@gmail.com" From f4bf6d9fd8685ff7633726353734e99b1631407d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 17:30:01 +0100 Subject: [PATCH 23/80] No need to alter permissions while upgrading --- scripts/upgrade | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 7485dd8..dd22913 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,18 +105,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #================================================= From 1232b3bc5a1c7ec9f7933ae2cf50f35b10960505 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 17:34:17 +0100 Subject: [PATCH 24/80] Embracing the future of permissions management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> --- scripts/install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 6dd3a56..9666a9d 100644 --- a/scripts/install +++ b/scripts/install @@ -144,11 +144,12 @@ sleep 5 #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=2 -# Make app public if necessary +# Make app public if necessary or protect it if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission "main" --add "visitors" fi #================================================= From e0ed7b183ba54ea94700889bc40a4dc4a4015290 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 18:02:32 +0100 Subject: [PATCH 25/80] Silence service restoration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> --- scripts/restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index e0fee5c..2943fc3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,8 +91,8 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( l #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" -ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" +ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null +ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null systemctl enable $app.service #================================================= From 0f07898dbbbe9c715525172a3e79e818134066cd Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 18:13:51 +0100 Subject: [PATCH 26/80] Wait for the service starting up --- scripts/install | 8 +++----- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 9666a9d..ec69321 100644 --- a/scripts/install +++ b/scripts/install @@ -92,9 +92,8 @@ ynh_system_user_create --username=$app # Load services once to generate system.xml systemctl enable jellyfin -systemctl start jellyfin -sleep 5 -systemctl stop jellyfin +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" +ynh_systemd_action --service_name=$app --action="stop" # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml" @@ -136,8 +135,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -sleep 5 +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 2943fc3..2b2ce8f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -107,7 +107,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index dd22913..ff41401 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" #================================================= # RELOAD NGINX From 50a26572eeca592643b0c0bbf6de854dcf83b8c6 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 18:29:39 +0100 Subject: [PATCH 27/80] ynh_clean_check_starting since we monitor the logs Co-authored-by: Eric Gaspar <46165813+ericgaspar@users.noreply.github.com> --- scripts/install | 2 +- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index ec69321..7fe9a64 100644 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors diff --git a/scripts/restore b/scripts/restore index 2b2ce8f..87c6bcf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { #### Remove this function if there's nothing to clean before calling the remove script. - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors From 552ee2b03b38820f1bf2ed1cac0cdd3d986ec330 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 18:44:16 +0100 Subject: [PATCH 28/80] Monitor systemd instead of log file --- scripts/install | 4 ++-- scripts/restore | 6 +++--- scripts/upgrade | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 7fe9a64..004ff25 100644 --- a/scripts/install +++ b/scripts/install @@ -92,7 +92,7 @@ ynh_system_user_create --username=$app # Load services once to generate system.xml systemctl enable jellyfin -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" ynh_systemd_action --service_name=$app --action="stop" # Port config @@ -135,7 +135,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 87c6bcf..2e727af 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,8 +91,8 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( l #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null -ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null +ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null +ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null systemctl enable $app.service #================================================= @@ -107,7 +107,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index ff41401..0e1dd4d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app$(date "+%Y%m%d").log" --line_match="Startup complete" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" #================================================= # RELOAD NGINX From f09dfe73e77002fb61913037073e691259aa6b5b Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 8 Nov 2020 19:13:35 +0100 Subject: [PATCH 29/80] Reverting to manual startup of the service to init xml setting file --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 004ff25..ac06e62 100644 --- a/scripts/install +++ b/scripts/install @@ -92,8 +92,9 @@ ynh_system_user_create --username=$app # Load services once to generate system.xml systemctl enable jellyfin -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Startup complete" -ynh_systemd_action --service_name=$app --action="stop" +systemctl start jellyfin +sleep 5 +systemctl stop jellyfin # Port config ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml" From ed1cfe27473f7fe3f54e0b739fb7fe07ba8fed8f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 13:52:14 +0100 Subject: [PATCH 30/80] Restart service after restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 2e727af..c4c9987 100644 --- a/scripts/restore +++ b/scripts/restore @@ -107,7 +107,7 @@ yunohost service add $app --description "Jellyfin media center" --log "/var/log/ #================================================= 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="restart" --log_path="systemd" --line_match="Startup complete" #================================================= # RESTORE THE LOGROTATE CONFIGURATION From 44e8ff74ead1b58bcacebf091678a69b7467050e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 14:13:58 +0100 Subject: [PATCH 31/80] Cleanup and enhance check_process --- check_process | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/check_process b/check_process index 867eda5..04cbd6f 100644 --- a/check_process +++ b/check_process @@ -1,4 +1,4 @@ -# See here for more informations +# See here for more information # https://github.com/YunoHost/package_check#syntax-check_process-file # Move this file from check_process.default to check_process when you have filled it. @@ -6,37 +6,35 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) + path="/path" (PATH) + admin="john" (USER) +# language="fr" is_public=1 (PUBLIC|public=1|private=0) # password="pass" -# nextclouddomain="domain.tld" - port="9980" (PORT) + port="666" (PORT) ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 setup_nourl=0 - setup_private=0 + setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 backup_restore=1 multi_instance=0 - incorrect_path=1 + # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. + # incorrect_path=1 port_already_use=0 change_url=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=1 (This app supports the Nextcloud LDAP auth) -# Level 5: + # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 + name=2020-09-07 commit +# manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&port=666& From af595b747982617c2444c2232e8fbb8884af7055 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 14:19:26 +0100 Subject: [PATCH 32/80] Add change_url --- check_process | 2 +- scripts/change_url | 129 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 scripts/change_url diff --git a/check_process b/check_process index 04cbd6f..9263eba 100644 --- a/check_process +++ b/check_process @@ -26,7 +26,7 @@ # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..28669c4 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,129 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=10 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # 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" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=2 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the nginx config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config +fi + +# Change the domain for nginx +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# ... +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +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" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading nginx web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last From 069ae32a83df81323e0ba4695d4736fa76c6badc Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 16:16:58 +0100 Subject: [PATCH 33/80] Load port in change_url --- scripts/change_url | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/change_url b/scripts/change_url index 28669c4..8845046 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,6 +21,8 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME +port=$(ynh_app_setting_get --app="$app" --key=port) + #================================================= # LOAD SETTINGS #================================================= From 5c519ec558ddb58cc7ac1ebf6c0bf98eedc987f1 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 20:33:27 +0100 Subject: [PATCH 34/80] Change baseurl in change_url --- scripts/change_url | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 8845046..f824a53 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -105,9 +105,15 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= -# ... +# BASE URL #================================================= +# Change the path in system.xml config file +if [ $change_path -eq 1 ] +then + ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" +fi + #================================================= # GENERIC FINALISATION #================================================= From 6e4b91f34d6a1de910141c1718213c0caed7b09d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 9 Nov 2020 20:34:10 +0100 Subject: [PATCH 35/80] Remove duplicate instruction in install --- scripts/install | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/install b/scripts/install index ac06e62..d1a8c02 100644 --- a/scripts/install +++ b/scripts/install @@ -102,9 +102,6 @@ ynh_replace_string --match_string="8096 Date: Tue, 10 Nov 2020 11:47:17 +0100 Subject: [PATCH 36/80] Fix change_url BaseUrl setting gets reverted to default if the wizard is not completed... --- scripts/change_url | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index f824a53..845c04d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -111,7 +111,12 @@ fi # Change the path in system.xml config file if [ $change_path -eq 1 ] then - ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" + # If the Startup Wizard was not complete, was reverted back to default when stopping the service + if grep -q "false" "/etc/jellyfin/system.xml"; then + ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" + else + ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" + fi fi #================================================= From 58e8339ca355446116fafd8ac8e97c8ace9e4b8f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 10 Nov 2020 14:50:59 +0100 Subject: [PATCH 37/80] Fix change_url Simpler is better --- scripts/change_url | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 845c04d..6abc645 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -111,8 +111,8 @@ fi # Change the path in system.xml config file if [ $change_path -eq 1 ] then - # If the Startup Wizard was not complete, was reverted back to default when stopping the service - if grep -q "false" "/etc/jellyfin/system.xml"; then + # If somehow was not replaced during install + if grep -q "" "/etc/jellyfin/system.xml"; then ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" else ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" From bd4932c47295ddc40b0d6f0c6c20ad6a3d738db8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 10 Nov 2020 16:58:19 +0100 Subject: [PATCH 38/80] Small typos --- README.md | 7 +++++-- manifest.json | 12 ++++++------ scripts/_common.sh | 16 ++++++++++++++++ scripts/backup | 5 ----- scripts/change_url | 16 ++++++++-------- scripts/install | 6 +++--- scripts/remove | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 6 +++--- 9 files changed, 44 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 63bd219..820524b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ [![Integration level](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) [![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jellyfin) +> *This package allows you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + ## 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. @@ -29,8 +32,8 @@ How to configure this app: From an admin panel, a plain file with SSH, or any ot #### Multi-user support - * Are LDAP and HTTP auth supported? - * Can the app be used by multiple users? + * Are LDAP and HTTP auth supported? **No** + * Can the app be used by multiple users? **Yes** #### Supported architectures diff --git a/manifest.json b/manifest.json index 6475faa..1292ae0 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "jellyfin", "packaging_format": 1, "description": { - "en": "The free software media system that puts you in control of managing and streaming your media.", - "fr": "Le système multimédia libre qui vous donne le contrôle pour gérer et diffuser vos médias." + "en": "Media System that manage and stream your media.", + "fr": "Système multimédia qui gère et diffuse vos médias." }, "version": "10.6.4~ynh1", "url": "https://github.com/jellyfin/jellyfin", @@ -34,8 +34,8 @@ "name": "path", "type": "path", "ask": { - "en": "Choose a path for Jellyfin /jellyfin is accepted", - "fr": "Choisissez un chemin pour Jellyfin /jellyfin est accepté" + "en": "Choose a path for Jellyfin", + "fr": "Choisissez un chemin pour Jellyfin" }, "example": "/jellyfin", "default": "/jellyfin" @@ -44,8 +44,8 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public app?", - "fr": "Est-ce une app publique ?" + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" }, "default": true, "help": { diff --git a/scripts/_common.sh b/scripts/_common.sh index bd66acb..0e17ea6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,3 +1,19 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + pkg_version="10.6.4-1" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index c0119b2..2b24fb0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,11 +36,6 @@ domain=$(ynh_app_setting_get --app="$app" --key=domain) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= diff --git a/scripts/change_url b/scripts/change_url index 6abc645..03e8e62 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE 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 ynh_backup_before_upgrade @@ -76,23 +76,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -131,7 +131,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index d1a8c02..82a5492 100644 --- a/scripts/install +++ b/scripts/install @@ -73,9 +73,9 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/$( awk -F'= #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=6 +ynh_script_progression --message="Configuring NGINX web server..." --weight=6 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -151,7 +151,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index f4aaac5..2fefac4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=3 @@ -62,7 +62,7 @@ ynh_secure_remove --file="/var/lib/jellyfin" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index c4c9987..9f061d1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -120,7 +120,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 0e1dd4d..01d1fc4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,9 +53,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -108,7 +108,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload From e0cd3c711b32e44acabb898b5e5cdc7f8c37b77f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 11 Nov 2020 20:14:48 +0100 Subject: [PATCH 39/80] Adding LDAP plugin and permissions --- conf/LDAP-Auth.xml | 16 ++++++++++++++++ conf/ldap.src | 7 +++++++ manifest.json | 9 +++++++++ scripts/install | 23 ++++++++++++++++++++--- scripts/upgrade | 24 ++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 conf/LDAP-Auth.xml create mode 100644 conf/ldap.src diff --git a/conf/LDAP-Auth.xml b/conf/LDAP-Auth.xml new file mode 100644 index 0000000..37a7a9e --- /dev/null +++ b/conf/LDAP-Auth.xml @@ -0,0 +1,16 @@ + + + 127.0.0.1 + ou=users,dc=yunohost,dc=org + 389 + uid, mail + uid + (permission=cn=jellyfin.main,ou=permission,dc=yunohost,dc=org) + (permission=cn=jellyfin.admin,ou=permission,dc=yunohost,dc=org) + cn=admin,ou=users,dc=yunohost,dc=org + + true + true + false + false + diff --git a/conf/ldap.src b/conf/ldap.src new file mode 100644 index 0000000..c4cd353 --- /dev/null +++ b/conf/ldap.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://repo.jellyfin.org/releases/plugin/ldap-authentication/ldap-authentication_9.0.0.0.zip +SOURCE_SUM=1EAE1099E30CB3C42FDC2B0ACE50601A8881EBFD9151526F39C8E2B61D7B3EF1 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/manifest.json b/manifest.json index 1292ae0..dd9c159 100644 --- a/manifest.json +++ b/manifest.json @@ -40,6 +40,15 @@ "example": "/jellyfin", "default": "/jellyfin" }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" + }, + "example": "johndoe" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 82a5492..96d1be9 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -89,6 +90,7 @@ ynh_system_user_create --username=$app #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_script_progression --message="Configuring the settings..." --weight=1 # Load services once to generate system.xml systemctl enable jellyfin @@ -102,6 +104,18 @@ ynh_replace_string --match_string="8096 Date: Fri, 4 Dec 2020 12:15:37 +0100 Subject: [PATCH 40/80] Fix linter warnings --- check_process | 5 ----- scripts/install | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/check_process b/check_process index 9263eba..19f6216 100644 --- a/check_process +++ b/check_process @@ -23,13 +23,8 @@ upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 backup_restore=1 multi_instance=0 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email= Notification=none diff --git a/scripts/install b/scripts/install index 82a5492..a2c874d 100644 --- a/scripts/install +++ b/scripts/install @@ -125,7 +125,7 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 9f061d1..0339296 100644 --- a/scripts/restore +++ b/scripts/restore @@ -93,14 +93,14 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 01d1fc4..2664d0e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -96,7 +96,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description "Jellyfin media center" --log "/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE From 772060554b31acf27ea1eca59715eacbfe6a9c3e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 20:57:00 +0100 Subject: [PATCH 41/80] fix linter warnings --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a2c874d..44fb817 100644 --- a/scripts/install +++ b/scripts/install @@ -91,7 +91,7 @@ ynh_system_user_create --username=$app #================================================= # Load services once to generate system.xml -systemctl enable jellyfin +systemctl enable jellyfin --quiet systemctl start jellyfin sleep 5 systemctl stop jellyfin From 076fe34f3752f294ce99d8599b4734a8287a8e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 19 Dec 2020 23:03:32 +0100 Subject: [PATCH 42/80] Set badge in SVG --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2b9467..f002652 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Jellyfin for YunoHost [![Integration level](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) -[![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jellyfin) +[![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jellyfin) > *This package allows you to install Jellyfin quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* From a3eadfe13f5575581fab2c52f31b17c95ab89ed7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 8 Jan 2021 23:52:54 +0100 Subject: [PATCH 43/80] Upgrade to version 10 --- conf/ldap.src | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/ldap.src b/conf/ldap.src index c4cd353..4e4d1de 100644 --- a/conf/ldap.src +++ b/conf/ldap.src @@ -1,7 +1,8 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/plugin/ldap-authentication/ldap-authentication_9.0.0.0.zip -SOURCE_SUM=1EAE1099E30CB3C42FDC2B0ACE50601A8881EBFD9151526F39C8E2B61D7B3EF1 +SOURCE_URL=https://github.com/jellyfin/jellyfin-plugin-ldapauth/archive/v10.zip +SOURCE_SUM=d3374a5188abbc6c75c58f64d187f0b9c369a873e6dda7252bf7fe3e44a45eef SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false SOURCE_FILENAME= SOURCE_EXTRACT=true + From fa5b1641d4625ec304ea3ead8cc2f5b225129b97 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 9 Jan 2021 22:33:46 +0100 Subject: [PATCH 44/80] Finding an available port --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 44fb817..95c39f8 100644 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --weight=1 +ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port port=$(ynh_find_port --port=8095) From 23e14b606548c204891b4f7a7c3f58bdacd852a1 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 11 Jan 2021 08:48:21 +0100 Subject: [PATCH 45/80] Update NGINX conf for proxy bufferring (#50) * Update NGINX conf for proxy bufferring * Bump package version * Fix linter warning --- conf/nginx.conf | 18 ++++++++++++++++++ manifest.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b1f2ab0..0e7dfc1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,6 +6,7 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } + # Proxy main Jellyfin traffic proxy_pass http://127.0.0.1:__PORT____PATH__/; proxy_pass_request_headers on; proxy_set_header Host $host; @@ -16,6 +17,23 @@ location __PATH__/ { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; + # Disable buffering when the nginx proxy gets very resource heavy upon streaming + proxy_buffering off; + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location __PATH__/socket { + # Proxy Jellyfin Websockets traffic + proxy_pass http://127.0.0.1:__PORT____PATH__/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Protocol $scheme; + proxy_set_header X-Forwarded-Host $http_host; +} diff --git a/manifest.json b/manifest.json index 43eff57..53a5b7f 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.6.4~ynh2", + "version": "10.6.4~ynh3", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { From ade36194b5cb66d6e0b7bf0a8c9ed55df1e06610 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 09:34:38 +0100 Subject: [PATCH 46/80] Upgrade to version 10.7.0 --- README.md | 2 +- manifest.json | 2 +- scripts/_common.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 820524b..f109e56 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,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.6.4 +**Shipped version:** 10.7.0 ## Screenshots diff --git a/manifest.json b/manifest.json index dd9c159..f12a6dd 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.6.4~ynh1", + "version": "10.7.0~ynh1", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 0e17ea6..c0e6516 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -pkg_version="10.6.4-1" +pkg_version="10.7.0-1" #================================================= # PERSONAL HELPERS From b4ab1faec59fd4ee274443c30f3a085fad0ca5a0 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 09:36:45 +0100 Subject: [PATCH 47/80] Update LDAP configuration Co-authored-by: h3ndrik h3ndrik@users.noreply.github.com --- conf/LDAP-Auth.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/LDAP-Auth.xml b/conf/LDAP-Auth.xml index 37a7a9e..713a063 100644 --- a/conf/LDAP-Auth.xml +++ b/conf/LDAP-Auth.xml @@ -1,4 +1,4 @@ - + 127.0.0.1 ou=users,dc=yunohost,dc=org @@ -7,10 +7,10 @@ uid (permission=cn=jellyfin.main,ou=permission,dc=yunohost,dc=org) (permission=cn=jellyfin.admin,ou=permission,dc=yunohost,dc=org) - cn=admin,ou=users,dc=yunohost,dc=org - + + true - true + false false false From 8f2150def7fd0ce42c6967b1d27305148ec154e3 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 10:35:54 +0100 Subject: [PATCH 48/80] Ensure network configuration for 10.7 --- scripts/install | 5 +++-- scripts/upgrade | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 01d9921..359b09a 100644 --- a/scripts/install +++ b/scripts/install @@ -99,10 +99,11 @@ sleep 5 systemctl stop jellyfin # Port config -ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml" +ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" +ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" # BaseUrl config -ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/system.xml" +ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml" # Disable Setup Wizard ynh_replace_string --match_string="false" --replace_string="true" --target_file="/etc/jellyfin/system.xml" diff --git a/scripts/upgrade b/scripts/upgrade index cbbc124..ed18b31 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,6 +74,28 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +# Check if network.xml exists (introduced in v10.7) +if [ -z "/etc/jellyfin/network.xml" ]; then + ynh_script_progression --message="Configuring the settings..." --weight=1 + + # Load services once to generate network.xml + systemctl enable jellyfin + systemctl start jellyfin + sleep 5 + systemctl stop jellyfin + + # Port config + ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" + ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" + + # BaseUrl config + ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml" +fi + #================================================= # INSTALL LDAP PLUGIN #================================================= From 4512bfbaed4f15fe171b78f977c909fdb8210090 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 10:36:26 +0100 Subject: [PATCH 49/80] Update ldap.src --- conf/ldap.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/ldap.src b/conf/ldap.src index 4e4d1de..7ddae3c 100644 --- a/conf/ldap.src +++ b/conf/ldap.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/jellyfin/jellyfin-plugin-ldapauth/archive/v10.zip -SOURCE_SUM=d3374a5188abbc6c75c58f64d187f0b9c369a873e6dda7252bf7fe3e44a45eef +SOURCE_URL=https://repo.jellyfin.org/releases/plugin/ldap-authentication/ldap-authentication_10.0.0.0.zip +SOURCE_SUM=A261DD2F9F448839BC24D4DDC0996007F72517E04EEA8C78C45AEF217DD82D22 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false From 9a3142a0ec1ebb369aa9a074d6099ad039593618 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 14:01:52 +0100 Subject: [PATCH 50/80] Fix change_url for v10.7 --- scripts/change_url | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 03e8e62..e660a15 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -112,10 +112,10 @@ fi if [ $change_path -eq 1 ] then # If somehow was not replaced during install - if grep -q "" "/etc/jellyfin/system.xml"; then - ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" + if grep -q "" "/etc/jellyfin/network.xml"; then + ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml" else - ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml" + ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml" fi fi From 5e2ef2062ab7847b339d45e3701ec5d369ab3c45 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 10 Mar 2021 14:02:11 +0100 Subject: [PATCH 51/80] Temporary fix for check_process --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 19f6216..fcdf735 100644 --- a/check_process +++ b/check_process @@ -20,7 +20,8 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 +# Disabled because Jellyfin's team decided to remove old package... +# upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 backup_restore=1 multi_instance=0 port_already_use=0 @@ -31,5 +32,4 @@ Notification=none ;;; Upgrade options ; commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 name=2020-09-07 commit -# manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&port=666& From de07007051bd6e340d494ec7e2d11dbeed289bff Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 11 Mar 2021 08:34:12 +0100 Subject: [PATCH 52/80] Fix linter warnings --- scripts/install | 5 ++--- scripts/upgrade | 30 ++++++++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/scripts/install b/scripts/install index 359b09a..ecb45af 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -160,11 +159,11 @@ if [ $is_public -eq 1 ] then # Everyone can access the app. # The "main" permission is automatically created before the install script. - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi # Only the admin can access the admin panel of the app (if the app has an admin panel) -ynh_permission_create --permission "admin" --allowed $admin +ynh_permission_create --permission="admin" --allowed=$admin #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index ed18b31..5fb1c2f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) @@ -28,6 +27,23 @@ port=$(ynh_app_setting_get --app=$app --key=port) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --allowed=$admin +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -83,7 +99,7 @@ if [ -z "/etc/jellyfin/network.xml" ]; then ynh_script_progression --message="Configuring the settings..." --weight=1 # Load services once to generate network.xml - systemctl enable jellyfin + systemctl enable jellyfin --quiet systemctl start jellyfin sleep 5 systemctl stop jellyfin @@ -127,16 +143,6 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading permissions configuration..." --weight=1 - -# Create the admin permission if needed -if ! ynh_permission_exists --permission "admin"; then - ynh_permission_create --permission "admin" --allowed $admin -fi - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From 78196aca6f4b48124d56586c85042d935620fe8b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 11 Mar 2021 08:34:28 +0100 Subject: [PATCH 53/80] Add missing files --- README.md | 10 +++--- README_fr.md | 71 ++++++++++++++++++++++++++++++++++++++++ issue_template.md | 55 +++++++++++++++++++++++++++++++ pull_request_template.md | 16 +++++++++ 4 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 README_fr.md create mode 100644 issue_template.md create mode 100644 pull_request_template.md diff --git a/README.md b/README.md index dabab87..6a0507f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ [![Integration level](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) [![Install Jellyfin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jellyfin) +*[Lire ce readme en français.](./README_fr.md)* + > *This package allows you to install Jellyfin quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* @@ -17,22 +19,22 @@ Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin ## Demo -* [Official demo](Link to a demo site for this app.) +* [Official demo](https://demo.jellyfin.org/) ## Configuration -How to configure this app: From an admin panel, a plain file with SSH, or any other way. + * How to configure this app: From an admin panel. ## Documentation - * Official documentation: Link to the official documentation of this app + * Official documentation: https://jellyfin.org/docs/ * YunoHost documentation: If specific documentation is needed, feel free to contribute. ## YunoHost specific features #### Multi-user support - * Are LDAP and HTTP auth supported? **No** + * Are LDAP and HTTP auth supported? **Yes** * Can the app be used by multiple users? **Yes** #### Supported architectures diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..ad701cb --- /dev/null +++ b/README_fr.md @@ -0,0 +1,71 @@ +# Jellyfin pour YunoHost + +[![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)* + +> *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. + +**Version incluse :** 10.7.0 + +## Captures d'écran + +![](https://jellyfin.org/images/screenshots/movie_full.png) + +## Démo + +* [Démo officielle](https://demo.jellyfin.org/) + +## Configuration + +Comment configurer cette application : via le panneau d'administration. + +## Documentation + + * Documentation officielle : https://jellyfin.org/docs/ + * Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. + +## Caractéristiques spécifiques YunoHost + +#### Support multi-utilisateur + +* L'authentification LDAP et HTTP est-elle prise en charge ? **Oui** +* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** + +#### Architectures supportées + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jellyfin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jellyfin/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jellyfin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jellyfin/) + +## Limitations + +* Limitations connues. + +## Informations additionnelles + +* Autres informations que vous souhaitez ajouter sur cette application. + +## Liens + + * Signaler un bug : https://github.com/YunoHost-Apps/jellyfin_ynh/issues + * Site de l'application : https://jellyfin.org/ + * Dépôt de l'application principale : https://github.com/jellyfin/jellyfin + * Site web YunoHost : https://yunohost.org/ + +--- + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug +ou +sudo yunohost app upgrade jellyfin -u https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug +``` diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..869d5e4 --- /dev/null +++ b/issue_template.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to Jellyfin itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install jellyfin + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..6c28fc5 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,16 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how do you fix that problem* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Package_check results +--- +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* From 43d672cd0c70f3fa125abf961374f50ae7e50c18 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 11 Mar 2021 10:59:27 +0100 Subject: [PATCH 54/80] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index ecb45af..944b386 100644 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=final_path --value=$final_path #================================================= From 2e921598226a51b79bce1817a8159ae995dcbb09 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 14 Mar 2021 11:46:27 +0100 Subject: [PATCH 55/80] Specifically install server and web packages --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 944b386..01a3bac 100644 --- a/scripts/install +++ b/scripts/install @@ -69,7 +69,7 @@ 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" +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 jellyfin-server=$pkg_version jellyfin-web=$pkg_version" #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 0339296..c28c805 100644 --- a/scripts/restore +++ b/scripts/restore @@ -84,7 +84,7 @@ chown -R $app: /var/lib/jellyfin 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" +ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( lsb_release -c -s ) main" --package="jellyfin=$pkg_version jellyfin-server=$pkg_version jellyfin-web=$pkg_version" --key="https://repo.jellyfin.org/debian/jellyfin_team.gpg.key" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 5fb1c2f..fcf5486 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,7 +80,7 @@ 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" +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 jellyfin-server=$pkg_version jellyfin-web=$pkg_version" #================================================= # CREATE DEDICATED USER From d12b437674edb31813a782f3cec940a6dff63bea Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 14 Mar 2021 11:50:56 +0100 Subject: [PATCH 56/80] Make service restore paths not mandatory --- scripts/backup | 3 ++- scripts/restore | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 2b24fb0..59d6081 100644 --- a/scripts/backup +++ b/scripts/backup @@ -61,7 +61,8 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/lib/systemd/system/jellyfin.service" +ynh_backup --src_path="/lib/systemd/system/jellyfin.service" --not_mandatory +ynh_backup --src_path="/usr/lib/systemd/system/jellyfin.service" --not_mandatory ynh_backup --src_path="/etc/systemd/system/jellyfin.service.d" #================================================= diff --git a/scripts/restore b/scripts/restore index c28c805..bcb597f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,7 +91,8 @@ ynh_install_extra_app_dependencies --repo="https://repo.jellyfin.org/debian $( l #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null +ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" --not_mandatory 2>/dev/null +ynh_restore_file --origin_path="/usr/lib/systemd/system/jellyfin.service" --not_mandatory 2>/dev/null ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null systemctl enable $app.service --quiet From 22ad337c765fdb3c1cb7f20adf3ea538e9e96a00 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 19 Mar 2021 14:06:07 +0100 Subject: [PATCH 57/80] Apply last example_ynh (#65) * Apply last example_ynh * missing config_path * Update check_process * Update manifest.json --- check_process | 24 ++++++++++++++++-------- manifest.json | 23 ++++------------------- scripts/backup | 22 +++++++--------------- scripts/change_url | 11 ++++++----- scripts/install | 38 ++++++++++++++++---------------------- scripts/remove | 22 +--------------------- scripts/restore | 42 ++++++++++++++---------------------------- scripts/upgrade | 45 +++++++++++++++++++++++++-------------------- 8 files changed, 89 insertions(+), 138 deletions(-) diff --git a/check_process b/check_process index fcdf735..e0d7b4c 100644 --- a/check_process +++ b/check_process @@ -8,10 +8,7 @@ domain="domain.tld" (DOMAIN) path="/path" (PATH) admin="john" (USER) -# language="fr" is_public=1 (PUBLIC|public=1|private=0) -# password="pass" - port="666" (PORT) ; Checks pkg_linter=1 setup_sub_dir=1 @@ -20,8 +17,14 @@ setup_private=1 setup_public=1 upgrade=1 -# Disabled because Jellyfin's team decided to remove old package... -# upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 + # 10.6.4~ynh1 + #upgrade=1 from_commit=dc5ab412fe599ce6d558c2f55fe53d2c21956c08 + # 10.6.4~ynh2 + #upgrade=1 from_commit=2aab8003d64ffabe65bd11ebe5933cfef519b061 + # 10.6.4~ynh3 + #upgrade=1 from_commit=5478712c0ca7683503bc1b50cfafe81ea508065e + # 10.7.0~ynh1 + upgrade=1 from_commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b backup_restore=1 multi_instance=0 port_already_use=0 @@ -30,6 +33,11 @@ Email= Notification=none ;;; Upgrade options - ; commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966 - name=2020-09-07 commit - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&port=666& + ; commit=dc5ab412fe599ce6d558c2f55fe53d2c21956c08 + name=10.6.4~ynh1 + ; commit=2aab8003d64ffabe65bd11ebe5933cfef519b061 + name=10.6.4~ynh2 + ; commit=5478712c0ca7683503bc1b50cfafe81ea508065e + name=10.6.4~ynh3 + ; commit=63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b + name=10.7.0~ynh1 diff --git a/manifest.json b/manifest.json index f12a6dd..0989818 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~ynh1", + "version": "10.7.0~ynh2", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { @@ -14,48 +14,33 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.3" }, "multi_instance": false, "services": [ "nginx" ], "arguments": { - "install": [{ + "install" : [ + { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Jellyfin", - "fr": "Choisissez un nom de domaine pour Jellyfin" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Jellyfin", - "fr": "Choisissez un chemin pour Jellyfin" - }, "example": "/jellyfin", "default": "/jellyfin" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true, "help": { "en": "Jellyfin has its own login system, you should make it public to let external clients access it (mobile app, etc.).", diff --git a/scripts/backup b/scripts/backup index 2b24fb0..a1138ab 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -28,8 +27,9 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app="$app" --key=final_path) -domain=$(ynh_app_setting_get --app="$app" --key=domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -41,7 +41,6 @@ ynh_print_info --message="Declaring files to be backed up..." #================================================= ynh_backup --src_path="$final_path" -ynh_backup --src_path="/var/lib/jellyfin" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -52,17 +51,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= -# BACKUP LOGROTATE +# BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/logrotate.d/$app" - -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/lib/systemd/system/jellyfin.service" -ynh_backup --src_path="/etc/systemd/system/jellyfin.service.d" +ynh_backup --src_path="$config_path" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index e660a15..6012a83 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -22,6 +22,7 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME port=$(ynh_app_setting_get --app="$app" --key=port) +config_path=$(ynh_app_setting_get --app="$app" --key=config_path) #================================================= # LOAD SETTINGS @@ -42,7 +43,7 @@ ynh_clean_setup () { # 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" - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -71,7 +72,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" #================================================= # MODIFY URL IN NGINX CONF @@ -112,10 +113,10 @@ fi if [ $change_path -eq 1 ] then # If somehow was not replaced during install - if grep -q "" "/etc/jellyfin/network.xml"; then - ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml" + if grep -q "" "$config_path/network.xml"; then + ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="$config_path/network.xml" else - ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml" + ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$config_path/network.xml" fi fi diff --git a/scripts/install b/scripts/install index 944b386..ff83a92 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -36,9 +35,10 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/etc/jellyfin +final_path=/var/lib/jellyfin +config_path=/etc/jellyfin test ! -e "$final_path" || ynh_die --message="There is already a directory: $final_path " -test ! -e "/var/lib/jellyfin" || ynh_die --message="There is already a directory: /var/lib/jellyfin " +test ! -e "$config_path" || ynh_die --message="There is already a directory: $config_path " # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -52,6 +52,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=final_path --value=$final_path +ynh_app_setting_set --app=$app --key=config_path --value=$config_path #================================================= # STANDARD MODIFICATIONS @@ -93,20 +94,21 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Configuring the settings..." --weight=1 # Load services once to generate system.xml -systemctl enable jellyfin --quiet -systemctl start jellyfin -sleep 5 -systemctl stop jellyfin +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" # Port config -ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" -ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" +ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" +ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" # BaseUrl config -ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml" +ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="$config_path/network.xml" # Disable Setup Wizard -ynh_replace_string --match_string="false" --replace_string="true" --target_file="/etc/jellyfin/system.xml" +ynh_replace_string --match_string="false" --replace_string="true" --target_file="$config_path/system.xml" + +ynh_store_file_checksum --file="$config_path/network.xml" +ynh_store_file_checksum --file="$config_path/system.xml" #================================================= # INSTALL LDAP PLUGIN @@ -115,32 +117,24 @@ ynh_script_progression --message="Installing LDAP plugin..." --weight=2 ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=ldap mkdir -p /var/lib/jellyfin/plugins/configurations/ -cp ../conf/LDAP-Auth.xml /var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml +ynh_add_config --template="../conf/LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" #================================================= # 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: /var/lib/jellyfin - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=2 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log_type="systemd" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 2fefac4..435c9ad 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,8 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -33,14 +31,6 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config -ynh_remove_systemd_config - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -49,22 +39,12 @@ ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=12 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" -ynh_secure_remove --file="/etc/jellyfin" -ynh_secure_remove --file="/var/lib/jellyfin" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= diff --git a/scripts/restore b/scripts/restore index 0339296..ecf73cc 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -28,27 +27,29 @@ ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app="$app" --key=domain) -path_url=$(ynh_app_setting_get --app="$app" --key=path) -final_path=$(ynh_app_setting_get --app="$app" --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -ynh_webpath_available --domain="$domain" --path_url="$path_url" \ +ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" -test ! -d "$final_path" \ +test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " -test ! -d "/var/lib/jellyfin" \ - || ynh_die --message="There is already a directory: /var/lib/jellyfin " +test ! -d $config_path \ + || ynh_die --message="There is already a directory: $config_path " #================================================= # STANDARD RESTORATION STEPS #================================================= # 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" @@ -58,7 +59,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Restoring the app main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" -ynh_restore_file --origin_path="/var/lib/jellyfin" +ynh_restore_file --origin_path="$config_path" #================================================= # RECREATE THE DEDICATED USER @@ -66,15 +67,15 @@ ynh_restore_file --origin_path="/var/lib/jellyfin" ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username="$app" +ynh_system_user_create --username=$app #================================================= # RESTORE USER RIGHTS #================================================= +ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files chown -R $app: $final_path -chown -R $app: /var/lib/jellyfin #================================================= # SPECIFIC RESTORATION @@ -86,21 +87,12 @@ 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" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 - -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" 2>/dev/null -ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null -systemctl enable $app.service --quiet - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log_type="systemd" #================================================= # START SYSTEMD SERVICE @@ -109,12 +101,6 @@ 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" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5fb1c2f..78983c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,11 +19,13 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -32,6 +34,14 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If db_name doesn't 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 + final_path=/etc/jellyfin + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -52,7 +62,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -65,7 +75,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="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" #================================================= # NGINX CONFIGURATION @@ -98,18 +108,22 @@ ynh_system_user_create --username=$app if [ -z "/etc/jellyfin/network.xml" ]; then ynh_script_progression --message="Configuring the settings..." --weight=1 + ynh_backup_if_checksum_is_different --file="$config_path/network.xml" + ynh_backup_if_checksum_is_different --file="$config_path/system.xml" + # Load services once to generate network.xml - systemctl enable jellyfin --quiet - systemctl start jellyfin - sleep 5 - systemctl stop jellyfin + 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" # Port config - ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" - ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml" + ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" + ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" # BaseUrl config - ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml" + ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="$config_path/network.xml" + + ynh_store_file_checksum --file="$config_path/network.xml" + ynh_store_file_checksum --file="$config_path/system.xml" fi #================================================= @@ -122,7 +136,7 @@ if [ ! -e "/var/lib/jellyfin/plugins/LDAP Authentication" ]; then ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=ldap mkdir -p /var/lib/jellyfin/plugins/configurations/ - cp ../conf/LDAP-Auth.xml /var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml + ynh_add_config --template="../conf/LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" fi #================================================= @@ -133,22 +147,13 @@ fi # Set permissions on app files chown -R $app: $final_path -chown -R $app: /var/lib/jellyfin - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Jellyfin media center" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Jellyfin media center" --log_type="systemd" #================================================= # START SYSTEMD SERVICE From 7c62a0f6cb568a1fda40a5de2e1fe538efb05511 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 27 Mar 2021 12:08:11 +0100 Subject: [PATCH 58/80] Overhaul of package installation Moving away from unreliable debian repo and use deb files WIP, YunoHost does not encourage directly using apt --- conf/ffmpeg.src.default | 7 ++ conf/ldap.src | 1 - conf/server.src.default | 7 ++ conf/web.src.default | 7 ++ manifest.json | 20 +---- scripts/_common.sh | 166 ++++++++++++++++++++++++++++++++++++++++ scripts/install | 23 +++++- scripts/remove | 4 + scripts/restore | 30 ++++++-- scripts/upgrade | 23 +++++- 10 files changed, 262 insertions(+), 26 deletions(-) create mode 100644 conf/ffmpeg.src.default create mode 100644 conf/server.src.default create mode 100644 conf/web.src.default diff --git a/conf/ffmpeg.src.default b/conf/ffmpeg.src.default new file mode 100644 index 0000000..5c0349b --- /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___amd64.deb +SOURCE_SUM=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/__FFMPEG_PKG_VERSION__/jellyfin-ffmpeg___FFMPEG_PKG_VERSION__-__DEBIAN___amd64.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.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.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 f12a6dd..bb49b67 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~ynh1", + "version": "10.7.0~ynh2", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { @@ -14,7 +14,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.0" }, "multi_instance": false, "services": [ @@ -24,38 +24,22 @@ "install": [{ "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Jellyfin", - "fr": "Choisissez un nom de domaine pour Jellyfin" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Jellyfin", - "fr": "Choisissez un chemin pour Jellyfin" - }, "example": "/jellyfin", "default": "/jellyfin" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true, "help": { "en": "Jellyfin has its own login system, you should make it public to let external clients access it (mobile app, etc.).", diff --git a/scripts/_common.sh b/scripts/_common.sh index c0e6516..b9feff8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,12 +4,178 @@ # COMMON VARIABLES #================================================= +debian=$(lsb_release --codename --short) pkg_version="10.7.0-1" +version=$(echo "$pkg_version" | cut -d '-' -f 1) + +ffmpeg_pkg_version="4.3.1-4" #================================================= # PERSONAL HELPERS #================================================= +# +# usage: ynh_setup_source_2 --dest_dir=dest_dir [--source_id=source_id] +# | arg: -d, --dest_dir= - Directory where to setup sources +# | arg: -s, --source_id= - Name of the app, if the package contains more than one app +# +# The file conf/app.src need to contains: +# +# SOURCE_URL=Address to download the app archive +# SOURCE_SUM can either be the SUM string, or a URL to a file containing the SUM. +# If a URL is provided, the contents of the file will be cut to the first space. +# SOURCE_SUM=Control sum +# # (Optional) Program to check the integrity (sha256sum, md5sum...) +# # default: sha256 +# SOURCE_SUM_PRG=sha256 +# # (Optional) Archive format +# # default: tar.gz +# SOURCE_FORMAT=tar.gz +# # (Optional) Put false if sources are directly in the archive root +# # default: true +# # Instead of true, SOURCE_IN_SUBDIR could be the number of sub directories +# # to remove. +# SOURCE_IN_SUBDIR=false +# # (Optionnal) Name of the local archive (offline setup support) +# # default: ${src_id}.${src_format} +# SOURCE_FILENAME=example.tar.gz +# # (Optional) If it set as false don't extract the source. +# # (Useful to get a debian package or a python wheel.) +# # default: true +# SOURCE_EXTRACT=(true|false) +# +# Details: +# This helper downloads sources from SOURCE_URL if there is no local source +# archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME +# +# Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command. +# +# If it's ok, the source archive will be uncompressed in $dest_dir. If the +# SOURCE_IN_SUBDIR is true, the first level directory of the archive will be +# removed. +# If SOURCE_IN_SUBDIR is a numeric value, 2 for example, the 2 first level +# directories will be removed +# +# Finally, patches named sources/patches/${src_id}-*.patch and extra files in +# sources/extra_files/$src_id will be applied to dest_dir +# +# Requires YunoHost version 2.6.4 or higher. +ynh_setup_source_2 () { + # Declare an array to define the options of this helper. + local legacy_args=ds + local -A args_array=( [d]=dest_dir= [s]=source_id= ) + local dest_dir + local source_id + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + source_id="${source_id:-app}" # If the argument is not given, source_id equals "app" + + local src_file_path="$YNH_CWD/../conf/${source_id}.src" + # In case of restore script the src file is in an other path. + # So try to use the restore path if the general path point to no file. + if [ ! -e "$src_file_path" ]; then + src_file_path="$YNH_CWD/../settings/conf/${source_id}.src" + fi + + # Load value from configuration file (see above for a small doc about this file + # format) + local src_url=$(grep 'SOURCE_URL=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_sum=$(grep 'SOURCE_SUM=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_sumprg=$(grep 'SOURCE_SUM_PRG=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_format=$(grep 'SOURCE_FORMAT=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_extract=$(grep 'SOURCE_EXTRACT=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_in_subdir=$(grep 'SOURCE_IN_SUBDIR=' "$src_file_path" | cut --delimiter='=' --fields=2-) + local src_filename=$(grep 'SOURCE_FILENAME=' "$src_file_path" | cut --delimiter='=' --fields=2-) + + # Default value + src_sumprg=${src_sumprg:-sha256sum} + src_in_subdir=${src_in_subdir:-true} + src_format=${src_format:-tar.gz} + src_format=$(echo "$src_format" | tr '[:upper:]' '[:lower:]') + src_extract=${src_extract:-true} + if [ "$src_filename" = "" ]; then + src_filename="${source_id}.${src_format}" + fi + local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}" + + if test -e "$local_src" + then # Use the local source file if it is present + cp $local_src $src_filename + else # If not, download the source + # NB. we have to declare the var as local first, + # otherwise 'local foo=$(false) || echo 'pwet'" does'nt work + # because local always return 0 ... + local out + # Timeout option is here to enforce the timeout on dns query and tcp connect (c.f. man wget) + out=$(wget --tries 3 --no-dns-cache --timeout 900 --no-verbose --output-document=$src_filename $src_url 2>&1) \ + || ynh_die --message="$out" + fi + + # Get the control sum if a URL was provided + # Only retain the part before the first space + if [[ "${src_sum}" =~ ^http[s+]:// ]]; then + src_sum=$(curl -L -s "${src_sum}" | cut -d ' ' -f 1) + fi + + # Check the control sum + echo "${src_sum} ${src_filename}" | ${src_sumprg} --check --status \ + || ynh_die --message="Corrupt source" + + # Extract source into the app dir + mkdir --parents "$dest_dir" + + if ! "$src_extract" + then + mv $src_filename $dest_dir + elif [ "$src_format" = "zip" ] + then + # Zip format + # Using of a temp directory, because unzip doesn't manage --strip-components + if $src_in_subdir + then + local tmp_dir=$(mktemp --directory) + unzip -quo $src_filename -d "$tmp_dir" + cp --archive $tmp_dir/*/. "$dest_dir" + ynh_secure_remove --file="$tmp_dir" + else + unzip -quo $src_filename -d "$dest_dir" + fi + else + local strip="" + if [ "$src_in_subdir" != "false" ] + then + if [ "$src_in_subdir" == "true" ] + then + local sub_dirs=1 + else + local sub_dirs="$src_in_subdir" + fi + strip="--strip-components $sub_dirs" + fi + if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]] + then + tar --extract --file=$src_filename --directory="$dest_dir" $strip + else + ynh_die --message="Archive format unrecognized." + fi + fi + + # Apply patches + if (( $(find $YNH_CWD/../sources/patches/ -type f -name "${source_id}-*.patch" 2> /dev/null | wc --lines) > "0" )) + then + (cd "$dest_dir" + for p in $YNH_CWD/../sources/patches/${source_id}-*.patch + do + patch --strip=1 < $p + done) || ynh_die --message="Unable to apply patches" + fi + + # Add supplementary files + if test -e "$YNH_CWD/../sources/extra_files/${source_id}"; then + cp --archive $YNH_CWD/../sources/extra_files/$source_id/. "$dest_dir" + fi +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 01a3bac..604bb64 100644 --- a/scripts/install +++ b/scripts/install @@ -40,6 +40,11 @@ final_path=/etc/jellyfin test ! -e "$final_path" || ynh_die --message="There is already a directory: $final_path " test ! -e "/var/lib/jellyfin" || ynh_die --message="There is already a directory: /var/lib/jellyfin " +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 @@ -69,7 +74,23 @@ 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 jellyfin-server=$pkg_version jellyfin-web=$pkg_version" +# Prepare the source files (replace the placeholders with version, architecture, etc. +ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" +ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" +ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" + +# Create the temporary directory +tempdir="$(mktemp -d)" + +# Download the deb files +ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg +ynh_setup_source_2 --dest_dir=$tempdir --source_id=server +ynh_setup_source_2 --dest_dir=$tempdir --source_id=web + +# Install the packages +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index 2fefac4..184168a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -46,6 +46,10 @@ ynh_remove_systemd_config #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 +apt remove jellyfin-web +apt remove jellyfin-server +apt remove jellyfin-ffmpeg + # Remove metapackage and its dependencies ynh_remove_app_dependencies diff --git a/scripts/restore b/scripts/restore index bcb597f..79d1605 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,6 +44,11 @@ test ! -d "$final_path" \ test ! -d "/var/lib/jellyfin" \ || ynh_die --message="There is already a directory: /var/lib/jellyfin " +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 #================================================= @@ -83,17 +88,32 @@ chown -R $app: /var/lib/jellyfin #================================================= 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=$pkg_version jellyfin-server=$pkg_version jellyfin-web=$pkg_version" --key="https://repo.jellyfin.org/debian/jellyfin_team.gpg.key" +# Prepare the source files (replace the placeholders with version, architecture, etc. +ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" +ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" +ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" + +# Create the temporary directory +tempdir="$(mktemp -d)" + +# Download the deb files +ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg +ynh_setup_source_2 --dest_dir=$tempdir --source_id=server +ynh_setup_source_2 --dest_dir=$tempdir --source_id=web + +# Install the packages +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb #================================================= # RESTORE SYSTEMD #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" --not_mandatory 2>/dev/null -ynh_restore_file --origin_path="/usr/lib/systemd/system/jellyfin.service" --not_mandatory 2>/dev/null -ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" 2>/dev/null +ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" --not_mandatory +ynh_restore_file --origin_path="/usr/lib/systemd/system/jellyfin.service" --not_mandatory +ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" systemctl enable $app.service --quiet #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fcf5486..6b2c2ab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,6 +32,11 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +architecture=$(dpkg --print-architecture) +if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then + ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1 +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -80,7 +85,23 @@ 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 jellyfin-server=$pkg_version jellyfin-web=$pkg_version" +# Prepare the source files (replace the placeholders with version, architecture, etc. +ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" +ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" +ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" + +# Create the temporary directory +tempdir="$(mktemp -d)" + +# Download the deb files +ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg +ynh_setup_source_2 --dest_dir=$tempdir --source_id=server +ynh_setup_source_2 --dest_dir=$tempdir --source_id=web + +# Install the packages +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb #================================================= # CREATE DEDICATED USER From ea5350820abd2317173862d66ee8bc27454b169a Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 27 Mar 2021 14:21:44 +0100 Subject: [PATCH 59/80] apt -y --- scripts/install | 6 +++--- scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index a7ae60c..89a0194 100644 --- a/scripts/install +++ b/scripts/install @@ -89,9 +89,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index f32a7ad..8940d13 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,9 +103,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 00c7928..3c4c2de 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,9 +109,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb +ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y #================================================= # CREATE DEDICATED USER From 4961da158e25aad248d33b5e4a368f535a9c64cf Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 27 Mar 2021 14:48:33 +0100 Subject: [PATCH 60/80] apt -y in remove too --- scripts/remove | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 4345a2e..4b4ecc5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -36,9 +36,9 @@ fi #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 -apt remove jellyfin-web -apt remove jellyfin-server -apt remove jellyfin-ffmpeg +apt remove jellyfin-web -y +apt remove jellyfin-server -y +apt remove jellyfin-ffmpeg -y # Remove metapackage and its dependencies ynh_remove_app_dependencies From d1adcf3b1c27f03393fc2550bd998b3317572b70 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 27 Mar 2021 17:28:26 +0100 Subject: [PATCH 61/80] Explicitely delete directories during removal --- scripts/remove | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/remove b/scripts/remove index 4b4ecc5..6ec2980 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 @@ -43,6 +45,16 @@ apt remove jellyfin-ffmpeg -y # Remove metapackage and its dependencies ynh_remove_app_dependencies +#================================================= +# REMOVE APP DIRECTORIES +#================================================= +ynh_script_progression --message="Removing app directories..." --time --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 #================================================= From 7d733097838b812f9e308c73896440fd1bc7502c Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 28 Mar 2021 01:22:45 +0100 Subject: [PATCH 62/80] Fix conf directory in restore it is actually in ../settings/conf --- scripts/restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/restore b/scripts/restore index 8940d13..d461558 100644 --- a/scripts/restore +++ b/scripts/restore @@ -90,9 +90,9 @@ chown -R $app: $final_path ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Prepare the source files (replace the placeholders with version, architecture, etc. -ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" -ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" -ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" +ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../settings/conf/ffmpeg.src" +ynh_add_config --template="../conf/server.src.default" --destination="../settings/conf/server.src" +ynh_add_config --template="../conf/web.src.default" --destination="../settings/conf/web.src" # Create the temporary directory tempdir="$(mktemp -d)" From 0aeb908c3499e7bce7eb800a6cf3862bdffdc5f0 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 28 Mar 2021 10:42:35 +0200 Subject: [PATCH 63/80] Disable upgrade from previous version --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 77873d0153a87ed9d7bc12170aca3d8676268a1f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 1 Apr 2021 23:22:31 +0200 Subject: [PATCH 64/80] Do not use dynamic checksum retrieval That's a security risk, if the source repo is maliciously altered. Let's add a dedicated script to automatically generate the source files instead. --- README_fr.md | 4 +- conf/ffmpeg.src | 7 ++++ conf/server.src | 7 ++++ conf/web.src | 7 ++++ manifest.json | 2 +- scripts/_common.sh | 2 + scripts/update_version.sh | 77 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 conf/ffmpeg.src create mode 100644 conf/server.src create mode 100644 conf/web.src create mode 100755 scripts/update_version.sh diff --git a/README_fr.md b/README_fr.md index ad701cb..dd444c0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,13 +3,13 @@ [![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 diff --git a/conf/ffmpeg.src b/conf/ffmpeg.src new file mode 100644 index 0000000..44fb1a9 --- /dev/null +++ b/conf/ffmpeg.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.3.1-4/jellyfin-ffmpeg_4.3.1-4-buster_amd64.deb +SOURCE_SUM=edf655807c120bc53ab1be3c0c2dfa9d2ba9e110419d79b0c6b1c1a5896db854 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=deb +SOURCE_IN_SUBDIR=false +SOURCE_EXTRACT=false +SOURCE_FILENAME=jellyfin-ffmpeg.deb diff --git a/conf/server.src b/conf/server.src new file mode 100644 index 0000000..9fabfc2 --- /dev/null +++ b/conf/server.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.0/jellyfin-server_10.7.0-1_amd64.deb +SOURCE_SUM=3e2ced1f99167961e341dae674a94d8fd892a857bcc3bba026654ce9284062de +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=deb +SOURCE_IN_SUBDIR=false +SOURCE_EXTRACT=false +SOURCE_FILENAME=jellyfin-server.deb diff --git a/conf/web.src b/conf/web.src new file mode 100644 index 0000000..0903798 --- /dev/null +++ b/conf/web.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.0/jellyfin-web_10.7.0-1_all.deb +SOURCE_SUM=19cf6bad41176c46950bf5ebb5cfd94efda4582cb898524e0a1ea7576e523af1 +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..4669493 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.0~ynh3", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index b9feff8..fab6ae5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,6 +10,8 @@ version=$(echo "$pkg_version" | cut -d '-' -f 1) ffmpeg_pkg_version="4.3.1-4" +architecture=$(dpkg --print-architecture) + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/update_version.sh b/scripts/update_version.sh new file mode 100755 index 0000000..00a943c --- /dev/null +++ b/scripts/update_version.sh @@ -0,0 +1,77 @@ +#!/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=tdv + local -A args_array=( [t]=template= [d]=destination= ) + local template + local destination + # 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 +} + +prepare_source --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" +prepare_source --template="../conf/web.src.default" --destination="../conf/web.src" +prepare_source --template="../conf/server.src.default" --destination="../conf/server.src" + +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 commit ../README.md ../README_fr.md ../manifest.json ../conf/ffmpeg.src ../conf/web.src ../conf/server.src -m "Upgrade to v$version" From 18bef5d8d9f13ccdcaa4d71696fb0e9f7c0672cb Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 1 Apr 2021 23:46:32 +0200 Subject: [PATCH 65/80] Enable logrotate and lower verbosity --- scripts/backup | 6 ++++++ scripts/install | 12 ++++++++++++ scripts/remove | 8 ++++++++ scripts/restore | 7 +++++++ scripts/upgrade | 17 ++++++++++++++++- 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index a1138ab..261bf40 100644 --- a/scripts/backup +++ b/scripts/backup @@ -50,6 +50,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP VARIOUS FILES #================================================= diff --git a/scripts/install b/scripts/install index 89a0194..e405e04 100644 --- a/scripts/install +++ b/scripts/install @@ -128,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\"" + ynh_store_file_checksum --file="$config_path/network.xml" ynh_store_file_checksum --file="$config_path/system.xml" @@ -150,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..." --time --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/remove b/scripts/remove index 6ec2980..7593e28 100644 --- a/scripts/remove +++ b/scripts/remove @@ -63,6 +63,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..." --time --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index d461558..c4ad372 100644 --- a/scripts/restore +++ b/scripts/restore @@ -121,6 +121,13 @@ 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" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3c4c2de..ab3b6a0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ 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 db_name doesn't exist, create it +# 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 @@ -47,6 +47,13 @@ if [ -z "$config_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi + +# If logging config does not exist, lower logging verbosity +if ! [ -e "$config_path/logging.json" ]; then + cp "$config_path/logging.default.json" "$config_path/logging.json" + ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -169,6 +176,14 @@ fi # Set permissions on app files chown -R $app: $final_path +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --time --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From 87549cb90a9b351f5e965a68729d554bea36d593 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 2 Apr 2021 03:59:03 +0200 Subject: [PATCH 66/80] ynh_replace_string is nice, but do not forget to specify the file --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index e405e04..f84360b 100644 --- a/scripts/install +++ b/scripts/install @@ -130,7 +130,7 @@ ynh_replace_string --match_string="false Date: Fri, 2 Apr 2021 12:36:17 +0200 Subject: [PATCH 67/80] Change service startup keywords --- scripts/install | 4 ++-- scripts/restore | 3 +-- scripts/upgrade | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index f84360b..101e698 100644 --- a/scripts/install +++ b/scripts/install @@ -115,7 +115,7 @@ ynh_system_user_create --username=$app 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="restart" --log_path="systemd" --line_match="Started Jellyfin Media Server" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" # Port config @@ -175,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" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index c4ad372..c835ca5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -119,8 +119,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" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 8a93dd1..0b944e2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -140,7 +140,7 @@ 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="restart" --log_path="systemd" --line_match="Started Jellyfin Media Server" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" # Port config @@ -196,7 +196,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" #================================================= # RELOAD NGINX From 51800683d1fa27abf40c87478b78a07142eecb14 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 6 Apr 2021 22:46:46 +0200 Subject: [PATCH 68/80] Use apt-get instead of apt --- scripts/install | 6 +++--- scripts/remove | 9 +++------ scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/scripts/install b/scripts/install index 101e698..6f9cc09 100644 --- a/scripts/install +++ b/scripts/install @@ -89,9 +89,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index 7593e28..ae00f83 100644 --- a/scripts/remove +++ b/scripts/remove @@ -38,12 +38,9 @@ fi #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 -apt remove jellyfin-web -y -apt remove jellyfin-server -y -apt remove jellyfin-ffmpeg -y - -# 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 diff --git a/scripts/restore b/scripts/restore index c835ca5..4a31ec8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,9 +103,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 0b944e2..852b3b5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,9 +116,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt install $tempdir/jellyfin-web.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y +ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y #================================================= # CREATE DEDICATED USER From 7f43e1daa406bfdcf7b7f209710fd187110075d2 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 22 Apr 2021 18:40:00 +0200 Subject: [PATCH 69/80] Install deb files with dependencies -f flag was missing for apt-get --- scripts/install | 6 +++--- scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index 6f9cc09..ffc60ea 100644 --- a/scripts/install +++ b/scripts/install @@ -89,9 +89,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y +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 diff --git a/scripts/restore b/scripts/restore index 4a31ec8..d206cbd 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,9 +103,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y +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 #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 852b3b5..fd0b38a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,9 +116,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # Install the packages -ynh_exec_warn_less apt-get install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt-get install $tempdir/jellyfin-web.deb -y +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 #================================================= # CREATE DEDICATED USER From f44dd068ade7b2cfbec3a98e5c83b24bd767fb27 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 23 Apr 2021 23:27:20 +0200 Subject: [PATCH 70/80] Skip apt-get's config file questions during restore --- scripts/restore | 6 +++--- scripts/upgrade | 17 +++++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/restore b/scripts/restore index d206cbd..7f3606d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,9 +103,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # 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 +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 diff --git a/scripts/upgrade b/scripts/upgrade index fd0b38a..dd889d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,13 +47,6 @@ if [ -z "$config_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi - -# If logging config does not exist, lower logging verbosity -if ! [ -e "$config_path/logging.json" ]; then - 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" -fi - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -116,9 +109,9 @@ ynh_setup_source_2 --dest_dir=$tempdir --source_id=server ynh_setup_source_2 --dest_dir=$tempdir --source_id=web # 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 +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 @@ -154,6 +147,10 @@ if [ -z "/etc/jellyfin/network.xml" ]; then ynh_store_file_checksum --file="$config_path/system.xml" fi +# 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" + #================================================= # INSTALL LDAP PLUGIN #================================================= From 9616d0da27965904a5988f72353c40a53db2d9c6 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 24 Apr 2021 10:35:12 +0200 Subject: [PATCH 71/80] Remove all --time flags --- scripts/install | 2 +- scripts/remove | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index ffc60ea..d4c6121 100644 --- a/scripts/install +++ b/scripts/install @@ -157,7 +157,7 @@ chown -R $app: $final_path #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate diff --git a/scripts/remove b/scripts/remove index ae00f83..acf5d08 100644 --- a/scripts/remove +++ b/scripts/remove @@ -45,7 +45,7 @@ apt-get remove jellyfin-ffmpeg -y #================================================= # REMOVE APP DIRECTORIES #================================================= -ynh_script_progression --message="Removing app directories..." --time --weight=1 +ynh_script_progression --message="Removing app directories..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -63,7 +63,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate diff --git a/scripts/upgrade b/scripts/upgrade index dd889d5..eb7410b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,7 +176,7 @@ chown -R $app: $final_path #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate --non-append From 0121ff40fead2965756d8d565c96d5eaaeb6d3b5 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 24 Apr 2021 10:49:04 +0200 Subject: [PATCH 72/80] Reduce line_match timeout Service startup is usually quite fast and YNH tends to start monitoring the logs too late --- scripts/change_url | 4 ++-- scripts/install | 6 +++--- scripts/restore | 2 +- scripts/upgrade | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) 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 d4c6121..cd63ee3 100644 --- a/scripts/install +++ b/scripts/install @@ -115,8 +115,8 @@ ynh_system_user_create --username=$app 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="Started Jellyfin Media Server" -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" @@ -175,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="Started Jellyfin Media Server" +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/restore b/scripts/restore index 7f3606d..8f44002 100644 --- a/scripts/restore +++ b/scripts/restore @@ -119,7 +119,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="Started Jellyfin Media Server" +ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15 #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index eb7410b..952154c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,7 +80,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 @@ -133,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="Started Jellyfin Media Server" - 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" @@ -193,7 +193,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="Started Jellyfin Media Server" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15 #================================================= # RELOAD NGINX From d61496a8285f10b81e552e799f1ced2b33be4746 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 2 May 2021 11:44:53 +0200 Subject: [PATCH 73/80] Upgrade to v10.7.2 --- README.md | 2 +- README_fr.md | 2 +- conf/ffmpeg.src | 4 ++-- conf/server.src | 4 ++-- conf/web.src | 4 ++-- manifest.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6a0507f..ee69c92 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.2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index dd444c0..f9e8988 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## 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. -**Version incluse :** 10.7.0 +**Version incluse :** 10.7.2 ## Captures d'écran diff --git a/conf/ffmpeg.src b/conf/ffmpeg.src index 44fb1a9..ad97f50 100644 --- a/conf/ffmpeg.src +++ b/conf/ffmpeg.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/4.3.1-4/jellyfin-ffmpeg_4.3.1-4-buster_amd64.deb -SOURCE_SUM=edf655807c120bc53ab1be3c0c2dfa9d2ba9e110419d79b0c6b1c1a5896db854 +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 diff --git a/conf/server.src b/conf/server.src index 9fabfc2..ffe2ba4 100644 --- a/conf/server.src +++ b/conf/server.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.0/jellyfin-server_10.7.0-1_amd64.deb -SOURCE_SUM=3e2ced1f99167961e341dae674a94d8fd892a857bcc3bba026654ce9284062de +SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.2/jellyfin-server_10.7.2-1_amd64.deb +SOURCE_SUM=05d7d7afc9ac7bf44d5fef79d88d56afd1c36f98b0f0746c2b8f37e3b881c353 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=deb SOURCE_IN_SUBDIR=false diff --git a/conf/web.src b/conf/web.src index 0903798..40ddf4f 100644 --- a/conf/web.src +++ b/conf/web.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.0/jellyfin-web_10.7.0-1_all.deb -SOURCE_SUM=19cf6bad41176c46950bf5ebb5cfd94efda4582cb898524e0a1ea7576e523af1 +SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.2/jellyfin-web_10.7.2-1_all.deb +SOURCE_SUM=a2213212e3c6ef0fd87c7414f64e0c2dc991997eef7b8a4a755734c5878c337a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=deb SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 4669493..9fa3acc 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~ynh3", + "version": "10.7.2~ynh1", "url": "https://github.com/jellyfin/jellyfin", "license": "GPL-2.0-only", "maintainer": { From 0e4f536ad503b49f95cf167cefce57173eb7c302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 5 May 2021 21:36:21 +0200 Subject: [PATCH 74/80] Add jellyfin to render group (#57) * Add jellyfin to render group * Update install * Fix * Improve render group detection Co-authored-by: tituspijean --- scripts/install | 5 +++++ scripts/upgrade | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/install b/scripts/install index cd63ee3..a81e750 100644 --- a/scripts/install +++ b/scripts/install @@ -109,6 +109,11 @@ 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 952154c..d394fc8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,6 +47,11 @@ if [ -z "$config_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If jellyfin doesn't belong to render group, add it +if [ ! $(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 @@ -58,7 +63,10 @@ if ! ynh_permission_exists --permission="admin"; then # Create the required permissions ynh_permission_create --permission="admin" --allowed=$admin fi +<<<<<<< HEAD +======= +>>>>>>> Add jellyfin to render group #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 5ec1be8f48cf0ccc6141a6d19d260f4ff05edba8 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 6 May 2021 13:49:49 +0200 Subject: [PATCH 75/80] Upgrade to v10.7.5 and fix source files generation --- README.md | 2 +- README_fr.md | 2 +- conf/{ffmpeg.src => ffmpeg.amd64.src} | 0 conf/ffmpeg.arm64.src | 7 ++ conf/ffmpeg.armhf.src | 7 ++ conf/ffmpeg.src.default | 4 +- conf/{server.src => server.amd64.src} | 4 +- conf/server.arm64.src | 7 ++ conf/server.armhf.src | 7 ++ conf/{web.src => web.amd64.src} | 4 +- conf/web.arm64.src | 7 ++ conf/web.armhf.src | 7 ++ manifest.json | 2 +- scripts/_common.sh | 166 +------------------------- scripts/install | 6 +- scripts/update_version.sh | 17 ++- scripts/upgrade | 6 +- 17 files changed, 70 insertions(+), 185 deletions(-) rename conf/{ffmpeg.src => ffmpeg.amd64.src} (100%) create mode 100644 conf/ffmpeg.arm64.src create mode 100644 conf/ffmpeg.armhf.src rename conf/{server.src => server.amd64.src} (57%) create mode 100644 conf/server.arm64.src create mode 100644 conf/server.armhf.src rename conf/{web.src => web.amd64.src} (58%) create mode 100644 conf/web.arm64.src create mode 100644 conf/web.armhf.src diff --git a/README.md b/README.md index ee69c92..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.2 +**Shipped version:** 10.7.5 ## Screenshots diff --git a/README_fr.md b/README_fr.md index f9e8988..66a499a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## 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. -**Version incluse :** 10.7.2 +**Version incluse :** 10.7.5 ## Captures d'écran diff --git a/conf/ffmpeg.src b/conf/ffmpeg.amd64.src similarity index 100% rename from conf/ffmpeg.src rename to conf/ffmpeg.amd64.src 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 index 5c0349b..4976a6c 100644 --- a/conf/ffmpeg.src.default +++ b/conf/ffmpeg.src.default @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/__FFMPEG_PKG_VERSION__/jellyfin-ffmpeg___FFMPEG_PKG_VERSION__-__DEBIAN___amd64.deb -SOURCE_SUM=https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/__FFMPEG_PKG_VERSION__/jellyfin-ffmpeg___FFMPEG_PKG_VERSION__-__DEBIAN___amd64.deb.sha256sum +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 diff --git a/conf/server.src b/conf/server.amd64.src similarity index 57% rename from conf/server.src rename to conf/server.amd64.src index ffe2ba4..3086fbd 100644 --- a/conf/server.src +++ b/conf/server.amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.7.2/jellyfin-server_10.7.2-1_amd64.deb -SOURCE_SUM=05d7d7afc9ac7bf44d5fef79d88d56afd1c36f98b0f0746c2b8f37e3b881c353 +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 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/web.src b/conf/web.amd64.src similarity index 58% rename from conf/web.src rename to conf/web.amd64.src index 40ddf4f..29a3b50 100644 --- a/conf/web.src +++ b/conf/web.amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.7.2/jellyfin-web_10.7.2-1_all.deb -SOURCE_SUM=a2213212e3c6ef0fd87c7414f64e0c2dc991997eef7b8a4a755734c5878c337a +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 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/manifest.json b/manifest.json index 9fa3acc..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.2~ynh1", + "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 fab6ae5..429ccc7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,10 +5,10 @@ #================================================= debian=$(lsb_release --codename --short) -pkg_version="10.7.0-1" +pkg_version="10.7.5-1" version=$(echo "$pkg_version" | cut -d '-' -f 1) -ffmpeg_pkg_version="4.3.1-4" +ffmpeg_pkg_version="4.3.2-1" architecture=$(dpkg --print-architecture) @@ -16,168 +16,6 @@ architecture=$(dpkg --print-architecture) # PERSONAL HELPERS #================================================= -# -# usage: ynh_setup_source_2 --dest_dir=dest_dir [--source_id=source_id] -# | arg: -d, --dest_dir= - Directory where to setup sources -# | arg: -s, --source_id= - Name of the app, if the package contains more than one app -# -# The file conf/app.src need to contains: -# -# SOURCE_URL=Address to download the app archive -# SOURCE_SUM can either be the SUM string, or a URL to a file containing the SUM. -# If a URL is provided, the contents of the file will be cut to the first space. -# SOURCE_SUM=Control sum -# # (Optional) Program to check the integrity (sha256sum, md5sum...) -# # default: sha256 -# SOURCE_SUM_PRG=sha256 -# # (Optional) Archive format -# # default: tar.gz -# SOURCE_FORMAT=tar.gz -# # (Optional) Put false if sources are directly in the archive root -# # default: true -# # Instead of true, SOURCE_IN_SUBDIR could be the number of sub directories -# # to remove. -# SOURCE_IN_SUBDIR=false -# # (Optionnal) Name of the local archive (offline setup support) -# # default: ${src_id}.${src_format} -# SOURCE_FILENAME=example.tar.gz -# # (Optional) If it set as false don't extract the source. -# # (Useful to get a debian package or a python wheel.) -# # default: true -# SOURCE_EXTRACT=(true|false) -# -# Details: -# This helper downloads sources from SOURCE_URL if there is no local source -# archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME -# -# Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command. -# -# If it's ok, the source archive will be uncompressed in $dest_dir. If the -# SOURCE_IN_SUBDIR is true, the first level directory of the archive will be -# removed. -# If SOURCE_IN_SUBDIR is a numeric value, 2 for example, the 2 first level -# directories will be removed -# -# Finally, patches named sources/patches/${src_id}-*.patch and extra files in -# sources/extra_files/$src_id will be applied to dest_dir -# -# Requires YunoHost version 2.6.4 or higher. -ynh_setup_source_2 () { - # Declare an array to define the options of this helper. - local legacy_args=ds - local -A args_array=( [d]=dest_dir= [s]=source_id= ) - local dest_dir - local source_id - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - source_id="${source_id:-app}" # If the argument is not given, source_id equals "app" - - local src_file_path="$YNH_CWD/../conf/${source_id}.src" - # In case of restore script the src file is in an other path. - # So try to use the restore path if the general path point to no file. - if [ ! -e "$src_file_path" ]; then - src_file_path="$YNH_CWD/../settings/conf/${source_id}.src" - fi - - # Load value from configuration file (see above for a small doc about this file - # format) - local src_url=$(grep 'SOURCE_URL=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_sum=$(grep 'SOURCE_SUM=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_sumprg=$(grep 'SOURCE_SUM_PRG=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_format=$(grep 'SOURCE_FORMAT=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_extract=$(grep 'SOURCE_EXTRACT=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_in_subdir=$(grep 'SOURCE_IN_SUBDIR=' "$src_file_path" | cut --delimiter='=' --fields=2-) - local src_filename=$(grep 'SOURCE_FILENAME=' "$src_file_path" | cut --delimiter='=' --fields=2-) - - # Default value - src_sumprg=${src_sumprg:-sha256sum} - src_in_subdir=${src_in_subdir:-true} - src_format=${src_format:-tar.gz} - src_format=$(echo "$src_format" | tr '[:upper:]' '[:lower:]') - src_extract=${src_extract:-true} - if [ "$src_filename" = "" ]; then - src_filename="${source_id}.${src_format}" - fi - local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}" - - if test -e "$local_src" - then # Use the local source file if it is present - cp $local_src $src_filename - else # If not, download the source - # NB. we have to declare the var as local first, - # otherwise 'local foo=$(false) || echo 'pwet'" does'nt work - # because local always return 0 ... - local out - # Timeout option is here to enforce the timeout on dns query and tcp connect (c.f. man wget) - out=$(wget --tries 3 --no-dns-cache --timeout 900 --no-verbose --output-document=$src_filename $src_url 2>&1) \ - || ynh_die --message="$out" - fi - - # Get the control sum if a URL was provided - # Only retain the part before the first space - if [[ "${src_sum}" =~ ^http[s+]:// ]]; then - src_sum=$(curl -L -s "${src_sum}" | cut -d ' ' -f 1) - fi - - # Check the control sum - echo "${src_sum} ${src_filename}" | ${src_sumprg} --check --status \ - || ynh_die --message="Corrupt source" - - # Extract source into the app dir - mkdir --parents "$dest_dir" - - if ! "$src_extract" - then - mv $src_filename $dest_dir - elif [ "$src_format" = "zip" ] - then - # Zip format - # Using of a temp directory, because unzip doesn't manage --strip-components - if $src_in_subdir - then - local tmp_dir=$(mktemp --directory) - unzip -quo $src_filename -d "$tmp_dir" - cp --archive $tmp_dir/*/. "$dest_dir" - ynh_secure_remove --file="$tmp_dir" - else - unzip -quo $src_filename -d "$dest_dir" - fi - else - local strip="" - if [ "$src_in_subdir" != "false" ] - then - if [ "$src_in_subdir" == "true" ] - then - local sub_dirs=1 - else - local sub_dirs="$src_in_subdir" - fi - strip="--strip-components $sub_dirs" - fi - if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]] - then - tar --extract --file=$src_filename --directory="$dest_dir" $strip - else - ynh_die --message="Archive format unrecognized." - fi - fi - - # Apply patches - if (( $(find $YNH_CWD/../sources/patches/ -type f -name "${source_id}-*.patch" 2> /dev/null | wc --lines) > "0" )) - then - (cd "$dest_dir" - for p in $YNH_CWD/../sources/patches/${source_id}-*.patch - do - patch --strip=1 < $p - done) || ynh_die --message="Unable to apply patches" - fi - - # Add supplementary files - if test -e "$YNH_CWD/../sources/extra_files/${source_id}"; then - cp --archive $YNH_CWD/../sources/extra_files/$source_id/. "$dest_dir" - fi -} - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index a81e750..9fea419 100644 --- a/scripts/install +++ b/scripts/install @@ -84,9 +84,9 @@ ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.s tempdir="$(mktemp -d)" # Download the deb files -ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg -ynh_setup_source_2 --dest_dir=$tempdir --source_id=server -ynh_setup_source_2 --dest_dir=$tempdir --source_id=web +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 diff --git a/scripts/update_version.sh b/scripts/update_version.sh index 00a943c..041b954 100755 --- a/scripts/update_version.sh +++ b/scripts/update_version.sh @@ -13,10 +13,11 @@ source /usr/share/yunohost/helpers prepare_source () { # Declare an array to define the options of this helper. - local legacy_args=tdv - local -A args_array=( [t]=template= [d]=destination= ) + 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 @@ -66,12 +67,16 @@ prepare_source () { fi } -prepare_source --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" -prepare_source --template="../conf/web.src.default" --destination="../conf/web.src" -prepare_source --template="../conf/server.src.default" --destination="../conf/server.src" +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 commit ../README.md ../README_fr.md ../manifest.json ../conf/ffmpeg.src ../conf/web.src ../conf/server.src -m "Upgrade to v$version" +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 6da156a..4203a27 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,9 +109,9 @@ ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.s tempdir="$(mktemp -d)" # Download the deb files -ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg -ynh_setup_source_2 --dest_dir=$tempdir --source_id=server -ynh_setup_source_2 --dest_dir=$tempdir --source_id=web +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 From 59a21a1415eb57e9d61774f20b74d4c8033cff04 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 6 May 2021 17:12:30 +0200 Subject: [PATCH 76/80] Fix helper name --- scripts/restore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/restore b/scripts/restore index 6c7c4ec..8c3c819 100644 --- a/scripts/restore +++ b/scripts/restore @@ -98,9 +98,9 @@ ynh_add_config --template="../conf/web.src.default" --destination="../settings/c tempdir="$(mktemp -d)" # Download the deb files -ynh_setup_source_2 --dest_dir=$tempdir --source_id=ffmpeg -ynh_setup_source_2 --dest_dir=$tempdir --source_id=server -ynh_setup_source_2 --dest_dir=$tempdir --source_id=web +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 From cfed6e12cf21341352dabe4d10551c5eb0f14df9 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 6 May 2021 17:13:04 +0200 Subject: [PATCH 77/80] Cannot test upgrades from older versions --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 570244afce72801645348c5897258052c62d6ec5 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 7 May 2021 18:50:15 +0200 Subject: [PATCH 78/80] No need to prepare sources at runtime It is handled by the maintainer with update_version.sh --- scripts/install | 5 ----- scripts/restore | 5 ----- scripts/upgrade | 5 ----- 3 files changed, 15 deletions(-) diff --git a/scripts/install b/scripts/install index 9fea419..556ef08 100644 --- a/scripts/install +++ b/scripts/install @@ -75,11 +75,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -# Prepare the source files (replace the placeholders with version, architecture, etc. -ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" -ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" -ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" - # Create the temporary directory tempdir="$(mktemp -d)" diff --git a/scripts/restore b/scripts/restore index 8c3c819..5971618 100644 --- a/scripts/restore +++ b/scripts/restore @@ -89,11 +89,6 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Prepare the source files (replace the placeholders with version, architecture, etc. -ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../settings/conf/ffmpeg.src" -ynh_add_config --template="../conf/server.src.default" --destination="../settings/conf/server.src" -ynh_add_config --template="../conf/web.src.default" --destination="../settings/conf/web.src" - # Create the temporary directory tempdir="$(mktemp -d)" diff --git a/scripts/upgrade b/scripts/upgrade index 4203a27..f1c247a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,11 +100,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=3 -# Prepare the source files (replace the placeholders with version, architecture, etc. -ynh_add_config --template="../conf/ffmpeg.src.default" --destination="../conf/ffmpeg.src" -ynh_add_config --template="../conf/server.src.default" --destination="../conf/server.src" -ynh_add_config --template="../conf/web.src.default" --destination="../conf/web.src" - # Create the temporary directory tempdir="$(mktemp -d)" From 69a4af8b68dcd9185f8af0c3115ba41a0165b4ee Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 7 May 2021 18:59:05 +0200 Subject: [PATCH 79/80] No need to use logging default template --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f1c247a..af4d339 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -148,7 +148,6 @@ if [ -z "/etc/jellyfin/network.xml" ]; then fi # 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" #================================================= From ce8050b5b729134bf719704ac7b4e8d32cf028a7 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 7 May 2021 18:59:49 +0200 Subject: [PATCH 80/80] Add system user to render group only if it exists --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index af4d339..39ebbe5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,8 +47,8 @@ if [ -z "$config_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If jellyfin doesn't belong to render group, add it -if [ ! $(id -Gn $app | grep -q '\brender\b') ]; then +# 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