transmission: add 'incomplete' and 'watch' dirs to ujail mounts
authorAlexander Egorenkov <egorenar-dev@posteo.net>
Sun, 10 Apr 2022 14:24:24 +0000 (16:24 +0200)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Sun, 18 Feb 2024 15:54:36 +0000 (16:54 +0100)
To fix the errors:

Sun Apr 10 14:19:41 2022 daemon.err transmission-daemon[29831]: [2022-04-10 14:19:41.098] watchdir Failed to open directory "/mnt/sda1/openwrt/transmission/watch" (2): No such file or directory (watchdir.c:358)

and

Sun Apr 10 14:20:18 2022 daemon.err transmission-daemon[30175]: [2022-04-10 14:20:18.641] Couldn't create "/mnt/sda1/openwrt/transmission/incomplete": Permission denied (file-posix.c:243)

References:
- https://github.com/openwrt/packages/issues/17674

Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
(cherry picked from commit cbc1b0790dd673d57ec673c159bee8d7b4a2c22b)

net/transmission/files/transmission.init

index b0553425ecef8eb5ef1c7a171409e02308d22961..0e6e043d9b5883a810570e51d05790fcb06de79a 100644 (file)
@@ -59,6 +59,10 @@ transmission() {
        config_get incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission'
        local incomplete_dir_enabled
        config_get incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0
+       local watch_dir
+       config_get watch_dir "$cfg" 'watch_dir' '/var/etc/transmission'
+       local watch_dir_enabled
+       config_get watch_dir_enabled "$cfg" 'watch_dir_enabled' 0
        local mem_percentage
        config_get mem_percentage "$cfg" 'mem_percentage' '50'
        local config_overwrite
@@ -164,6 +168,8 @@ transmission() {
        procd_add_jail_mount_rw "$config_dir/blocklists"
        procd_add_jail_mount_rw "$config_dir/stats.json"
        procd_add_jail_mount_rw "$download_dir"
+       [ "$incomplete_dir_enabled" = "1" ] && procd_add_jail_mount_rw "$incomplete_dir"
+       [ "$watch_dir_enabled" = "1" ] && procd_add_jail_mount_rw "$watch_dir"
        web_home="${web_home:-/usr/share/transmission/web}"
        [ -d "$web_home" ] && procd_add_jail_mount "$web_home"
        [ -f "$ca_bundle_file" ] && procd_add_jail_mount "$ca_bundle_file"