Gentoo Archives: gentoo-commits

From: Dirkjan Ochtman <djc@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/, net-p2p/syncthing/files/
Date: Wed, 27 Jul 2016 20:19:31
Message-Id: 1469650724.5210bac33931b2b8716f1bf45ab39a27c481582c.djc@gentoo
1 commit: 5210bac33931b2b8716f1bf45ab39a27c481582c
2 Author: Alexey Korepanov <kaikaikai <AT> yandex <DOT> ru>
3 AuthorDate: Sun Jul 24 20:05:41 2016 +0000
4 Commit: Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 27 20:18:44 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5210bac3
7
8 net-p2p/syncting: fix init scripts for strelaysrv
9
10 net-p2p/syncthing/files/strelaysrv.confd | 3 +++
11 net-p2p/syncthing/files/strelaysrv.initd | 30 +++++++++++++++++++++
12 net-p2p/syncthing/files/strelaysrv.logrotate | 6 +++++
13 ...ng-0.14.0.ebuild => syncthing-0.14.0-r1.ebuild} | 31 +++++++++++++++-------
14 4 files changed, 60 insertions(+), 10 deletions(-)
15
16 diff --git a/net-p2p/syncthing/files/strelaysrv.confd b/net-p2p/syncthing/files/strelaysrv.confd
17 new file mode 100644
18 index 0000000..00564f1
19 --- /dev/null
20 +++ b/net-p2p/syncthing/files/strelaysrv.confd
21 @@ -0,0 +1,3 @@
22 +# Options to pass to relaysrv
23 +# see /usr/libexec/syncthing/strelaysrv --help for more information
24 +SR_OPTS=
25
26 diff --git a/net-p2p/syncthing/files/strelaysrv.initd b/net-p2p/syncthing/files/strelaysrv.initd
27 new file mode 100644
28 index 0000000..7eb77be
29 --- /dev/null
30 +++ b/net-p2p/syncthing/files/strelaysrv.initd
31 @@ -0,0 +1,30 @@
32 +#!/sbin/openrc-run
33 +# Copyright 1999-2016 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +SR_USER=strelaysrv
36 +SR_GROUP=strelaysrv
37 +SR_HOMEDIR=/var/lib/strelaysrv
38 +SR_LOGFILE=/var/log/syncthing/strelaysrv.log
39 +
40 +
41 +description="Relay service for syncthing"
42 +command="/usr/libexec/syncthing/strelaysrv"
43 +command_args="${SR_OPTS}"
44 +pidfile="/run/strelaysrv.pid"
45 +start_stop_daemon_args="--background
46 + --user ${SR_USER}
47 + --group ${SR_GROUP}
48 + --chdir \"${SR_HOMEDIR}\"
49 + --make-pidfile
50 + --stdout \"${SR_LOGFILE}\"
51 + --stderr \"${SR_LOGFILE}\"
52 + "
53 +
54 +depend() {
55 + need net
56 +}
57 +
58 +start_pre() {
59 + checkpath -q -d -o ${SR_USER}:${SR_GROUP} ${SR_HOMEDIR}
60 + checkpath -q -f -o ${SR_USER}:${SR_GROUP} ${SR_LOGFILE}
61 +}
62
63 diff --git a/net-p2p/syncthing/files/strelaysrv.logrotate b/net-p2p/syncthing/files/strelaysrv.logrotate
64 new file mode 100644
65 index 0000000..f168cbf
66 --- /dev/null
67 +++ b/net-p2p/syncthing/files/strelaysrv.logrotate
68 @@ -0,0 +1,6 @@
69 +/var/log/syncthing/relaysrv.log {
70 + missingok
71 + notifempty
72 + sharedscripts
73 + copytruncate
74 +}
75
76 diff --git a/net-p2p/syncthing/syncthing-0.14.0.ebuild b/net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
77 similarity index 73%
78 rename from net-p2p/syncthing/syncthing-0.14.0.ebuild
79 rename to net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
80 index 08ebbea..6b30bdc 100644
81 --- a/net-p2p/syncthing/syncthing-0.14.0.ebuild
82 +++ b/net-p2p/syncthing/syncthing-0.14.0-r1.ebuild
83 @@ -25,16 +25,19 @@ pkg_setup() {
84 enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
85
86 if use tools ; then
87 - # separate user for relaysrv
88 - enewgroup ${PN}-relaysrv
89 - enewuser ${PN}-relaysrv -1 -1 /var/lib/${PN}-relaysrv ${PN}-relaysrv
90 + # separate user for the relay server
91 + enewgroup strelaysrv
92 + enewuser strelaysrv -1 -1 /var/lib/strelaysrv strelaysrv
93 + # and his home folder
94 + keepdir /var/lib/strelaysrv
95 + fowners strelaysrv:strelaysrv /var/lib/strelaysrv
96 fi
97 }
98
99 src_prepare() {
100 default
101 sed -i \
102 - 's|^ExecStart=.*|ExecStart=/usr/libexec/syncthing/relaysrv|' \
103 + 's|^ExecStart=.*|ExecStart=/usr/libexec/syncthing/strelaysrv|' \
104 src/${EGO_PN}/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service \
105 || die
106 }
107 @@ -86,14 +89,11 @@ src_install() {
108 if use tools ; then
109 # openrc and systemd service files
110 systemd_dounit "${S}"/src/${EGO_PN}/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service
111 - newconfd "${FILESDIR}/${PN}-relaysrv.confd" ${PN}-relaysrv
112 - newinitd "${FILESDIR}/${PN}-relaysrv.initd" ${PN}-relaysrv
113 -
114 - keepdir /var/lib/${PN}-relaysrv
115 - fowners ${PN}-relaysrv:${PN}-relaysrv /var/{lib,log}/${PN}
116 + newconfd "${FILESDIR}/strelaysrv.confd" strelaysrv
117 + newinitd "${FILESDIR}/strelaysrv.initd" strelaysrv
118
119 insinto /etc/logrotate.d
120 - newins "${FILESDIR}/syncthing-relaysrv.logrotate" syncthing-relaysrv
121 + newins "${FILESDIR}/strelaysrv.logrotate" strelaysrv
122 fi
123 }
124
125 @@ -108,4 +108,15 @@ pkg_postinst() {
126 "0.$(get_version_component_range 2).0."
127 fi
128 done
129 +
130 + # check if user syncthing-relaysrv exists
131 + # if yes, warn that it has been moved to strelaysrv
132 + if [ -n "$(egetent passwd syncthing-relaysrv 2>/dev/null)" ]; then
133 + ewarn
134 + ewarn "The user and group for the relay server have been changed"
135 + ewarn "from syncthing-relaysrv to strelaysrv"
136 + ewarn "The old user and group are not deleted automatically. Delete them by running:"
137 + ewarn " userdel -r syncthing-relaysrv"
138 + ewarn " groupdel syncthing-relaysrv"
139 + fi
140 }