--- /dev/null
+# /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=""
--- /dev/null
+#!/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}
+}
--- /dev/null
+/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
+}
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"
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}
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}
}