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

Upgrade Jellyfin to v10.9

This commit is contained in:
selfhoster1312 2024-05-12 12:33:01 +02:00 committed by Félix Piédallu
parent 85ed3abec9
commit 32eb278275
11 changed files with 208 additions and 151 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~ynh1 **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~ynh1 **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~ynh1 **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~ynh1" version = "10.9.1~ynh1"
maintainers = ["tituspijean"] maintainers = ["tituspijean"]
@ -56,78 +56,77 @@ ram.runtime = "100M"
default = true default = true
[resources] [resources]
[resources.sources]
[resources.sources.server]
armhf.url = "https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.8.13/jellyfin-server_10.8.13-1_armhf.deb"
armhf.sha256 = "ee4588aeeb55282b044d3bb4efef146a43abd742d3ef9327e042b2959008dc60"
arm64.url = "https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.8.13/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.1/armhf/jellyfin-server_10.9.1+deb11_armhf.deb"
armhf.sha256 = "88a5bd8831468a7fd6f71e2389e99df4951c062e639a788caabdc6aef53d7974"
amd64.url = "https://repo.jellyfin.org/releases/server/debian/versions/stable/server/10.8.13/jellyfin-server_10.8.13-1_amd64.deb" arm64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.1/arm64/jellyfin-server_10.9.1+deb11_arm64.deb"
amd64.sha256 = "d54decc098d5e61be50847edba8722d6468e22134bae2df514859e064eb8d727" arm64.sha256 = "fc61cce35d98ceae8cabc154c891dcd2afc302e82d30eb9bbe9ed8fb4a89129e"
amd64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.1/amd64/jellyfin-server_10.9.1+deb11_amd64.deb"
amd64.sha256 = "ee855f20090639a214339254de3e4f2cedcbec4d887026dc0c7191209316e556"
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.1/armhf/jellyfin-server_10.9.1+deb12_armhf.deb"
armhf.sha256 = "fad4963580ae9cdc9cf11b3a05e6b2544e2e5765fec4d7c83d81f65285385171"
arm64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.1/arm64/jellyfin-server_10.9.1+deb12_arm64.deb"
arm64.sha256 = "a7d2b9805833bba01404d594356e91861e78ba63cdff44b02da85a416a49c03b"
amd64.url = "https://repo.jellyfin.org/files/server/debian/stable/v10.9.1/amd64/jellyfin-server_10.9.1+deb12_amd64.deb"
amd64.sha256 = "be13ab2dab329febb5ff3aa683c6f8f190c86d14e614c5ae4f84560f3504e8b5"
format = "whatever" format = "whatever"
extract = false extract = false
rename = "jellyfin-server.deb"
[resources.sources.web]
url = "https://repo.jellyfin.org/releases/server/debian/versions/stable/web/10.8.13/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.1/amd64/jellyfin-web_10.9.1+deb11_all.deb"
sha256 = "003f433fa1b18017917b47878a6c31b8d165fd909cd1641092dc41e3909ed209"
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.1/amd64/jellyfin-web_10.9.1+deb12_all.deb"
sha256 = "327613691aab0e2448992bb8020fc5481e9438066984189f60f2e8feaf76416d"
format = "whatever" format = "whatever"
extract = false extract = false
rename = "jellyfin-web.deb"
[resources.sources.ffmpeg_bookworm]
armhf.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/jellyfin-ffmpeg6_6.0.1-3-bookworm_armhf.deb"
armhf.sha256 = "bdb28e67fa4dc8e321366c4a19e18bcc6166a60d6aa5a4bf2da1263489b4f25f"
arm64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/jellyfin-ffmpeg6_6.0.1-3-bookworm_arm64.deb"
arm64.sha256 = "aabf62104399f242ddb7b8c2e308976f6b233ceac5ffccbabd340a28e428ca3c"
amd64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/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/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/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-6-bullseye_armhf.deb"
armhf.sha256 = "700bab9e8c96594f83d731019cdbc20fbab303c1d8440288e463e372cd16ed7a" armhf.sha256 = "6f315702413a77d9103ff23963742d508f21fcaeca4c18325defe51eaa9a4380"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/arm64/jellyfin-ffmpeg6_6.0.1-6-bullseye_arm64.deb"
arm64.sha256 = "8d11232e36f3dab5defdf4731ca470d51170c423a840d2da0c861d30ea663ff3"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/amd64/jellyfin-ffmpeg6_6.0.1-6-bullseye_amd64.deb"
amd64.sha256 = "a678695eeeb92c1fa42bbd665e43d0f3568d211245978b7605019102876c2e8a"
arm64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/jellyfin-ffmpeg6_6.0.1-3-bullseye_arm64.deb"
arm64.sha256 = "56ef93f285e922417cda98b109021be614a5307d9d7c18aff22fa0c439ab77b5"
amd64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/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/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/jellyfin-ffmpeg6_6.0.1-3-buster_armhf.deb"
armhf.sha256 = "6f3beae72aec030aae96dc044bfcf736f12fc135cc574cde8085609e47374a43"
arm64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/jellyfin-ffmpeg6_6.0.1-3-buster_arm64.deb"
arm64.sha256 = "109ea41f17e314e3e9b32689844841ddd54a600419ff89e0e979e195a25b91c5"
amd64.url = "https://repo.jellyfin.org/releases/server/debian/versions/jellyfin-ffmpeg/6.0.1-3/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-6-bookworm_armhf.deb"
armhf.sha256 = "7ba482bfdfaff4ed5a11bbbfff17e0aa97d305432a40c0beac2dcdb8fa1468d6"
arm64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/arm64/jellyfin-ffmpeg6_6.0.1-6-bookworm_arm64.deb"
arm64.sha256 = "c54657f94247bb082fa04ec2e9ab3d68a8ae8d4ff879f52a4cea18f073cdf3ba"
amd64.url = "https://repo.jellyfin.org/files/ffmpeg/debian/latest-6.x/amd64/jellyfin-ffmpeg6_6.0.1-6-bookworm_amd64.deb"
amd64.sha256 = "92d859895f7cb2f6428fe7e1299ce14959948a1e48a0b22a339c17f66970c45e"
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/releases/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

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.1"
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-6"
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,16 +48,18 @@ 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

View file

@ -69,6 +69,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"
@ -111,6 +112,12 @@ yunohost service add "$app" --description="Jellyfin media center"
# Only the admin can access the admin panel of the app (if the app has an admin panel) # Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_update --permission="admin" --add="$admin" 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

@ -1,14 +1,14 @@
#!/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
REPO_ROOT = Path(__file__).parent.parent REPO_ROOT = Path(__file__).parent.parent
JELLYFIN_REPO = "https://repo.jellyfin.org" JELLYFIN_REPO = "https://repo.jellyfin.org"
JELLYFIN_DEB_REPO = f"{JELLYFIN_REPO}/releases/server/debian"
ARCHS = [ ARCHS = [
"armhf", "armhf",
@ -16,45 +16,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_DEB_REPO}/versions/stable/server/{version_simple}/jellyfin-server_{version}_{arch}.deb"
def web_url(arch: str, version: str) -> str:
version_simple = version.split("-")[0]
return f"{JELLYFIN_DEB_REPO}/versions/stable/web/{version_simple}/jellyfin-web_{version}_all.deb"
def ffmpeg_url(arch: str, deb: str, version: str) -> str:
major = version.split(".")[0]
return f"{JELLYFIN_DEB_REPO}/versions/jellyfin-ffmpeg/{version}/jellyfin-ffmpeg{major}_{version}-{deb}_{arch}.deb"
def ldap_url(arch: str, version: str) -> str:
major = version.split(".")[0]
return f"{JELLYFIN_REPO}/releases/plugin/ldap-authentication/ldap-authentication_{version}.zip"
def sha256sum_of(url: str) -> str: def sha256sum_of(url: str) -> str:
result = requests.get(f"{url}.sha256sum", timeout=10) # No more sha256sum files provided on release repo?
result = requests.get(url, timeout=10)
content = result.content.decode("utf-8") if result.status_code != 200 and not (result.status_code > 300 and result.status_code < 400):
return content.split(" ")[0] 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"
@ -64,27 +114,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

@ -92,14 +92,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 +115,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,7 +182,7 @@ 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
@ -172,12 +191,18 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Jellyfin media center" yunohost service add $app --description="Jellyfin media center"
#=================================================
# 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