summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-p2p/syncthing')
-rw-r--r--net-p2p/syncthing/files/strelaysrv.confd3
-rw-r--r--net-p2p/syncthing/files/strelaysrv.initd30
-rw-r--r--net-p2p/syncthing/files/strelaysrv.logrotate6
-rw-r--r--net-p2p/syncthing/syncthing-0.14.0-r1.ebuild (renamed from net-p2p/syncthing/syncthing-0.14.0.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 000000000000..00564f140542
--- /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 000000000000..7eb77be26fda
--- /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 000000000000..f168cbfc413e
--- /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
index 08ebbea4bfce..6b30bdc1cf88 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
}