commit:     47bab42079645321669e0e55bc64f0246857be91
Author:     Filip Kobierski <fkobi <AT> fsfe <DOT> org>
AuthorDate: Sun Dec 14 13:29:46 2025 +0000
Commit:     Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
CommitDate: Sun Dec 14 16:22:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47bab420

net-p2p/syncthing: unify openrc services

Notable changes
- use supervisor
- unify with upstream systemd services
  - specifies log formatting
- remove outdated --logflags
- use --log_file instead of _logs

Closes: https://bugs.gentoo.org/966963
Signed-off-by: Filip Kobierski <fkobi <AT> fsfe.org>
Part-of: https://github.com/gentoo/gentoo/pull/45005
Closes: https://github.com/gentoo/gentoo/pull/45005
Signed-off-by: Marc Schiffbauer <mschiff <AT> gentoo.org>

 net-p2p/syncthing/files/syncthing.confd-r2      |  27 +++++
 net-p2p/syncthing/files/syncthing.initd-r5      |  29 ++++++
 net-p2p/syncthing/files/syncthing.initd-user-r1 |  26 +++++
 net-p2p/syncthing/syncthing-2.0.12-r1.ebuild    | 125 ++++++++++++++++++++++++
 4 files changed, 207 insertions(+)

diff --git a/net-p2p/syncthing/files/syncthing.confd-r2 
b/net-p2p/syncthing/files/syncthing.confd-r2
new file mode 100644
index 000000000000..f9b4412c1e19
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.confd-r2
@@ -0,0 +1,27 @@
+# /etc/conf.d/syncthing: config file for /etc/init.d/syncthing
+
+# umask used to create files
+# The default allows group access
+#umask=007
+
+# Nice level of syncthing
+#SSD_NICELEVEL=0
+
+# I/O nice level of syncthing
+#SSD_IONICELEVEL=0
+
+# User and group as which to run
+#command_user="syncthing:syncthing"
+
+# Configuration directory
+#SYNCTHING_HOMEDIR="/var/lib/syncthing/.config/syncthing"
+
+# Log file location
+#SYNCTHING_LOGFILE="/var/log/syncthing/syncthing.log"
+
+# Where the syncthing GUI should listen. Can be a http(s) URI or a Unix domain 
socket
+#SYNCTHING_GUI_ADDRESS="http://127.0.0.1:8384";
+#SYNCTHING_GUI_ADDRESS="unix:/run/syncthing.sock"
+
+# Extra options for syncthing
+#SYNCTHING_OPTS=""

diff --git a/net-p2p/syncthing/files/syncthing.initd-r5 
b/net-p2p/syncthing/files/syncthing.initd-r5
new file mode 100644
index 000000000000..ce34a6e31350
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.initd-r5
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+: ${command_user:="syncthing:syncthing"}
+SYNCTHING_HOMEDIR=${SYNCTHING_HOMEDIR:-/var/lib/syncthing/.config/syncthing}
+SYNCTHING_LOGFILE=${SYNCTHING_LOGFILE:-/var/log/syncthing/syncthing.log}
+SYNCTHING_GUI_ADDRESS=${SYNCTHING_GUI_ADDRESS:-http://127.0.0.1:8384}
+
+description="Open Source Continuous File Synchronization"
+command="/usr/bin/syncthing"
+supervisor=supervise-daemon
+
+command_args="serve --no-browser --no-restart \
+       --home=${SYNCTHING_HOMEDIR} \
+       --log-file=\"${SYNCTHING_LOGFILE}\"
+       --no-log-format-level-string --log-format-level-syslog \
+       --gui-address=${SYNCTHING_GUI_ADDRESS} \
+       ${SYNCTHING_OPTS}"
+
+depend() {
+       need localmount
+       after net
+}
+
+start_pre() {
+       checkpath -q -d -o "${command_user}" "${SYNCTHING_HOMEDIR}"
+       checkpath -q -f -o "${command_user}" "${SYNCTHING_LOGFILE}"
+}

diff --git a/net-p2p/syncthing/files/syncthing.initd-user-r1 
b/net-p2p/syncthing/files/syncthing.initd-user-r1
new file mode 100644
index 000000000000..39defd98ace2
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.initd-user-r1
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+SYNCTHING_LOGFILE=${SYNCTHING_LOGFILE:-$HOME/.config/syncthing/syncthing.log}
+SYNCTHING_GUI_ADDRESS=${SYNCTHING_GUI_ADDRESS:-http://127.0.0.1:8384}
+
+description="Open Source Continuous File Synchronization"
+command="/usr/bin/syncthing"
+supervisor=supervise-daemon
+
+command_args="serve --no-browser --no-restart \
+       --log-file=\"${SYNCTHING_LOGFILE}\"
+       --no-log-format-level-string --log-format-level-syslog \
+       --gui-address=${SYNCTHING_GUI_ADDRESS} \
+       ${SYNCTHING_OPTS}"
+
+depend() {
+       need localmount
+       after net
+}
+
+start_pre() {
+       checkpath -q -d -o "${command_user}" "${SYNCTHING_HOMEDIR}"
+       checkpath -q -f -o "${command_user}" "${SYNCTHING_LOGFILE}"
+}

diff --git a/net-p2p/syncthing/syncthing-2.0.12-r1.ebuild 
b/net-p2p/syncthing/syncthing-2.0.12-r1.ebuild
new file mode 100644
index 000000000000..321ac1c91c22
--- /dev/null
+++ b/net-p2p/syncthing/syncthing-2.0.12-r1.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit eapi9-ver desktop go-module systemd verify-sig xdg
+
+DESCRIPTION="Open Source Continuous File Synchronization"
+HOMEPAGE="https://syncthing.net https://github.com/syncthing/syncthing";
+SRC_URI="
+       
https://github.com/${PN}/${PN}/releases/download/v${PV}/${PN}-source-v${PV}.tar.gz
+       verify-sig? (
+               
https://github.com/${PN}/${PN}/releases/download/v${PV}/${PN}-source-v${PV}.tar.gz.asc
+       )
+"
+S="${WORKDIR}"/${PN}
+
+LICENSE="MPL-2.0 Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT Unlicense"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="selinux tools"
+
+DEPEND="
+       dev-db/sqlite:3
+"
+RDEPEND="
+       ${DEPEND}
+       acct-group/syncthing
+       acct-user/syncthing
+       tools? (
+               >=acct-user/stdiscosrv-1
+               >=acct-user/strelaysrv-1
+       )
+       selinux? ( sec-policy/selinux-syncthing )
+"
+BDEPEND="
+       verify-sig? ( sec-keys/openpgp-keys-syncthing )
+"
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/syncthing.asc
+
+DOCS=( AUTHORS {GOALS,README}.md )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.3.4-TestIssue5063_timeout.patch
+       "${FILESDIR}"/${PN}-1.18.4-tool_users.patch
+       "${FILESDIR}"/${PN}-1.29.5-remove_race_in_tests.patch #955442
+)
+
+src_prepare() {
+       # Bug #679280
+       xdg_environment_reset
+
+       default
+
+       local srv
+       for srv in st{disco,relay}srv; do
+               sed -i \
+                       's|^ExecStart=.*|ExecStart=/usr/libexec/${PN}/${srv}|' \
+                       cmd/${srv}/etc/linux-systemd/${srv}.service || die
+       done;
+}
+
+src_compile() {
+       # https://github.com/mattn/go-sqlite3#linux
+       # -tags libsqlite3: use system sqlite3 instead of bundled
+       ego run build.go -version "v${PV}" -tags "libsqlite3" -no-upgrade 
-build-out=bin/ \
+               build $(usev tools all)
+}
+
+src_test() {
+       ego run build.go test
+}
+
+src_install() {
+       dobin bin/${PN}
+
+       doman man/*.[157]
+       einstalldocs
+
+       domenu etc/linux-desktop/${PN}-{start,ui}.desktop
+       local -i icon_size
+       for icon_size in 32 64 128 256 512; do
+               newicon -s ${icon_size} assets/logo-${icon_size}.png ${PN}.png
+       done
+       newicon -s scalable assets/logo-only.svg ${PN}.svg
+
+       systemd_dounit etc/linux-systemd/system/${PN}@.service
+       systemd_douserunit etc/linux-systemd/user/${PN}.service
+       newconfd "${FILESDIR}"/${PN}.confd-r2 ${PN}
+       newinitd "${FILESDIR}"/${PN}.initd-r5 ${PN}
+       exeinto /etc/user/init.d
+       newexe "${FILESDIR}"/syncthing.initd-user-r1 syncthing
+
+       keepdir /var/log/${PN}
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/${PN}.logrotate ${PN}
+
+       insinto /etc/ufw/applications.d
+       doins etc/firewall-ufw/${PN}
+
+       if use tools; then
+               exeinto /usr/libexec/${PN}
+               insinto /etc/logrotate.d
+
+               local srv
+               for srv in st{disco,relay}srv; do
+                       doexe bin/${srv}
+                       systemd_dounit 
cmd/${srv}/etc/linux-systemd/${srv}.service
+                       newconfd "${FILESDIR}"/${srv}.confd ${srv}
+                       newinitd "${FILESDIR}"/${srv}.initd-r1 ${srv}
+
+                       newins "${FILESDIR}"/${srv}.logrotate ${srv}
+               done
+       fi
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+
+       if ver_replacing -lt 2.0 ; then
+               elog "Major changes in 2.0:"
+               elog 
"https://github.com/syncthing/syncthing/blob/v${PV}/relnotes/v2.0.md";
+       fi
+}

Reply via email to