From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-863904-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 2417D1388BF
	for <garchives@archives.gentoo.org>; Wed, 17 Feb 2016 20:43:24 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0A7F521C005;
	Wed, 17 Feb 2016 20:43:22 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 55BF9E086D
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Feb 2016 20:43:21 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 5BF3C340AB6
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Feb 2016 20:43:20 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 022F214CD
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Feb 2016 20:43:18 +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: <1455741200.c7c80deec9e3adf001a7a47dafada47afef3ff04.djc@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/files/, net-p2p/syncthing/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-p2p/syncthing/files/syncthing.confd net-p2p/syncthing/files/syncthing.initd net-p2p/syncthing/files/syncthing.logrotate net-p2p/syncthing/syncthing-0.12.19.ebuild
X-VCS-Directories: net-p2p/syncthing/files/ net-p2p/syncthing/
X-VCS-Committer: djc
X-VCS-Committer-Name: Dirkjan Ochtman
X-VCS-Revision: c7c80deec9e3adf001a7a47dafada47afef3ff04
X-VCS-Branch: master
Date: Wed, 17 Feb 2016 20:43:18 +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: cce1bf30-1441-43d1-8bbc-47f7342054fe
X-Archives-Hash: 8de2449e6fec84be27794b8e2f3f2915

commit:     c7c80deec9e3adf001a7a47dafada47afef3ff04
Author:     Louis Sautier <sautier.louis <AT> gmail <DOT> com>
AuthorDate: Wed Feb 17 14:01:29 2016 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Wed Feb 17 20:33:20 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7c80dee

net-p2p/syncthing: add init script, man, logrotate

Package-Manager: portage-2.2.27

 net-p2p/syncthing/files/syncthing.confd     | 24 ++++++++++++++++++++
 net-p2p/syncthing/files/syncthing.initd     | 34 +++++++++++++++++++++++++++++
 net-p2p/syncthing/files/syncthing.logrotate |  9 ++++++++
 net-p2p/syncthing/syncthing-0.12.19.ebuild  | 16 ++++++++++++--
 4 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/net-p2p/syncthing/files/syncthing.confd b/net-p2p/syncthing/files/syncthing.confd
new file mode 100644
index 0000000..da3ac4d
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.confd
@@ -0,0 +1,24 @@
+# /etc/conf.d/syncthing: config file for /etc/init.d/syncthing
+
+# User and group as which to run
+#SYNCTHING_USER="syncthing"
+#SYNCTHING_GROUP="syncthing"
+
+# Configuration directory
+#SYNCTHING_HOMEDIR="/var/lib/syncthing"
+
+# Log file location
+#SYNCTHING_LOGFILE="/var/log/syncthing/syncthing.log"
+
+# umask used to create files
+# The default allows group access
+#SYNCTHING_UMASK=007
+
+# I/O nice level of syncthing
+#SYNCTHING_IONICE="0"
+
+# Nice level of syncthing
+#SYNCTHING_NICE="0"
+
+# Extra options for syncthing
+#SYNCTHING_OPTS=""

diff --git a/net-p2p/syncthing/files/syncthing.initd b/net-p2p/syncthing/files/syncthing.initd
new file mode 100755
index 0000000..2acaf34
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.initd
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+SYNCTHING_USER=${SYNCTHING_USER:-syncthing}
+SYNCTHING_GROUP=${SYNCTHING_GROUP:-syncthing}
+SYNCTHING_HOMEDIR=${SYNCTHING_HOMEDIR:-/var/lib/syncthing}
+SYNCTHING_LOGFILE=${SYNCTHING_LOGFILE:-/var/log/syncthing/syncthing.log}
+SYNCTHING_UMASK=${SYNCTHING_UMASK:-007}
+SYNCTHING_IONICE=${SYNCTHING_IONICE:-0}
+SYNCTHING_NICE=${SYNCTHING_NICE:-0}
+
+description="Syncthing is an open, trustworthy and decentralized cloud storage system"
+command="/usr/bin/syncthing"
+command_args="-no-browser -home=${SYNCTHING_HOMEDIR} ${SYNCTHING_OPTS}"
+pidfile="/run/syncthing.pid"
+start_stop_daemon_args="--background \
+  --user ${SYNCTHING_USER} \
+  --group ${SYNCTHING_GROUP} \
+  --umask ${SYNCTHING_UMASK} \
+  --make-pidfile \
+  --ionice ${SYNCTHING_IONICE} \
+  --nicelevel ${SYNCTHING_NICE} \
+  --stdout ${SYNCTHING_LOGFILE} \
+  --stderr ${SYNCTHING_LOGFILE}"
+
+depend() {
+  need localmount net
+}
+
+start_pre() {
+  checkpath -q -d -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_HOMEDIR}
+  checkpath -q -f -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_LOGFILE}
+}

diff --git a/net-p2p/syncthing/files/syncthing.logrotate b/net-p2p/syncthing/files/syncthing.logrotate
new file mode 100644
index 0000000..37c4320
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing.logrotate
@@ -0,0 +1,9 @@
+/var/log/syncthing/syncthing.log {
+    missingok
+    notifempty
+    sharedscripts
+    postrotate
+        kill -0 $(</run/syncthing.pid) && \
+          /etc/init.d/syncthing restart > /dev/null 2>&1 || true
+    endscript
+}

diff --git a/net-p2p/syncthing/syncthing-0.12.19.ebuild b/net-p2p/syncthing/syncthing-0.12.19.ebuild
index 0766431..5f22a11 100644
--- a/net-p2p/syncthing/syncthing-0.12.19.ebuild
+++ b/net-p2p/syncthing/syncthing-0.12.19.ebuild
@@ -7,7 +7,7 @@ EAPI=5
 EGO_PN="github.com/syncthing/syncthing"
 EGIT_COMMIT=v${PV}
 
-inherit golang-vcs-snapshot systemd
+inherit golang-vcs-snapshot systemd user
 
 DESCRIPTION="Syncthing is an open, trustworthy and decentralized cloud storage system"
 HOMEPAGE="http://syncthing.net"
@@ -21,6 +21,11 @@ IUSE=""
 DEPEND=""
 RDEPEND=""
 
+pkg_setup() {
+	enewgroup ${PN}
+	enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
+}
+
 src_compile() {
 	export GOPATH="${S}:$(get_golibdir_gopath)"
 	cd src/${EGO_PN}
@@ -34,8 +39,15 @@ src_test() {
 
 src_install() {
 	cd src/${EGO_PN}
+	doman man/*.[157] || die
 	dobin bin/*
-	dodoc README.md AUTHORS  CONTRIBUTING.md
+	dodoc README.md AUTHORS CONTRIBUTING.md
 	systemd_dounit "${S}"/src/${EGO_PN}/etc/linux-systemd/system/${PN}@.service
 	systemd_douserunit "${S}"/src/${EGO_PN}/etc/linux-systemd/user/${PN}.service
+	newconfd "${FILESDIR}/${PN}.confd" ${PN}
+	newinitd "${FILESDIR}/${PN}.initd" ${PN}
+	keepdir /var/{lib,log}/${PN}
+	fowners ${PN}:${PN} /var/{lib,log}/${PN}
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}/${PN}.logrotate" ${PN}
 }