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

Merge pull request #154 from selfhoster1312/10.9

PLEASE TEST: Upgrade Jellyfin to v10.9
This commit is contained in:
Kayou 2024-06-28 21:34:38 +02:00 committed by GitHub
commit a711397f4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 285 additions and 206 deletions

View file

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included. Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.
**Shipped version:** 10.8.13~ynh2 **Shipped version:** 10.9.1~ynh1
**Demo:** <https://demo.jellyfin.org/stable/web/index.html> **Demo:** <https://demo.jellyfin.org/stable/web/index.html>

View file

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
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.8.13~ynh2 **Version incluse:** 10.9.1~ynh1
**Démo:** <https://demo.jellyfin.org/stable/web/index.html> **Démo:** <https://demo.jellyfin.org/stable/web/index.html>

View file

@ -19,7 +19,7 @@ NON debe editarse manualmente.
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included. Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.
**Versión proporcionada:** 10.8.13~ynh2 **Versión proporcionada:** 10.9.1~ynh1
**Demo:** <https://demo.jellyfin.org/stable/web/index.html> **Demo:** <https://demo.jellyfin.org/stable/web/index.html>

View file

@ -19,7 +19,7 @@ NON DEVE essere modificato manualmente.
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included. Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.
**Versione pubblicata:** 10.8.13~ynh1 **Versione pubblicata:** 10.9.1~ynh1
**Prova:** <https://demo.jellyfin.org/stable/web/index.html> **Prova:** <https://demo.jellyfin.org/stable/web/index.html>

View file

@ -1,35 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<NetworkConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <NetworkConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RequireHttps>false</RequireHttps> <RequireHttps>false</RequireHttps>
<CertificatePath />
<CertificatePassword />
<BaseUrl>__PATH__</BaseUrl> <BaseUrl>__PATH__</BaseUrl>
<PublicHttpsPort>8920</PublicHttpsPort> <InternalHttpPort>__PORT__</InternalHttpPort>
<HttpServerPortNumber>__PORT__</HttpServerPortNumber>
<HttpsPortNumber>8920</HttpsPortNumber>
<EnableHttps>false</EnableHttps> <EnableHttps>false</EnableHttps>
<PublicPort>__PORT__</PublicPort>
<UPnPCreateHttpPortMap>false</UPnPCreateHttpPortMap>
<UDPPortRange />
<EnableIPV6>true</EnableIPV6> <EnableIPV6>true</EnableIPV6>
<EnableIPV4>true</EnableIPV4> <EnableIPV4>true</EnableIPV4>
<EnableSSDPTracing>false</EnableSSDPTracing>
<SSDPTracingFilter />
<UDPSendCount>2</UDPSendCount>
<UDPSendDelay>100</UDPSendDelay>
<IgnoreVirtualInterfaces>true</IgnoreVirtualInterfaces>
<VirtualInterfaceNames>vEthernet*</VirtualInterfaceNames>
<GatewayMonitorPeriod>60</GatewayMonitorPeriod>
<TrustAllIP6Interfaces>false</TrustAllIP6Interfaces>
<HDHomerunPortRange />
<PublishedServerUriBySubnet />
<AutoDiscoveryTracing>false</AutoDiscoveryTracing>
<AutoDiscovery>true</AutoDiscovery> <AutoDiscovery>true</AutoDiscovery>
<RemoteIPFilter />
<IsRemoteIPFilterBlacklist>false</IsRemoteIPFilterBlacklist>
<EnableUPnP>true</EnableUPnP> <EnableUPnP>true</EnableUPnP>
<EnableRemoteAccess>true</EnableRemoteAccess> <EnableRemoteAccess>true</EnableRemoteAccess>
<LocalNetworkSubnets /> <LocalNetworkAddresses>
<LocalNetworkAddresses /> <string>127.0.0.1</string>
<KnownProxies /> </LocalNetworkAddresses>
</NetworkConfiguration> </NetworkConfiguration>

2
conf/systemd.service Normal file
View file

@ -0,0 +1,2 @@
[Service]
Environment="JELLYFIN_PublishedServerUrl=https://__DOMAIN____PATH__"

View file

@ -7,7 +7,7 @@ name = "Jellyfin"
description.en = "Media System that manage and stream your media" description.en = "Media System that manage and stream your media"
description.fr = "Système multimédia qui gère et diffuse vos médias" description.fr = "Système multimédia qui gère et diffuse vos médias"
version = "10.8.13~ynh2" version = "10.9.6~ynh1"
maintainers = ["tituspijean"] maintainers = ["tituspijean"]
@ -44,7 +44,7 @@ ram.runtime = "100M"
type = "group" type = "group"
default = "visitors" default = "visitors"
[install.admin] [install.init_admin_permission]
type = "user" type = "user"
[install.discovery] [install.discovery]
@ -56,78 +56,77 @@ ram.runtime = "100M"
default = true default = true
[resources] [resources]
[resources.sources]
[resources.sources.server]
armhf.url = "https://repo.jellyfin.org/files/server/debian/stable/10.8.13/armhf/jellyfin-server_10.8.13-1_armhf.deb"
armhf.sha256 = "ee4588aeeb55282b044d3bb4efef146a43abd742d3ef9327e042b2959008dc60"
arm64.url = "https://repo.jellyfin.org/files/server/debian/stable/10.8.13/arm64/jellyfin-server_10.8.13-1_arm64.deb" [resources.sources.server_bullseye]
arm64.sha256 = "b9b917ec6ed4ddd3c728cb7be84245ff625c0a7ae12653a921cb3a9f6149252d" armhf.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/armhf/jellyfin-server_10.9.6+deb11_armhf.deb"
armhf.sha256 = "aaadbda9350db388b7e96427e640dcce0821c8241f23bba1f1587ee642ca05f1"
amd64.url = "https://repo.jellyfin.org/files/server/debian/stable/10.8.13/amd64/jellyfin-server_10.8.13-1_amd64.deb" arm64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/arm64/jellyfin-server_10.9.6+deb11_arm64.deb"
amd64.sha256 = "d54decc098d5e61be50847edba8722d6468e22134bae2df514859e064eb8d727" arm64.sha256 = "bf0dc1239fff35aa03582b78c4371dd5e96422ead43bf24fa8b0527fcca64b3f"
amd64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/amd64/jellyfin-server_10.9.6+deb11_amd64.deb"
amd64.sha256 = "ec5d745f6e140d1ed1795c36276f695fe96c295396db475b85bdce54f29d9506"
format = "whatever"
extract = false
rename = "jellyfin-server.deb" rename = "jellyfin-server.deb"
[resources.sources.server_bookworm]
armhf.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/armhf/jellyfin-server_10.9.6+deb12_armhf.deb"
armhf.sha256 = "2666666e66e7c736b47723d911c85807154fb277a7da46ea9bd12cfbb474a2ea"
arm64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/arm64/jellyfin-server_10.9.6+deb12_arm64.deb"
arm64.sha256 = "7ef1d9c347619e59af7d71e97c762031f6c24680a035f54964f34a2042103c1f"
amd64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/amd64/jellyfin-server_10.9.6+deb12_amd64.deb"
amd64.sha256 = "eafe4e19ee2a99bfb98c9de11e367f0d2313cd585332efe8cd1468e132221181"
format = "whatever" format = "whatever"
extract = false extract = false
rename = "jellyfin-server.deb"
[resources.sources.web]
url = "https://repo.jellyfin.org/files/server/debian/stable/10.8.13/amd64/jellyfin-web_10.8.13-1_all.deb"
sha256 = "8a30e2239f97d1d749f6059db0ff1e4189f44babfb9b0cf236102b7c95b0babe"
[resources.sources.web_bullseye]
url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/amd64/jellyfin-web_10.9.6+deb11_all.deb"
sha256 = "ea469e302a19db6bfc1ac5001adeb5f278e9c02b52cb6752000345a4a7392416"
format = "whatever"
extract = false
rename = "jellyfin-web.deb" rename = "jellyfin-web.deb"
[resources.sources.web_bookworm]
url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.6/amd64/jellyfin-web_10.9.6+deb12_all.deb"
sha256 = "7324d204b5c050a3d85e10861c6923366fa9c17b21ed8cd6420b07363c0d1f5f"
format = "whatever" format = "whatever"
extract = false extract = false
rename = "jellyfin-web.deb"
[resources.sources.ffmpeg_bookworm]
armhf.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/armhf/jellyfin-ffmpeg6_6.0.1-3-bookworm_armhf.deb"
armhf.sha256 = "bdb28e67fa4dc8e321366c4a19e18bcc6166a60d6aa5a4bf2da1263489b4f25f"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/arm64/jellyfin-ffmpeg6_6.0.1-3-bookworm_arm64.deb"
arm64.sha256 = "aabf62104399f242ddb7b8c2e308976f6b233ceac5ffccbabd340a28e428ca3c"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/amd64/jellyfin-ffmpeg6_6.0.1-3-bookworm_amd64.deb"
amd64.sha256 = "cb40c04e026d83b9265535e214f883d4a26824b5703304064fd38fffa70ac449"
rename = "jellyfin-ffmpeg6.deb"
format = "whatever"
extract = false
[resources.sources.ffmpeg_bullseye] [resources.sources.ffmpeg_bullseye]
armhf.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/armhf/jellyfin-ffmpeg6_6.0.1-3-bullseye_armhf.deb" armhf.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/armhf/jellyfin-ffmpeg6_6.0.1-7-bullseye_armhf.deb"
armhf.sha256 = "700bab9e8c96594f83d731019cdbc20fbab303c1d8440288e463e372cd16ed7a" armhf.sha256 = "4940083aa8bf6f04df7fbd3c5740f96b8b1d41ae2aeef8aba25eed7fbc72dd57"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/arm64/jellyfin-ffmpeg6_6.0.1-7-bullseye_arm64.deb"
arm64.sha256 = "106311dfc45cfa69f9588772b9c0327e1558fd5186f6b4ce6d1f615ad09893bb"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/amd64/jellyfin-ffmpeg6_6.0.1-7-bullseye_amd64.deb"
amd64.sha256 = "ee50c84a501c530e179088cf3f6d9048fe446e186d93f726a2073b860a313c5c"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/arm64/jellyfin-ffmpeg6_6.0.1-3-bullseye_arm64.deb"
arm64.sha256 = "56ef93f285e922417cda98b109021be614a5307d9d7c18aff22fa0c439ab77b5"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/amd64/jellyfin-ffmpeg6_6.0.1-3-bullseye_amd64.deb"
amd64.sha256 = "50b0cbd2cd0ab64fd6803d2bdfd15946ec6f80c0b492f81ad85e921ffafdcf7e"
rename = "jellyfin-ffmpeg6.deb"
format = "whatever" format = "whatever"
extract = false extract = false
[resources.sources.ffmpeg_buster]
armhf.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/armhf/jellyfin-ffmpeg6_6.0.1-3-buster_armhf.deb"
armhf.sha256 = "6f3beae72aec030aae96dc044bfcf736f12fc135cc574cde8085609e47374a43"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/arm64/jellyfin-ffmpeg6_6.0.1-3-buster_arm64.deb"
arm64.sha256 = "109ea41f17e314e3e9b32689844841ddd54a600419ff89e0e979e195a25b91c5"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/6.x/6.0.1-3/amd64/jellyfin-ffmpeg6_6.0.1-3-buster_amd64.deb"
amd64.sha256 = "a1c55b7f439f2b9a487ea90341a280467f1973fcd12607f08bcd16cf22ce307a"
rename = "jellyfin-ffmpeg6.deb" rename = "jellyfin-ffmpeg6.deb"
[resources.sources.ffmpeg_bookworm]
armhf.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/armhf/jellyfin-ffmpeg6_6.0.1-7-bookworm_armhf.deb"
armhf.sha256 = "03d8a5512c7406e77359475da729157fc653dc5203f2399b59c71c6f59ca10f3"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/arm64/jellyfin-ffmpeg6_6.0.1-7-bookworm_arm64.deb"
arm64.sha256 = "6c21dfdd931c576fcd5c095d4aae2cf92d4720beba6c73404f3d56220213c2a4"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/amd64/jellyfin-ffmpeg6_6.0.1-7-bookworm_amd64.deb"
amd64.sha256 = "0773fda9111e03394e088790eabc99dbb0291d107a4950bdcbfafd94c5d0652e"
format = "whatever" format = "whatever"
extract = false extract = false
rename = "jellyfin-ffmpeg6.deb"
[resources.sources.plugin_ldap] [resources.sources.plugin_ldap]
url = "https://repo.jellyfin.org/files/plugin/ldap-authentication/ldap-authentication_17.0.0.0.zip" url = "https://repo.jellyfin.org/files/plugin/ldap-authentication/ldap-authentication_19.0.0.0.zip"
sha256 = "042bdd16950c7569c154311cc64af49c7d6096e9b0a7184287707d5ee317ecf5" sha256 = "3b8366f670484c9ab1ece826667754b69736d910d9ccde90c105a67ba441ead9"
in_subdir = false in_subdir = false
@ -144,8 +143,16 @@ ram.runtime = "100M"
admin.protected = true admin.protected = true
admin.auth_header = false admin.auth_header = false
admin.show_tile = false
[resources.ports] [resources.ports]
main.default = 8095 main.default = 8095
# If we ever want to automatically expose the discovery ports without a setting
# servicediscovery.default = 1900
# servicediscovery.exposed = "UDP"
# servicediscovery.fixed = true
# clientdiscovery.default = 7359
# clientdiscovery.exposed = "UDP"
# clientdiscovery.fixed = true
[resources.apt] [resources.apt]

View file

@ -5,11 +5,15 @@
#================================================= #=================================================
debian=$(lsb_release --codename --short) debian=$(lsb_release --codename --short)
pkg_version="10.8.13-1" debian_number=$(lsb_release --release --short)
pkg_version="10.9.6"
version=$(echo "$pkg_version" | cut -d '-' -f 1) version=$(echo "$pkg_version" | cut -d '-' -f 1)
ffmpeg_pkg_version="6.0.1-3" ffmpeg_pkg_version="6.0.1-7"
ldap_pkg_version="17.0.0.0"
# "targetAbi" line in plugin's meta.json, to check for outdated plugins
plugin_abi="10.9.0.0"
ldap_pkg_version="19.0.0.0"
discovery_service_port=1900 discovery_service_port=1900
discovery_client_port=7359 discovery_client_port=7359
@ -30,9 +34,10 @@ install_jellyfin_packages() {
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
# Download the deb files # Download the deb files
ynh_setup_source --dest_dir="$tempdir" --source_id="web" ynh_setup_source --dest_dir="$tempdir" --source_id="web_$debian"
ynh_setup_source --dest_dir="$tempdir" --source_id="ffmpeg_$debian" ynh_setup_source --dest_dir="$tempdir" --source_id="ffmpeg_$debian"
ynh_setup_source --dest_dir="$tempdir" --source_id="server" ynh_setup_source --dest_dir="$tempdir" --source_id="server_$debian"
# Install the packages # Install the packages
ynh_package_install \ ynh_package_install \
@ -43,26 +48,56 @@ install_jellyfin_packages() {
if ynh_package_is_installed "jellyfin-ffmpeg5"; then if ynh_package_is_installed "jellyfin-ffmpeg5"; then
ynh_package_remove "jellyfin-ffmpeg5" ynh_package_remove "jellyfin-ffmpeg5"
fi fi
# Install the packages
ynh_package_install \ ynh_package_install \
"$tempdir/jellyfin-ffmpeg6.deb" "${tempdir}/jellyfin-ffmpeg6.deb"
# The doc says it should be called only once, # The doc says it should be called only once,
# but the code says multiple calls are supported. # but the code says multiple calls are supported.
# Also, they're already installed so that should be quasi instantaneous. # Also, they're already installed so that should be quasi instantaneous.
ynh_install_app_dependencies \ ynh_install_app_dependencies \
jellyfin-web="$pkg_version" \ jellyfin-web="$pkg_version+deb$debian_number" \
jellyfin-ffmpeg6="$ffmpeg_pkg_version-$debian" \ jellyfin-ffmpeg6="$ffmpeg_pkg_version-$debian" \
jellyfin-server="$pkg_version" jellyfin-server="$pkg_version+deb$debian_number"
# Mark packages as dependencies, to allow automatic removal # Mark packages as dependencies, to allow automatic removal
apt-mark auto jellyfin-server jellyfin-web jellyfin-ffmpeg6 apt-mark auto jellyfin-server jellyfin-web jellyfin-ffmpeg6
} }
open_jellyfin_discovery_ports() { configure_jellyfin_discovery_ports() {
case $1 in
"install")
install_jellyfin_discovery_ports
;;
"remove")
remove_jellyfin_discovery_ports
;;
*)
ynh_print_warn --message="Invalid script calling configure_jellyfin_discovery_ports with args (should be install|remove): $@"
;;
esac
}
remove_jellyfin_discovery_ports() {
if [[ $discovery_service -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_service_port$"
then
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_service_port
fi
if [[ $discovery_client -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_client_port$"
then
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_client_port
fi
}
install_jellyfin_discovery_ports() {
discovery_service=$discovery discovery_service=$discovery
discovery_client=$discovery discovery_client=$discovery
if [ "$discovery" -eq 1 ]; then if [ "$discovery" -eq 1 ]; then
opened_ports=($discovery_service_port $discovery_client_port)
# Open port $discovery_service_port for service auto-discovery # Open port $discovery_service_port for service auto-discovery
if ynh_port_available --port=$discovery_service_port; then if ynh_port_available --port=$discovery_service_port; then

View file

@ -23,10 +23,8 @@ ynh_app_setting_set --app="$app" --key=config_path --value="$config_path"
#================================================= #=================================================
# OPEN PORTS # OPEN PORTS
#================================================= #=================================================
ynh_script_progression --message="Checking whether to open ports..." --weight=1
ynh_script_progression --message="Configuring firewall..." --weight=1 configure_jellyfin_discovery_ports install
open_jellyfin_discovery_ports
#================================================= #=================================================
# INSTALL PACKAGES # INSTALL PACKAGES
@ -69,6 +67,7 @@ ynh_add_config --template="logging.json" --destination="$config_path/logging.jso
ynh_script_progression --message="Installing LDAP plugin..." --weight=2 ynh_script_progression --message="Installing LDAP plugin..." --weight=2
ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=plugin_ldap ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=plugin_ldap
mkdir -p /var/lib/jellyfin/plugins/configurations/ mkdir -p /var/lib/jellyfin/plugins/configurations/
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
@ -106,10 +105,19 @@ ynh_use_logrotate
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "$app" --description="Jellyfin media center" ports_args=()
if [[ "${opened_ports:-__NOTHING__}" != "__NOTHING__" ]]; then
ports_args+=('--needs_exposed_ports')
ports_args+=(${opened_ports})
fi
# Only the admin can access the admin panel of the app (if the app has an admin panel) yunohost service add "$app" --description="Jellyfin media center" ${ports_args[@]}
ynh_permission_update --permission="admin" --add="$admin"
#=================================================
# EDIT SYSTEMD ENVIRONMENT VARIABLE FOR AUTO-DISCOVERY
#=================================================
ynh_add_config --template="systemd.service" --destination="/etc/systemd/system/jellyfin.service.d/baseurl.service.conf"
systemctl daemon-reload
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -41,18 +41,8 @@ ynh_remove_app_dependencies
#================================================= #=================================================
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
ynh_script_progression --message="Checking whether to open ports..." --weight=1
if [[ $discovery_service -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_service_port$" configure_jellyfin_discovery_ports remove
then
ynh_script_progression --message="Closing port $discovery_service_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_service_port
fi
if [[ $discovery_client -eq 1 ]] && yunohost firewall list | grep -q "\- $discovery_client_port$"
then
ynh_script_progression --message="Closing port $discovery_client_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP $discovery_client_port
fi
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE

View file

@ -18,7 +18,6 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Reconfiguring the dedicated system user..." --weight=1 ynh_script_progression --message="Reconfiguring the dedicated system user..." --weight=1
# It could be created later by the deb, but it's cleaner here # It could be created later by the deb, but it's cleaner here
ynh_system_user_create --username=$app
if getent group render && ! id -Gn "$app" | grep -qw "\brender\b" >/dev/null; then if getent group render && ! id -Gn "$app" | grep -qw "\brender\b" >/dev/null; then
# Add user to render group # Add user to render group
adduser $app render adduser $app render
@ -27,9 +26,8 @@ fi
#================================================= #=================================================
# OPEN PORTS # OPEN PORTS
#================================================= #=================================================
ynh_script_progression --message="Configuring firewall..." --weight=1 ynh_script_progression --message="Checking whether to open ports..." --weight=1
configure_jellyfin_discovery_ports install
open_jellyfin_discovery_ports
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -93,7 +91,15 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Jellyfin media center" ports_args=()
if [[ "${opened_ports:-__NOTHING__}" = "__NOTHING__" ]]; then
ports_args+=('--open-ports')
ports_args+=(${ports})
fi
yunohost service add "$app" --description="Jellyfin media center" "${ports_args[@]}"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -1,14 +1,15 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from typing import Any from typing import Any, Tuple, Dict, Optional, List
from pathlib import Path from pathlib import Path
import hashlib
import tomlkit import tomlkit
import requests import requests
import hashlib import hashlib
REPO_ROOT = Path(__file__).parent.parent REPO_ROOT = Path(__file__).parent.parent
JELLYFIN_REPO = "https://repo.jellyfin.org/files" JELLYFIN_REPO = "https://repo.jellyfin.org"
ARCHS = [ ARCHS = [
"armhf", "armhf",
@ -16,44 +17,95 @@ ARCHS = [
"amd64", "amd64",
] ]
DEBS = [ DEBS = {
"buster", "bullseye": "11",
"bullseye", "bookworm": "12",
"bookworm", }
]
class JellyfinDistro:
def __init__(self, debian_number: str, debian_name: str, arch: List[str]):
self.debian_number = debian_number
self.debian_name = debian_name
self.arch = arch
# Version in form of 10.9.0-2
def server_url(self, version: str, arch: str) -> str:
return f"{JELLYFIN_REPO}/files/server/debian/stable/v{version}/{arch}/jellyfin-server_{version}+deb{self.debian_number}_{arch}.deb"
def web_url(self, version: str) -> str:
return f"{JELLYFIN_REPO}/files/server/debian/stable/v{version}/amd64/jellyfin-web_{version}+deb{self.debian_number}_all.deb"
def ffmpeg_url(self, version: str, arch: str) -> str:
return f"{JELLYFIN_REPO}/files/ffmpeg/debian/latest-6.x/{arch}/jellyfin-ffmpeg6_{version}-{self.debian_name}_{arch}.deb"
def ldap_url(self, version: str) -> str:
return f"{JELLYFIN_REPO}/files/plugin/ldap-authentication/ldap-authentication_{version}.zip"
def update_package(self, manifest: Dict, package: str, version: str):
url = None
urls = {}
if package == "server":
for arch in self.arch: urls[arch] = self.server_url(version, arch)
key = f"server_{self.debian_name}"
extra = { "format": "whatever", "extract": False, "rename": "jellyfin-server.deb" }
elif package == "web":
url = self.web_url(version)
key = f"web_{self.debian_name}"
extra = { "format": "whatever", "extract": False, "rename": "jellyfin-web.deb" }
elif package == "ffmpeg":
for arch in self.arch: urls[arch] = self.ffmpeg_url(version, arch)
key = f"ffmpeg_{self.debian_name}"
extra = { "format": "whatever", "extract": False, "rename": "jellyfin-ffmpeg6.deb" }
elif package == "ldap":
url = self.ldap_url(version)
key = "plugin_ldap"
extra = {"in_subdir": False}
else: raise Exception(f"Wrong jellyfin package: {package}")
if key not in manifest["resources"]["sources"]:
manifest["resources"]["sources"][key] = {}
# Single URL, not per arch
if url:
print(f"Checking for updates for Jellyfin's {package} (distro={self.debian_name}) to version {version}")
self.update_package_helper(manifest["resources"]["sources"][key], package, version, url)
else:
# Different URL per architecture
for arch, url in urls.items():
if arch not in manifest["resources"]["sources"][key]:
manifest["resources"]["sources"][key][arch] = {}
print(f"Checking for updates for Jellyfin's {package} (arch={arch},distro={self.debian_name}) to version {version}")
self.update_package_helper(manifest["resources"]["sources"][key][arch], package, version, url)
# Add extra settings
for k, v in extra.items():
manifest["resources"]["sources"][key][k] = v
def update_package_helper(self, entry: Dict, package: str, version: str, url: str):
# Assume version changed only if URL changed
if "url" in entry and entry["url"] == url:
print(f" Already at version {version} in manifest.toml.")
return
sha = sha256sum_of(url)
entry["url"] = url
entry["sha256"] = sha
print(f" Updated to version {version}.")
def version_from__common_sh(name: str) -> str: def version_from__common_sh(name: str) -> str:
content = (REPO_ROOT/"scripts"/"_common.sh").open(encoding="utf-8").readlines() content = (REPO_ROOT/"scripts"/"_common.sh").open(encoding="utf-8").readlines()
result = next(filter(lambda line: line.startswith(f"{name}="), content)) result = next(filter(lambda line: line.startswith(f"{name}="), content))
return result.split('"')[1] return result.split('"')[1]
def server_url(arch: str, version: str) -> str:
version_simple = version.split("-")[0]
return f"{JELLYFIN_REPO}/server/debian/stable/{version_simple}/{arch}/jellyfin-server_{version}_{arch}.deb"
def web_url(arch: str, version: str) -> str:
version_simple = version.split("-")[0]
return f"{JELLYFIN_REPO}/server/debian/stable/{version_simple}/amd64/jellyfin-web_{version}_all.deb"
def ffmpeg_url(arch: str, deb: str, version: str) -> str:
major = version.split(".")[0]
return f"{JELLYFIN_REPO}/ffmpeg/debian/6.x/{version}/{arch}/jellyfin-ffmpeg{major}_{version}-{deb}_{arch}.deb"
def ldap_url(arch: str, version: str) -> str:
major = version.split(".")[0]
return f"{JELLYFIN_REPO}/plugin/ldap-authentication/ldap-authentication_{version}.zip"
def sha256sum_of(url: str) -> str: def sha256sum_of(url: str) -> str:
result = requests.get(f"{url}", timeout=10) # No more sha256sum files provided on release repo?
result = requests.get(url, timeout=10)
sha256sum = hashlib.sha256(result.content) if result.status_code != 200 and not (result.status_code > 300 and result.status_code < 400):
return sha256sum.hexdigest() raise Exception(f"Wrong status code on URL {url}: {result.status_code}")
hasher = hashlib.sha256()
hasher.update(result.content)
return hasher.hexdigest()
def main() -> None: def main() -> None:
manifest_file = REPO_ROOT/"manifest.toml" manifest_file = REPO_ROOT/"manifest.toml"
@ -63,27 +115,14 @@ def main() -> None:
ffmpeg_version = version_from__common_sh("ffmpeg_pkg_version") ffmpeg_version = version_from__common_sh("ffmpeg_pkg_version")
ldap_version = version_from__common_sh("ldap_pkg_version") ldap_version = version_from__common_sh("ldap_pkg_version")
for arch in ARCHS: for debian_name, debian_number in DEBS.items():
url = server_url(arch, jellyfin_version) jellyfin = JellyfinDistro(debian_number, debian_name, ARCHS)
manifest["resources"]["sources"]["server"][arch]["url"] = url jellyfin.update_package(manifest, "server", jellyfin_version)
manifest["resources"]["sources"]["server"][arch]["sha256"] = sha256sum_of(url) jellyfin.update_package(manifest, "web", jellyfin_version)
jellyfin.update_package(manifest, "ffmpeg", ffmpeg_version)
url = web_url(arch, jellyfin_version) jellyfin.update_package(manifest, "ldap", ldap_version)
manifest["resources"]["sources"]["web"]["url"] = url
manifest["resources"]["sources"]["web"]["sha256"] = sha256sum_of(url)
for arch in ARCHS:
for deb in DEBS:
url = ffmpeg_url(arch, deb, ffmpeg_version)
manifest["resources"]["sources"][f"ffmpeg_{deb}"][arch]["url"] = url
manifest["resources"]["sources"][f"ffmpeg_{deb}"][arch]["sha256"] = sha256sum_of(url)
url = ldap_url(arch, ldap_version)
manifest["resources"]["sources"]["plugin_ldap"]["url"] = url
manifest["resources"]["sources"]["plugin_ldap"]["sha256"] = sha256sum_of(url)
manifest_file.open("w", encoding="utf-8").write(tomlkit.dumps(manifest)) manifest_file.open("w", encoding="utf-8").write(tomlkit.dumps(manifest))
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -55,31 +55,11 @@ if [ ! -f "/etc/logrotate.d/$app" ]; then
ynh_use_logrotate ynh_use_logrotate
fi fi
discovery_service=$discovery #=================================================
discovery_client=$discovery # OPEN PORTS
#=================================================
if [ $discovery -eq 1 ]; then ynh_script_progression --message="Checking whether to open ports..." --weight=1
ynh_script_progression --message="Configuring firewall..." --weight=1 configure_jellyfin_discovery_ports install
# Open port $discovery_service_port for service auto-discovery
if ynh_port_available --port=$discovery_service_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_service_port
else
discovery_service=0
ynh_print_warn --message="Port $discovery_service_port (for service auto-discovery) is not available. Continuing nonetheless."
fi
# Open port $discovery_client_port for client auto-discovery
if ynh_port_available --port=$discovery_client_port; then
ynh_exec_warn_less yunohost firewall allow UDP $discovery_client_port
else
discovery_client=0
ynh_print_warn --message="Port $discovery_client_port (for client auto-discovery) is not available. Continuing nonetheless."
fi
fi
ynh_app_setting_set --app=$app --key=discovery_service --value=$discovery_service
ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client
#================================================= #=================================================
# UPGRADE PACKAGES # UPGRADE PACKAGES
@ -92,14 +72,6 @@ for name in system.xml network.xml logging.json; do
cp "$config_path/$name" "$bakdir/$name" cp "$config_path/$name" "$bakdir/$name"
done done
# ynh_package_install passes --no-remove so the ffmpeg5 -> ffmpeg6 migration is blocked.
# So we remove the packages before installing the new ones.
if ynh_package_is_installed "jellyfin-ffmpeg5"; then
# Previous versions of the package did not do that so remove_app_dependencies doesn't do its job
apt-mark auto jellyfin-server jellyfin-web jellyfin-ffmpeg5
# ynh_remove_app_dependencies
fi
install_jellyfin_packages install_jellyfin_packages
#================================================= #=================================================
@ -123,17 +95,44 @@ for name in system.xml network.xml logging.json; do
done done
ynh_secure_remove "$bakdir" ynh_secure_remove "$bakdir"
# TODO: investigate if we can avoid overriding 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="network.xml" --destination="$config_path/network.xml"
ynh_add_config --template="logging.json" --destination="$config_path/logging.json" ynh_add_config --template="logging.json" --destination="$config_path/logging.json"
#=================================================
# ENSURE NO OLD/INCOMPATIBLE PLUGINS ARE LEFT
#=================================================
shopt -s nullglob
mkdir -p /var/lib/jellyfin/plugins-backup
if [ -d /var/lib/jellyfin/plugins ]; then
for directory in /var/lib/jellyfin/plugins/*; do
if [[ "$(basename "$directory")" = "configurations" ]]; then
# Kepe plugin config
continue
fi
if [ ! -f "$directory"/meta.json ]; then
mv "$directory" /var/lib/jellyfin/plugins-backup/
fi
# Jellyfin doesn't refuse to start with old plugins. It just does weird
# things such as https://github.com/jellyfin/jellyfin-plugin-ldapauth/issues/161
# As a precaution, move older ABI plugins to another folder so things don't break
abi="$(jq -r '.targetAbi' "$directory"/meta.json)"
if [[ "$abi" != "$plugin_abi" ]]; then
name="$(basename "$directory")"
ynh_print_warn --message="Jellyfin plugin '$name' has different ABI version $abi than expected $plugin_abi. Moving to /var/lib/jellyfin/plugins-backup."
mv "$directory" /var/lib/jellyfin/plugins-backup/
fi
done
fi
#================================================= #=================================================
# INSTALL LDAP PLUGIN # INSTALL LDAP PLUGIN
#================================================= #=================================================
ynh_script_progression --message="Installing LDAP plugin..." --weight=2 ynh_script_progression --message="Installing LDAP plugin..." --weight=2
ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=plugin_ldap ynh_setup_source --full_replace=1 --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=plugin_ldap
mkdir -p /var/lib/jellyfin/plugins/configurations/ mkdir -p /var/lib/jellyfin/plugins/configurations/
ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"
@ -163,21 +162,33 @@ ynh_multimedia_addaccess $app
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Jellyfin media center" ports_args=()
if [[ "${opened_ports:-__NOTHING__}" = "__NOTHING__" ]]; then
ports_args+=('--open-ports')
ports_args+=(${ports})
fi
yunohost service add "$app" --description="Jellyfin media center" "${ports_args[@]}"
#=================================================
# EDIT SYSTEMD ENVIRONMENT VARIABLE FOR AUTO-DISCOVERY
#=================================================
ynh_add_config --template="systemd.service" --destination="/etc/systemd/system/jellyfin.service.d/baseurl.service.conf"
systemctl daemon-reload
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --timeout=15 ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --timeout=15
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -8,8 +8,9 @@ test_format = 1.0
sudo apt update >/dev/null sudo apt update >/dev/null
""" """
args.admin = "john" args.admin = "package_checker"
args.init_admin_permission="package_checker"
test_upgrade_from.384dcd2ff1dbf4b0085edb7f12e4d15f00508e2b.name = "10.8.0_ynh1" test_upgrade_from.c78bd4fc24803f23b1d243f397f3128d8fe663d8.name = "10.8.13_ynh1"
test_upgrade_from.384dcd2ff1dbf4b0085edb7f12e4d15f00508e2b.args.domain = "domain.tld" test_upgrade_from.c78bd4fc24803f23b1d243f397f3128d8fe663d8.args.domain = "domain.tld"
test_upgrade_from.384dcd2ff1dbf4b0085edb7f12e4d15f00508e2b.args.admin = "john" test_upgrade_from.c78bd4fc24803f23b1d243f397f3128d8fe663d8.args.admin = "package_checker"