diff --git a/check_process b/check_process index c1fd17c..f2acfeb 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,12 @@ # 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. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + admin="john" + is_public=1 discovery=1 ; Checks pkg_linter=1 @@ -18,18 +16,6 @@ setup_private=1 setup_public=1 upgrade=1 - # 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 - # 10.7.5~ynh1 - #upgrade=1 from_commit=8ed403b30a8d3e61e2d3bf5bc8d3f4cae1ed80b6 - # 10.7.6~ynh1 - upgrade=1 from_commit=227b2cb8661b59ba391802637d0893976ffb6dd4 backup_restore=1 multi_instance=0 port_already_use=0 @@ -38,15 +24,5 @@ Email= Notification=none ;;; Upgrade options - ; 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 - ; commit=8ed403b30a8d3e61e2d3bf5bc8d3f4cae1ed80b6 - name=10.7.5~ynh1 - ; commit=227b2cb8661b59ba391802637d0893976ffb6dd4 - name=10.7.6~ynh1 +# ; commit= +# name= diff --git a/conf/logging.json b/conf/logging.json new file mode 100644 index 0000000..359bfa4 --- /dev/null +++ b/conf/logging.json @@ -0,0 +1,38 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Error", + "Override": { + "Microsoft": "Warning", + "System": "Warning" + } + }, + "WriteTo": [ + { + "Name": "Console", + "Args": { + "outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}" + } + }, + { + "Name": "Async", + "Args": { + "configure": [ + { + "Name": "File", + "Args": { + "path": "%JELLYFIN_LOG_DIR%//log_.log", + "rollingInterval": "Day", + "retainedFileCountLimit": 3, + "rollOnFileSizeLimit": true, + "fileSizeLimitBytes": 100000000, + "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}" + } + } + ] + } + } + ], + "Enrich": [ "FromLogContext", "WithThreadId" ] + } +} diff --git a/conf/network.xml b/conf/network.xml new file mode 100644 index 0000000..1d60af9 --- /dev/null +++ b/conf/network.xml @@ -0,0 +1,35 @@ + + + false + + + __PATH__ + 8920 + __PORT__ + 8920 + false + __PORT__ + false + + true + true + false + + 2 + 100 + true + vEthernet* + 60 + false + + + false + true + + false + true + true + + + + diff --git a/conf/system.xml b/conf/system.xml new file mode 100644 index 0000000..6e2ed94 --- /dev/null +++ b/conf/system.xml @@ -0,0 +1,195 @@ + + + 3 + true + true + false + __PORT__ + false + + true + true + false + + 2 + 100 + true + vEthernet* + 60 + false + + + false + true + 8920 + __PORT__ + 8920 + false + true + + + true + false + true + true + true + + + en + US + + . + + + % + + + , + & + - + { + } + ' + + + the + a + an + + 5 + 90 + 300 + 5 + 5 + 60 + true + Legacy + + + Book + + + + + + + + + Movie + + + + + + + + + MusicVideo + + + + The Open Movie Database + + + + The Open Movie Database + + + + + Series + + + + + + + + + MusicAlbum + + + + TheAudioDB + + + + + + + MusicArtist + + + + TheAudioDB + + + + + + + BoxSet + + + + + + + + + Season + + + + + + + + + Episode + + + + + + + + + true + + + en-US + false + + 0 + false + false + true + + + + + + Jellyfin Stable + https://repo.jellyfin.org/releases/plugin/manifest-stable.json + true + + + true + false + true + + false + 0 + + + true + 500 + + * + + + 30 + 0 + 0 + false + diff --git a/scripts/_common.sh b/scripts/_common.sh index 2995370..3f135a0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,6 +16,15 @@ architecture=$(dpkg --print-architecture) discovery_service_port=1900 discovery_client_port=7359 +if [ $architecture == "arm64" ]; then + ffmpeg_deps="libass9 libbluray2 libc6 libdrm2 libfontconfig1 libfreetype6 libfribidi0 libgcc1 libgmp10 libgnutls30 libmp3lame0 libopus0 libstdc++6 libtheora0 libvdpau1 libvorbis0a libvorbisenc2 libvpx5 libwebp6 libwebpmux3 libx11-6 libx264-155 libx265-165 libzvbi0 zlib1g" +else + ffmpeg_deps="libass9 libbluray2 libc6 libdrm-intel1 libdrm2 libfontconfig1 libfreetype6 libfribidi0 libgcc1 libgmp10 libgnutls30 libmp3lame0 libopus0 libstdc++6 libtheora0 libvdpau1 libvorbis0a libvorbisenc2 libvpx5 libwebp6 libwebpmux3 libx11-6 libx264-155 libx265-165 libzvbi0 libopencl1 zlib1g" +fi + +jellyfin_deps="at libsqlite3-0 libfontconfig1 libfreetype6 libssl1.1" +pkg_dependencies="$ffmpeg_deps $jellyfin_deps" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index aa00def..18038d9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -61,7 +61,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= ynh_backup --src_path="/etc/systemd/system/jellyfin.service.d" --not_mandatory -ynh_backup --src_path="/lib/systemd/system/jellyfin.service" #================================================= # BACKUP VARIOUS FILES diff --git a/scripts/install b/scripts/install index 3466d03..d0e2cce 100644 --- a/scripts/install +++ b/scripts/install @@ -101,20 +101,38 @@ ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=5 + +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# INSTALL PACKAGES +#================================================= +ynh_script_progression --message="Installing packages..." --weight=1 # Create the temporary directory tempdir="$(mktemp -d)" # Download the deb files ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture" +# In case of a new version, the url change from https://repo.jellyfin.org/releases/server/debian/versions/stable/server/X.X.X/jellyfin-server_X.X.X-1_$architecture.deb to https://repo.jellyfin.org/archive/debian/stable/X.X.X/server/jellyfin-server_X.X.X-1_$architecture.deb +src_url=$(grep 'SOURCE_URL=' "../conf/server.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/server/$version/jellyfin-server_$version-1_$architecture.deb" --replace_string="archive/debian/stable/$version/server/jellyfin-server_$version-1_$architecture.deb" --target_file="../conf/server.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture" + +# Same for web +src_url=$(grep 'SOURCE_URL=' "../conf/web.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/web/$version/jellyfin-web_$version-1_all.deb" --replace_string="archive/debian/stable/$version/web/jellyfin-web_$version-1_all.deb" --target_file="../conf/web.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture" # Install the packages -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y +ynh_exec_warn_less dpkg -i $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less dpkg -i $tempdir/jellyfin-server.deb +ynh_exec_warn_less dpkg -i $tempdir/jellyfin-web.deb #================================================= # NGINX CONFIGURATION @@ -142,32 +160,11 @@ fi #================================================= ynh_script_progression --message="Configuring the settings..." --weight=1 -# Set permissions to app files -chown -R $app: $final_path - -# Load services once to generate system.xml -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" -ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" - -# Enable IPv6 -ynh_replace_string --match_string="false" --replace_string="true" --target_file="$config_path/network.xml" - -# BaseUrl config -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="$config_path/system.xml" - -# Lower logging verbosity -cp "$config_path/logging.default.json" "$config_path/logging.json" -ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" --target_file="$config_path/logging.json" - -ynh_store_file_checksum --file="$config_path/network.xml" -ynh_store_file_checksum --file="$config_path/system.xml" +ynh_add_config --template="system.xml" --destination="$config_path/system.xml" +ynh_add_config --template="network.xml" --destination="$config_path/network.xml" +ynh_add_config --template="logging.json" --destination="$config_path/logging.json" #================================================= # INSTALL LDAP PLUGIN @@ -176,7 +173,7 @@ 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/ -ynh_add_config --template="../conf/LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" +ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" #================================================= # GENERIC FINALIZATION diff --git a/scripts/remove b/scripts/remove index ad0998e..31c288c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -38,11 +38,18 @@ fi #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=3 -apt-get remove jellyfin-web -y -apt-get remove jellyfin-server -y -apt-get remove jellyfin-ffmpeg -y +ynh_remove_app_dependencies + +#================================================= +# REMOVE PACKAGES +#================================================= +ynh_script_progression --message="Removing packages..." --weight=1 + +dpkg --remove jellyfin-web +dpkg --remove jellyfin-server +dpkg --remove jellyfin-ffmpeg #================================================= # REMOVE APP DIRECTORIES diff --git a/scripts/restore b/scripts/restore index b2e9f84..2d796bb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -109,20 +109,39 @@ ynh_system_user_create --username=$app #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +ynh_script_progression --message="Reinstalling dependencies..." --weight=5 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# REINSTALL PACKAGES +#================================================= +ynh_script_progression --message="Reinstalling packages..." --weight=7 # Create the temporary directory tempdir="$(mktemp -d)" # Download the deb files ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture" +# In case of a new version, the url change from https://repo.jellyfin.org/releases/server/debian/versions/stable/server/X.X.X/jellyfin-server_X.X.X-1_$architecture.deb to https://repo.jellyfin.org/archive/debian/stable/X.X.X/server/jellyfin-server_X.X.X-1_$architecture.deb +src_url=$(grep 'SOURCE_URL=' "../settings/conf/server.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/server/$version/jellyfin-server_$version-1_$architecture.deb" --replace_string="archive/debian/stable/$version/server/jellyfin-server_$version-1_$architecture.deb" --target_file="../settings/conf/server.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture" + +# Same for web +src_url=$(grep 'SOURCE_URL=' "../settings/conf/web.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/web/$version/jellyfin-web_$version-1_all.deb" --replace_string="archive/debian/stable/$version/web/jellyfin-web_$version-1_all.deb" --target_file="../settings/conf/web.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture" # Install the packages -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold +ynh_exec_warn_less dpkg --force-confdef --force-confold -i $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less dpkg --force-confdef --force-confold -i $tempdir/jellyfin-server.deb +ynh_exec_warn_less dpkg --force-confdef --force-confold -i $tempdir/jellyfin-web.deb #================================================= # RESTORE SYSTEMD @@ -130,7 +149,6 @@ ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y -o Dpkg::Opti ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/jellyfin.service.d" --not_mandatory -ynh_restore_file --origin_path="/lib/systemd/system/jellyfin.service" systemctl enable jellyfin.service --quiet #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ce19637..0bbfc4e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -137,20 +137,38 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=3 +ynh_script_progression --message="Upgrading dependencies..." --weight=5 + +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# UPGRADE packages +#================================================= +ynh_script_progression --message="Upgrading packages..." --weight=3 # Create the temporary directory tempdir="$(mktemp -d)" # Download the deb files ynh_setup_source --dest_dir=$tempdir --source_id="ffmpeg.$architecture" +# In case of a new version, the url change from https://repo.jellyfin.org/releases/server/debian/versions/stable/server/X.X.X/jellyfin-server_X.X.X-1_$architecture.deb to https://repo.jellyfin.org/archive/debian/stable/X.X.X/server/jellyfin-server_X.X.X-1_$architecture.deb +src_url=$(grep 'SOURCE_URL=' "../conf/server.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/server/$version/jellyfin-server_$version-1_$architecture.deb" --replace_string="archive/debian/stable/$version/server/jellyfin-server_$version-1_$architecture.deb" --target_file="../conf/server.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="server.$architecture" + +# Same for web +src_url=$(grep 'SOURCE_URL=' "../conf/web.$architecture.src" | cut -d= -f2-) +if ! curl --output /dev/null --silent --head --fail "$src_url"; then + ynh_replace_string --match_string="releases/server/debian/versions/stable/web/$version/jellyfin-web_$version-1_all.deb" --replace_string="archive/debian/stable/$version/web/jellyfin-web_$version-1_all.deb" --target_file="../conf/web.$architecture.src" +fi ynh_setup_source --dest_dir=$tempdir --source_id="web.$architecture" # Install the packages -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-ffmpeg.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-server.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -ynh_exec_warn_less apt-get -f install $tempdir/jellyfin-web.deb -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew +ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-ffmpeg.deb +ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-server.deb +ynh_exec_warn_less dpkg --force-confdef --force-confnew -i $tempdir/jellyfin-web.deb #================================================= # CREATE DEDICATED USER @@ -163,41 +181,11 @@ ynh_system_user_create --username=$app #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_script_progression --message="Setting up configuration files..." --weight=2 -# Check if network.xml exists (introduced in v10.7) -if [ -f "/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" - - # Set permissions to app files - chown -R $app: $final_path - - # Load services once to generate network.xml - 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" - ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="$config_path/network.xml" - - # Enable IPv6 - ynh_replace_string --match_string="false" --replace_string="true" --target_file="$config_path/network.xml" - - # BaseUrl config - 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 - -# Lower logging verbosity -# But first, if missing, copy it from its template -if [ ! -f "$config_path/logging.json" ]; then - cp "$config_path/logging.default.json" "$config_path/logging.json" -fi -ynh_exec_fully_quiet ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\"" --target_file="$config_path/logging.json" +ynh_add_config --template="system.xml" --destination="$config_path/system.xml" +ynh_add_config --template="network.xml" --destination="$config_path/network.xml" +ynh_add_config --template="logging.json" --destination="$config_path/logging.json" #================================================= # INSTALL LDAP PLUGIN @@ -206,7 +194,7 @@ 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/ -ynh_add_config --template="../conf/LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" +ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" #================================================= # GENERIC FINALIZATION