From a4069148660f802333f35ed40fe9c6d6699e50a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 5 Dec 2023 15:38:33 +0100 Subject: [PATCH 1/6] Patch download location after move from /home/yunohost.transmission to /home/yunohost.app --- manifest.toml | 1 + scripts/_common.sh | 27 +++++++++++++++++++++++++++ scripts/upgrade | 7 +++++++ 3 files changed, 35 insertions(+) diff --git a/manifest.toml b/manifest.toml index 06d3eaf..3a115d3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,6 +49,7 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + rpc.url = "/transmission/rpc" rpc.allowed = "visitors" rpc.show_tile = false diff --git a/scripts/_common.sh b/scripts/_common.sh index dfb9f1c..71bc4ff 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -51,6 +51,33 @@ _save_and_revert_rpc_password_hash_to_password() { } +_patch_download_locations() { + # First check if patching is required... + if ! grep -R /home/yunohost.transmission /var/lib/transmission-daemon/info/resume >/dev/null; then + return + fi + + rpc_url="http://127.0.0.1:${port}${path_less}transmission/rpc" + + mapfile -t stopped_torrents < <( + transmission-remote "$rpc_url" -l \ + | awk -F '[[:space:]][[:space:]]+' '{if ($9 == "Stopped") print $2;}' + ) + + for torrent in "${stopped_torrents[@]}"; do + # Remove trailing '*' error marker + torrent="${torrent%\*}" + location=$( + transmission-remote "$rpc_url" -t $torrent -i | grep Location: | awk -F ': ' '{print $2}' + ) + newlocation=$( + echo "$location" | sed -e 's|yunohost.transmission|yunohost.app/transmission|' + ) + transmission-remote "$rpc_url" -t "$torrent" --find "$newlocation" + transmission-remote "$rpc_url" -t "$torrent" --verify + done +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4e94bb5..f291232 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -120,6 +120,13 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=transmission-daemon --action="start" --log_path="systemd" +#================================================= +# PATCH DOWNLOAD LOCATION IF DOWNLOAD PATH CHANGED +#================================================= +ynh_script_progression --message="Patching download locations..." --weight=1 + +_patch_download_locations + #================================================= # END OF SCRIPT #================================================= From 2f8ae261f37c273ae76b7ec0aa2f1cdaae1a215a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 8 Dec 2023 14:03:15 +0100 Subject: [PATCH 2/6] bump package revision --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 3a115d3..6c1540d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Transmission" description.en = "Fast, Easy, and Free BitTorrent Client" description.fr = "Client BitTorrent libre et rapide" -version = "3.00~ynh4" +version = "3.00~ynh5" maintainers = [] From 1f533f4dced6c3afcc34e34f65c9a263905091b1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 8 Dec 2023 13:03:21 +0000 Subject: [PATCH 3/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbf16b1..2f3c37d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Transmission is a fast, easy, and free BitTorrent client. * Integration with YunoHost Multimedia directories -**Shipped version:** 3.00~ynh4 +**Shipped version:** 3.00~ynh5 ## Screenshots diff --git a/README_fr.md b/README_fr.md index f449eb2..4fadf34 100644 --- a/README_fr.md +++ b/README_fr.md @@ -23,7 +23,7 @@ Transmission est un client BitTorrent libre, efficace et simple. * Intégration avec les répertoires Multimédias de YunoHost -**Version incluse :** 3.00~ynh4 +**Version incluse :** 3.00~ynh5 ## Captures d’écran From 727aabfe0da9e00775e2c83714ed0710e6d18de2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:42:08 +0100 Subject: [PATCH 4/6] Update upgrade: `rm` on a non-existing file miserably crash the upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index f291232..234cc8d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,8 +68,8 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=3 # Remove possibly dangling symlinks created before the /home/yunohost.transmission -> /home/yunohost.app/transmission transition # Use rm because ynh_secure_remove fails on dangling symlinks, see https://github.com/YunoHost/issues/issues/2253... -rm "$MEDIA_DIRECTORY/share/Torrents" -rm "$MEDIA_DIRECTORY/share/Torrent to download" +rm "$MEDIA_DIRECTORY/share/Torrents" || true +rm "$MEDIA_DIRECTORY/share/Torrent to download" || true ynh_multimedia_build_main_dir From 58f985838806528be1f2dbb5808b970d598a5381 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:45:05 +0100 Subject: [PATCH 5/6] Bump version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 6c1540d..7f3981e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Transmission" description.en = "Fast, Easy, and Free BitTorrent Client" description.fr = "Client BitTorrent libre et rapide" -version = "3.00~ynh5" +version = "3.00~ynh7" maintainers = [] From cf5698db695cf1b610ccddcd8625714bcf31ef02 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 11 Dec 2023 12:45:09 +0000 Subject: [PATCH 6/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f3c37d..2976043 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Transmission is a fast, easy, and free BitTorrent client. * Integration with YunoHost Multimedia directories -**Shipped version:** 3.00~ynh5 +**Shipped version:** 3.00~ynh7 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 4fadf34..8f7eae9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -23,7 +23,7 @@ Transmission est un client BitTorrent libre, efficace et simple. * Intégration avec les répertoires Multimédias de YunoHost -**Version incluse :** 3.00~ynh5 +**Version incluse :** 3.00~ynh7 ## Captures d’écran