From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-893903-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5069F13832E
	for <garchives@archives.gentoo.org>; Wed, 27 Jul 2016 20:19:31 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B788FE0AA9;
	Wed, 27 Jul 2016 20:19:28 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 4651BE0AA9
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Jul 2016 20:19:28 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D3216340D19
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Jul 2016 20:19:26 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 8B28D7D4
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Jul 2016 20:19:23 +0000 (UTC)
From: "Dirkjan Ochtman" <djc@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Dirkjan Ochtman" <djc@gentoo.org>
Message-ID: <1469650724.5210bac33931b2b8716f1bf45ab39a27c481582c.djc@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/, net-p2p/syncthing/files/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-p2p/syncthing/files/strelaysrv.confd net-p2p/syncthing/files/strelaysrv.initd net-p2p/syncthing/files/strelaysrv.logrotate net-p2p/syncthing/syncthing-0.14.0-r1.ebuild net-p2p/syncthing/syncthing-0.14.0.ebuild
X-VCS-Directories: net-p2p/syncthing/files/ net-p2p/syncthing/
X-VCS-Committer: djc
X-VCS-Committer-Name: Dirkjan Ochtman
X-VCS-Revision: 5210bac33931b2b8716f1bf45ab39a27c481582c
X-VCS-Branch: master
Date: Wed, 27 Jul 2016 20:19:23 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 2165e0e0-c4d5-4ce8-921c-cf7e604cd183
X-Archives-Hash: b645d3f9efb40a0f17c22f40295fade2

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
 }