1 |
commit: c7c80deec9e3adf001a7a47dafada47afef3ff04 |
2 |
Author: Louis Sautier <sautier.louis <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Feb 17 14:01:29 2016 +0000 |
4 |
Commit: Dirkjan Ochtman <djc <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 17 20:33:20 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7c80dee |
7 |
|
8 |
net-p2p/syncthing: add init script, man, logrotate |
9 |
|
10 |
Package-Manager: portage-2.2.27 |
11 |
|
12 |
net-p2p/syncthing/files/syncthing.confd | 24 ++++++++++++++++++++ |
13 |
net-p2p/syncthing/files/syncthing.initd | 34 +++++++++++++++++++++++++++++ |
14 |
net-p2p/syncthing/files/syncthing.logrotate | 9 ++++++++ |
15 |
net-p2p/syncthing/syncthing-0.12.19.ebuild | 16 ++++++++++++-- |
16 |
4 files changed, 81 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/net-p2p/syncthing/files/syncthing.confd b/net-p2p/syncthing/files/syncthing.confd |
19 |
new file mode 100644 |
20 |
index 0000000..da3ac4d |
21 |
--- /dev/null |
22 |
+++ b/net-p2p/syncthing/files/syncthing.confd |
23 |
@@ -0,0 +1,24 @@ |
24 |
+# /etc/conf.d/syncthing: config file for /etc/init.d/syncthing |
25 |
+ |
26 |
+# User and group as which to run |
27 |
+#SYNCTHING_USER="syncthing" |
28 |
+#SYNCTHING_GROUP="syncthing" |
29 |
+ |
30 |
+# Configuration directory |
31 |
+#SYNCTHING_HOMEDIR="/var/lib/syncthing" |
32 |
+ |
33 |
+# Log file location |
34 |
+#SYNCTHING_LOGFILE="/var/log/syncthing/syncthing.log" |
35 |
+ |
36 |
+# umask used to create files |
37 |
+# The default allows group access |
38 |
+#SYNCTHING_UMASK=007 |
39 |
+ |
40 |
+# I/O nice level of syncthing |
41 |
+#SYNCTHING_IONICE="0" |
42 |
+ |
43 |
+# Nice level of syncthing |
44 |
+#SYNCTHING_NICE="0" |
45 |
+ |
46 |
+# Extra options for syncthing |
47 |
+#SYNCTHING_OPTS="" |
48 |
|
49 |
diff --git a/net-p2p/syncthing/files/syncthing.initd b/net-p2p/syncthing/files/syncthing.initd |
50 |
new file mode 100755 |
51 |
index 0000000..2acaf34 |
52 |
--- /dev/null |
53 |
+++ b/net-p2p/syncthing/files/syncthing.initd |
54 |
@@ -0,0 +1,34 @@ |
55 |
+#!/sbin/runscript |
56 |
+# Copyright 1999-2016 Gentoo Foundation |
57 |
+# Distributed under the terms of the GNU General Public License v2 |
58 |
+ |
59 |
+SYNCTHING_USER=${SYNCTHING_USER:-syncthing} |
60 |
+SYNCTHING_GROUP=${SYNCTHING_GROUP:-syncthing} |
61 |
+SYNCTHING_HOMEDIR=${SYNCTHING_HOMEDIR:-/var/lib/syncthing} |
62 |
+SYNCTHING_LOGFILE=${SYNCTHING_LOGFILE:-/var/log/syncthing/syncthing.log} |
63 |
+SYNCTHING_UMASK=${SYNCTHING_UMASK:-007} |
64 |
+SYNCTHING_IONICE=${SYNCTHING_IONICE:-0} |
65 |
+SYNCTHING_NICE=${SYNCTHING_NICE:-0} |
66 |
+ |
67 |
+description="Syncthing is an open, trustworthy and decentralized cloud storage system" |
68 |
+command="/usr/bin/syncthing" |
69 |
+command_args="-no-browser -home=${SYNCTHING_HOMEDIR} ${SYNCTHING_OPTS}" |
70 |
+pidfile="/run/syncthing.pid" |
71 |
+start_stop_daemon_args="--background \ |
72 |
+ --user ${SYNCTHING_USER} \ |
73 |
+ --group ${SYNCTHING_GROUP} \ |
74 |
+ --umask ${SYNCTHING_UMASK} \ |
75 |
+ --make-pidfile \ |
76 |
+ --ionice ${SYNCTHING_IONICE} \ |
77 |
+ --nicelevel ${SYNCTHING_NICE} \ |
78 |
+ --stdout ${SYNCTHING_LOGFILE} \ |
79 |
+ --stderr ${SYNCTHING_LOGFILE}" |
80 |
+ |
81 |
+depend() { |
82 |
+ need localmount net |
83 |
+} |
84 |
+ |
85 |
+start_pre() { |
86 |
+ checkpath -q -d -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_HOMEDIR} |
87 |
+ checkpath -q -f -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_LOGFILE} |
88 |
+} |
89 |
|
90 |
diff --git a/net-p2p/syncthing/files/syncthing.logrotate b/net-p2p/syncthing/files/syncthing.logrotate |
91 |
new file mode 100644 |
92 |
index 0000000..37c4320 |
93 |
--- /dev/null |
94 |
+++ b/net-p2p/syncthing/files/syncthing.logrotate |
95 |
@@ -0,0 +1,9 @@ |
96 |
+/var/log/syncthing/syncthing.log { |
97 |
+ missingok |
98 |
+ notifempty |
99 |
+ sharedscripts |
100 |
+ postrotate |
101 |
+ kill -0 $(</run/syncthing.pid) && \ |
102 |
+ /etc/init.d/syncthing restart > /dev/null 2>&1 || true |
103 |
+ endscript |
104 |
+} |
105 |
|
106 |
diff --git a/net-p2p/syncthing/syncthing-0.12.19.ebuild b/net-p2p/syncthing/syncthing-0.12.19.ebuild |
107 |
index 0766431..5f22a11 100644 |
108 |
--- a/net-p2p/syncthing/syncthing-0.12.19.ebuild |
109 |
+++ b/net-p2p/syncthing/syncthing-0.12.19.ebuild |
110 |
@@ -7,7 +7,7 @@ EAPI=5 |
111 |
EGO_PN="github.com/syncthing/syncthing" |
112 |
EGIT_COMMIT=v${PV} |
113 |
|
114 |
-inherit golang-vcs-snapshot systemd |
115 |
+inherit golang-vcs-snapshot systemd user |
116 |
|
117 |
DESCRIPTION="Syncthing is an open, trustworthy and decentralized cloud storage system" |
118 |
HOMEPAGE="http://syncthing.net" |
119 |
@@ -21,6 +21,11 @@ IUSE="" |
120 |
DEPEND="" |
121 |
RDEPEND="" |
122 |
|
123 |
+pkg_setup() { |
124 |
+ enewgroup ${PN} |
125 |
+ enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} |
126 |
+} |
127 |
+ |
128 |
src_compile() { |
129 |
export GOPATH="${S}:$(get_golibdir_gopath)" |
130 |
cd src/${EGO_PN} |
131 |
@@ -34,8 +39,15 @@ src_test() { |
132 |
|
133 |
src_install() { |
134 |
cd src/${EGO_PN} |
135 |
+ doman man/*.[157] || die |
136 |
dobin bin/* |
137 |
- dodoc README.md AUTHORS CONTRIBUTING.md |
138 |
+ dodoc README.md AUTHORS CONTRIBUTING.md |
139 |
systemd_dounit "${S}"/src/${EGO_PN}/etc/linux-systemd/system/${PN}@.service |
140 |
systemd_douserunit "${S}"/src/${EGO_PN}/etc/linux-systemd/user/${PN}.service |
141 |
+ newconfd "${FILESDIR}/${PN}.confd" ${PN} |
142 |
+ newinitd "${FILESDIR}/${PN}.initd" ${PN} |
143 |
+ keepdir /var/{lib,log}/${PN} |
144 |
+ fowners ${PN}:${PN} /var/{lib,log}/${PN} |
145 |
+ insinto /etc/logrotate.d |
146 |
+ newins "${FILESDIR}/${PN}.logrotate" ${PN} |
147 |
} |