public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Dirkjan Ochtman" <djc@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/, net-p2p/syncthing/files/
Date: Wed, 27 Jul 2016 20:19:23 +0000 (UTC)	[thread overview]
Message-ID: <1469650724.5210bac33931b2b8716f1bf45ab39a27c481582c.djc@gentoo> (raw)

commit:     5210bac33931b2b8716f1bf45ab39a27c481582c
Author:     Alexey Korepanov <kaikaikai <AT> yandex <DOT> ru>
AuthorDate: Sun Jul 24 20:05:41 2016 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 20:18:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5210bac3

net-p2p/syncting: fix init scripts for strelaysrv

 net-p2p/syncthing/files/strelaysrv.confd           |  3 +++
 net-p2p/syncthing/files/strelaysrv.initd           | 30 +++++++++++++++++++++
 net-p2p/syncthing/files/strelaysrv.logrotate       |  6 +++++
 ...ng-0.14.0.ebuild => syncthing-0.14.0-r1.ebuild} | 31 +++++++++++++++-------
 4 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/net-p2p/syncthing/files/strelaysrv.confd b/net-p2p/syncthing/files/strelaysrv.confd
new file mode 100644
index 0000000..00564f1
--- /dev/null
+++ b/net-p2p/syncthing/files/strelaysrv.confd
@@ -0,0 +1,3 @@
+# Options to pass to relaysrv
+# see /usr/libexec/syncthing/strelaysrv --help for more information
+SR_OPTS=

diff --git a/net-p2p/syncthing/files/strelaysrv.initd b/net-p2p/syncthing/files/strelaysrv.initd
new file mode 100644
index 0000000..7eb77be
--- /dev/null
+++ b/net-p2p/syncthing/files/strelaysrv.initd
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+SR_USER=strelaysrv
+SR_GROUP=strelaysrv
+SR_HOMEDIR=/var/lib/strelaysrv
+SR_LOGFILE=/var/log/syncthing/strelaysrv.log
+
+
+description="Relay service for syncthing"
+command="/usr/libexec/syncthing/strelaysrv"
+command_args="${SR_OPTS}"
+pidfile="/run/strelaysrv.pid"
+start_stop_daemon_args="--background
+  --user ${SR_USER}
+  --group ${SR_GROUP}
+  --chdir \"${SR_HOMEDIR}\"
+  --make-pidfile
+  --stdout \"${SR_LOGFILE}\"
+  --stderr \"${SR_LOGFILE}\"
+  "
+
+depend() {
+  need net
+}
+
+start_pre() {
+  checkpath -q -d -o ${SR_USER}:${SR_GROUP} ${SR_HOMEDIR}
+  checkpath -q -f -o ${SR_USER}:${SR_GROUP} ${SR_LOGFILE}
+}

diff --git a/net-p2p/syncthing/files/strelaysrv.logrotate b/net-p2p/syncthing/files/strelaysrv.logrotate
new file mode 100644
index 0000000..f168cbf
--- /dev/null
+++ b/net-p2p/syncthing/files/strelaysrv.logrotate
@@ -0,0 +1,6 @@
+/var/log/syncthing/relaysrv.log {
+    missingok
+    notifempty
+    sharedscripts
+    copytruncate
+}

diff --git a/net-p2p/syncthing/syncthing-0.14.0.ebuild b/net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
similarity index 73%
rename from net-p2p/syncthing/syncthing-0.14.0.ebuild
rename to net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
index 08ebbea..6b30bdc 100644
--- a/net-p2p/syncthing/syncthing-0.14.0.ebuild
+++ b/net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
@@ -25,16 +25,19 @@ pkg_setup() {
 	enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
 
 	if use tools ; then
-		# separate user for relaysrv
-		enewgroup ${PN}-relaysrv
-		enewuser ${PN}-relaysrv -1 -1 /var/lib/${PN}-relaysrv ${PN}-relaysrv
+		# separate user for the relay server
+		enewgroup strelaysrv
+		enewuser strelaysrv -1 -1 /var/lib/strelaysrv strelaysrv
+		# and his home folder
+		keepdir /var/lib/strelaysrv
+		fowners strelaysrv:strelaysrv /var/lib/strelaysrv
 	fi
 }
 
 src_prepare() {
 	default
 	sed -i \
-		's|^ExecStart=.*|ExecStart=/usr/libexec/syncthing/relaysrv|' \
+		's|^ExecStart=.*|ExecStart=/usr/libexec/syncthing/strelaysrv|' \
 		src/${EGO_PN}/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service \
 		|| die
 }
@@ -86,14 +89,11 @@ src_install() {
 	if use tools ; then
 		# openrc and systemd service files
 		systemd_dounit "${S}"/src/${EGO_PN}/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service
-		newconfd "${FILESDIR}/${PN}-relaysrv.confd" ${PN}-relaysrv
-		newinitd "${FILESDIR}/${PN}-relaysrv.initd" ${PN}-relaysrv
-
-		keepdir /var/lib/${PN}-relaysrv
-		fowners ${PN}-relaysrv:${PN}-relaysrv /var/{lib,log}/${PN}
+		newconfd "${FILESDIR}/strelaysrv.confd" strelaysrv
+		newinitd "${FILESDIR}/strelaysrv.initd" strelaysrv
 
 		insinto /etc/logrotate.d
-		newins "${FILESDIR}/syncthing-relaysrv.logrotate" syncthing-relaysrv
+		newins "${FILESDIR}/strelaysrv.logrotate" strelaysrv
 	fi
 }
 
@@ -108,4 +108,15 @@ pkg_postinst() {
 				"0.$(get_version_component_range 2).0."
 		fi
 	done
+
+	# check if user syncthing-relaysrv exists
+	# if yes, warn that it has been moved to strelaysrv
+	if [ -n "$(egetent passwd syncthing-relaysrv 2>/dev/null)" ]; then
+		ewarn
+		ewarn "The user and group for the relay server have been changed"
+		ewarn "from syncthing-relaysrv to strelaysrv"
+		ewarn "The old user and group are not deleted automatically. Delete them by running:"
+		ewarn "    userdel -r syncthing-relaysrv"
+		ewarn "    groupdel syncthing-relaysrv"
+	fi
 }


             reply	other threads:[~2016-07-27 20:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 20:19 Dirkjan Ochtman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-05-06 18:54 [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/, net-p2p/syncthing/files/ Marc Schiffbauer
2022-02-03 15:31 Marek Szuba
2022-01-27 14:15 Marek Szuba
2021-12-09 12:03 Marek Szuba
2020-04-17 17:58 Marek Szuba
2019-05-24 11:13 Marek Szuba
2017-05-22 10:36 Marek Szuba
2016-08-17 17:36 Dirkjan Ochtman
2016-06-27 15:20 Göktürk Yüksek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469650724.5210bac33931b2b8716f1bf45ab39a27c481582c.djc@gentoo \
    --to=djc@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox