transmission: add mount trigger
authorDaniel Golle <daniel@makrotopia.org>
Sun, 8 Aug 2021 14:47:52 +0000 (15:47 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 8 Aug 2021 14:49:26 +0000 (15:49 +0100)
Restart transmission once an underlaying mountpoint becomes available.
Add myself as maintainer.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
net/transmission/Makefile
net/transmission/files/transmission.init

index 14b4daf2f3ee1c25af8065a1d30e8ed6c14ec3eb..7926486a887dde8b44ae4b82e23fbe07a680d9f4 100644 (file)
@@ -9,12 +9,13 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=transmission
 PKG_VERSION:=3.00
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GITHUB/transmission/transmission-releases/master
 PKG_HASH:=9144652fe742f7f7dd6657716e378da60b751aaeda8bef8344b3eefc4db255f2
 
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 PKG_LICENSE:=GPL-2.0-or-later
 PKG_LICENSE_FILES:=COPYING
 PKG_CPE_ID:=cpe:/a:transmissionbt:transmission
index 242157277292c73992b1dc93f5e73b694d353c24..3c4c7d805d7846a454799c83ca1f1532c71de7c7 100644 (file)
@@ -173,6 +173,32 @@ reload_service() {
        procd_send_signal "$PROG"
 }
 
+transmission_mount_triggers() {
+       local cfg="$1"
+
+       local enabled
+       config_get_bool enabled "$cfg" enabled 0
+       [ "$enabled" -gt 0 ] || return 0
+
+       local config_dir download_dir incomplete_dir incomplete_dir_enabled \
+               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 incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission'
+       config_get 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'
+
+       service_dirs="$config_dir $download_dir $web_home"
+       [ "$incomplete_dir_enabled" = "0" ] || service_dirs="$service_dirs $incomplete_dir"
+       [ "$watch_dir_enabled" = "0" ] || service_dirs="$service_dirs $watch_dir"
+
+       procd_add_restart_mount_trigger $service_dirs
+}
+
 service_triggers() {
-       procd_add_reload_trigger "transmission"
+       procd_add_reload_trigger 'transmission'
+       config_load 'transmission'
+       config_foreach transmission_mount_triggers 'transmission'
 }