transmission: retrieve boolean config opts using `config_get_bool`
authorSalim B <git@salim.space>
Sun, 12 Feb 2023 21:20:00 +0000 (22:20 +0100)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Sun, 18 Feb 2024 15:54:58 +0000 (16:54 +0100)
The tranmission UCI config options

- `config_overwrite`
- `incomplete_dir_enabled`
- `watch_dir_enabled`

are all booleans, so we have to retrieve them using `config_get_bool` in order
to make sure they are properly interpreted in case the user sets them to a
keyword (`true`/`false`, `on`/`off` etc.) and not an integer (`0`/`1`).

Signed-off-by: Salim B <git@salim.space>
(cherry picked from commit 63dc13d7d2f5150bf3cf4b6648d8c7f10975381f)

net/transmission/files/transmission.init

index 0e6e043d9b5883a810570e51d05790fcb06de79a..a6bc00f01bb0bd86fd4db8aed268bc92ad323524 100644 (file)
@@ -58,15 +58,15 @@ transmission() {
        local incomplete_dir
        config_get incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission'
        local incomplete_dir_enabled
-       config_get incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0
+       config_get_bool 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
+       config_get_bool watch_dir_enabled "$cfg" 'watch_dir_enabled' 0
        local mem_percentage
        config_get mem_percentage "$cfg" 'mem_percentage' '50'
        local config_overwrite
-       config_get config_overwrite "$cfg" config_overwrite 1
+       config_get_bool config_overwrite "$cfg" config_overwrite 1
        local nice
        config_get nice "$cfg" nice 0
        local web_home
@@ -196,9 +196,9 @@ transmission_mount_triggers() {
                watch_dir watch_dir_enabled web_home service_dirs
        config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission'
        config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission'
-       config_get incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0
+       config_get_bool incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0
        config_get incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission'
-       config_get watch_dir_enabled "$cfg" 'watch_dir_enabled' 0
+       config_get_bool watch_dir_enabled "$cfg" 'watch_dir_enabled' 0
        config_get watch_dir "$cfg" 'watch_dir' '/var/etc/transmission'
        config_get web_home "$cfg" 'web_home'