syncthing: fix relay and discovery args and permissions

Fixes: #26829
Signed-off-by: George Sapkin <george@sapk.in>
This commit is contained in:
George Sapkin
2025-06-29 14:13:55 +03:00
committed by Josef Schlehofer
parent 0ea85424be
commit cd142a1ba8
3 changed files with 20 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=syncthing
PKG_VERSION:=1.29.7
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=syncthing-source-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/syncthing/syncthing/releases/download/v$(PKG_VERSION)
@@ -42,12 +42,12 @@ define Package/syncthing/Default
DEPENDS:=$(GO_ARCH_DEPENDS)
SECTION:=utils
CATEGORY:=Utilities
USERID:=syncthing=499:syncthing=499
endef
define Package/syncthing
$(call Package/syncthing/Default)
TITLE:=Continuous file synchronization program
USERID:=syncthing=499:syncthing=499
endef
define Package/stdiscosrv

View File

@@ -43,31 +43,35 @@ start_service() {
# Options with default value different with the syncthing should be defined explicitly here
local enabled=0
local listen=":8443"
local cert="/etc/stdiscosrv/cert.pem"
local key="/etc/stdiscosrv/key.pem"
local db_dir="/etc/stdiscosrv/discovery.db"
local conf_dir="/etc/stdiscosrv"
local cert="$conf_dir/cert.pem"
local key="$conf_dir/key.pem"
local db_dir="$conf_dir/discovery.db"
local nice=0
local user="syncthing"
config_load "stdiscosrv"
[ "$enabled" -gt 0 ] || return 0
local group=$(id -gn $user)
[ -d "$db_dir" ] || mkdir -p "$db_dir"
[ -d "$db_dir" ] && chown -R nobody:nogroup "$db_dir"
[ -d "$conf_dir" ] && chown -R "$user":"$group" "$conf_dir"
config_get nice stdiscosrv nice "0"
procd_open_instance
procd_set_param command "$PROG"
procd_append_param command -listen="$listen"
procd_append_param command -db-dir="$db_dir"
procd_append_param command -cert="$cert"
procd_append_param command -key="$key"
procd_append_param command --listen="$listen"
procd_append_param command --db-dir="$db_dir"
procd_append_param command --cert="$cert"
procd_append_param command --key="$key"
[ -z "$extra_args" ] || procd_append_param command "$extra_args"
procd_set_param nice "$nice"
procd_set_param term_timeout 15
procd_set_param user "nobody"
procd_set_param user "$user"
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1

View File

@@ -44,13 +44,16 @@ start_service() {
local enabled=0
local keys="/etc/strelaysrv"
local nice=0
local user="syncthing"
config_load "strelaysrv"
[ "$enabled" -gt 0 ] || return 0
local group=$(id -gn $user)
[ -d "$keys" ] || mkdir -p "$keys"
[ -d "$keys" ] && chown -R nobody:nogroup "$keys"
[ -d "$keys" ] && chown -R "$user":"$group" "$keys"
config_get nice strelaysrv nice "0"
@@ -65,7 +68,7 @@ start_service() {
procd_set_param nice "$nice"
procd_set_param term_timeout 15
procd_set_param user "nobody"
procd_set_param user "$user"
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1