1 |
commit: 781c7df3a4d765bb6f592f1d4b4e521a9de56a60 |
2 |
Author: Andreas Schuerch <nativemad <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 1 10:44:07 2017 +0000 |
4 |
Commit: Andreas Schuerch <nativemad <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 1 10:45:42 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=781c7df3 |
7 |
|
8 |
net-im/coturn: sane logging defaults thanks to Andrey Utkin. New systemd unit, see bug 605302 |
9 |
|
10 |
Package-Manager: Portage-2.3.3, Repoman-2.3.1 |
11 |
|
12 |
.../{coturn-4.5.0.4.ebuild => coturn-4.5.0.4-r1.ebuild} | 16 +++++++++++----- |
13 |
net-im/coturn/coturn-9999.ebuild | 16 +++++++++++----- |
14 |
net-im/coturn/files/coturn.service | 17 +++++++++++++++++ |
15 |
net-im/coturn/files/logrotate.coturn | 15 +++++++++++++++ |
16 |
net-im/coturn/files/turnserver.init | 3 ++- |
17 |
5 files changed, 56 insertions(+), 11 deletions(-) |
18 |
|
19 |
diff --git a/net-im/coturn/coturn-4.5.0.4.ebuild b/net-im/coturn/coturn-4.5.0.4-r1.ebuild |
20 |
similarity index 68% |
21 |
rename from net-im/coturn/coturn-4.5.0.4.ebuild |
22 |
rename to net-im/coturn/coturn-4.5.0.4-r1.ebuild |
23 |
index 6fa8344cd79..2ffd86380e4 100644 |
24 |
--- a/net-im/coturn/coturn-4.5.0.4.ebuild |
25 |
+++ b/net-im/coturn/coturn-4.5.0.4-r1.ebuild |
26 |
@@ -1,8 +1,8 @@ |
27 |
-# Copyright 1999-2016 Gentoo Foundation |
28 |
+# Copyright 1999-2017 Gentoo Foundation |
29 |
# Distributed under the terms of the GNU General Public License v2 |
30 |
|
31 |
EAPI=6 |
32 |
-inherit eutils user |
33 |
+inherit eutils user systemd |
34 |
DESCRIPTION="coturn TURN server project" |
35 |
HOMEPAGE="https://github.com/${PN}/${PN}" |
36 |
|
37 |
@@ -30,6 +30,10 @@ RDEPEND="dev-libs/libevent[ssl] |
38 |
DEPEND="${RDEPEND}" |
39 |
|
40 |
src_configure() { |
41 |
+ sed 's:#log-file=/var/tmp/turn.log:log-file=/var/log/turnserver.log:' \ |
42 |
+ -i "${S}/examples/etc/turnserver.conf" || die "sed for logdir failed" |
43 |
+ sed 's:#simple-log:simple-log:' -i "${S}/examples/etc/turnserver.conf" \ |
44 |
+ || die "sed for simple-log failed" |
45 |
if ! use mongodb; then |
46 |
export TURN_NO_MONGO=yes |
47 |
fi |
48 |
@@ -52,12 +56,14 @@ src_configure() { |
49 |
src_install() { |
50 |
default |
51 |
newinitd "${FILESDIR}/turnserver.init" turnserver |
52 |
+ insinto /etc/logrotate.d |
53 |
+ newins "${FILESDIR}/logrotate.${PN}" "${PN}" |
54 |
+ systemd_dounit "${FILESDIR}/${PN}.service" |
55 |
} |
56 |
|
57 |
pkg_postinst() { |
58 |
enewgroup turnserver |
59 |
enewuser turnserver -1 -1 -1 turnserver |
60 |
- elog "Be aware that the default path for logfiles in coturn is /var/tmp!" |
61 |
- elog "You should copy /etc/turnserver.conf.default to" |
62 |
- elog "/etc/turnserver.conf and change not only the log option." |
63 |
+ elog "You need to copy /etc/turnserver.conf.default to" |
64 |
+ elog "/etc/turnserver.conf and do your settings there." |
65 |
} |
66 |
|
67 |
diff --git a/net-im/coturn/coturn-9999.ebuild b/net-im/coturn/coturn-9999.ebuild |
68 |
index 6fa8344cd79..2ffd86380e4 100644 |
69 |
--- a/net-im/coturn/coturn-9999.ebuild |
70 |
+++ b/net-im/coturn/coturn-9999.ebuild |
71 |
@@ -1,8 +1,8 @@ |
72 |
-# Copyright 1999-2016 Gentoo Foundation |
73 |
+# Copyright 1999-2017 Gentoo Foundation |
74 |
# Distributed under the terms of the GNU General Public License v2 |
75 |
|
76 |
EAPI=6 |
77 |
-inherit eutils user |
78 |
+inherit eutils user systemd |
79 |
DESCRIPTION="coturn TURN server project" |
80 |
HOMEPAGE="https://github.com/${PN}/${PN}" |
81 |
|
82 |
@@ -30,6 +30,10 @@ RDEPEND="dev-libs/libevent[ssl] |
83 |
DEPEND="${RDEPEND}" |
84 |
|
85 |
src_configure() { |
86 |
+ sed 's:#log-file=/var/tmp/turn.log:log-file=/var/log/turnserver.log:' \ |
87 |
+ -i "${S}/examples/etc/turnserver.conf" || die "sed for logdir failed" |
88 |
+ sed 's:#simple-log:simple-log:' -i "${S}/examples/etc/turnserver.conf" \ |
89 |
+ || die "sed for simple-log failed" |
90 |
if ! use mongodb; then |
91 |
export TURN_NO_MONGO=yes |
92 |
fi |
93 |
@@ -52,12 +56,14 @@ src_configure() { |
94 |
src_install() { |
95 |
default |
96 |
newinitd "${FILESDIR}/turnserver.init" turnserver |
97 |
+ insinto /etc/logrotate.d |
98 |
+ newins "${FILESDIR}/logrotate.${PN}" "${PN}" |
99 |
+ systemd_dounit "${FILESDIR}/${PN}.service" |
100 |
} |
101 |
|
102 |
pkg_postinst() { |
103 |
enewgroup turnserver |
104 |
enewuser turnserver -1 -1 -1 turnserver |
105 |
- elog "Be aware that the default path for logfiles in coturn is /var/tmp!" |
106 |
- elog "You should copy /etc/turnserver.conf.default to" |
107 |
- elog "/etc/turnserver.conf and change not only the log option." |
108 |
+ elog "You need to copy /etc/turnserver.conf.default to" |
109 |
+ elog "/etc/turnserver.conf and do your settings there." |
110 |
} |
111 |
|
112 |
diff --git a/net-im/coturn/files/coturn.service b/net-im/coturn/files/coturn.service |
113 |
new file mode 100644 |
114 |
index 00000000000..81465f589d8 |
115 |
--- /dev/null |
116 |
+++ b/net-im/coturn/files/coturn.service |
117 |
@@ -0,0 +1,17 @@ |
118 |
+[Unit] |
119 |
+Description=turnserver daemon |
120 |
+After=networking.target |
121 |
+ |
122 |
+[Service] |
123 |
+Type=simple |
124 |
+User=turnserver |
125 |
+Group=turnserver |
126 |
+PermissionsStartOnly=true |
127 |
+ExecStartPre=/bin/bash -c "[ -f /var/log/turnserver.log ] || touch /var/log/turnserver.log && chown turnserver:turnserver /var/log/turnserver.log && chmod 660 /var/log/turnserver.log" |
128 |
+ExecStartPre=/bin/bash -c "[ -d /var/run/turnserver ] || mkdir /var/run/turnserver && chown turnserver:turnserver /var/run/turnserver" |
129 |
+ExecStart=/usr/bin/turnserver --pidfile /var/run/turnserver/turnserver.pid |
130 |
+Restart=always |
131 |
+RestartSec=30s |
132 |
+ |
133 |
+[Install] |
134 |
+WantedBy=multi-user.target |
135 |
|
136 |
diff --git a/net-im/coturn/files/logrotate.coturn b/net-im/coturn/files/logrotate.coturn |
137 |
new file mode 100644 |
138 |
index 00000000000..06b4d74ec3a |
139 |
--- /dev/null |
140 |
+++ b/net-im/coturn/files/logrotate.coturn |
141 |
@@ -0,0 +1,15 @@ |
142 |
+# Copyright 1999-2017 Gentoo Foundation |
143 |
+# Distributed under the terms of the GNU General Public License v2 |
144 |
+ |
145 |
+/var/log/turnserver.log { |
146 |
+daily |
147 |
+rotate 7 |
148 |
+create 660 turnserver turnserver |
149 |
+notifempty |
150 |
+size 50M |
151 |
+sharedscripts |
152 |
+missingok |
153 |
+postrotate |
154 |
+[ -f /var/run/turnserver/turnserver.pid ] && kill -HUP `cat /var/run/turnserver/turnserver.pid` |
155 |
+endscript |
156 |
+} |
157 |
|
158 |
diff --git a/net-im/coturn/files/turnserver.init b/net-im/coturn/files/turnserver.init |
159 |
index 9be7711a850..682e4f12202 100755 |
160 |
--- a/net-im/coturn/files/turnserver.init |
161 |
+++ b/net-im/coturn/files/turnserver.init |
162 |
@@ -1,5 +1,5 @@ |
163 |
#!/sbin/openrc-run |
164 |
-# Copyright 1999-2013 Gentoo Foundation |
165 |
+# Copyright 1999-2017 Gentoo Foundation |
166 |
# Distributed under the terms of the GNU General Public License v2 |
167 |
|
168 |
|
169 |
@@ -13,6 +13,7 @@ depend() { |
170 |
start() { |
171 |
ebegin "Starting turnserver" |
172 |
checkpath -q -d -m 0755 -o turnserver:turnserver /var/run/turnserver |
173 |
+ checkpath -q -f -m 0660 -o turnserver:turnserver /var/log/turnserver.log |
174 |
start-stop-daemon --start --user turnserver --exec /usr/bin/turnserver -- -o \ |
175 |
--pidfile /var/run/turnserver/turnserver.pid >/dev/null |
176 |
eend $? |